diff --git a/README.md b/README.md new file mode 100644 index 0000000..7b95199 --- /dev/null +++ b/README.md @@ -0,0 +1,241 @@ + +

IoTLink v0.5.0

+

基于 SpringBoot、Vue、Mybatis、RabbitMq、Mysql、Redis 的物联网卡管理系统

+ + +# 一、 关于 IoTLink + +> 云则 物联网卡管理系统 + +## 1.1 项目介绍 + +IoTLink 一套全部开源的物联网管理平台,毫无保留给个人及企业免费使用。 + +基于[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue)开发的物联网卡管理系统; + +物联网卡管理系统基础功能: + +同步物联网卡数据信息【用量】【状态】【激活时间】【在线信息】等,资费组、资费计划、订购历史、用量详情 + +API通道灵活管理、启动轮询任务同步分类针对不同的需求控制轮询启动间隔、通道轮询进度监控、RabbitMq独立控制轮询同步 + +物联网卡划分代理集团、卡信息变更记录查询、分组、备注、发货时间标签 + +基于我司自主研发的融合管理系统为企业客户提供全面的API接口开放能力 + +同时保障所有物联网卡的可溯源、可监管、可操作、可调配的能力 + +支持定制化流量及自主计费支撑,并通过调用流量运营有效合理进行用量管控,保障稳定性的同时成本最小化 + +山东云则期待与您携手共建物联网智能化项目生态环境! + +特别鸣谢:[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue),[element](https://github.com/ElemeFE/element),[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://github.com/elunez/eladmin-web) + +## 1.2 [公司介绍](https://www.5iot.com/gongsijianjie.html) [山东云则](https://www.5iot.com) + +一家专注于物联网行业通信模组、传感器、设备研究、研发、生产及销售于一体的新兴高新技术企业。公司聚集了一批朝气蓬勃、有梦想,有追求的物联网人,他们服务热忱,经验丰富,熟悉行业,用专业的技术和热情的态度做好产品技术支持。 + +公司自成立以来,先后通过ISO 9001质量管理体系认证、ISO27001信息安全管理体系认证、山东省物联网协会理事单位、深圳市物联网协会理事单位,公司拥有实用新型专利4项、作品著作权1项、软件著作权20余项。 + +公司以创新为动力,以应用促研发,为政府部门、企事业单位和行业客户提供专业的物联网解决方案。与通信运营商强强联合,赋予更多行业、更便捷、高质量、低成本的联网能力。并与多家知名硬件生产、方案商精诚合作。携手政府、金融、农业、环保、工业、能源、安防等产业伙伴们一起打造更高效率、更安全、更节能环保、更可持续发展的智慧产业,公司致力于成为您身边的物联网专家,助您快速接入物联网,让万物互联更简单。 + +公司通过“专业、及时、真诚”的服务,获得了广大用户及业界的认可,依靠多年的行业经验,与用户共同打造可持续发展企业,实现为客户持续创造价值的目标。 + + + +## 1.3 能力 + +整个系统共分为十一大模块: + +![输入图片说明](yunze-ui/public/IoTLink%20(1).png) + +* 山东云则 + + + +## 1.4 优势 + +IoTLink 基于RuoYI-Vue开发RabbitMq分离服务与执行优化业务与执行,可满足物联网用户对物联网卡、客户、合同、发货、仓库 多重管理 + +* 上游API集中管理一次对接直接配置 ,快速上手 +* RabbitMq 分离执行任务快速响应满足多端部署 +* 采用主流 Java 架构,具备高拓展性、灵活性 +* 对外提供内部 API,低成本二次开发 +* 基于 RuoYI-Vue 主流业务系统框架 + + + + +## 1.4 愿景 + +IoTLink 通过开源让每个企业都能快速接入物联网成为自己的物联网专家: + +* 集成 RuoYI-Vue 基础能力,拿来即用 +* 针对垂直行业提供一站式物联网 营销、管理 解决方案 +* 开放自身平台能力,让更多的开发者参与进来 +* 携手政府、金融、农业、环保、工业、能源、安防等产业伙伴们一起打造更高效率、更安全、更节能环保、更可持续发展的智慧产业 + +# 二、关于项目 + +演示地址:[http://demo.5iot.cn/](http://demo.5iot.cn/) + +演示账号/密码:5iot/123456 + +## 2.2 技术栈 + +本项目基于 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue?_from=gitee_search) 后台开发框架,感谢 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue?_from=gitee_search) 的开源。 + + +| 技术栈 | 介绍 | 地址 | +|:-:|:-:|:-:| +| Vue | 渐进式 JavaScript 框架 | https://cn.vuejs.org/ | +| Vuex |专为 Vue.js 应用程序开发的状态管理模式 |https://vuex.vuejs.org/zh/ | +|Vue Router| Vue.js 官方的路由管理器| https://router.vuejs.org/zh/ +|Vue CLI |基于 Vue.js 进行快速开发的完整系统 |https://cli.vuejs.org/zh/guide/ +|Vant| 轻量、可靠的移动端 Vue 组件库 |https://vant-contrib.gitee.io/vant/#/zh-CN/ +|Element-UI |基于 Vue 2.0 的桌面端组件库| https://element.eleme.io/#/zh-CN +|ES6| JavaScript 语言的下一代标准| https://es6.ruanyifeng.com/ + + + **后端技术栈** +| 技术栈 | 介绍 | 地址 | +|:-:|:-:|:-:| +|Spring Boot |快捷创建基于 Spring 的生产级应用程序| https://spring.io/projects/spring-boot +|MyBatis-Plus| MyBatis 增强工具 |https://mp.baomidou.com/ +|MyBatis| MyBatis 持久层框架 |https://mybatis.org/mybatis-3/zh/index.html +|JWT| 轻量级身份认证规范| https://jwt.io/introduction +|RabbitMq| 基于AMQP协议的消息中间件 | https://www.rabbitmq.com/ +|Spring Security |基于 Spring 的强大且高度可定制的身份验证和访问控制框架 |https://spring.io/projects/spring-security/ + + + + +## 2.3 项目结构 + +**后端结构** + +``` +com.yunze +├── common // 工具类 +│ └── annotation // 自定义注解 +│ └── config // 全局配置 +│ └── constant // 通用常量 +│ └── core // 核心控制 +│ └── enums // 通用枚举 +│ └── exception // 通用异常 +│ └── filter // 过滤器处理 +│ └── mapper // 数据持久化 +│ └── utils // 通用类处理 +├── framework // 框架核心 +│ └── aspectj // 注解实现 +│ └── config // 系统配置 +│ └── datasource // 数据权限 +│ └── interceptor // 拦截器 +│ └── manager // 异步处理 +│ └── security // 权限控制 +│ └── web // 前端控制 +├── cAdmin // 平台业务分离执行监听 +│ └── system // 监听yunze-admin业务执行 +├── yunze-generator // 代码生成 +├── yunze-quartz // 定时任务 +├── yunze-system // 系统代码 +├── yunze-admin // 后台服务 +├── yunze-ui // 页面前端代码 + +``` + +**前端结构** + +``` +├── build // 构建相关 +├── bin // 执行脚本 +├── public // 公共文件 +│ ├── favicon.ico // favicon图标 +│ └── index.html // html模板 +├── src // 源代码 +│ ├── api // 所有请求 +│ ├── assets // 主题 字体等静态资源 +│ ├── components // 全局公用组件 +│ ├── directive // 全局指令 +│ ├── layout // 布局 +│ ├── router // 路由 +│ ├── store // 全局 store管理 +│ ├── utils // 全局公用方法 +│ ├── views // view +│ ├── App.vue // 入口页面 +│ ├── main.js // 入口 加载组件 初始化等 +│ ├── permission.js // 权限管理 +│ └── settings.js // 系统配置 +├── .editorconfig // 编码格式 +├── .env.development // 开发环境配置 +├── .env.production // 生产环境配置 +├── .env.staging // 测试环境配置 +├── .eslintignore // 忽略语法检查 +├── .eslintrc.js // eslint 配置项 +├── .gitignore // git 忽略项 +├── babel.config.js // babel.config.js +├── package.json // package.json +└── vue.config.js // vue.config.js +``` + + +## 2.4 项目部署 + +点击下方链接进入官方语雀帮助手册查看项目部署方式: + +[如何快速部署 IoTLink](https://doc.5iot.com) + +建议服务器最低配置: + +| 类型 | 配置 | +|:-:|:-:| +|操作系统|CentOS Stream 8 64位| +|CPU|4核| +|内存|16G| +|带宽|5M| +|硬盘|100G| + +# 三、常见问题 + + +**常见问题列表** + +[1.有哪几种部署方式?](https://doc.5iot.com/help/bww8vd) + +[2.数据库为什么 Group By 查询报错?](https://doc.5iot.com/help/babnva) + +[3.项目每个分支的作用是什么?](https://doc.5iot.com/help/ztbre1) + +[4、项目启动时为什么报错?](https://doc.5iot.com/help/cepvgv) + +[5、目前支持哪些上游资源接口?](https://doc.5iot.com/help/ffi7bu) + + +# 四、最近规划 + +IoTLink 团队目前在完成 IoTLink V0.6 版本建设,主要围绕 营销管理、财务管理、发货管理、商品管理 等模块进行建设,预计 2022.03 月中旬上线。 + +V1.0版本主要功能如下 + +- [ ] 开放【营销管理】【财务管理】【发货管理】【商品管理】业务板块 2022.03; +- [ ] B端公众号web程序开放【公众号管理】【C端充值】【商品购买】业务板块 2022.06; +- [ ] 开放【对外API接口对接程序】【上游对接API核心jar】业务板块 2022.08; +- [ ] 开放升级【自动化任务】业务板块 2022.11; + + +# 五、联系我们 + +如果你想加入我们的开源交流群,请扫码添加 IoTLink 项目作者,加入群聊: + + +如果你有任何 IoTLink 产品上的想法、意见或建议,或商务上的合作需求,请扫码添加 IoTLink 项目团队进一步沟通: + + + + + +--- + + **

如果您觉得我们的开源项目很有帮助,请点击 :star: Star 支持 IoTLink 开源团队 :heart:

** + +--- \ No newline at end of file diff --git a/RunZe-iot.iml b/RunZe-iot.iml new file mode 100644 index 0000000..174bcc9 --- /dev/null +++ b/RunZe-iot.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/jar/依赖jar/yunze-apiCommon.7z b/jar/依赖jar/yunze-apiCommon.7z new file mode 100644 index 0000000..5b410f6 Binary files /dev/null and b/jar/依赖jar/yunze-apiCommon.7z differ diff --git a/mnt/README.md b/mnt/README.md new file mode 100644 index 0000000..ebf997a --- /dev/null +++ b/mnt/README.md @@ -0,0 +1,5 @@ + +# 目录说明 + +> `mnt\yunze\download\csv` 目录下的 xls 文件用于下载模板 将该文件夹复制到服务器根目录 + diff --git a/mnt/yunze/download/csv/ImportCardSel.xls b/mnt/yunze/download/csv/ImportCardSel.xls new file mode 100644 index 0000000..21e4731 Binary files /dev/null and b/mnt/yunze/download/csv/ImportCardSel.xls differ diff --git a/mnt/yunze/download/csv/ImportRecharge.xls b/mnt/yunze/download/csv/ImportRecharge.xls new file mode 100644 index 0000000..f04c04d Binary files /dev/null and b/mnt/yunze/download/csv/ImportRecharge.xls differ diff --git a/mnt/yunze/download/csv/ImportSetCard.xls b/mnt/yunze/download/csv/ImportSetCard.xls new file mode 100644 index 0000000..1a8630c Binary files /dev/null and b/mnt/yunze/download/csv/ImportSetCard.xls differ diff --git a/mnt/yunze/logs/yunze-admin/yunze-admin/yunze-admin.log b/mnt/yunze/logs/yunze-admin/yunze-admin/yunze-admin.log new file mode 100644 index 0000000..2a2e00c --- /dev/null +++ b/mnt/yunze/logs/yunze-admin/yunze-admin/yunze-admin.log @@ -0,0 +1,514 @@ +2022-01-12 09:40:50 [background-preinit] INFO org.hibernate.validator.internal.util.Version --> HV000001: Hibernate Validator 6.0.22.Final +2022-01-12 09:40:50 [restartedMain] INFO com.yunze.YunZeApplication --> Starting YunZeApplication on Dell with PID 26064 (H:\gitflie\sdyunze\yun-ze-iot\yunze-admin\target\classes started by 54655 in H:\gitflie\sdyunze\yun-ze-iot) +2022-01-12 09:40:50 [restartedMain] DEBUG com.yunze.YunZeApplication --> Running with Spring Boot v2.2.13.RELEASE, Spring v5.2.12.RELEASE +2022-01-12 09:40:50 [restartedMain] INFO com.yunze.YunZeApplication --> The following profiles are active: druid +2022-01-12 09:41:02 [restartedMain] INFO org.apache.coyote.http11.Http11NioProtocol --> Initializing ProtocolHandler ["http-nio-8080"] +2022-01-12 09:41:02 [restartedMain] INFO org.apache.catalina.core.StandardService --> Starting service [Tomcat] +2022-01-12 09:41:02 [restartedMain] INFO org.apache.catalina.core.StandardEngine --> Starting Servlet engine: [Apache Tomcat/9.0.41] +2022-01-12 09:41:02 [restartedMain] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] --> Initializing Spring embedded WebApplicationContext +2022-01-12 09:41:05 [restartedMain] DEBUG c.y.f.security.filter.JwtAuthenticationTokenFilter --> Filter 'jwtAuthenticationTokenFilter' configured for use +2022-01-12 09:41:12 [restartedMain] INFO com.alibaba.druid.pool.DruidDataSource --> {dataSource-1} inited +2022-01-12 09:41:12 [restartedMain] DEBUG c.y.system.mapper.SysConfigMapper.selectConfigList --> ==> Preparing: select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark from sys_config +2022-01-12 09:41:12 [restartedMain] DEBUG c.y.system.mapper.SysConfigMapper.selectConfigList --> ==> Parameters: +2022-01-12 09:41:12 [restartedMain] DEBUG c.y.system.mapper.SysConfigMapper.selectConfigList --> <== Total: 13 +2022-01-12 09:41:13 [restartedMain] INFO io.lettuce.core.EpollProvider --> Starting without optional epoll library +2022-01-12 09:41:13 [restartedMain] INFO io.lettuce.core.KqueueProvider --> Starting without optional kqueue library +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.mapper.SysDictTypeMapper.selectDictTypeAll --> ==> Preparing: select dict_id, dict_name, dict_type, status, create_by, create_time, remark from sys_dict_type +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.mapper.SysDictTypeMapper.selectDictTypeAll --> ==> Parameters: +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.mapper.SysDictTypeMapper.selectDictTypeAll --> <== Total: 128 +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: sys_user_sex(String) +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: sys_show_hide(String) +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: sys_normal_disable(String) +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: sys_job_status(String) +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: sys_job_group(String) +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: sys_yes_no(String) +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: sys_notice_type(String) +2022-01-12 09:41:16 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: sys_notice_status(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: sys_oper_type(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 9 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: sys_common_status(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: card_type(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_seltype(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_sel_timetype(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_deltype(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_operators_type(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_status_type(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 33 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_takeEffect_type(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_valid_type(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_pay_type(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_customize_whether(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_card_type(String) +2022-01-12 09:41:17 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_network_type(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_online_status(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_access_type(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_StartAndEnd_type(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 5 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_channel_selType(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: ORDER_BY_rule(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: channel_ORDER_BY_type(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: channel_status(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: channel_code(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: executionTask_selType(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: executionTask_ORDER_BY_type(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_ExecutionTask_OutType(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 22 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_packet_valid_name(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_tariffGroup_selType(String) +2022-01-12 09:41:18 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_tariffPlan_selType(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_order_type(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_order_status(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_polling_type(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 5 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_task_type(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 13 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_order_seltype(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 5 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_order_creType(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_order_profitType(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_order_sel_timetype(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_order_StartAndEnd_type(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_packet_type(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_base_packet_type(String) +2022-01-12 09:41:19 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_syslogs_sel_timetype(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: dosage_details_flow_his(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_yz_card_flow_his(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_yz_passageway(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_passageway_polling(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_sorting_rules(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_flow(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Lifting_sequence(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_card_flow(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: system_yz_sys_logs_sysLog(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 6 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_sys_logs_project(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cardChange_type(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cardChange_sourceType(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 7 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cardConnection_type(String) +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:20 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cardChange_ExecutionStatus(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: cardNumber(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cc_trigger_type(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cc_execution_type(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cc_status(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cc_template(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cc_HisStatus(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cc_result(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_enabled_state(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_commodity_sell(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_check_state(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Stop_and_resume(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Disconnect_the_network(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_card_info_change(String) +2022-01-12 09:41:21 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_customer_state(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_customer_source(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_customer_grade(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 5 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_customer_grade_one(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_customer_grade_tow(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 5 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_customer_selType(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_customer_selTimeType(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_CustomerChange_type(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 6 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_CustomerSort_type(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Automation_time(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Automated_configuration(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 0 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_cc_condition(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: cc_query_criteria(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: prdCategory_timet(String) +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:22 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_task_sel_timetype(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: buttonyesno(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Warehousing_source(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 0 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_Commodity_supplier(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_Commodity_Operator(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_Bcommodity_selType(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_Ccommodity_selType(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_BcommoditySort_selType(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_Universal_delete(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_profit_sharingType(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 8 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_Invoicing_Type(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_Contract_status(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 5 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_ReceivePayment_type(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_SalesContract_selType(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yz_SalesContract_selTimeType(String) +2022-01-12 09:41:23 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: cwgl_Deposit_type(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: cwgl_Deposit_state(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Ship_state(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: DepositSource_type(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: invoice_Nature(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: contract_nature(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_OrderDelivery_selType(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 1 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_OrderDelivery_timetype(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Delivery_selection_type(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Delivery_method(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 5 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Delivery_type(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: Shipping_method(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_ShippingApplication_selType(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_ShippingApplication_timetype(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_ExpressInquiry_selType(String) +2022-01-12 09:41:24 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 4 +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_ExpressInquiry_timetype(String) +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_ExpressInquiry_SignFor(String) +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_ExpressInquiry_Evaluation(String) +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 5 +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_card_status_ShowId(String) +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 8 +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_InventoryDetails_selType(String) +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 16 +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_inventorydetails_timetype(String) +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_inventorydetails_StartAndEnd_type(String) +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 15 +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_CustomerInquiries_selType(String) +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 2 +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_ShippingApplication_OutboundStatus (String) +2022-01-12 09:41:25 [restartedMain] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 3 +2022-01-12 09:41:28 [restartedMain] INFO org.quartz.impl.StdSchedulerFactory --> Using default implementation for ThreadExecutor +2022-01-12 09:41:28 [restartedMain] INFO org.quartz.core.SchedulerSignalerImpl --> Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl +2022-01-12 09:41:28 [restartedMain] INFO org.quartz.core.QuartzScheduler --> Quartz Scheduler v.2.3.2 created. +2022-01-12 09:41:28 [restartedMain] INFO org.quartz.core.QuartzScheduler --> Scheduler meta-data: Quartz Scheduler (v2.3.2) 'RuoyiScheduler' with instanceId 'Dell1641951688467' + Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. + NOT STARTED. + Currently in standby mode. + Number of jobs executed: 0 + Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 20 threads. + Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered. + +2022-01-12 09:41:28 [restartedMain] INFO org.quartz.impl.StdSchedulerFactory --> Quartz scheduler 'RuoyiScheduler' initialized from an externally provided properties instance. +2022-01-12 09:41:28 [restartedMain] INFO org.quartz.impl.StdSchedulerFactory --> Quartz scheduler version: 2.3.2 +2022-01-12 09:41:28 [restartedMain] INFO org.quartz.core.QuartzScheduler --> JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@54275e0e +2022-01-12 09:41:29 [restartedMain] DEBUG com.yunze.quartz.mapper.SysJobMapper.selectJobAll --> ==> Preparing: select job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, remark from sys_job +2022-01-12 09:41:29 [restartedMain] DEBUG com.yunze.quartz.mapper.SysJobMapper.selectJobAll --> ==> Parameters: +2022-01-12 09:41:29 [restartedMain] DEBUG com.yunze.quartz.mapper.SysJobMapper.selectJobAll --> <== Total: 25 +2022-01-12 09:41:48 [restartedMain] INFO s.d.s.w.PropertySourcedRequestMappingHandlerMapping --> Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)] +2022-01-12 09:41:53 [restartedMain] INFO s.d.s.web.plugins.DocumentationPluginsBootstrapper --> Context refreshed +2022-01-12 09:41:53 [restartedMain] INFO s.d.s.web.plugins.DocumentationPluginsBootstrapper --> Found 1 custom documentation plugin(s) +2022-01-12 09:41:53 [restartedMain] INFO s.d.spring.web.scanners.ApiListingReferenceScanner --> Scanning for api listing references +2022-01-12 09:41:54 [restartedMain] INFO org.apache.coyote.http11.Http11NioProtocol --> Starting ProtocolHandler ["http-nio-8080"] +2022-01-12 09:41:54 [restartedMain] INFO com.yunze.YunZeApplication --> Started YunZeApplication in 65.83 seconds (JVM running for 77.537) +2022-01-12 09:41:56 [Quartz Scheduler [RuoyiScheduler]] INFO org.quartz.core.QuartzScheduler --> Scheduler RuoyiScheduler_$_Dell1641951688467 started. +2022-01-12 09:44:09 [http-nio-8080-exec-24] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] --> Initializing Spring DispatcherServlet 'dispatcherServlet' +2022-01-12 09:44:16 [http-nio-8080-exec-26] WARN o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver --> Resolved [com.yunze.common.exception.user.CaptchaException: 验证码错误] +2022-01-12 09:44:16 [schedule-pool-1] INFO sys-user --> [127.0.0.1]XX XX[admin][Error][验证码错误] +2022-01-12 09:44:16 [schedule-pool-1] DEBUG c.y.s.mapper.SysLogininforMapper.insertLogininfor --> ==> Preparing: insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time) values (?, ?, ?, ?, ?, ?, ?, sysdate()) +2022-01-12 09:44:16 [schedule-pool-1] DEBUG c.y.s.mapper.SysLogininforMapper.insertLogininfor --> ==> Parameters: admin(String), 1(String), 127.0.0.1(String), XX XX(String), Chrome 9(String), Windows 10(String), 验证码错误(String) +2022-01-12 09:44:17 [schedule-pool-1] DEBUG c.y.s.mapper.SysLogininforMapper.insertLogininfor --> <== Updates: 1 +2022-01-12 09:44:52 [http-nio-8080-exec-23] WARN o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver --> Resolved [com.yunze.common.exception.user.CaptchaException: 验证码错误] +2022-01-12 09:44:52 [schedule-pool-1] INFO sys-user --> [127.0.0.1]XX XX[admin][Error][验证码错误] +2022-01-12 09:44:52 [schedule-pool-1] DEBUG c.y.s.mapper.SysLogininforMapper.insertLogininfor --> ==> Preparing: insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time) values (?, ?, ?, ?, ?, ?, ?, sysdate()) +2022-01-12 09:44:52 [schedule-pool-1] DEBUG c.y.s.mapper.SysLogininforMapper.insertLogininfor --> ==> Parameters: admin(String), 1(String), 127.0.0.1(String), XX XX(String), Chrome 9(String), Windows 10(String), 验证码错误(String) +2022-01-12 09:44:52 [schedule-pool-1] DEBUG c.y.s.mapper.SysLogininforMapper.insertLogininfor --> <== Updates: 1 +2022-01-12 09:44:55 [http-nio-8080-exec-25] DEBUG c.y.s.mapper.SysUserMapper.selectUserByUserName --> ==> Preparing: select u.user_id, u.dept_id, u.user_name, u.nick_name, 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, d.dept_id, d.parent_id, 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 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 where u.user_name = ? +2022-01-12 09:44:55 [http-nio-8080-exec-25] DEBUG c.y.s.mapper.SysUserMapper.selectUserByUserName --> ==> Parameters: admin(String) +2022-01-12 09:44:55 [http-nio-8080-exec-25] DEBUG c.y.s.mapper.SysUserMapper.selectUserByUserName --> <== Total: 1 +2022-01-12 09:44:55 [http-nio-8080-exec-25] DEBUG com.yunze.system.mapper.SysUserMapper.updateUser --> ==> Preparing: update sys_user SET dept_id = ?, user_name = ?, nick_name = ?, email = ?, phonenumber = ?, sex = ?, avatar = ?, password = ?, status = ?, login_ip = ?, login_date = ?, remark = ?, update_time = sysdate() where user_id = ? +2022-01-12 09:44:55 [schedule-pool-2] INFO sys-user --> [127.0.0.1]XX XX[admin][Success][登录成功] +2022-01-12 09:44:55 [http-nio-8080-exec-25] DEBUG com.yunze.system.mapper.SysUserMapper.updateUser --> ==> Parameters: 100(Long), admin(String), 管理员(String), (String), 15888888899(String), 0(String), /profile/avatar/2021/09/18/07019f5b-4ac2-4852-9c8d-ff104e376c44.jpeg(String), $2a$10$Aec8Mrw3PfMTErFL8PtxM.oX7Mb52rtOms9/0yd8lWhBZ1jik6tv2(String), 0(String), 127.0.0.1(String), 2022-01-12 09:44:55.356(Timestamp), 管理员(String), 1(Long) +2022-01-12 09:44:55 [http-nio-8080-exec-25] DEBUG com.yunze.system.mapper.SysUserMapper.updateUser --> <== Updates: 1 +2022-01-12 09:44:55 [schedule-pool-2] WARN com.alibaba.druid.pool.DruidAbstractDataSource --> discard long time none received connection. , jdbcUrl : jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8, version : 1.2.8, lastPacketReceivedIdleMillis : 119157 +2022-01-12 09:44:55 [schedule-pool-2] DEBUG c.y.s.mapper.SysLogininforMapper.insertLogininfor --> ==> Preparing: insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time) values (?, ?, ?, ?, ?, ?, ?, sysdate()) +2022-01-12 09:44:55 [schedule-pool-2] DEBUG c.y.s.mapper.SysLogininforMapper.insertLogininfor --> ==> Parameters: admin(String), 0(String), 127.0.0.1(String), XX XX(String), Chrome 9(String), Windows 10(String), 登录成功(String) +2022-01-12 09:44:55 [schedule-pool-2] DEBUG c.y.s.mapper.SysLogininforMapper.insertLogininfor --> <== Updates: 1 +2022-01-12 09:44:56 [http-nio-8080-exec-20] DEBUG c.y.system.mapper.SysMenuMapper.selectMenuTreeAll --> ==> Preparing: select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0 order by m.parent_id, m.order_num +2022-01-12 09:44:56 [http-nio-8080-exec-20] DEBUG c.y.system.mapper.SysMenuMapper.selectMenuTreeAll --> ==> Parameters: +2022-01-12 09:44:56 [http-nio-8080-exec-20] DEBUG c.y.system.mapper.SysMenuMapper.selectMenuTreeAll --> <== Total: 51 +2022-01-12 09:45:00 [RuoyiScheduler_Worker-1] DEBUG c.y.common.mapper.yunze.YzOrderMapper.updAutomatic --> ==> Preparing: update yz_order SET add_package = 1 WHERE id in ( SELECT b.id FROM yz_card_flow a, yz_order b where a.ord_no = b.ord_no and a.iccid = b.iccid and b.add_package = 0 ) +2022-01-12 09:45:00 [RuoyiScheduler_Worker-1] DEBUG c.y.common.mapper.yunze.YzOrderMapper.updAutomatic --> ==> Parameters: +2022-01-12 09:45:00 [RuoyiScheduler_Worker-1] DEBUG c.y.c.mapper.yunze.YzOrderMapper.findAddPackage --> ==> Preparing: SELECT a.id, a.ord_no, a.iccid, a.add_parameter, a.validate_type, DATE_FORMAT( a.create_time, "%Y-%m-%d %H:%i:%S" ) AS create_time, b.id as Bid, b.activate_date FROM yz_order a, yz_card_info b WHERE a.ord_type = 2 and a.status = 1 and a.add_package = 0 and a.iccid = b.iccid AND a.validate_type != ? +2022-01-12 09:45:00 [RuoyiScheduler_Worker-1] DEBUG c.y.c.mapper.yunze.YzOrderMapper.findAddPackage --> ==> Parameters: 4(String) +2022-01-12 09:45:00 [RuoyiScheduler_Worker-1] DEBUG c.y.c.mapper.yunze.YzOrderMapper.findAddPackage --> <== Total: 0 +2022-01-12 09:45:00 [RuoyiScheduler_Worker-1] DEBUG c.yunze.quartz.mapper.SysJobLogMapper.insertJobLog --> ==> Preparing: insert into sys_job_log( job_name, job_group, invoke_target, job_message, status, create_time )values( ?, ?, ?, ?, ?, sysdate() ) +2022-01-12 09:45:00 [RuoyiScheduler_Worker-1] DEBUG c.yunze.quartz.mapper.SysJobLogMapper.insertJobLog --> ==> Parameters: 除 生效类型为 [激活生效] 外 所有加包 增加到生产任务中去(String), POLLING(String), orderAddPackageProductionTask.addPackageProduction(180)(String), 除 生效类型为 [激活生效] 外 所有加包 增加到生产任务中去 总共耗时:235毫秒(String), 0(String) +2022-01-12 09:45:00 [RuoyiScheduler_Worker-1] DEBUG c.yunze.quartz.mapper.SysJobLogMapper.insertJobLog --> <== Updates: 1 +2022-01-12 09:45:01 [RuoyiScheduler_Worker-2] WARN com.alibaba.druid.pool.DruidAbstractDataSource --> discard long time none received connection. , jdbcUrl : jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8, version : 1.2.8, lastPacketReceivedIdleMillis : 229823 +2022-01-12 09:45:01 [RuoyiScheduler_Worker-2] WARN com.alibaba.druid.pool.DruidAbstractDataSource --> discard long time none received connection. , jdbcUrl : jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8, version : 1.2.8, lastPacketReceivedIdleMillis : 230250 +2022-01-12 09:45:01 [RuoyiScheduler_Worker-2] WARN com.alibaba.druid.pool.DruidAbstractDataSource --> discard long time none received connection. , jdbcUrl : jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8, version : 1.2.8, lastPacketReceivedIdleMillis : 230610 +2022-01-12 09:45:01 [RuoyiScheduler_Worker-2] DEBUG c.y.apiCommon.mapper.YzCardRouteMapper.findRouteID --> ==> Preparing: SELECT cd_id, cd_code, cd_name, cd_username, cd_pwd, cd_key, cd_status, cd_concurrency, cd_control_type FROM yz_card_route WHERE cd_lunxun = '1' and cd_status = '1' +2022-01-12 09:45:01 [RuoyiScheduler_Worker-2] DEBUG c.y.apiCommon.mapper.YzCardRouteMapper.findRouteID --> ==> Parameters: +2022-01-12 09:45:01 [RuoyiScheduler_Worker-2] DEBUG c.y.apiCommon.mapper.YzCardRouteMapper.findRouteID --> <== Total: 0 +2022-01-12 09:45:01 [RuoyiScheduler_Worker-2] DEBUG c.yunze.quartz.mapper.SysJobLogMapper.insertJobLog --> ==> Preparing: insert into sys_job_log( job_name, job_group, invoke_target, job_message, status, create_time )values( ?, ?, ?, ?, ?, sysdate() ) +2022-01-12 09:45:01 [RuoyiScheduler_Worker-2] DEBUG c.yunze.quartz.mapper.SysJobLogMapper.insertJobLog --> ==> Parameters: 达量停机(String), POLLING(String), cardStopTask.pollingCardStop(60)(String), 达量停机 总共耗时:186毫秒(String), 0(String) +2022-01-12 09:45:01 [RuoyiScheduler_Worker-2] DEBUG c.yunze.quartz.mapper.SysJobLogMapper.insertJobLog --> <== Updates: 1 +2022-01-12 09:45:04 [http-nio-8080-exec-18] DEBUG c.y.c.m.yunze.YzCardFlowMapper.queryPackage_simple --> ==> Preparing: SELECT package_id, package_agentname FROM yz_card_package +2022-01-12 09:45:04 [http-nio-8080-exec-18] DEBUG c.y.c.m.yunze.YzCardFlowMapper.queryPackage_simple --> ==> Parameters: +2022-01-12 09:45:04 [http-nio-8080-exec-18] DEBUG c.y.c.m.yunze.YzCardFlowMapper.queryPackage_simple --> <== Total: 0 +2022-01-12 09:45:05 [http-nio-8080-exec-12] DEBUG c.yunze.apiCommon.mapper.YzCardRouteMapper.find_sp --> ==> Preparing: SELECT cd_id, cd_alias FROM yz_card_route ORDER BY cd_alias ASC,cd_id +2022-01-12 09:45:05 [http-nio-8080-exec-12] DEBUG c.yunze.apiCommon.mapper.YzCardRouteMapper.find_sp --> ==> Parameters: +2022-01-12 09:45:05 [http-nio-8080-exec-8] DEBUG com.yunze.system.mapper.SysDeptMapper.getDeptName --> ==> Preparing: select dept_id,dname as 'dept_name' from sys_dept +2022-01-12 09:45:05 [http-nio-8080-exec-8] DEBUG com.yunze.system.mapper.SysDeptMapper.getDeptName --> ==> Parameters: +2022-01-12 09:45:05 [http-nio-8080-exec-12] DEBUG c.yunze.apiCommon.mapper.YzCardRouteMapper.find_sp --> <== Total: 1 +2022-01-12 09:45:05 [http-nio-8080-exec-8] DEBUG com.yunze.system.mapper.SysDeptMapper.getDeptName --> <== Total: 1 +2022-01-12 09:45:05 [http-nio-8080-exec-15] DEBUG c.y.c.mapper.yunze.YzCardMapper.getCardGrouping --> ==> Preparing: SELECT customize_grouping FROM yz_card_info WHERE ISNULL(customize_grouping )= 0 AND LENGTH( trim( customize_grouping ))> 0 GROUP BY customize_grouping +2022-01-12 09:45:05 [http-nio-8080-exec-15] DEBUG c.y.c.mapper.yunze.YzCardMapper.getCardGrouping --> ==> Parameters: +2022-01-12 09:45:05 [http-nio-8080-exec-15] DEBUG c.y.c.mapper.yunze.YzCardMapper.getCardGrouping --> <== Total: 0 +2022-01-12 09:45:05 [http-nio-8080-exec-29] DEBUG c.y.common.mapper.yunze.YzCardMapper.selMapCount --> ==> Preparing: SELECT COUNT(iccid) FROM yz_card_info +2022-01-12 09:45:05 [http-nio-8080-exec-29] DEBUG c.y.common.mapper.yunze.YzCardMapper.selMapCount --> ==> Parameters: +2022-01-12 09:45:05 [http-nio-8080-exec-29] DEBUG c.y.common.mapper.yunze.YzCardMapper.selMapCount --> <== Total: 1 +2022-01-12 09:45:05 [http-nio-8080-exec-29] DEBUG com.yunze.common.mapper.yunze.YzCardMapper.selMap --> ==> Preparing: SELECT id, vid, msisdn, iccid, imsi, open_date, activate_date, agent_id, channel_id, DATE_FORMAT( batch_date, "%Y-%m-%d" ) AS batch_date, DATE_FORMAT( syn_Time, "%Y-%m-%d %H:%i:%S" ) AS syn_Time, remarks, status_id, status_ShowId, package_id, used, customize_grouping, DATE_FORMAT( deliver_date, "%Y-%m-%d" ) AS deliver_date, DATE_FORMAT( due_expire_time, "%Y-%m-%d" ) AS due_expire_time ,remind_ratio, virtual_ratio, del_flag, connection_status, is_Disconnected FROM yz_card_info LIMIT ?,? +2022-01-12 09:45:05 [http-nio-8080-exec-29] DEBUG com.yunze.common.mapper.yunze.YzCardMapper.selMap --> ==> Parameters: 0(Integer), 10(Integer) +2022-01-12 09:45:05 [http-nio-8080-exec-29] DEBUG com.yunze.common.mapper.yunze.YzCardMapper.selMap --> <== Total: 1 +2022-01-12 09:45:06 [http-nio-8080-exec-30] DEBUG c.yunze.system.mapper.SysDeptMapper.selectDeptList --> ==> Preparing: 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,d.dname from sys_dept d where d.del_flag = '0' order by d.parent_id, d.order_num +2022-01-12 09:45:06 [http-nio-8080-exec-30] DEBUG c.yunze.system.mapper.SysDeptMapper.selectDeptList --> ==> Parameters: +2022-01-12 09:45:06 [http-nio-8080-exec-30] DEBUG c.yunze.system.mapper.SysDeptMapper.selectDeptList --> <== Total: 1 +2022-01-12 09:45:06 [http-nio-8080-exec-26] DEBUG c.yunze.apiCommon.mapper.YzCardRouteMapper.find_cr --> ==> Preparing: SELECT cd_id AS 'dictValue', CONCAT( cd_alias , "-",cd_name ) AS 'dictLabel' FROM yz_card_route WHERE cd_status = 1 ORDER BY dictLabel ASC, cd_id +2022-01-12 09:45:06 [http-nio-8080-exec-26] DEBUG c.yunze.apiCommon.mapper.YzCardRouteMapper.find_cr --> ==> Parameters: +2022-01-12 09:45:06 [http-nio-8080-exec-26] DEBUG c.yunze.apiCommon.mapper.YzCardRouteMapper.find_cr --> <== Total: 0 +2022-01-12 09:45:09 [http-nio-8080-exec-28] DEBUG c.yunze.apiCommon.mapper.YzCardRouteMapper.find_cr --> ==> Preparing: SELECT cd_id AS 'dictValue', CONCAT( cd_alias , "-",cd_name ) AS 'dictLabel' FROM yz_card_route WHERE cd_status = 1 ORDER BY dictLabel ASC, cd_id +2022-01-12 09:45:09 [http-nio-8080-exec-28] DEBUG c.yunze.apiCommon.mapper.YzCardRouteMapper.find_cr --> ==> Parameters: +2022-01-12 09:45:09 [http-nio-8080-exec-28] DEBUG c.yunze.apiCommon.mapper.YzCardRouteMapper.find_cr --> <== Total: 0 +2022-01-12 09:45:12 [http-nio-8080-exec-19] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Preparing: 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 where status = '0' and dict_type = ? order by dict_sort asc +2022-01-12 09:45:12 [http-nio-8080-exec-22] DEBUG c.yunze.system.mapper.SysDeptMapper.selectDeptList --> ==> Preparing: 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,d.dname from sys_dept d where d.del_flag = '0' order by d.parent_id, d.order_num +2022-01-12 09:45:12 [http-nio-8080-exec-22] DEBUG c.yunze.system.mapper.SysDeptMapper.selectDeptList --> ==> Parameters: +2022-01-12 09:45:12 [http-nio-8080-exec-19] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> ==> Parameters: yunze_packet_valid_time(String) +2022-01-12 09:45:12 [http-nio-8080-exec-19] DEBUG c.y.s.m.SysDictDataMapper.selectDictDataByType --> <== Total: 0 +2022-01-12 09:45:12 [http-nio-8080-exec-23] DEBUG c.y.c.m.yunze.YzAgentPackageMapper.selMapCount --> ==> Preparing: SELECT a.id FROM yz_agent_package a LEFT JOIN sys_dept d ON a.dept_id = d.dept_id LEFT JOIN sys_user_role ur ON a.user_id = ur.user_id LEFT JOIN sys_role r ON r.role_id = ur.role_id LEFT JOIN sys_user u ON a.user_id = u.user_id GROUP BY a.id +2022-01-12 09:45:12 [http-nio-8080-exec-22] DEBUG c.yunze.system.mapper.SysDeptMapper.selectDeptList --> <== Total: 1 +2022-01-12 09:45:12 [http-nio-8080-exec-23] DEBUG c.y.c.m.yunze.YzAgentPackageMapper.selMapCount --> ==> Parameters: +2022-01-12 09:45:12 [http-nio-8080-exec-23] DEBUG c.y.c.m.yunze.YzAgentPackageMapper.selMapCount --> <== Total: 0 +2022-01-12 09:45:12 [http-nio-8080-exec-23] DEBUG c.y.common.mapper.yunze.YzCardPackageMapper.selMap --> ==> Preparing: SELECT a.id, a.package_id, a.package_agentname, a.package_name, DATE_FORMAT( a.create_time, "%Y-%m-%d %H:%i:%S" ) AS create_time, a.error_so, d.dept_name, u.nick_name FROM yz_card_package a LEFT JOIN sys_dept d ON a.dept_id = d.dept_id LEFT JOIN sys_user_role ur ON a.user_id = ur.user_id LEFT JOIN sys_role r ON r.role_id = ur.role_id LEFT JOIN sys_user u ON a.user_id = u.user_id GROUP BY a.id LIMIT ?,? +2022-01-12 09:45:12 [http-nio-8080-exec-23] DEBUG c.y.common.mapper.yunze.YzCardPackageMapper.selMap --> ==> Parameters: 0(Integer), 10(Integer) +2022-01-12 09:45:12 [http-nio-8080-exec-23] DEBUG c.y.common.mapper.yunze.YzCardPackageMapper.selMap --> <== Total: 0 +2022-01-12 09:45:31 [SpringContextShutdownHook] INFO org.quartz.core.QuartzScheduler --> Scheduler RuoyiScheduler_$_Dell1641951688467 paused. +2022-01-12 09:45:31 [SpringContextShutdownHook] INFO org.quartz.core.QuartzScheduler --> Scheduler RuoyiScheduler_$_Dell1641951688467 shutting down. +2022-01-12 09:45:31 [SpringContextShutdownHook] INFO org.quartz.core.QuartzScheduler --> Scheduler RuoyiScheduler_$_Dell1641951688467 paused. +2022-01-12 09:45:31 [SpringContextShutdownHook] INFO org.quartz.core.QuartzScheduler --> Scheduler RuoyiScheduler_$_Dell1641951688467 shutdown complete. +2022-01-12 09:45:31 [SpringContextShutdownHook] INFO sys-user --> ====关闭后台任务任务线程池==== +2022-01-12 09:45:31 [SpringContextShutdownHook] INFO com.alibaba.druid.pool.DruidDataSource --> {dataSource-1} closing ... +2022-01-12 09:45:31 [SpringContextShutdownHook] INFO com.alibaba.druid.pool.DruidDataSource --> {dataSource-1} closed diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..48e341a --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3 @@ +{ + "lockfileVersion": 1 +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..b3d10a1 --- /dev/null +++ b/pom.xml @@ -0,0 +1,291 @@ + + + 4.0.0 + + com.yunze + yunze + 0.5.0 + + yunze + http://www.5iot.cn + IOT综合业务支撑平台 + + + 0.5.0 + UTF-8 + UTF-8 + 1.8 + 3.1.1 + 1.2.8 + 1.21 + 2.9.2 + 2.3.2 + 2.2.0 + 1.3.0 + 1.2.76 + 5.6.0 + 5.7.0 + 2.5 + 1.3.3 + 3.2.2 + 4.1.2 + 1.7 + 0.9.1 + + + + + + + + + + + + + org.springframework.boot + spring-boot-dependencies + 2.2.13.RELEASE + pom + import + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + eu.bitwalker + UserAgentUtils + ${bitwalker.version} + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + ${mybatis-spring-boot.version} + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + ${pagehelper.boot.version} + + + + + com.github.oshi + oshi-core + ${oshi.version} + + + + net.java.dev.jna + jna + ${jna.version} + + + + net.java.dev.jna + jna-platform + ${jna.version} + + + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + + + + + io.springfox + springfox-swagger-ui + ${swagger.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 + ${velocity.version} + + + commons-collections + commons-collections + + + + + + + commons-collections + commons-collections + ${commons.collections.version} + + + + + com.alibaba + fastjson + ${fastjson.version} + + + + + io.jsonwebtoken + jjwt + ${jwt.version} + + + + + com.github.penggle + kaptcha + ${kaptcha.version} + + + + + com.yunze + yunze-quartz + ${yunze.version} + + + + + com.yunze + yunze-generator + ${yunze.version} + + + + + com.yunze + yunze-framework + ${yunze.version} + + + + + com.yunze + yunze-system + ${yunze.version} + + + + + com.yunze + yunze-common + ${yunze.version} + + + + + + + yunze-admin + yunze-framework + yunze-system + yunze-quartz + yunze-generator + yunze-common + yunze-consumption-admin + yunze-consumption-car-activatedate + yunze-consumption-car-flow + yunze-consumption-car-status + yunze-consumption-car-stop + yunze-consumption-order + yunze-consumption-update + yunze-consumption-car-disconnected + + + + pom + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${java.version} + ${java.version} + ${project.build.sourceEncoding} + + + + + + + + public + aliyun nexus + http://maven.aliyun.com/nexus/content/groups/public/ + + true + + + + + + + public + aliyun nexus + http://maven.aliyun.com/nexus/content/groups/public/ + + true + + + false + + + + + \ No newline at end of file diff --git a/sql/iotdb0.5.020220112.sql b/sql/iotdb0.5.020220112.sql new file mode 100644 index 0000000..e62dfe4 --- /dev/null +++ b/sql/iotdb0.5.020220112.sql @@ -0,0 +1,3053 @@ +/* + Navicat Premium Data Transfer + + Source Server Type : MySQL + Source Server Version : 80024 + Source Schema : iotdb + Target Server Type : MySQL + Target Server Version : 80024 + File Encoding : 65001 + + Date: 12/01/2022 11:20:15 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for gen_table +-- ---------------------------- +DROP TABLE IF EXISTS `gen_table`; +CREATE TABLE `gen_table` ( + `table_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '编号', + `table_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '表名称', + `table_comment` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '表描述', + `sub_table_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联子表的表名', + `sub_table_fk_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '子表关联的外键名', + `class_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '实体类名称', + `tpl_category` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'crud' COMMENT '使用的模板(crud单表操作 tree树表操作)', + `package_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成包路径', + `module_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成模块名', + `business_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成业务名', + `function_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成功能名', + `function_author` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成功能作者', + `gen_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '生成代码方式(0zip压缩包 1自定义路径)', + `gen_path` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '/' COMMENT '生成路径(不填默认项目路径)', + `options` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其它生成选项', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`table_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成业务表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of gen_table +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_table_column +-- ---------------------------- +DROP TABLE IF EXISTS `gen_table_column`; +CREATE TABLE `gen_table_column` ( + `column_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '编号', + `table_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '归属表编号', + `column_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列名称', + `column_comment` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列描述', + `column_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列类型', + `java_type` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'JAVA类型', + `java_field` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'JAVA字段名', + `is_pk` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否主键(1是)', + `is_increment` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否自增(1是)', + `is_required` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否必填(1是)', + `is_insert` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否为插入字段(1是)', + `is_edit` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否编辑字段(1是)', + `is_list` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否列表字段(1是)', + `is_query` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否查询字段(1是)', + `query_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'EQ' COMMENT '查询方式(等于、不等于、大于、小于、范围)', + `html_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)', + `dict_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典类型', + `sort` int(0) NULL DEFAULT NULL COMMENT '排序', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`column_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成业务表字段' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of gen_table_column +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_blob_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_blob_triggers`; +CREATE TABLE `qrtz_blob_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `blob_data` blob NULL, + PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, + CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_blob_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_calendars +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_calendars`; +CREATE TABLE `qrtz_calendars` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `calendar_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `calendar` blob NOT NULL, + PRIMARY KEY (`sched_name`, `calendar_name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_calendars +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_cron_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_cron_triggers`; +CREATE TABLE `qrtz_cron_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `cron_expression` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `time_zone_id` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, + CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_cron_triggers +-- ---------------------------- +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME1', 'DEFAULT', '0/10 * * * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME10', 'POLLING', '0 0/5 * * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME11', 'POLLING', '0 0/10 * * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME12', 'POLLING', '0 0/1 * * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME13', 'BACKUP', '0 0 0 * * ? *', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME14', 'DEFAULT', '0 0 0 * * ? *', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME15', 'POLLING', '0 0/20 * * * ? ', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME16', 'BACKUP', '0 0 0 * * ? *', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME18', 'POLLING', '0 0 0/8 * * ? ', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME19', 'POLLING', '0 0 0,2,4,6 1 * ? *', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME2', 'DEFAULT', '0/15 * * * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME21', 'BACKUP', '0/20 * * * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME22', 'POLLING', '0 0 0/1 * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME23', 'POLLING', '0 0 0/1 * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME24', 'POLLING', '0 0 0/3 * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME25', 'POLLING', '0 0 0/1 * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME26', 'POLLING', '0 0 0/1 * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME27', 'POLLING', '0 0 0/2 * * ? *', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME3', 'DEFAULT', '0/20 * * * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME4', 'DEFAULT', '0 0 0/1 * * ? ', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME5', 'POLLING', '0 0 0 * * ? ', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME6', 'POLLING', '0 0/10 * * * ?', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME7', 'POLLING', '0 0 11,22 * * ? ', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME8', 'POLLING', '0 0 6,18 * * ? ', 'Asia/Shanghai'); +INSERT INTO `qrtz_cron_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME9', 'POLLING', '0 0/15 * * * ?', 'Asia/Shanghai'); + +-- ---------------------------- +-- Table structure for qrtz_fired_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_fired_triggers`; +CREATE TABLE `qrtz_fired_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `entry_id` varchar(95) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `instance_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `fired_time` bigint(0) NOT NULL, + `sched_time` bigint(0) NOT NULL, + `priority` int(0) NOT NULL, + `state` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `job_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `job_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `is_nonconcurrent` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `requests_recovery` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`sched_name`, `entry_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_fired_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_job_details +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_job_details`; +CREATE TABLE `qrtz_job_details` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `job_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `job_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `description` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `job_class_name` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `is_durable` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `is_nonconcurrent` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `is_update_data` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `requests_recovery` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `job_data` blob NULL, + PRIMARY KEY (`sched_name`, `job_name`, `job_group`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_job_details +-- ---------------------------- +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME1', 'DEFAULT', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B5974190300007870770800000179D9BA361078707400007070707400013174000E302F3130202A202A202A202A203F74001172795461736B2E72794E6F506172616D7374000744454641554C547372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000001740018E7B3BBE7BB9FE9BB98E8AEA4EFBC88E697A0E58F82EFBC8974000133740001317800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME10', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017B105D9A5878707400007070707400013174000D3020302F35202A202A202A203F7400376F726465724164645061636B61676550726F64756374696F6E5461736B2E6164645061636B61676550726F64756374696F6E2831383029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000A74004FE999A420E7949FE69588E7B1BBE59E8BE4B8BA205BE6BF80E6B4BBE7949FE695885D20E5A49620E68980E69C89E58AA0E58C8520E5A29EE58AA0E588B0E7949FE4BAA7E4BBBBE58AA1E4B8ADE58EBB74000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME11', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017B3E53849078707400007070707400013174000E3020302F3130202A202A202A203F7400506F726465724164645061636B61676550726F64756374696F6E5461736B2E61637469766174696F6E4164645061636B61676550726F64756374696F6E416E644163746976617465446174652831383029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000B740051E7949FE69588E7B1BBE59E8BE4B8BA205BE6BF80E6B4BBE7949FE695885D20E4B89420E5B7B2E69C89E7949FE69588E697B6E997B420E5A29EE58AA0E588B0E7949FE4BAA7E4BBBBE58AA1E4B8ADE58EBB74000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME12', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017B5D27321878707400007070707400013174000D3020302F31202A202A202A203F74001E63617264466C6F775461736B2E537461727443617264466C6F7728363029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000C740018E6898BE58AA8E5BC80E590AFE794A8E9878FE79B91E590AC74000131740001317800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME13', 'BACKUP', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017B5DD8174078707400007070707400013174000D3020302030202A202A203F202A7400157379734C6F67735461736B2E6261636B75707328297400064241434B55507372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000D740018E588A0E999A4E5AFB9E5A496E68EA5E58FA3E697A5E5BF9774000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME14', 'DEFAULT', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017B9AA31FF878707400007070707400013174000D3020302030202A202A203F202A740013696E69744D512E696E69744D51436F6E66696774000744454641554C547372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000E74000B4D51E5889DE5A78BE58C9674000131740001317800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME15', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017BE2EBE6A078707400007070707400013174000F3020302F3230202A202A202A203F2074003163617264446973636F6E6E65637465645461736B2E706F6C6C696E6743617264446973636F6E6E65637465642831323029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000F74000FE69CAAE8AEA2E8B4ADE5819CE69CBA74000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME16', 'BACKUP', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017BEE1815A878707400007070707400013174000D3020302030202A202A203F202A7400176261636B7570546573742E67656E7461626C65283330297400064241434B55507372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001074000FE5A487E4BBBDE68980E69C89E8A1A874000131740001317800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME18', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017CC634131078707400007070707400013174000E30203020302F38202A202A203F20740037636172644163746976617465446174655461736B2E706F6C6C696E674163746976617465446174652827536572696F7573272C20363029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001274001CE8BDAEE8AFA22DE6BF80E6B4BBE697B6E997B4E69C89E794A8E9878F74000131740001317800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME19', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017CFD4332A078707400007070707400013174001330203020302C322C342C362031202A203F202A7400136D6F6E74682E67656E7461626C652831323029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001374001BE69C88E5889DE6B581E9878FE58DA1E8BF9BE8A18CE5A48DE69CBA74000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME2', 'DEFAULT', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B5974190300007870770800000179D9BA361078707400007070707400013174000E302F3135202A202A202A202A203F74001572795461736B2E7279506172616D7328277279272974000744454641554C547372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000002740018E7B3BBE7BB9FE9BB98E8AEA4EFBC88E69C89E58F82EFBC8974000133740001317800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME21', 'BACKUP', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017D238B375078707400007070707400013174000E302F3230202A202A202A202A203F740076726F6C6C6261636B436172646167656E742E726F6C6C6261636B4572726F722827313633363936333636313639375F6373765F39626435656531346136383134653862613265653763373037313163653463645F43617264446973747269627574654261636B75702E637376272C3233362C323436297400064241434B55507372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000015740013E59B9EE6BB9A20E58892E58DA1E5A487E4BBBD74000131740001317800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME22', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017D457A7CB878707400007070707400013174000D30203020302F31202A202A203F74002863617264466C6F775461736B2E706F6C6C696E6743617264466C6F774F6E652836302C2734392729740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001674001BE5889BE5BBBAE58D95E9809AE98193E794A8E9878FE79B91E590AC74000131740001317800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME23', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017D4589558078707400007070707400013174000D30203020302F31202A202A203F74002C63617264466C6F775461736B2E43617264466C6F774372656174654C697374656E65722836302C2734392729740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000017740022E68C87E5AE9AE58D95E4B8AAE9809AE98193E5889BE5BBBA20E6B688E8B4B9E8808574000131740001317800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME24', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017D4C28864078707400007070707400013174000D30203020302F33202A202A203F7400217265626F6F745461736B2E5265626F6F74466C6F77506F6C6C696E672831383029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000018740024E8BDAEE8AFA2E9878DE590AFE697A0E8AEB0E5BD95E6B688E8B4B9E88085E5889BE5BBBA74000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME25', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017D5FEF11F878707400007070707400013174000D30203020302F31202A202A203F74001E7265626F6F745461736B2E5265626F6F744361726453746F702831383029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000019740012E5819CE69CBAE99888E580BCE9878DE590AF74000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME26', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017D5FEFA28078707400007070707400013174000D30203020302F31202A202A203F7400267265626F6F745461736B2E5265626F6F7443617264446973636F6E6E65637465642831383029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001A740015E69CAAE8AEA2E8B4ADE5819CE69CBAE9878DE590AF74000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME27', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017D5A0D8BE878707400007070707400013174000F30203020302F32202A202A203F202A7400166D7163617264666C6F772E67657474696D6528333029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001B740018E5908CE6ADA5E4B8BBE8A1A8E588B0E69C9FE697A5E69C9F74000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME3', 'DEFAULT', NULL, 'com.yunze.quartz.util.QuartzJobExecution', '0', '0', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B5974190300007870770800000179D9BA361078707400007070707400013074000E302F3230202A202A202A202A203F74003872795461736B2E72794D756C7469706C65506172616D7328277279272C20747275652C20323030304C2C203331362E3530442C203130302974000744454641554C547372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000003740018E7B3BBE7BB9FE9BB98E8AEA4EFBC88E5A49AE58F82EFBC8974000133740001317800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME4', 'DEFAULT', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017A707EF3B078707400007070707400013174000E30203020302F31202A202A203F207400506F726465724164645061636B61676550726F64756374696F6E5461736B2E61637469766174696F6E4164645061636B61676550726F64756374696F6E416E64416374697661746544617465283138302974000744454641554C547372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000004740024E6A0B9E68DAEE8AEA2E58D95E8BDAEE5BA8FE69BB4E696B0E6BF80E6B4BBE697B6E997B474000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME5', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017A7FE1F28078707400007070707400013174000C3020302030202A202A203F20740037636172644163746976617465446174655461736B2E706F6C6C696E674163746976617465446174652827536C69676874272C2031323029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000005740013E8BDAEE8AFA22DE6BF80E6B4BBE697B6E997B474000132740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME6', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzJobExecution', '0', '0', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017AA96B7E0078707400007070707400013074000E3020302F3130202A202A202A203F74002270617373616765776179506F6C6C696E675461736B2E53796E4368616E6E656C2829740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000006740019E8BDAEE8AFA22DE5908CE6ADA5E9809AE98193E695B0E68DAE74000132740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME7', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017AC2153E507870740000707070740001317400103020302031312C3232202A202A203F20740025636172645374617475735461736B2E706F6C6C696E67436172645374617475732831323029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000000000007740010E8BDAEE8AFA22DE58DA1E78AB6E6808174000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME8', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017AC78DE4B878707400007070707400013174000F30203020362C3138202A202A203F2074002163617264466C6F775461736B2E706F6C6C696E6743617264466C6F772831323029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000874000DE8BDAEE8AFA22DE794A8E9878F74000131740001307800); +INSERT INTO `qrtz_job_details` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME9', 'POLLING', NULL, 'com.yunze.quartz.util.QuartzDisallowConcurrentExecution', '0', '1', '0', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C7708000000100000000174000F5441534B5F50524F504552544945537372001E636F6D2E79756E7A652E71756172747A2E646F6D61696E2E5379734A6F6200000000000000010200084C000A636F6E63757272656E747400124C6A6176612F6C616E672F537472696E673B4C000E63726F6E45787072657373696F6E71007E00094C000C696E766F6B6554617267657471007E00094C00086A6F6247726F757071007E00094C00056A6F6249647400104C6A6176612F6C616E672F4C6F6E673B4C00076A6F624E616D6571007E00094C000D6D697366697265506F6C69637971007E00094C000673746174757371007E000978720027636F6D2E79756E7A652E636F6D6D6F6E2E636F72652E646F6D61696E2E42617365456E7469747900000000000000010200074C0008637265617465427971007E00094C000A63726561746554696D657400104C6A6176612F7574696C2F446174653B4C0006706172616D7371007E00034C000672656D61726B71007E00094C000B73656172636856616C756571007E00094C0008757064617465427971007E00094C000A75706461746554696D6571007E000C787074000561646D696E7372000E6A6176612E7574696C2E44617465686A81014B597419030000787077080000017AD2D5B9E078707400007070707400013174000E3020302F3135202A202A202A203F7400206361726453746F705461736B2E706F6C6C696E674361726453746F7028363029740007504F4C4C494E477372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000000974000CE8BEBEE9878FE5819CE69CBA74000131740001307800); + +-- ---------------------------- +-- Table structure for qrtz_locks +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_locks`; +CREATE TABLE `qrtz_locks` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `lock_name` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + PRIMARY KEY (`sched_name`, `lock_name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_locks +-- ---------------------------- +INSERT INTO `qrtz_locks` VALUES ('RuoyiScheduler', 'STATE_ACCESS'); +INSERT INTO `qrtz_locks` VALUES ('RuoyiScheduler', 'TRIGGER_ACCESS'); + +-- ---------------------------- +-- Table structure for qrtz_paused_trigger_grps +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`; +CREATE TABLE `qrtz_paused_trigger_grps` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + PRIMARY KEY (`sched_name`, `trigger_group`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_paused_trigger_grps +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_scheduler_state +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_scheduler_state`; +CREATE TABLE `qrtz_scheduler_state` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `instance_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `last_checkin_time` bigint(0) NOT NULL, + `checkin_interval` bigint(0) NOT NULL, + PRIMARY KEY (`sched_name`, `instance_name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_scheduler_state +-- ---------------------------- +INSERT INTO `qrtz_scheduler_state` VALUES ('RuoyiScheduler', 'hecs-x-xlarge-2-linux-202006152200231641953379431', 1641957613462, 15000); + +-- ---------------------------- +-- Table structure for qrtz_simple_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_simple_triggers`; +CREATE TABLE `qrtz_simple_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `repeat_count` bigint(0) NOT NULL, + `repeat_interval` bigint(0) NOT NULL, + `times_triggered` bigint(0) NOT NULL, + PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, + CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_simple_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_simprop_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_simprop_triggers`; +CREATE TABLE `qrtz_simprop_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `str_prop_1` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `str_prop_2` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `str_prop_3` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `int_prop_1` int(0) NULL DEFAULT NULL, + `int_prop_2` int(0) NULL DEFAULT NULL, + `long_prop_1` bigint(0) NULL DEFAULT NULL, + `long_prop_2` bigint(0) NULL DEFAULT NULL, + `dec_prop_1` decimal(13, 4) NULL DEFAULT NULL, + `dec_prop_2` decimal(13, 4) NULL DEFAULT NULL, + `bool_prop_1` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `bool_prop_2` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, + CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_simprop_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_triggers`; +CREATE TABLE `qrtz_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `job_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `job_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `description` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `next_fire_time` bigint(0) NULL DEFAULT NULL, + `prev_fire_time` bigint(0) NULL DEFAULT NULL, + `priority` int(0) NULL DEFAULT NULL, + `trigger_state` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `trigger_type` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + `start_time` bigint(0) NOT NULL, + `end_time` bigint(0) NULL DEFAULT NULL, + `calendar_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `misfire_instr` smallint(0) NULL DEFAULT NULL, + `job_data` blob NULL, + PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, + INDEX `sched_name`(`sched_name`, `job_name`, `job_group`) USING BTREE, + CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `job_name`, `job_group`) REFERENCES `qrtz_job_details` (`sched_name`, `job_name`, `job_group`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_triggers +-- ---------------------------- +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME1', 'DEFAULT', 'TASK_CLASS_NAME1', 'DEFAULT', NULL, 1641953380000, -1, 5, 'PAUSED', 'CRON', 1641953379000, 0, NULL, 2, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME10', 'POLLING', 'TASK_CLASS_NAME10', 'POLLING', NULL, 1641957900000, 1641957600000, 5, 'WAITING', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME11', 'POLLING', 'TASK_CLASS_NAME11', 'POLLING', NULL, 1641958200000, 1641957600000, 5, 'WAITING', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME12', 'POLLING', 'TASK_CLASS_NAME12', 'POLLING', NULL, 1641953400000, -1, 5, 'PAUSED', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME13', 'BACKUP', 'TASK_CLASS_NAME13', 'BACKUP', NULL, 1642003200000, -1, 5, 'WAITING', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME14', 'DEFAULT', 'TASK_CLASS_NAME14', 'DEFAULT', NULL, 1642003200000, -1, 5, 'PAUSED', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME15', 'POLLING', 'TASK_CLASS_NAME15', 'POLLING', NULL, 1641958800000, 1641957600000, 5, 'WAITING', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME16', 'BACKUP', 'TASK_CLASS_NAME16', 'BACKUP', NULL, 1642003200000, -1, 5, 'PAUSED', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME18', 'POLLING', 'TASK_CLASS_NAME18', 'POLLING', NULL, 1641974400000, -1, 5, 'PAUSED', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME19', 'POLLING', 'TASK_CLASS_NAME19', 'POLLING', NULL, 1643644800000, -1, 5, 'WAITING', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME2', 'DEFAULT', 'TASK_CLASS_NAME2', 'DEFAULT', NULL, 1641953385000, -1, 5, 'PAUSED', 'CRON', 1641953379000, 0, NULL, 2, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME21', 'BACKUP', 'TASK_CLASS_NAME21', 'BACKUP', NULL, 1641953380000, -1, 5, 'PAUSED', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME22', 'POLLING', 'TASK_CLASS_NAME22', 'POLLING', NULL, 1641956400000, -1, 5, 'PAUSED', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME23', 'POLLING', 'TASK_CLASS_NAME23', 'POLLING', NULL, 1641956400000, -1, 5, 'PAUSED', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME24', 'POLLING', 'TASK_CLASS_NAME24', 'POLLING', NULL, 1641960000000, -1, 5, 'WAITING', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME25', 'POLLING', 'TASK_CLASS_NAME25', 'POLLING', NULL, 1641960000000, 1641956400000, 5, 'WAITING', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME26', 'POLLING', 'TASK_CLASS_NAME26', 'POLLING', NULL, 1641960000000, 1641956400000, 5, 'WAITING', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME27', 'POLLING', 'TASK_CLASS_NAME27', 'POLLING', NULL, 1641960000000, -1, 5, 'WAITING', 'CRON', 1641953380000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME3', 'DEFAULT', 'TASK_CLASS_NAME3', 'DEFAULT', NULL, 1641953380000, -1, 5, 'PAUSED', 'CRON', 1641953379000, 0, NULL, 2, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME4', 'DEFAULT', 'TASK_CLASS_NAME4', 'DEFAULT', NULL, 1641960000000, 1641956400000, 5, 'WAITING', 'CRON', 1641953379000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME5', 'POLLING', 'TASK_CLASS_NAME5', 'POLLING', NULL, 1642003200000, -1, 5, 'WAITING', 'CRON', 1641953379000, 0, NULL, 1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME6', 'POLLING', 'TASK_CLASS_NAME6', 'POLLING', NULL, 1641958200000, 1641957600000, 5, 'WAITING', 'CRON', 1641953379000, 0, NULL, 1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME7', 'POLLING', 'TASK_CLASS_NAME7', 'POLLING', NULL, 1641996000000, 1641956400000, 5, 'WAITING', 'CRON', 1641953379000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME8', 'POLLING', 'TASK_CLASS_NAME8', 'POLLING', NULL, 1641981600000, -1, 5, 'WAITING', 'CRON', 1641953379000, 0, NULL, -1, ''); +INSERT INTO `qrtz_triggers` VALUES ('RuoyiScheduler', 'TASK_CLASS_NAME9', 'POLLING', 'TASK_CLASS_NAME9', 'POLLING', NULL, 1641958200000, 1641957300000, 5, 'WAITING', 'CRON', 1641953380000, 0, NULL, -1, ''); + +-- ---------------------------- +-- Table structure for sys_config +-- ---------------------------- +DROP TABLE IF EXISTS `sys_config`; +CREATE TABLE `sys_config` ( + `config_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '参数主键', + `config_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '参数名称', + `config_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '参数键名', + `config_value` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '参数键值', + `config_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'N' COMMENT '系统内置(Y是 N否)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`config_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '参数配置表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_config +-- ---------------------------- +INSERT INTO `sys_config` VALUES (1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', '2021-06-05 09:12:10', '', NULL, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow'); +INSERT INTO `sys_config` VALUES (2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', '2021-06-05 09:12:10', '', NULL, '初始化密码 123456'); +INSERT INTO `sys_config` VALUES (3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', '2021-06-05 09:12:10', '', NULL, '深色主题theme-dark,浅色主题theme-light'); +INSERT INTO `sys_config` VALUES (4, '连接管理解绑默认联系人', 'yunze.card.contactName', 'CeShi', 'Y', 'admin', '2021-07-31 09:17:58', '', NULL, NULL); +INSERT INTO `sys_config` VALUES (5, '连接管理解绑联系人电话', 'yunze.card.contactPhone', '188888888', 'Y', 'admin', '2021-07-31 09:19:30', '', NULL, NULL); +INSERT INTO `sys_config` VALUES (6, '购卡运费', 'yunze.web.byCardFare', '0.01', 'Y', 'admin', '2021-09-22 17:42:07', 'admin', '2021-09-24 13:45:46', '微信web端购卡运费'); +INSERT INTO `sys_config` VALUES (7, '系统邮件抄送邮箱', 'yunze.ccConfig.Email', 'youxiang@5iot.cn', 'Y', 'admin', '2021-09-26 12:01:02', '', NULL, NULL); +INSERT INTO `sys_config` VALUES (8, '系统邮件抄送邮箱密码', 'yunze.ccConfig.EmailPwd', 'fffff', 'Y', 'admin', '2021-09-26 12:01:58', '', NULL, '密码或者授权码'); +INSERT INTO `sys_config` VALUES (9, '复机重试最大次数', 'MaixCount', '50', 'N', 'admin', '2021-11-15 14:58:40', 'admin', '2021-11-23 16:57:01', NULL); +INSERT INTO `sys_config` VALUES (10, '重启消费者轮序队列数量', 'polling.rebootStandard', '1000', 'N', 'admin', '2021-11-23 16:56:42', 'admin', '2021-11-27 13:40:22', NULL); +INSERT INTO `sys_config` VALUES (11, '重启停机阈值待销费标准', 'polling.rebootCardStop', '1', 'N', 'admin', '2021-11-27 13:40:08', 'admin', '2021-11-27 14:09:29', NULL); +INSERT INTO `sys_config` VALUES (12, '重启未订购停机待销费标准', 'polling.rebootCardDisconnected', '1', 'Y', 'admin', '2021-11-27 13:41:57', 'admin', '2021-11-27 14:09:34', NULL); +INSERT INTO `sys_config` VALUES (13, 'C端充值失败再次充值执行次数', 'yunze.card.IsStop', '10', 'Y', 'admin', '2021-12-27 10:26:40', '', NULL, NULL); + +-- ---------------------------- +-- Table structure for sys_dept +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dept`; +CREATE TABLE `sys_dept` ( + `dept_id` bigint(0) NOT NULL AUTO_INCREMENT, + `parent_id` bigint(0) NULL DEFAULT 0, + `ancestors` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '', + `dept_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '', + `order_num` int(0) NULL DEFAULT 0, + `leader` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0', + `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '', + `create_time` datetime(0) NULL DEFAULT NULL, + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '', + `update_time` datetime(0) NULL DEFAULT NULL, + `dname` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (`dept_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 252 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_dept +-- ---------------------------- +INSERT INTO `sys_dept` VALUES (100, 0, '0', '总集团', 0, NULL, NULL, NULL, '0', '0', 'admin', '2021-06-05 09:12:09', 'admin', '2021-06-07 09:04:38', '总集团'); + +-- ---------------------------- +-- Table structure for sys_dict_data +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dict_data`; +CREATE TABLE `sys_dict_data` ( + `dict_code` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '字典编码', + `dict_sort` int(0) NULL DEFAULT 0 COMMENT '字典排序', + `dict_label` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典标签', + `dict_value` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典键值', + `dict_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典类型', + `css_class` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '样式属性(其他样式扩展)', + `list_class` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '表格回显样式', + `is_default` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'N' COMMENT '是否默认(Y是 N否)', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`dict_code`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 559 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '字典数据表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_dict_data +-- ---------------------------- +INSERT INTO `sys_dict_data` VALUES (1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '性别男'); +INSERT INTO `sys_dict_data` VALUES (2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '性别女'); +INSERT INTO `sys_dict_data` VALUES (3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '性别未知'); +INSERT INTO `sys_dict_data` VALUES (4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '显示菜单'); +INSERT INTO `sys_dict_data` VALUES (5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '隐藏菜单'); +INSERT INTO `sys_dict_data` VALUES (6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '停用状态'); +INSERT INTO `sys_dict_data` VALUES (8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '停用状态'); +INSERT INTO `sys_dict_data` VALUES (10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '默认分组'); +INSERT INTO `sys_dict_data` VALUES (11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '系统分组'); +INSERT INTO `sys_dict_data` VALUES (12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '系统默认是'); +INSERT INTO `sys_dict_data` VALUES (13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '系统默认否'); +INSERT INTO `sys_dict_data` VALUES (14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '通知'); +INSERT INTO `sys_dict_data` VALUES (15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '公告'); +INSERT INTO `sys_dict_data` VALUES (16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '关闭状态'); +INSERT INTO `sys_dict_data` VALUES (18, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '新增操作'); +INSERT INTO `sys_dict_data` VALUES (19, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '修改操作'); +INSERT INTO `sys_dict_data` VALUES (20, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '删除操作'); +INSERT INTO `sys_dict_data` VALUES (21, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '授权操作'); +INSERT INTO `sys_dict_data` VALUES (22, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '导出操作'); +INSERT INTO `sys_dict_data` VALUES (23, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '导入操作'); +INSERT INTO `sys_dict_data` VALUES (24, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '强退操作'); +INSERT INTO `sys_dict_data` VALUES (25, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '生成操作'); +INSERT INTO `sys_dict_data` VALUES (26, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '清空操作'); +INSERT INTO `sys_dict_data` VALUES (27, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (28, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '停用状态'); +INSERT INTO `sys_dict_data` VALUES (100, 0, '中国移动', '1', 'card_type', NULL, NULL, 'N', '0', 'admin', '2021-06-05 10:49:40', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (101, 1, '中国联通', '2', 'card_type', NULL, NULL, 'N', '0', 'admin', '2021-06-05 10:50:08', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (102, 2, '中国电信', '3', 'card_type', NULL, NULL, 'N', '0', 'admin', '2021-06-05 10:50:18', 'admin', '2021-06-05 10:51:06', NULL); +INSERT INTO `sys_dict_data` VALUES (103, 3, '其他', '4', 'card_type', NULL, NULL, 'N', '0', 'admin', '2021-06-05 10:50:42', 'admin', '2021-06-05 10:51:10', NULL); +INSERT INTO `sys_dict_data` VALUES (104, 0, '卡号', '1', 'yunze_card_seltype', NULL, NULL, 'N', '0', 'admin', '2021-06-07 09:21:09', 'admin', '2021-06-07 09:22:33', '卡号查询 vid/msisdn/iccid/imsi'); +INSERT INTO `sys_dict_data` VALUES (105, 0, '备注', '2', 'yunze_card_seltype', NULL, NULL, 'N', '0', 'admin', '2021-06-07 09:22:29', '', NULL, '卡板备注'); +INSERT INTO `sys_dict_data` VALUES (106, 0, '开卡日期', '1', 'yunze_card_sel_timetype', NULL, NULL, 'N', '0', 'admin', '2021-06-07 12:23:05', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (107, 0, '激活日期', '2', 'yunze_card_sel_timetype', NULL, NULL, 'N', '0', 'admin', '2021-06-07 12:23:35', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (108, 0, '入库日期', '3', 'yunze_card_sel_timetype', NULL, NULL, 'N', '0', 'admin', '2021-06-07 12:23:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (109, 0, '正常', '0', 'yunze_card_deltype', NULL, NULL, 'N', '0', 'admin', '2021-06-07 12:26:06', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (110, 0, '已删除', '1', 'yunze_card_deltype', NULL, NULL, 'N', '0', 'admin', '2021-06-07 12:26:12', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (111, 1, '移动', '1', 'yunze_card_operators_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:15:06', 'admin', '2021-06-07 16:15:24', NULL); +INSERT INTO `sys_dict_data` VALUES (112, 2, '联通', '2', 'yunze_card_operators_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:15:15', 'admin', '2021-06-07 16:15:27', NULL); +INSERT INTO `sys_dict_data` VALUES (113, 3, '电信', '3', 'yunze_card_operators_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:15:42', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (114, 4, '全网通', '4', 'yunze_card_operators_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:16:00', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (115, 3, '单项停机', '3', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:29:20', 'admin', '2021-06-09 10:16:03', NULL); +INSERT INTO `sys_dict_data` VALUES (116, 1, '正常', '1', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:29:32', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (117, 2, '停机', '2', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:29:46', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (118, 4, '预销号', '4', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:30:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (119, 5, '过户', '5', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:30:15', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (120, 6, '休眠', '6', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:30:31', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (121, 7, '待激活', '7', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:30:41', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (122, 8, '未知', '8', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:31:02', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (123, 9, '测试期正常', '9', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:31:21', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (124, 10, '测试期停机', '10', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:31:30', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (125, 11, '停机保号', '11', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:31:42', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (126, 12, '机卡分离停机', '12', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:31:59', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (127, 13, '空套餐', '13', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-06-07 16:32:11', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (128, 1, '当月生效', '1', 'yunze_card_takeEffect_type', NULL, NULL, 'N', '0', 'admin', '2021-06-09 08:55:50', 'admin', '2021-06-22 11:14:16', NULL); +INSERT INTO `sys_dict_data` VALUES (129, 2, '次月生效', '2', 'yunze_card_takeEffect_type', NULL, NULL, 'N', '0', 'admin', '2021-06-09 08:56:18', 'admin', '2021-06-22 11:14:20', NULL); +INSERT INTO `sys_dict_data` VALUES (130, 3, '周期延顺', '3', 'yunze_card_takeEffect_type', NULL, NULL, 'N', '0', 'admin', '2021-06-09 08:58:17', 'admin', '2021-06-22 11:14:23', NULL); +INSERT INTO `sys_dict_data` VALUES (131, 0, '已失效', '0', 'yunze_card_valid_type', NULL, NULL, 'N', '0', 'admin', '2021-06-09 09:01:14', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (132, 0, '生效中', '1', 'yunze_card_valid_type', NULL, NULL, 'N', '0', 'admin', '2021-06-09 09:01:23', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (133, 1, '微信支付', 'wx', 'yunze_card_pay_type', NULL, NULL, 'N', '0', 'admin', '2021-06-09 09:02:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (134, 2, '余额支付', 'be', 'yunze_card_pay_type', NULL, NULL, 'N', '0', 'admin', '2021-06-09 09:03:39', 'admin', '2021-06-09 09:03:45', NULL); +INSERT INTO `sys_dict_data` VALUES (135, 4, '人工操作', 'al', 'yunze_card_pay_type', NULL, NULL, 'N', '0', 'admin', '2021-06-09 09:04:28', 'admin', '2021-08-06 10:55:23', NULL); +INSERT INTO `sys_dict_data` VALUES (136, 0, '否', '0', 'yunze_customize_whether', NULL, NULL, 'N', '0', 'admin', '2021-06-09 09:07:20', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (137, 1, '是', '1', 'yunze_customize_whether', NULL, NULL, 'N', '0', 'admin', '2021-06-09 09:07:26', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (138, 1, '普通贴片MS0 5mm*6mm', '1', 'yunze_card_card_type', NULL, NULL, 'N', '0', 'admin', '2021-06-10 08:52:08', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (139, 2, '普通SIM卡MS0 5mm*6mm', '2', 'yunze_card_card_type', NULL, NULL, 'N', '0', 'admin', '2021-06-10 08:52:40', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (140, 1, 'NB', '1', 'yunze_card_network_type', NULL, NULL, 'N', '0', 'admin', '2021-06-10 08:53:41', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (141, 2, '4G SIM', '2', 'yunze_card_network_type', NULL, NULL, 'N', '0', 'admin', '2021-06-10 08:53:52', 'admin', '2021-06-10 08:54:09', NULL); +INSERT INTO `sys_dict_data` VALUES (142, 3, '5G SIM', '3', 'yunze_card_network_type', NULL, NULL, 'N', '0', 'admin', '2021-06-10 08:54:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (143, 1, '离线', '00', 'yunze_card_online_status', NULL, NULL, 'N', '0', 'admin', '2021-06-10 14:01:14', 'admin', '2021-06-10 14:01:22', 'EC'); +INSERT INTO `sys_dict_data` VALUES (144, 2, '在线', '01', 'yunze_card_online_status', NULL, NULL, 'N', '0', 'admin', '2021-06-10 14:01:36', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (145, 1, '3G', '1', 'yunze_card_access_type', NULL, NULL, 'N', '0', 'admin', '2021-06-10 14:02:48', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (146, 2, '2G', '2', 'yunze_card_access_type', NULL, NULL, 'N', '0', 'admin', '2021-06-10 14:02:55', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (147, 6, '4G', '6', 'yunze_card_access_type', NULL, NULL, 'N', '0', 'admin', '2021-06-10 14:03:10', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (148, 8, 'NB', '8', 'yunze_card_access_type', NULL, NULL, 'N', '0', 'admin', '2021-06-10 14:03:23', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (149, 1, '虚拟编号', '1', 'yunze_card_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-06-11 15:17:27', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (150, 2, 'MSISDN', '2', 'yunze_card_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-06-11 15:17:45', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (151, 3, 'ICCID', '3', 'yunze_card_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-06-11 15:17:55', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (152, 4, 'IMSI', '4', 'yunze_card_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-06-11 15:18:06', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (153, 1, '通道名称', '2', 'yunze_channel_selType', NULL, NULL, 'N', '0', 'admin', '2021-06-19 12:22:37', 'admin', '2021-06-21 08:40:22', NULL); +INSERT INTO `sys_dict_data` VALUES (154, 1, '升序', '1', 'ORDER_BY_rule', NULL, NULL, 'N', '0', 'admin', '2021-06-19 13:32:30', '', NULL, 'ASC'); +INSERT INTO `sys_dict_data` VALUES (155, 2, '倒叙', '2', 'ORDER_BY_rule', NULL, NULL, 'N', '0', 'admin', '2021-06-19 13:32:41', '', NULL, 'DESC'); +INSERT INTO `sys_dict_data` VALUES (156, 1, '创建时间', '1', 'channel_ORDER_BY_type', NULL, NULL, 'N', '0', 'admin', '2021-06-19 13:34:42', '', NULL, 'createTime'); +INSERT INTO `sys_dict_data` VALUES (157, 2, '通道编号', '2', 'channel_ORDER_BY_type', NULL, NULL, 'N', '0', 'admin', '2021-06-19 13:34:58', '', NULL, 'cd_code'); +INSERT INTO `sys_dict_data` VALUES (158, 1, '启用', '1', 'channel_status', NULL, NULL, 'N', '0', 'admin', '2021-06-19 13:41:52', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (159, 2, '停用', '2', 'channel_status', NULL, NULL, 'N', '0', 'admin', '2021-06-19 13:42:02', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (160, 3, '已删除', '3', 'channel_status', NULL, NULL, 'N', '0', 'admin', '2021-06-19 13:42:11', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (161, 1, '中国移动', 'YiDong_EC', 'channel_code', NULL, NULL, 'N', '0', 'admin', '2021-06-19 14:46:59', '', NULL, '移动EC新平台'); +INSERT INTO `sys_dict_data` VALUES (162, 2, '中国电信', 'DianXin_CMP', 'channel_code', NULL, NULL, 'N', '0', 'admin', '2021-06-19 14:47:40', 'admin', '2021-06-19 14:48:41', '电信CMP'); +INSERT INTO `sys_dict_data` VALUES (164, 3, '全球电信', 'DianXin_DCP', 'channel_code', NULL, NULL, 'N', '0', 'admin', '2021-06-19 14:49:19', '', NULL, 'DianXin_DCP'); +INSERT INTO `sys_dict_data` VALUES (165, 0, '通道别名', '3', 'yunze_channel_selType', NULL, NULL, 'N', '0', 'admin', '2021-06-21 08:40:15', 'admin', '2021-06-21 08:40:27', NULL); +INSERT INTO `sys_dict_data` VALUES (166, 1, '任务名', '1', 'executionTask_selType', NULL, NULL, 'N', '0', 'admin', '2021-06-21 11:30:21', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (167, 2, '创建人', '2', 'executionTask_selType', NULL, NULL, 'N', '0', 'admin', '2021-06-21 11:30:37', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (168, 3, '下载地址', '3', 'executionTask_selType', NULL, NULL, 'N', '0', 'admin', '2021-06-21 11:31:08', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (169, 1, '创建时间', '1', 'executionTask_ORDER_BY_type', NULL, NULL, 'N', '0', 'admin', '2021-06-21 11:40:22', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (170, 2, '任务名', '2', 'executionTask_ORDER_BY_type', NULL, NULL, 'N', '0', 'admin', '2021-06-21 11:40:35', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (171, 3, '修改时间', '3', 'executionTask_ORDER_BY_type', NULL, NULL, 'N', '0', 'admin', '2021-06-21 11:41:44', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (172, 1, '连接管理导入', '_CardImport', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-06-21 14:17:45', 'admin', '2021-07-28 12:19:58', NULL); +INSERT INTO `sys_dict_data` VALUES (173, 2, '连接管理导出', '_CardOut', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-06-21 14:17:54', 'admin', '2021-07-28 12:20:05', NULL); +INSERT INTO `sys_dict_data` VALUES (174, 3, '上游通道导出', '_ChannelOut', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-06-21 14:18:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (175, 1, '月', '1', 'yunze_packet_valid_name', NULL, NULL, 'N', '0', 'admin', '2021-06-22 16:20:27', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (176, 2, '年', '2', 'yunze_packet_valid_name', NULL, NULL, 'N', '0', 'admin', '2021-06-22 16:20:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (177, 1, '资费组名称', '1', 'yunze_tariffGroup_selType', NULL, NULL, 'N', '0', 'admin', '2021-06-22 17:15:27', 'admin', '2021-06-22 17:35:27', NULL); +INSERT INTO `sys_dict_data` VALUES (178, 2, '平台资费组名称', '2', 'yunze_tariffGroup_selType', NULL, NULL, 'N', '0', 'admin', '2021-06-22 17:15:41', 'admin', '2021-06-22 17:40:30', NULL); +INSERT INTO `sys_dict_data` VALUES (179, 1, '资费计划名称', '1', 'yunze_tariffPlan_selType', NULL, NULL, 'N', '0', 'admin', '2021-06-22 17:18:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (180, 2, '平台计划名称', '2', 'yunze_tariffPlan_selType', NULL, NULL, 'N', '0', 'admin', '2021-06-22 17:18:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (181, 1, '金额充值', '1', 'yunze_order_type', NULL, NULL, 'N', '0', 'admin', '2021-07-03 10:50:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (182, 2, '用量充值', '2', 'yunze_order_type', NULL, NULL, 'N', '0', 'admin', '2021-07-03 10:51:03', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (183, 0, '未支付', '0', 'yunze_order_status', NULL, NULL, 'N', '0', 'admin', '2021-07-03 10:52:22', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (184, 1, '支付成功', '1', 'yunze_order_status', NULL, NULL, 'N', '0', 'admin', '2021-07-03 10:52:48', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (185, 4, '激活生效', '4', 'yunze_card_takeEffect_type', NULL, NULL, 'N', '0', 'admin', '2021-07-03 11:35:12', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (186, 2, '未生效', '2', 'yunze_card_valid_type', NULL, NULL, 'N', '0', 'admin', '2021-07-03 11:36:23', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (188, 14, '运营商管理状态', '14', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-07-06 15:44:42', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (189, 3, '轮询任务', 'POLLING', 'sys_job_group', NULL, NULL, 'N', '0', 'admin', '2021-07-07 15:23:51', 'admin', '2021-11-12 09:32:39', NULL); +INSERT INTO `sys_dict_data` VALUES (190, 1, '激活状态', '1', 'yunze_polling_type', NULL, NULL, 'N', '0', 'admin', '2021-07-08 14:20:36', 'admin', '2021-07-08 14:21:20', 'polling.cardActivateDate.exchange\npolling.cardActivateDate.queue'); +INSERT INTO `sys_dict_data` VALUES (191, 2, '卡装态', '2', 'yunze_polling_type', NULL, NULL, 'N', '0', 'admin', '2021-07-08 14:25:02', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (192, 3, '用量轮序', '3', 'yunze_polling_type', NULL, NULL, 'N', '0', 'admin', '2021-07-08 14:26:05', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (193, 3, '工业贴片MS1 5mm*6mm', '3', 'yunze_card_card_type', NULL, NULL, 'N', '0', 'admin', '2021-07-09 09:12:57', 'admin', '2021-08-05 08:26:02', 'NB贴片'); +INSERT INTO `sys_dict_data` VALUES (194, 15, '测试去激活', '15', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-07-16 09:06:00', 'admin', '2021-07-16 09:06:16', '电信CMP'); +INSERT INTO `sys_dict_data` VALUES (195, 16, '拆机', '16', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-07-16 09:08:06', '', NULL, '电信CMP'); +INSERT INTO `sys_dict_data` VALUES (196, 17, '可测试', '17', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-07-16 14:16:08', 'admin', '2021-07-16 14:16:14', NULL); +INSERT INTO `sys_dict_data` VALUES (199, 18, '销号', '18', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-07-21 15:41:43', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (200, 19, '库存', '19', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-07-21 15:43:36', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (202, 4, '达量停机', '4', 'yunze_polling_type', NULL, NULL, 'N', '0', 'admin', '2021-07-23 17:35:17', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (203, 1, '连接管理导出', '1', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-07-28 08:36:33', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (204, 2, '连接管理划卡', '2', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-07-28 08:36:55', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (205, 3, '连接管理导入', '3', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-07-28 08:44:46', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (206, 4, '上游通道导出', '4', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-07-28 08:45:56', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (207, 4, '连接管理划卡', '_CardDistribute', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-07-28 12:20:35', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (208, 5, '连接管理划卡备份', '_CardDistributeBackup', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-07-28 13:04:27', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (210, 20, '违章停机', '20', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-07-31 14:37:07', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (211, 21, '断网', '21', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-07-31 15:16:09', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (212, 22, '开始', '22', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-08-02 09:17:24', '', NULL, '联通CMP'); +INSERT INTO `sys_dict_data` VALUES (213, 23, '已失效', '23', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-08-02 09:21:25', '', NULL, '联通CMP'); +INSERT INTO `sys_dict_data` VALUES (214, 24, '已清除', '24', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-08-02 09:21:45', 'admin', '2021-08-02 09:22:09', '联通CMP'); +INSERT INTO `sys_dict_data` VALUES (215, 25, '已更换', '25', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-08-02 09:21:53', 'admin', '2021-08-02 09:22:06', '联通CMP'); +INSERT INTO `sys_dict_data` VALUES (216, 4, '工业插拔', '4', 'yunze_card_card_type', NULL, NULL, 'N', '0', 'admin', '2021-08-05 08:25:50', 'admin', '2021-08-05 08:26:35', 'NB插拔'); +INSERT INTO `sys_dict_data` VALUES (218, 2, '订单号', '2', 'yunze_order_seltype', NULL, NULL, 'N', '0', 'admin', '2021-08-06 10:48:36', 'admin', '2021-08-09 09:46:32', NULL); +INSERT INTO `sys_dict_data` VALUES (219, 3, '交易名称', '3', 'yunze_order_seltype', NULL, NULL, 'N', '0', 'admin', '2021-08-06 10:48:51', 'admin', '2021-08-09 09:46:47', NULL); +INSERT INTO `sys_dict_data` VALUES (220, 4, '微信订单号', '4', 'yunze_order_seltype', NULL, NULL, 'N', '0', 'admin', '2021-08-06 10:49:08', 'admin', '2021-08-09 09:46:52', NULL); +INSERT INTO `sys_dict_data` VALUES (221, 1, 'ICCID', '1', 'yunze_order_seltype', NULL, NULL, 'N', '0', 'admin', '2021-08-06 10:49:22', 'admin', '2021-08-09 09:46:37', NULL); +INSERT INTO `sys_dict_data` VALUES (222, 0, '平台记录', 's', 'yunze_card_pay_type', NULL, NULL, 'N', '0', 'admin', '2021-08-06 10:55:00', 'admin', '2021-08-06 10:55:16', NULL); +INSERT INTO `sys_dict_data` VALUES (223, 1, '系统', 'sys', 'yunze_order_creType', NULL, NULL, 'N', '0', 'admin', '2021-08-06 10:58:15', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (224, 2, '人工', 'ai', 'yunze_order_creType', NULL, NULL, 'N', '0', 'admin', '2021-08-06 10:58:57', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (225, 1, '否', '0', 'yunze_order_profitType', NULL, NULL, 'N', '0', 'admin', '2021-08-06 11:02:31', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (226, 3, '比例', '1', 'yunze_order_profitType', NULL, NULL, 'N', '0', 'admin', '2021-08-06 11:03:11', 'admin', '2021-08-06 11:03:51', NULL); +INSERT INTO `sys_dict_data` VALUES (227, 2, '差价', '2', 'yunze_order_profitType', NULL, NULL, 'N', '0', 'admin', '2021-08-06 11:03:22', 'admin', '2021-08-06 11:03:41', NULL); +INSERT INTO `sys_dict_data` VALUES (228, 5, '备注', '5', 'yunze_order_seltype', NULL, NULL, 'N', '0', 'admin', '2021-08-06 11:07:10', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (229, 1, '创建时间', '1', 'yunze_order_sel_timetype', NULL, NULL, 'N', '0', 'admin', '2021-08-06 11:44:20', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (230, 2, '加包时间', '2', 'yunze_order_sel_timetype', NULL, NULL, 'N', '0', 'admin', '2021-08-06 11:44:28', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (231, 1, 'ICCID', '1', 'yunze_order_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-08-06 17:41:59', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (233, 5, '平台批量充值', '5', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-08-12 16:13:18', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (234, 6, '平台资费订购', '_importRecharge', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-08-13 13:48:14', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (235, 6, '连接管理设置', '6', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-08-18 11:57:54', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (236, 7, '连接设置详情', '_CardImportSet', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-08-18 11:59:56', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (237, 8, '连接管理设置备份', '_CardImportSetBackup', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-08-18 12:00:14', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (238, 4, '备份任务', 'BACKUP', 'sys_job_group', NULL, NULL, 'N', '0', 'admin', '2021-08-18 17:25:27', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (239, 9, 'imei查询', '_CardImportSelImei', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-08-20 16:36:39', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (240, 7, '特殊操作 查询imie', '7', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-08-20 16:37:44', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (241, 0, '基础资费', '0', 'yunze_packet_type', NULL, NULL, 'N', '0', 'admin', '2021-09-01 16:05:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (242, 1, '叠加资费', '1', 'yunze_packet_type', NULL, NULL, 'N', '0', 'admin', '2021-09-01 16:05:30', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (243, 0, '仅一次', '0', 'yunze_base_packet_type', NULL, NULL, 'N', '0', 'admin', '2021-09-03 15:31:06', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (244, 1, '可叠加', '1', 'yunze_base_packet_type', NULL, NULL, 'N', '0', 'admin', '2021-09-03 15:31:18', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (245, 3, '请求参数', '4', 'system_yz_sys_logs_sysLog', NULL, NULL, 'N', '0', 'admin', '2021-08-24 10:49:25', '', NULL, '请求参数'); +INSERT INTO `sys_dict_data` VALUES (246, 4, '响应参数', '5', 'system_yz_sys_logs_sysLog', NULL, NULL, 'N', '0', 'admin', '2021-08-24 10:49:52', '', NULL, '响应参数'); +INSERT INTO `sys_dict_data` VALUES (247, 5, '操作名称', '6', 'system_yz_sys_logs_sysLog', NULL, NULL, 'N', '0', 'admin', '2021-08-24 10:50:20', '', NULL, '操作名称'); +INSERT INTO `sys_dict_data` VALUES (248, 1, 'iotapi', 'iotapi', 'yz_sys_logs_project', NULL, NULL, 'N', '0', 'admin', '2021-08-24 10:51:45', 'admin', '2021-08-24 12:02:16', NULL); +INSERT INTO `sys_dict_data` VALUES (249, 0, '对应串号', '1', 'dosage_details_flow_his', NULL, NULL, 'N', '0', 'admin', '2021-08-26 09:14:59', '', NULL, '对应串号'); +INSERT INTO `sys_dict_data` VALUES (250, 0, '创建时间', '1', 'yunze_yz_card_flow_his', NULL, NULL, 'N', '0', 'admin', '2021-08-26 09:44:16', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (251, 1, '修改时间', '2', 'yunze_yz_card_flow_his', NULL, NULL, 'N', '0', 'admin', '2021-08-26 09:44:54', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (252, 1, '创建时间', '0', 'yunze_yz_passageway', NULL, NULL, 'N', '0', 'admin', '2021-08-31 11:39:48', '', NULL, '通道进度创建时间'); +INSERT INTO `sys_dict_data` VALUES (253, 2, '修改时间', '1', 'yunze_yz_passageway', NULL, NULL, 'N', '0', 'admin', '2021-08-31 11:40:25', '', NULL, '通道进度修改时间'); +INSERT INTO `sys_dict_data` VALUES (254, 1, '轮序批次编码', '0', 'yz_passageway_polling', NULL, NULL, 'N', '0', 'admin', '2021-08-31 14:05:46', 'admin', '2021-09-01 10:11:19', NULL); +INSERT INTO `sys_dict_data` VALUES (255, 3, '同步时间', '2', 'yunze_yz_passageway', NULL, NULL, 'N', '0', 'admin', '2021-08-31 14:13:21', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (257, 1, 'iccid', '0', 'yunze_sorting_rules', NULL, NULL, 'N', '0', 'admin', '2021-09-06 13:34:33', '', NULL, '排序规则iccid'); +INSERT INTO `sys_dict_data` VALUES (258, 1, '创建时间', '0', 'yunze_card_flow', NULL, NULL, 'N', '0', 'admin', '2021-09-06 13:54:40', '', NULL, '创建时间'); +INSERT INTO `sys_dict_data` VALUES (259, 2, '生效时间', '1', 'yunze_card_flow', NULL, NULL, 'N', '0', 'admin', '2021-09-06 13:55:05', '', NULL, '生效时间'); +INSERT INTO `sys_dict_data` VALUES (260, 3, '到期时间', '2', 'yunze_card_flow', NULL, NULL, 'N', '0', 'admin', '2021-09-06 13:55:23', '', NULL, '到期时间'); +INSERT INTO `sys_dict_data` VALUES (261, 4, '更新累计包时间', '3', 'yunze_card_flow', NULL, NULL, 'N', '0', 'admin', '2021-09-06 13:55:48', '', NULL, '更新累计包时间'); +INSERT INTO `sys_dict_data` VALUES (262, 1, '升序', '0', 'Lifting_sequence', NULL, NULL, 'N', '0', 'admin', '2021-09-06 14:01:04', '', NULL, '升序'); +INSERT INTO `sys_dict_data` VALUES (263, 2, '降序', '1', 'Lifting_sequence', NULL, NULL, 'N', '0', 'admin', '2021-09-06 14:01:19', '', NULL, '降序'); +INSERT INTO `sys_dict_data` VALUES (264, 1, '订单号', '0', 'yz_card_flow', NULL, NULL, 'N', '0', 'admin', '2021-09-06 14:23:41', '', NULL, '订购资费订单号'); +INSERT INTO `sys_dict_data` VALUES (265, 2, '对应串号', '1', 'yz_card_flow', NULL, NULL, 'N', '0', 'admin', '2021-09-06 14:25:29', '', NULL, '订购资费对应串号'); +INSERT INTO `sys_dict_data` VALUES (266, 1, '创建时间', '0', 'yunze_syslogs_sel_timetype', NULL, NULL, 'N', '0', 'admin', '2021-08-24 08:55:05', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (267, 0, '请求url', '1', 'system_yz_sys_logs_sysLog', NULL, NULL, 'N', '0', 'admin', '2021-08-24 10:46:33', '', NULL, '请求url'); +INSERT INTO `sys_dict_data` VALUES (268, 1, '执行的类方法', '2', 'system_yz_sys_logs_sysLog', NULL, NULL, 'N', '0', 'admin', '2021-08-24 10:47:19', 'admin', '2021-08-24 10:47:54', NULL); +INSERT INTO `sys_dict_data` VALUES (269, 2, 'ip', '3', 'system_yz_sys_logs_sysLog', NULL, NULL, 'N', '0', 'admin', '2021-08-24 10:48:30', 'admin', '2021-08-24 10:48:45', NULL); +INSERT INTO `sys_dict_data` VALUES (270, 1, '生命周期', '1', 'yz_cardChange_type', NULL, NULL, 'N', '0', 'admin', '2021-09-14 09:39:11', 'admin', '2021-09-14 09:39:25', NULL); +INSERT INTO `sys_dict_data` VALUES (271, 2, '断开网状态', '2', 'yz_cardChange_type', NULL, NULL, 'N', '0', 'admin', '2021-09-14 09:39:51', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (272, 1, '达量停机', '1', 'yz_cardChange_sourceType', NULL, NULL, 'N', '0', 'admin', '2021-09-14 09:41:33', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (273, 2, '未订购轮询停机', '2', 'yz_cardChange_sourceType', NULL, NULL, 'N', '0', 'admin', '2021-09-14 09:41:48', 'admin', '2021-09-14 14:53:39', NULL); +INSERT INTO `sys_dict_data` VALUES (274, 3, '手动变更', '3', 'yz_cardChange_sourceType', NULL, NULL, 'N', '0', 'admin', '2021-09-14 09:42:02', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (275, 4, 'C端充值', '4', 'yz_cardChange_sourceType', NULL, NULL, 'N', '0', 'admin', '2021-09-14 09:42:32', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (276, 5, '批量操作', '5', 'yz_cardChange_sourceType', NULL, NULL, 'N', '0', 'admin', '2021-09-14 09:42:54', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (277, 5, '未订购资费断网', '5', 'yunze_polling_type', NULL, NULL, 'N', '0', 'admin', '2021-09-14 10:16:15', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (278, 1, '正常', '1', 'yz_cardConnection_type', NULL, NULL, 'N', '0', 'admin', '2021-09-14 11:41:44', 'admin', '2021-09-14 11:42:04', NULL); +INSERT INTO `sys_dict_data` VALUES (279, 2, '断网', '2', 'yz_cardConnection_type', NULL, NULL, 'N', '0', 'admin', '2021-09-14 11:41:58', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (280, 1, '成功', '1', 'yz_cardChange_ExecutionStatus', NULL, NULL, 'N', '0', 'admin', '2021-09-15 08:38:37', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (281, 2, '失败', '2', 'yz_cardChange_ExecutionStatus', NULL, NULL, 'N', '0', 'admin', '2021-09-15 08:38:43', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (282, 1, '虚拟编号', '0', 'cardNumber', NULL, NULL, 'N', '0', 'admin', '2021-09-09 17:15:00', '', NULL, '卡号类别虚拟编号'); +INSERT INTO `sys_dict_data` VALUES (283, 2, 'MSISDN', '1', 'cardNumber', NULL, NULL, 'N', '0', 'admin', '2021-09-09 17:15:18', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (284, 3, 'ICCID', '2', 'cardNumber', NULL, NULL, 'N', '0', 'admin', '2021-09-09 17:15:35', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (285, 4, 'IMSI', '3', 'cardNumber', NULL, NULL, 'N', '0', 'admin', '2021-09-09 17:15:49', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (287, 26, '用户注销', '26', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-09-18 15:51:11', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (288, 27, '停断网', '27', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-09-18 15:52:19', 'admin', '2021-10-11 15:58:07', '欠停'); +INSERT INTO `sys_dict_data` VALUES (289, 28, '挂失', '28', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-09-18 15:53:15', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (290, 29, '故障卡', '29', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-09-18 15:54:10', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (291, 30, '未实名停机', '30', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-09-18 15:54:59', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (292, 31, '超量停机', '31', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-09-18 15:58:42', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (293, 32, '停机保号', '32', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-09-18 15:59:26', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (294, 33, '已锁定', '33', 'yunze_card_status_type', NULL, NULL, 'N', '0', 'admin', '2021-09-18 16:00:02', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (295, 3, '商品购买', '3', 'yunze_order_type', NULL, NULL, 'N', '0', 'admin', '2021-09-23 12:46:25', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (296, 99, '购买下单邮件推送', '99', 'yz_cc_trigger_type', NULL, NULL, 'N', '0', 'admin', '2021-09-24 14:53:03', 'admin', '2021-09-24 15:15:31', NULL); +INSERT INTO `sys_dict_data` VALUES (297, 1, '卡状态变更', '1', 'yz_cc_trigger_type', NULL, NULL, 'N', '0', 'admin', '2021-09-24 14:53:14', 'admin', '2021-09-24 15:16:06', NULL); +INSERT INTO `sys_dict_data` VALUES (298, 2, '单卡有效期', '2', 'yz_cc_trigger_type', NULL, NULL, 'N', '0', 'admin', '2021-09-24 15:16:23', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (299, 3, '单卡用量', '3', 'yz_cc_trigger_type', NULL, NULL, 'N', '0', 'admin', '2021-09-24 15:16:36', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (300, 1, '邮件推送', '1', 'yz_cc_execution_type', NULL, NULL, 'N', '0', 'admin', '2021-09-24 15:21:10', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (301, 2, 'API推送', '2', 'yz_cc_execution_type', NULL, NULL, 'N', '0', 'admin', '2021-09-24 15:31:31', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (302, 1, '正常', '1', 'yz_cc_status', NULL, NULL, 'N', '0', 'admin', '2021-09-24 15:32:13', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (303, 2, '已停用', '2', 'yz_cc_status', NULL, NULL, 'N', '0', 'admin', '2021-09-24 15:32:25', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (304, 3, '已删除', '3', 'yz_cc_status', NULL, NULL, 'N', '0', 'admin', '2021-09-24 15:32:49', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (305, 1, '默认', '1', 'yz_cc_template', NULL, NULL, 'N', '0', 'admin', '2021-09-24 15:34:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (313, 0, '待处理', '0', 'yz_cc_HisStatus', NULL, NULL, 'N', '0', 'admin', '2021-09-26 17:03:54', 'admin', '2021-09-26 17:04:01', NULL); +INSERT INTO `sys_dict_data` VALUES (314, 1, '已处理', '1', 'yz_cc_HisStatus', NULL, NULL, 'N', '0', 'admin', '2021-09-26 17:04:53', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (315, 0, '失败', '0', 'yz_cc_result', NULL, NULL, 'N', '0', 'admin', '2021-09-26 17:06:24', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (316, 1, '成功', '1', 'yz_cc_result', NULL, NULL, 'N', '0', 'admin', '2021-09-26 17:06:32', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (317, 0, '已废弃', '0', 'yz_enabled_state', NULL, NULL, 'N', '0', 'admin', '2021-09-27 14:52:05', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (318, 1, '正常', '1', 'yz_enabled_state', NULL, NULL, 'N', '0', 'admin', '2021-09-27 14:52:15', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (319, 0, '下架', '0', 'yz_commodity_sell', NULL, NULL, 'N', '0', 'admin', '2021-09-27 18:04:30', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (320, 1, '售卖中', '1', 'yz_commodity_sell', NULL, NULL, 'N', '0', 'admin', '2021-09-27 18:04:47', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (321, 0, '未审核', '0', 'yz_check_state', NULL, NULL, 'N', '0', 'admin', '2021-09-27 18:06:44', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (322, 1, '已审核', '1', 'yz_check_state', NULL, NULL, 'N', '0', 'admin', '2021-09-27 18:06:55', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (323, 1, '不操作', '1', 'Stop_and_resume', NULL, NULL, 'N', '0', 'admin', '2021-09-28 09:32:13', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (324, 2, '停机', '2', 'Stop_and_resume', NULL, NULL, 'N', '0', 'admin', '2021-09-28 09:32:30', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (325, 3, '复机', '3', 'Stop_and_resume', NULL, NULL, 'N', '0', 'admin', '2021-09-28 09:32:48', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (326, 1, '不操作', '1', 'Disconnect_the_network', NULL, NULL, 'N', '0', 'admin', '2021-09-28 09:40:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (327, 2, '断网', '2', 'Disconnect_the_network', NULL, NULL, 'N', '0', 'admin', '2021-09-28 09:40:22', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (328, 3, '开网', '3', 'Disconnect_the_network', NULL, NULL, 'N', '0', 'admin', '2021-09-28 09:40:32', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (329, 1, 'ICCID', '1', 'yz_card_info_change', NULL, NULL, 'N', '0', 'admin', '2021-09-29 19:54:17', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (330, 1, '正常', '1', 'yz_customer_state', NULL, NULL, 'N', '0', 'admin', '2021-10-11 15:55:03', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (331, 2, '已停用', '2', 'yz_customer_state', NULL, NULL, 'N', '0', 'admin', '2021-10-11 15:56:15', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (332, 1, '自有2021年前含老客户', '1', 'yz_customer_source', NULL, NULL, 'N', '0', 'admin', '2021-10-11 16:05:53', 'admin', '2021-10-11 16:06:20', NULL); +INSERT INTO `sys_dict_data` VALUES (333, 2, '自有2022年起新客户', '2', 'yz_customer_source', NULL, NULL, 'N', '0', 'admin', '2021-10-11 16:06:15', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (334, 99, '其他', '99', 'yz_customer_source', NULL, NULL, 'N', '0', 'admin', '2021-10-11 16:06:36', 'admin', '2021-10-11 16:06:47', NULL); +INSERT INTO `sys_dict_data` VALUES (335, 1, 'A', '1', 'yz_customer_grade', NULL, NULL, 'N', '0', 'admin', '2021-10-12 10:47:07', '', NULL, 'VIP'); +INSERT INTO `sys_dict_data` VALUES (336, 2, 'B', '2', 'yz_customer_grade', NULL, NULL, 'N', '0', 'admin', '2021-10-12 10:47:16', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (337, 3, 'C', '3', 'yz_customer_grade', NULL, NULL, 'N', '0', 'admin', '2021-10-12 10:47:23', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (338, 4, 'D', '4', 'yz_customer_grade', NULL, NULL, 'N', '0', 'admin', '2021-10-12 10:47:29', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (339, 99, '其他', '99', 'yz_customer_grade', NULL, NULL, 'N', '0', 'admin', '2021-10-12 10:47:43', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (340, 10, '卡分组备注更新', '_CardSetCardInfo', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-10-14 08:53:09', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (341, 14, '卡分组备注更新备份', '_CardSetCardInfoBackup', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-10-14 08:53:20', 'admin', '2021-12-24 15:47:40', NULL); +INSERT INTO `sys_dict_data` VALUES (342, 8, '特殊操作 变更卡分组、备注', '8', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-10-14 08:53:56', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (347, 1, '终端', '1', 'yz_customer_grade_one', NULL, NULL, 'N', '0', 'admin', '2021-10-29 16:09:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (348, 1, '直客', '1', 'yz_customer_grade_tow', NULL, NULL, 'N', '0', 'admin', '2021-10-30 14:17:21', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (349, 2, '生产厂家', '2', 'yz_customer_grade_tow', NULL, NULL, 'N', '0', 'admin', '2021-10-30 14:17:42', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (350, 11, '分销商', '11', 'yz_customer_grade_tow', NULL, NULL, 'N', '0', 'admin', '2021-10-30 14:17:54', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (351, 12, '贸易商', '12', 'yz_customer_grade_tow', NULL, NULL, 'N', '0', 'admin', '2021-10-30 14:18:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (352, 2, '代理', '2', 'yz_customer_grade_one', NULL, NULL, 'N', '0', 'admin', '2021-10-30 14:18:29', 'admin', '2021-10-30 14:18:35', NULL); +INSERT INTO `sys_dict_data` VALUES (353, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:25:31', '', NULL, '创建时间'); +INSERT INTO `sys_dict_data` VALUES (354, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:28:42', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (355, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:30:09', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (356, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:30:35', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (357, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:38:08', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (358, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:39:21', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (359, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:39:24', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (360, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:39:24', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (361, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:39:32', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (362, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:40:26', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (363, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:41:18', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (364, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:42:14', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (365, 1, '学生', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 14:44:35', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (366, 1, '123', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 15:00:36', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (367, 1, '创建时间', '1', 'Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-25 15:40:21', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (368, 1, '无', '1', 'yz_cc_condition', NULL, NULL, 'N', '0', 'admin', '2021-10-25 15:59:29', 'admin', '2021-10-25 15:59:34', NULL); +INSERT INTO `sys_dict_data` VALUES (369, 1, '判断条件', '1', 'cc_query_criteria', NULL, NULL, 'N', '0', 'admin', '2021-10-26 10:01:08', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (370, 1, '最后修改时间', '1', 'prdCategory_timet', NULL, NULL, 'N', '0', 'admin', '2021-10-29 15:33:27', 'admin', '2021-10-29 15:33:48', NULL); +INSERT INTO `sys_dict_data` VALUES (371, 1, '创建时间', '1', 'yunze_task_sel_timetype', NULL, NULL, 'N', '0', 'admin', '2021-10-29 16:11:55', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (372, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-19 14:30:24', '', NULL, '自动化 创建时间 类型'); +INSERT INTO `sys_dict_data` VALUES (373, 1, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-19 14:31:46', '', NULL, '自动化创建类型'); +INSERT INTO `sys_dict_data` VALUES (374, 1, '创建时间', '0', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-19 14:32:41', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (375, 0, '创建时间', '1', ' Automation_time', NULL, NULL, 'N', '0', 'admin', '2021-10-19 14:34:03', '', NULL, '创建时间'); +INSERT INTO `sys_dict_data` VALUES (376, 1, '创建时间', '1', ' Automated_configuration', NULL, NULL, 'N', '0', 'admin', '2021-10-19 16:33:20', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (377, 0, '创建时间', '1', ' Automated_configuration', NULL, NULL, 'N', '0', 'admin', '2021-10-19 16:35:23', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (378, 1, '创建时间', '1', ' Automated_configuration', NULL, NULL, 'N', '0', 'admin', '2021-10-25 09:52:42', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (379, 1, '创建时间', '0', ' Automated_configuration', NULL, NULL, 'N', '0', 'admin', '2021-10-25 09:55:51', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (380, 1, '创建时间', '1', ' Automated_configuration', NULL, NULL, 'N', '0', 'admin', '2021-10-25 13:38:57', '', NULL, '创建时间'); +INSERT INTO `sys_dict_data` VALUES (381, 1, '客户名称', '1', 'yz_customer_selType', NULL, NULL, 'N', '0', 'admin', '2021-11-02 16:26:22', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (382, 2, '税号', '2', 'yz_customer_selType', NULL, NULL, 'N', '0', 'admin', '2021-11-02 16:26:37', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (383, 3, '地址详情', '3', 'yz_customer_selType', NULL, NULL, 'N', '0', 'admin', '2021-11-02 16:27:05', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (384, 0, '创建时间', '0', 'yz_customer_selTimeType', NULL, NULL, 'N', '0', 'admin', '2021-11-02 16:28:55', 'admin', '2021-11-04 16:29:49', NULL); +INSERT INTO `sys_dict_data` VALUES (385, 1, '最后修改时间', '1', 'yz_customer_selTimeType', NULL, NULL, 'N', '0', 'admin', '2021-11-02 16:29:26', 'admin', '2021-11-04 16:29:53', NULL); +INSERT INTO `sys_dict_data` VALUES (386, 1, '是否回收', '1', 'yz_CustomerChange_type', NULL, NULL, 'N', '0', 'admin', '2021-11-05 14:04:06', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (387, 2, '合伙人费率', '2', 'yz_CustomerChange_type', NULL, NULL, 'N', '0', 'admin', '2021-11-05 14:04:25', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (388, 3, '销售费率', '3', 'yz_CustomerChange_type', NULL, NULL, 'N', '0', 'admin', '2021-11-05 14:04:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (389, 4, '售后费率', '4', 'yz_CustomerChange_type', NULL, NULL, 'N', '0', 'admin', '2021-11-05 14:04:42', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (390, 5, '所属合伙人', '5', 'yz_CustomerChange_type', NULL, NULL, 'N', '0', 'admin', '2021-11-05 14:05:58', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (391, 6, '所属销售', '6', 'yz_CustomerChange_type', NULL, NULL, 'N', '0', 'admin', '2021-11-05 14:06:08', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (392, 1, '企业', '1', 'yz_CustomerSort_type', NULL, NULL, 'N', '0', 'admin', '2021-11-05 15:56:02', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (393, 2, '个人', '2', 'yz_CustomerSort_type', NULL, NULL, 'N', '0', 'admin', '2021-11-05 15:56:09', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (394, 2, '平台仅一次', '2', 'yunze_packet_type', NULL, NULL, 'N', '0', 'admin', '2021-11-09 16:51:51', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (395, 9, '月初复机操作', '9', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-11-09 10:30:35', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (396, 6, '月初已订购复机', '6', 'yz_cardChange_sourceType', NULL, NULL, 'N', '0', 'admin', '2021-11-09 14:46:47', '', NULL, '月初有流量的卡进行复机'); +INSERT INTO `sys_dict_data` VALUES (397, 10, 'C端充值变更失败再次复机', '10', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-11-10 13:46:58', '', NULL, 'C端充值 轮询 卡状态变更失败的 进行再次 复机;(前提是没用完用量)'); +INSERT INTO `sys_dict_data` VALUES (398, 7, 'C端充值变更失败再次复机', '7', 'yz_cardChange_sourceType', NULL, NULL, 'N', '0', 'admin', '2021-11-11 11:32:03', '', NULL, 'C端充值 轮询 卡状态变更失败的 进行再次 复机;(前提是没用完用量)'); +INSERT INTO `sys_dict_data` VALUES (400, 15, '中国移动ECV2', 'YiDong_ECv2', 'channel_code', NULL, NULL, 'N', '0', 'admin', '2021-11-29 12:06:53', 'admin', '2021-11-29 12:07:11', 'pboss'); +INSERT INTO `sys_dict_data` VALUES (401, 1, '是', '1', 'buttonyesno', NULL, NULL, 'N', '0', 'admin', '2021-11-11 21:26:37', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (402, 2, '否', '2', 'buttonyesno', NULL, NULL, 'N', '0', 'admin', '2021-11-11 21:26:53', 'admin', '2021-11-12 16:07:02', NULL); +INSERT INTO `sys_dict_data` VALUES (407, 11, '全部订单导出', '11', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-11-23 15:26:59', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (408, 10, '订单管理导出', '_Exportallorders', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-11-24 13:32:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (409, 12, '购物订单导出', '12', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2021-11-25 10:03:38', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (410, 13, '购物订单导出', '_Shoppingexport', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-11-25 10:10:07', 'admin', '2021-12-24 15:47:36', NULL); +INSERT INTO `sys_dict_data` VALUES (411, 4, '发货日期', '4', 'yunze_card_sel_timetype', NULL, NULL, 'N', '0', 'admin', '2021-11-25 16:04:05', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (412, 1, '中移集团', '1', 'yz_Commodity_supplier', NULL, NULL, 'N', '0', 'admin', '2021-12-06 10:14:31', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (413, 2, '电信物联网', '2', 'yz_Commodity_supplier', NULL, NULL, 'N', '0', 'admin', '2021-12-06 10:14:59', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (414, 1, '中国移动', '1', 'yz_Commodity_Operator', NULL, NULL, 'N', '0', 'admin', '2021-12-06 10:15:20', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (415, 2, '中国联通', '2', 'yz_Commodity_Operator', NULL, NULL, 'N', '0', 'admin', '2021-12-06 10:15:30', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (416, 3, '中国电信', '3', 'yz_Commodity_Operator', NULL, NULL, 'N', '0', 'admin', '2021-12-06 10:15:40', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (417, 1, '商品名称', '1', 'yz_Bcommodity_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-06 16:29:29', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (418, 1, '分类名称', '1', 'yz_BcommoditySort_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-06 16:32:03', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (419, 1, '名称', '1', 'yz_Ccommodity_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-06 16:44:26', 'admin', '2021-12-06 16:44:48', NULL); +INSERT INTO `sys_dict_data` VALUES (420, 2, '型号', '2', 'yz_Ccommodity_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-06 16:44:41', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (421, 3, '备注', '3', 'yz_Ccommodity_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-06 16:44:58', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (422, 0, '已删除', '0', 'yz_Universal_delete', NULL, NULL, 'N', '0', 'admin', '2021-12-07 09:51:55', 'admin', '2021-12-07 09:52:06', NULL); +INSERT INTO `sys_dict_data` VALUES (423, 1, '正常', '1', 'yz_Universal_delete', NULL, NULL, 'N', '0', 'admin', '2021-12-07 09:52:18', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (424, 0, '不分润', '0', 'yz_profit_sharingType', NULL, NULL, 'N', '0', 'admin', '2021-12-07 14:38:55', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (425, 1, '正常分润', '1', 'yz_profit_sharingType', NULL, NULL, 'N', '0', 'admin', '2021-12-07 15:11:40', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (426, 2, '合伙人分润', '2', 'yz_profit_sharingType', NULL, NULL, 'N', '0', 'admin', '2021-12-07 15:12:08', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (427, 3, '销售分润', '3', 'yz_profit_sharingType', NULL, NULL, 'N', '0', 'admin', '2021-12-07 15:12:24', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (428, 4, '售后分润', '4', 'yz_profit_sharingType', NULL, NULL, 'N', '0', 'admin', '2021-12-07 15:20:48', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (429, 5, '合伙人+销售分润', '5', 'yz_profit_sharingType', NULL, NULL, 'N', '0', 'admin', '2021-12-07 15:21:13', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (430, 6, '合伙人+售后分润', '6', 'yz_profit_sharingType', NULL, NULL, 'N', '0', 'admin', '2021-12-07 15:21:41', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (431, 7, '销售+售后分润', '7', 'yz_profit_sharingType', NULL, NULL, 'N', '0', 'admin', '2021-12-07 15:22:03', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (432, 0, '不开票', '0', 'yz_Invoicing_Type', NULL, NULL, 'N', '0', 'admin', '2021-12-07 15:38:57', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (433, 1, '增值票', '1', 'yz_Invoicing_Type', NULL, NULL, 'N', '0', 'admin', '2021-12-07 15:39:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (434, 2, '普通票', '2', 'yz_Invoicing_Type', NULL, NULL, 'N', '0', 'admin', '2021-12-07 15:39:33', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (435, 1, '已申请', '1', 'yz_Contract_status', NULL, NULL, 'N', '0', 'admin', '2021-12-10 17:49:29', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (436, 2, '待发货', '2', 'yz_Contract_status', NULL, NULL, 'N', '0', 'admin', '2021-12-10 17:49:36', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (437, 3, '待出库', '3', 'yz_Contract_status', NULL, NULL, 'N', '0', 'admin', '2021-12-10 17:49:51', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (438, 4, '已完成', '4', 'yz_Contract_status', NULL, NULL, 'N', '0', 'admin', '2021-12-10 17:50:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (439, 99, '作废', '99', 'yz_Contract_status', NULL, NULL, 'N', '0', 'admin', '2021-12-10 17:51:09', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (440, 0, '未打款', '0', 'yz_ReceivePayment_type', NULL, NULL, 'N', '0', 'admin', '2021-12-10 18:08:38', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (441, 1, '部分到款', '1', 'yz_ReceivePayment_type', NULL, NULL, 'N', '0', 'admin', '2021-12-10 18:08:59', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (442, 3, '已收款', '3', 'yz_ReceivePayment_type', NULL, NULL, 'N', '0', 'admin', '2021-12-10 18:09:12', 'admin', '2021-12-10 18:09:21', NULL); +INSERT INTO `sys_dict_data` VALUES (443, 1, '客户名称', '1', 'yz_SalesContract_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-11 16:43:14', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (444, 2, '甲方代表', '2', 'yz_SalesContract_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-11 16:43:33', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (445, 3, '合同金额', '3', 'yz_SalesContract_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-11 16:44:00', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (446, 4, '备注', '4', 'yz_SalesContract_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-11 16:49:54', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (447, 1, '创建时间', '1', 'yz_SalesContract_selTimeType', NULL, NULL, 'N', '0', 'admin', '2021-12-11 16:51:58', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (448, 2, '修改时间', '2', 'yz_SalesContract_selTimeType', NULL, NULL, 'N', '0', 'admin', '2021-12-11 16:52:10', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (449, 0, '合同日期', '0', 'yz_SalesContract_selTimeType', NULL, NULL, 'N', '0', 'admin', '2021-12-11 16:52:21', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (450, 1, '现金', '1', 'cwgl_Deposit_type', NULL, NULL, 'N', '0', 'admin', '2021-12-13 16:05:33', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (451, 1, '未到款', '1', 'cwgl_Deposit_state', NULL, NULL, 'N', '0', 'admin', '2021-12-13 16:27:01', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (452, 2, '有尾款', '2', 'cwgl_Deposit_state', NULL, NULL, 'N', '0', 'admin', '2021-12-13 16:27:44', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (453, 3, '已到款', '3', 'cwgl_Deposit_state', NULL, NULL, 'N', '0', 'admin', '2021-12-13 16:27:53', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (454, 1, '未发', '1', 'Ship_state', NULL, NULL, 'N', '0', 'admin', '2021-12-13 16:44:40', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (455, 2, '未发全', '2', 'Ship_state', NULL, NULL, 'N', '0', 'admin', '2021-12-13 16:44:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (456, 3, '已发', '3', 'Ship_state', NULL, NULL, 'N', '0', 'admin', '2021-12-13 16:53:05', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (457, 1, '销售合同', '1', 'DepositSource_type', NULL, NULL, 'N', '0', 'admin', '2021-12-13 16:57:28', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (458, 1, '合同开票', '1', 'invoice_Nature', NULL, NULL, 'N', '0', 'admin', '2021-12-14 08:37:33', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (459, 2, '预付开票', '2', 'invoice_Nature', NULL, NULL, 'N', '0', 'admin', '2021-12-14 08:37:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (460, 3, '代开票', '3', 'invoice_Nature', NULL, NULL, 'N', '0', 'admin', '2021-12-14 08:37:59', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (461, 1, '销售订单', '1', 'contract_nature', NULL, NULL, 'N', '0', 'admin', '2021-12-14 09:02:42', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (462, 2, '临时订单', '2', 'contract_nature', NULL, NULL, 'N', '0', 'admin', '2021-12-14 09:02:52', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (464, 1, '客户名称', '1', 'yunze_OrderDelivery_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-14 12:28:06', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (465, 1, '预计发货时间', '1', 'yunze_OrderDelivery_timetype', NULL, NULL, 'N', '0', 'admin', '2021-12-14 13:28:52', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (466, 2, '合同创建时间', '2', 'yunze_OrderDelivery_timetype', NULL, NULL, 'N', '0', 'admin', '2021-12-14 13:52:23', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (467, 1, '临时订单', '1', 'Delivery_selection_type', NULL, NULL, 'N', '1', 'admin', '2021-12-14 15:58:49', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (468, 2, '合同发货', '2', 'Delivery_selection_type', NULL, NULL, 'N', '0', 'admin', '2021-12-14 15:59:09', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (469, 3, '普通发货', '3', 'Delivery_selection_type', NULL, NULL, 'N', '0', 'admin', '2021-12-14 15:59:15', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (470, 4, '发票发货', '4', 'Delivery_selection_type', NULL, NULL, 'N', '0', 'admin', '2021-12-14 15:59:23', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (471, 5, '其他发货', '5', 'Delivery_selection_type', NULL, NULL, 'N', '0', 'admin', '2021-12-14 15:59:33', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (472, 1, '快递', '1', 'Delivery_method', NULL, NULL, 'N', '0', 'admin', '2021-12-14 16:39:21', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (473, 2, '物流', '2', 'Delivery_method', NULL, NULL, 'N', '0', 'admin', '2021-12-14 16:39:27', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (474, 3, '送货', '3', 'Delivery_method', NULL, NULL, 'N', '0', 'admin', '2021-12-14 16:39:43', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (475, 4, '自取', '4', 'Delivery_method', NULL, NULL, 'N', '0', 'admin', '2021-12-14 16:39:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (476, 5, '其他', '5', 'Delivery_method', NULL, NULL, 'N', '0', 'admin', '2021-12-14 16:39:58', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (477, 1, '合同发货', '1', 'Delivery_type', NULL, NULL, 'N', '0', 'admin', '2021-12-15 09:23:44', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (478, 2, '其他发货', '2', 'Delivery_type', NULL, NULL, 'N', '0', 'admin', '2021-12-15 09:23:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (479, 1, '寄付', '1', 'Shipping_method', NULL, NULL, 'N', '0', 'admin', '2021-12-15 10:27:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (480, 2, '到付', '2', 'Shipping_method', NULL, NULL, 'N', '0', 'admin', '2021-12-15 10:27:56', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (481, 1, '客户名称', '1', 'yunze_ShippingApplication_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-21 16:16:56', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (482, 2, '发货人姓名', '2', 'yunze_ShippingApplication_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-21 16:17:12', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (483, 1, '申请发货日期', '1', 'yunze_ShippingApplication_timetype', NULL, NULL, 'N', '0', 'admin', '2021-12-21 16:18:29', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (484, 2, '数据修改时间', '2', 'yunze_ShippingApplication_timetype', NULL, NULL, 'N', '0', 'admin', '2021-12-21 16:18:42', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (485, 1, '单位', '1', 'yunze_ExpressInquiry_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:07:31', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (486, 2, '收件人', '2', 'yunze_ExpressInquiry_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:07:44', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (487, 3, '快递编号', '3', 'yunze_ExpressInquiry_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:07:52', 'admin', '2021-12-23 16:28:22', NULL); +INSERT INTO `sys_dict_data` VALUES (488, 1, '发货日期', '1', 'yunze_ExpressInquiry_timetype', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:09:37', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (489, 2, '收件日期', '2', 'yunze_ExpressInquiry_timetype', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:09:49', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (490, 1, '未收', '1', 'yunze_ExpressInquiry_SignFor', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:15:32', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (491, 2, '已收', '2', 'yunze_ExpressInquiry_SignFor', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:15:46', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (492, 3, '退回', '3', 'yunze_ExpressInquiry_SignFor', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:15:52', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (493, 1, '未评价', '1', 'yunze_ExpressInquiry_Evaluation', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:16:17', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (494, 2, '正常', '2', 'yunze_ExpressInquiry_Evaluation', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:16:22', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (495, 3, '慢', '3', 'yunze_ExpressInquiry_Evaluation', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:16:40', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (496, 4, '损坏', '4', 'yunze_ExpressInquiry_Evaluation', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:16:52', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (497, 5, '丢件', '5', 'yunze_ExpressInquiry_Evaluation', NULL, NULL, 'N', '0', 'admin', '2021-12-23 10:17:09', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (498, 4, '快递单号', '4', 'yunze_ExpressInquiry_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-23 16:28:30', 'admin', '2021-12-23 16:29:38', NULL); +INSERT INTO `sys_dict_data` VALUES (499, 1, '库存', '1', 'yunze_card_status_ShowId', NULL, NULL, 'N', '0', 'admin', '2021-12-24 10:51:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (500, 2, '可测试', '2', 'yunze_card_status_ShowId', NULL, NULL, 'N', '0', 'admin', '2021-12-24 10:51:42', 'admin', '2021-12-24 10:51:47', NULL); +INSERT INTO `sys_dict_data` VALUES (501, 3, '待激活', '3', 'yunze_card_status_ShowId', NULL, NULL, 'N', '0', 'admin', '2021-12-24 10:51:55', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (502, 4, '已激活', '4', 'yunze_card_status_ShowId', NULL, NULL, 'N', '0', 'admin', '2021-12-24 10:52:03', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (503, 5, '已停机', '5', 'yunze_card_status_ShowId', NULL, NULL, 'N', '0', 'admin', '2021-12-24 10:52:10', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (504, 6, '预销户', '6', 'yunze_card_status_ShowId', NULL, NULL, 'N', '0', 'admin', '2021-12-24 10:52:25', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (505, 7, '已销户', '7', 'yunze_card_status_ShowId', NULL, NULL, 'N', '0', 'admin', '2021-12-24 10:52:41', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (506, 8, '未知', '8', 'yunze_card_status_ShowId', NULL, NULL, 'N', '0', 'admin', '2021-12-24 10:52:51', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (507, 11, '批量同步用量', '_Consumption', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-12-24 15:47:18', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (508, 15, '批量-同步状态', '_PublicMethod', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-12-24 15:48:01', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (509, 16, '批量-同步状态和用量', '_ConsumptionAndState', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-12-24 15:48:16', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (510, 17, '批量-停机', '_Stopped', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-12-24 15:49:01', 'admin', '2021-12-24 16:06:45', NULL); +INSERT INTO `sys_dict_data` VALUES (511, 18, '批量-复机', '_Machine', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-12-24 15:49:20', 'admin', '2021-12-24 16:06:50', NULL); +INSERT INTO `sys_dict_data` VALUES (512, 19, '批量-断网', '_DisconnectNetwork', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-12-24 15:50:56', 'admin', '2021-12-24 16:06:54', NULL); +INSERT INTO `sys_dict_data` VALUES (513, 20, '批量-开网', '_OpenNetwork', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-12-24 15:52:00', 'admin', '2021-12-24 16:06:59', NULL); +INSERT INTO `sys_dict_data` VALUES (514, 21, '批量变更', '_CardChangeInfo', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2021-12-24 16:07:22', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (515, 1, '箱号', '1', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:56:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (516, 2, '盘号', '2', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:56:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (517, 3, '产品编码', '3', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:57:06', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (518, 4, '序列号', '4', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:57:20', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (519, 5, '批号', '5', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:57:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (520, 6, '卷盘号', '6', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:57:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (521, 7, 'MAC', '7', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:58:09', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (522, 8, '设备码', '8', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:58:26', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (523, 9, '串号', '9', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:58:57', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (524, 10, 'SN', '10', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:59:10', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (525, 11, '原SN', '11', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:59:27', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (526, 12, 'ICCID', '12', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:59:51', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (527, 13, 'IMSI', '13', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 11:00:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (528, 14, 'IMEI', '14', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 11:00:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (529, 15, 'CMEI', '15', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 11:00:57', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (530, 16, '所属入库编号', '16', 'yunze_InventoryDetails_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 11:01:24', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (531, 1, '创建日期', '1', 'yunze_inventorydetails_timetype', NULL, NULL, 'N', '0', 'admin', '2021-12-28 11:04:05', 'admin', '2021-12-28 11:04:29', NULL); +INSERT INTO `sys_dict_data` VALUES (532, 2, '入库日期', '2', 'yunze_inventorydetails_timetype', NULL, NULL, 'N', '0', 'admin', '2021-12-28 11:04:15', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (533, 1, '箱号', '1', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:56:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (534, 2, '盘号', '2', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:56:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (535, 3, '产品编码', '3', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:57:06', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (536, 4, '序列号', '4', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:57:20', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (537, 5, '批号', '5', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:57:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (538, 6, '卷盘号', '6', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:57:50', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (539, 7, 'MAC', '7', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:58:09', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (540, 8, '设备码', '8', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:58:26', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (541, 9, '串号', '9', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:58:57', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (542, 10, 'SN', '10', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:59:10', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (543, 11, '原SN', '11', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:59:27', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (544, 12, 'ICCID', '12', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 10:59:51', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (545, 13, 'IMSI', '13', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 11:00:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (546, 14, 'IMEI', '14', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 11:00:34', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (547, 15, 'CMEI', '15', 'yunze_inventorydetails_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-28 11:00:57', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (548, 1, '商品名称', '1', 'yunze_CustomerInquiries_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 15:32:20', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (549, 2, '型号/编号', '2', 'yunze_CustomerInquiries_selType', NULL, NULL, 'N', '0', 'admin', '2021-12-28 15:32:32', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (550, 3, 'IMEI', '3', 'yunze_card_seltype', NULL, NULL, 'N', '0', 'admin', '2021-12-29 16:22:39', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (551, 5, 'IMEI', '5', 'yunze_card_StartAndEnd_type', NULL, NULL, 'N', '0', 'admin', '2021-12-29 16:23:09', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (552, 22, '客户导入', '_CustomerImport', 'yunze_ExecutionTask_OutType', NULL, NULL, 'N', '0', 'admin', '2022-01-02 10:52:36', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (553, 13, '客户导入', '13', 'yunze_task_type', NULL, NULL, 'N', '0', 'admin', '2022-01-02 10:53:19', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (554, 3, '老客户', '3', 'yz_customer_source', NULL, NULL, 'N', '0', 'admin', '2022-01-03 11:01:08', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (555, 13, '同行', '13', 'yz_customer_grade_tow', NULL, NULL, 'N', '0', 'admin', '2022-01-03 12:25:26', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (556, 0, '无需出库', '0', 'yunze_ShippingApplication_OutboundStatus ', NULL, NULL, 'N', '0', 'admin', '2022-01-05 10:25:04', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (557, 1, '未出库', '1', 'yunze_ShippingApplication_OutboundStatus ', NULL, NULL, 'N', '0', 'admin', '2022-01-05 10:25:12', '', NULL, NULL); +INSERT INTO `sys_dict_data` VALUES (558, 2, '已出库', '2', 'yunze_ShippingApplication_OutboundStatus ', NULL, NULL, 'N', '0', 'admin', '2022-01-05 10:25:20', '', NULL, NULL); + +-- ---------------------------- +-- Table structure for sys_dict_type +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dict_type`; +CREATE TABLE `sys_dict_type` ( + `dict_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '字典主键', + `dict_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典名称', + `dict_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典类型', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`dict_id`) USING BTREE, + UNIQUE INDEX `dict_type`(`dict_type`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 228 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '字典类型表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_dict_type +-- ---------------------------- +INSERT INTO `sys_dict_type` VALUES (1, '用户性别', 'sys_user_sex', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '用户性别列表'); +INSERT INTO `sys_dict_type` VALUES (2, '菜单状态', 'sys_show_hide', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '菜单状态列表'); +INSERT INTO `sys_dict_type` VALUES (3, '系统开关', 'sys_normal_disable', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '系统开关列表'); +INSERT INTO `sys_dict_type` VALUES (4, '任务状态', 'sys_job_status', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '任务状态列表'); +INSERT INTO `sys_dict_type` VALUES (5, '任务分组', 'sys_job_group', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '任务分组列表'); +INSERT INTO `sys_dict_type` VALUES (6, '系统是否', 'sys_yes_no', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '系统是否列表'); +INSERT INTO `sys_dict_type` VALUES (7, '通知类型', 'sys_notice_type', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '通知类型列表'); +INSERT INTO `sys_dict_type` VALUES (8, '通知状态', 'sys_notice_status', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '通知状态列表'); +INSERT INTO `sys_dict_type` VALUES (9, '操作类型', 'sys_oper_type', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '操作类型列表'); +INSERT INTO `sys_dict_type` VALUES (10, '系统状态', 'sys_common_status', '0', 'admin', '2021-06-05 09:12:10', '', NULL, '登录状态列表'); +INSERT INTO `sys_dict_type` VALUES (100, '卡类型', 'card_type', '0', 'admin', '2021-06-05 10:49:08', 'admin', '2021-08-05 08:24:13', '运营商类型\n'); +INSERT INTO `sys_dict_type` VALUES (101, '卡列表查询条件', 'yunze_card_seltype', '0', 'admin', '2021-06-07 09:19:56', '', NULL, '卡列表查询条件'); +INSERT INTO `sys_dict_type` VALUES (102, '卡板列表时间查询类型', 'yunze_card_sel_timetype', '0', 'admin', '2021-06-07 12:22:33', '', NULL, '卡板列表时间查询类型'); +INSERT INTO `sys_dict_type` VALUES (103, '卡板删除标记', 'yunze_card_deltype', '0', 'admin', '2021-06-07 12:25:44', '', NULL, 'del_flag'); +INSERT INTO `sys_dict_type` VALUES (104, '运营商类型', 'yunze_card_operators_type', '0', 'admin', '2021-06-07 16:14:48', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (105, '卡状态', 'yunze_card_status_type', '0', 'admin', '2021-06-07 16:28:35', 'admin', '2021-06-07 17:14:33', NULL); +INSERT INTO `sys_dict_type` VALUES (106, '资费计划生效类别', 'yunze_card_takeEffect_type', '0', 'admin', '2021-06-09 08:54:58', 'admin', '2021-06-22 12:12:32', NULL); +INSERT INTO `sys_dict_type` VALUES (107, '资费计划生效中类型', 'yunze_card_valid_type', '0', 'admin', '2021-06-09 08:59:53', 'admin', '2021-06-22 12:12:19', NULL); +INSERT INTO `sys_dict_type` VALUES (108, '支付方式', 'yunze_card_pay_type', '0', 'admin', '2021-06-09 09:02:21', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (109, '自定义是否', 'yunze_customize_whether', '0', 'admin', '2021-06-09 09:07:06', '', NULL, '0 否,1 是'); +INSERT INTO `sys_dict_type` VALUES (110, '卡类型', 'yunze_card_card_type', '0', 'admin', '2021-06-10 08:51:19', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (111, '卡板网络类型', 'yunze_card_network_type', '0', 'admin', '2021-06-10 08:53:30', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (112, '卡板在线状态', 'yunze_card_online_status', '0', 'admin', '2021-06-10 14:00:59', '', NULL, '卡板列表在线信息'); +INSERT INTO `sys_dict_type` VALUES (113, '卡板接入方式', 'yunze_card_access_type', '0', 'admin', '2021-06-10 14:02:21', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (114, '卡板列表起止条件查询', 'yunze_card_StartAndEnd_type', '0', 'admin', '2021-06-11 15:17:02', '', NULL, '号码类型'); +INSERT INTO `sys_dict_type` VALUES (115, '通道管理查询类型', 'yunze_channel_selType', '0', 'admin', '2021-06-19 12:20:10', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (116, '查询排序类型', 'ORDER_BY_rule', '0', 'admin', '2021-06-19 13:31:47', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (117, '通道排序类型', 'channel_ORDER_BY_type', '0', 'admin', '2021-06-19 13:34:08', '', NULL, '通道管理排序类型'); +INSERT INTO `sys_dict_type` VALUES (118, '通道状态', 'channel_status', '0', 'admin', '2021-06-19 13:41:06', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (119, '通道编码', 'channel_code', '0', 'admin', '2021-06-19 14:45:39', '', NULL, 'API调用 通道编码'); +INSERT INTO `sys_dict_type` VALUES (120, '执行任务表查询类型', 'executionTask_selType', '0', 'admin', '2021-06-21 11:29:19', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (121, '执行任务管理排序类型', 'executionTask_ORDER_BY_type', '0', 'admin', '2021-06-21 11:39:21', '', NULL, '流量卡》执行任务管理'); +INSERT INTO `sys_dict_type` VALUES (122, '执行任务导出类别', 'yunze_ExecutionTask_OutType', '0', 'admin', '2021-06-21 14:17:16', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (123, '资费计划周期', 'yunze_packet_valid_name', '0', 'admin', '2021-06-22 16:19:38', 'admin', '2021-06-22 16:24:03', '月 年'); +INSERT INTO `sys_dict_type` VALUES (124, '资费组查询条件', 'yunze_tariffGroup_selType', '0', 'admin', '2021-06-22 17:14:54', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (125, '资费计划条件', 'yunze_tariffPlan_selType', '0', 'admin', '2021-06-22 17:16:24', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (126, '订单交易类型', 'yunze_order_type', '0', 'admin', '2021-07-03 10:50:16', 'admin', '2021-08-06 11:21:53', NULL); +INSERT INTO `sys_dict_type` VALUES (127, '订单状态', 'yunze_order_status', '0', 'admin', '2021-07-03 10:52:05', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (129, '通道轮询类型', 'yunze_polling_type', '0', 'admin', '2021-07-08 14:19:59', 'admin', '2021-07-08 14:20:15', '通道轮序详情表用'); +INSERT INTO `sys_dict_type` VALUES (130, '执行任务类别', 'yunze_task_type', '0', 'admin', '2021-07-28 08:35:29', '', NULL, '执行任务表,主要用于记录'); +INSERT INTO `sys_dict_type` VALUES (131, '订单查询条件', 'yunze_order_seltype', '0', 'admin', '2021-08-06 10:48:24', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (132, '订单生成方式', 'yunze_order_creType', '0', 'admin', '2021-08-06 10:57:52', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (133, '分润类型', 'yunze_order_profitType', '0', 'admin', '2021-08-06 11:02:08', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (135, '订单管理时间查询类型', 'yunze_order_sel_timetype', '0', 'admin', '2021-08-06 11:43:56', 'admin', '2021-08-06 17:31:11', NULL); +INSERT INTO `sys_dict_type` VALUES (136, '订单管理起止条件', 'yunze_order_StartAndEnd_type', '0', 'admin', '2021-08-06 17:41:37', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (137, '资费计划类别', 'yunze_packet_type', '0', 'admin', '2021-09-01 16:04:44', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (138, '资费类型规则', 'yunze_base_packet_type', '0', 'admin', '2021-09-03 15:29:17', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (139, '对外接口日志时间类型', 'yunze_syslogs_sel_timetype', '0', 'admin', '2021-08-24 08:52:32', 'admin', '2021-08-24 12:04:02', '日志创建时间'); +INSERT INTO `sys_dict_type` VALUES (141, '用量详情', 'dosage_details_flow_his', '0', 'admin', '2021-08-26 09:13:18', 'admin', '2021-08-26 09:13:58', '用量详情'); +INSERT INTO `sys_dict_type` VALUES (142, '用量详情时间类型', 'yunze_yz_card_flow_his', '0', 'admin', '2021-08-26 09:43:21', '', NULL, '用量详情时间类型'); +INSERT INTO `sys_dict_type` VALUES (143, '通道进度时间类型', 'yunze_yz_passageway', '0', 'admin', '2021-08-31 11:37:08', '', NULL, '通道进度时间类型'); +INSERT INTO `sys_dict_type` VALUES (144, '通道编号', 'yz_passageway_polling', '0', 'admin', '2021-08-31 14:03:30', '', NULL, '通道进度编号'); +INSERT INTO `sys_dict_type` VALUES (146, '排序规则', 'yunze_sorting_rules', '0', 'admin', '2021-09-06 13:32:43', '', NULL, '排序规则'); +INSERT INTO `sys_dict_type` VALUES (147, '时间类型', 'yunze_card_flow', '0', 'admin', '2021-09-06 13:53:34', '', NULL, '订购资费查询'); +INSERT INTO `sys_dict_type` VALUES (148, '排序类型', 'Lifting_sequence', '0', 'admin', '2021-09-06 14:00:42', '', NULL, '排序类型'); +INSERT INTO `sys_dict_type` VALUES (149, '条件查询', 'yz_card_flow', '0', 'admin', '2021-09-06 14:19:22', '', NULL, '订购资费条件查询'); +INSERT INTO `sys_dict_type` VALUES (150, '条件选择', 'system_yz_sys_logs_sysLog', '0', 'admin', '2021-08-24 08:33:58', '', NULL, '日志执行'); +INSERT INTO `sys_dict_type` VALUES (151, '模块类别', 'yz_sys_logs_project', '0', 'admin', '2021-08-24 08:47:40', '', NULL, '执行模块类别\n'); +INSERT INTO `sys_dict_type` VALUES (152, '卡变更类型', 'yz_cardChange_type', '0', 'admin', '2021-09-14 09:37:48', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (153, '卡变更类型来源', 'yz_cardChange_sourceType', '0', 'admin', '2021-09-14 09:38:44', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (154, '断开网状态', 'yz_cardConnection_type', '0', 'admin', '2021-09-14 11:41:26', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (155, '卡信息变更执行状态', 'yz_cardChange_ExecutionStatus', '0', 'admin', '2021-09-15 08:37:48', 'admin', '2021-09-15 08:38:16', ''); +INSERT INTO `sys_dict_type` VALUES (156, '卡号类别', 'cardNumber', '0', 'admin', '2021-09-09 17:13:07', '', NULL, '卡号类别'); +INSERT INTO `sys_dict_type` VALUES (157, '自动化触发类型', 'yz_cc_trigger_type', '0', 'admin', '2021-09-24 14:52:22', 'admin', '2021-09-24 15:18:37', NULL); +INSERT INTO `sys_dict_type` VALUES (158, '推送执行动作类型', 'yz_cc_execution_type', '0', 'admin', '2021-09-24 15:18:30', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (159, '自动化状态', 'yz_cc_status', '0', 'admin', '2021-09-24 15:19:52', 'admin', '2021-09-24 15:20:21', NULL); +INSERT INTO `sys_dict_type` VALUES (160, '自动化推送模板', 'yz_cc_template', '0', 'admin', '2021-09-24 15:34:04', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (162, '自动化抄送状态', 'yz_cc_HisStatus', '0', 'admin', '2021-09-26 17:03:05', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (163, '自动化抄送结果', 'yz_cc_result', '0', 'admin', '2021-09-26 17:06:03', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (164, '通用启用状态', 'yz_enabled_state', '0', 'admin', '2021-09-27 14:51:46', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (165, '商品出售状态', 'yz_commodity_sell', '0', 'admin', '2021-09-27 18:04:05', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (166, '商品审核状态', 'yz_check_state', '0', 'admin', '2021-09-27 18:06:19', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (167, '停复机', 'Stop_and_resume', '0', 'admin', '2021-09-28 09:31:31', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (168, '断开网', 'Disconnect_the_network', '0', 'admin', '2021-09-28 09:39:45', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (169, '卡信息变更查询条件', 'yz_card_info_change', '0', 'admin', '2021-09-29 19:54:02', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (170, '客户状态', 'yz_customer_state', '0', 'admin', '2021-10-11 15:54:03', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (171, '客户来源', 'yz_customer_source', '0', 'admin', '2021-10-11 16:04:56', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (172, '客户等级', 'yz_customer_grade', '0', 'admin', '2021-10-12 10:45:48', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (174, '客户一级分类', 'yz_customer_grade_one', '0', 'admin', '2021-10-29 16:08:24', '', NULL, '客户一级分类'); +INSERT INTO `sys_dict_type` VALUES (175, '客户二级分类', 'yz_customer_grade_tow', '0', 'admin', '2021-10-29 16:08:55', '', NULL, '客户二级分类'); +INSERT INTO `sys_dict_type` VALUES (176, '客户查询类型', 'yz_customer_selType', '0', 'admin', '2021-11-02 16:25:20', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (177, '客户时间查询类型', 'yz_customer_selTimeType', '0', 'admin', '2021-11-02 16:28:34', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (178, '客户敏感信息变更类型', 'yz_CustomerChange_type', '0', 'admin', '2021-11-05 13:59:36', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (179, '客户类型', 'yz_CustomerSort_type', '0', 'admin', '2021-11-05 15:55:44', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (180, '自动化时间类型', 'Automation_time', '0', 'admin', '2021-10-19 14:29:36', '', NULL, '自动化时间 类型'); +INSERT INTO `sys_dict_type` VALUES (181, '自动化配置时间类型', 'Automated_configuration', '0', 'admin', '2021-10-19 16:33:02', '', NULL, '自动化配置时间类型'); +INSERT INTO `sys_dict_type` VALUES (186, '自动化条件类型', 'yz_cc_condition', '0', 'admin', '2021-10-25 15:57:52', 'admin', '2021-10-25 16:00:03', '自动化'); +INSERT INTO `sys_dict_type` VALUES (187, '自动化条件选择', 'cc_query_criteria', '0', 'admin', '2021-10-26 10:00:40', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (188, '商品分类时间类型', 'prdCategory_timet', '0', 'admin', '2021-10-29 15:32:48', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (189, '自动化配置时间类型 ', 'yunze_task_sel_timetype', '0', 'admin', '2021-10-29 16:11:23', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (190, '是否更新未填写属性', 'buttonyesno', '0', 'admin', '2021-11-11 21:25:52', '', NULL, '物联网卡管理 新增 勾选式 编辑 分组 备注 可选择型更新字段;'); +INSERT INTO `sys_dict_type` VALUES (191, '入库源', 'Warehousing_source', '0', 'admin', '2021-11-17 09:53:14', '', NULL, '入库出库信息'); +INSERT INTO `sys_dict_type` VALUES (192, '商品供应商', 'yz_Commodity_supplier', '0', 'admin', '2021-12-06 10:12:36', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (193, '商品运营商', 'yz_Commodity_Operator', '0', 'admin', '2021-12-06 10:13:36', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (194, 'B端商品查询条件', 'yz_Bcommodity_selType', '0', 'admin', '2021-12-06 16:28:29', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (195, 'C端商品查询条件', 'yz_Ccommodity_selType', '0', 'admin', '2021-12-06 16:29:15', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (196, 'B端商品分类查询条件', 'yz_BcommoditySort_selType', '0', 'admin', '2021-12-06 16:31:52', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (197, '通用删除', 'yz_Universal_delete', '0', 'admin', '2021-12-07 09:51:39', '', NULL, '用与状态删除标记'); +INSERT INTO `sys_dict_type` VALUES (198, '销售合同分润模式', 'yz_profit_sharingType', '0', 'admin', '2021-12-07 14:38:31', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (199, '销售合同开票类型', 'yz_Invoicing_Type', '0', 'admin', '2021-12-07 15:38:43', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (200, '销售合同状态', 'yz_Contract_status', '0', 'admin', '2021-12-10 17:46:46', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (201, '合同收款状态', 'yz_ReceivePayment_type', '0', 'admin', '2021-12-10 18:07:57', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (202, '销售合同查询条件', 'yz_SalesContract_selType', '0', 'admin', '2021-12-11 16:42:53', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (203, '销售合同查询时间类型', 'yz_SalesContract_selTimeType', '0', 'admin', '2021-12-11 16:51:19', 'admin', '2021-12-11 16:53:03', NULL); +INSERT INTO `sys_dict_type` VALUES (204, '入款类型', 'cwgl_Deposit_type', '0', 'admin', '2021-12-13 16:04:10', '', NULL, '入款信息'); +INSERT INTO `sys_dict_type` VALUES (205, '入款状态', 'cwgl_Deposit_state', '0', 'admin', '2021-12-13 16:04:42', '', NULL, '入款信息\n'); +INSERT INTO `sys_dict_type` VALUES (206, '发货状态', 'Ship_state', '0', 'admin', '2021-12-13 16:44:28', '', NULL, '订单合同'); +INSERT INTO `sys_dict_type` VALUES (207, '入款信息来源类别', 'DepositSource_type', '0', 'admin', '2021-12-13 16:57:04', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (208, '发票性质', 'invoice_Nature', '0', 'admin', '2021-12-14 08:37:15', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (209, '合同性质', 'contract_nature', '0', 'admin', '2021-12-14 09:02:24', '', NULL, '订单合同发货信息'); +INSERT INTO `sys_dict_type` VALUES (210, '合同发货查询条件', 'yunze_OrderDelivery_selType', '0', 'admin', '2021-12-14 12:27:20', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (211, '合同发货查询时间类型', 'yunze_OrderDelivery_timetype', '0', 'admin', '2021-12-14 13:28:39', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (212, '发货选择类型', 'Delivery_selection_type', '0', 'admin', '2021-12-14 15:58:20', 'admin', '2021-12-15 09:23:20', ''); +INSERT INTO `sys_dict_type` VALUES (213, '发货方式', 'Delivery_method', '0', 'admin', '2021-12-14 16:39:07', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (214, '发货类型', 'Delivery_type', '0', 'admin', '2021-12-15 09:23:35', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (215, '运费方式', 'Shipping_method', '0', 'admin', '2021-12-15 10:27:38', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (216, '发货申请查询条件', 'yunze_ShippingApplication_selType', '0', 'admin', '2021-12-21 16:16:07', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (217, '发货申请时间查询类型', 'yunze_ShippingApplication_timetype', '0', 'admin', '2021-12-21 16:18:18', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (218, '快递查询-查询条件', 'yunze_ExpressInquiry_selType', '0', 'admin', '2021-12-23 10:06:31', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (219, '快递查询-时间查询类型', 'yunze_ExpressInquiry_timetype', '0', 'admin', '2021-12-23 10:07:05', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (220, '快递签收状态', 'yunze_ExpressInquiry_SignFor', '0', 'admin', '2021-12-23 10:12:24', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (221, '快递评价', 'yunze_ExpressInquiry_Evaluation', '0', 'admin', '2021-12-23 10:13:00', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (222, '卡状态', 'yunze_card_status_ShowId', '0', 'admin', '2021-12-24 10:50:08', '', NULL, '对外展示'); +INSERT INTO `sys_dict_type` VALUES (223, '库存明细查询条件', 'yunze_InventoryDetails_selType', '0', 'admin', '2021-12-28 10:55:55', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (224, '入库明细-时间查询类型', 'yunze_inventorydetails_timetype', '0', 'admin', '2021-12-28 11:03:50', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (225, '入库明细-起止条件查询类型', 'yunze_inventorydetails_StartAndEnd_type', '0', 'admin', '2021-12-28 11:05:47', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (226, '库存数量-查询条件类型', 'yunze_CustomerInquiries_selType', '0', 'admin', '2021-12-28 15:29:48', '', NULL, NULL); +INSERT INTO `sys_dict_type` VALUES (227, '出库状态', 'yunze_ShippingApplication_OutboundStatus ', '0', 'admin', '2022-01-05 10:24:50', '', NULL, '发货申请出库状态'); + +-- ---------------------------- +-- Table structure for sys_job +-- ---------------------------- +DROP TABLE IF EXISTS `sys_job`; +CREATE TABLE `sys_job` ( + `job_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '任务ID', + `job_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '任务名称', + `job_group` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'DEFAULT' COMMENT '任务组名', + `invoke_target` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调用目标字符串', + `cron_expression` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT 'cron执行表达式', + `misfire_policy` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '3' COMMENT '计划执行错误策略(1立即执行 2执行一次 3放弃执行)', + `concurrent` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '是否并发执行(0允许 1禁止)', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1暂停)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '备注信息', + PRIMARY KEY (`job_id`, `job_name`, `job_group`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '定时任务调度表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_job +-- ---------------------------- +INSERT INTO `sys_job` VALUES (1, '系统默认(无参)', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', '2021-06-05 09:12:10', '', NULL, ''); +INSERT INTO `sys_job` VALUES (2, '系统默认(有参)', 'DEFAULT', 'ryTask.ryParams(\'ry\')', '0/15 * * * * ?', '3', '1', '1', 'admin', '2021-06-05 09:12:10', '', NULL, ''); +INSERT INTO `sys_job` VALUES (3, '系统默认(多参)', 'DEFAULT', 'ryTask.ryMultipleParams(\'ry\', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '0', '1', 'admin', '2021-06-05 09:12:10', 'admin', '2021-07-04 08:47:54', ''); +INSERT INTO `sys_job` VALUES (4, '根据订单轮序更新激活时间', 'DEFAULT', 'orderAddPackageProductionTask.activationAddPackageProductionAndActivateDate(180)', '0 0 0/1 * * ? ', '1', '1', '0', 'admin', '2021-07-04 15:50:06', 'admin', '2021-11-15 13:31:37', ''); +INSERT INTO `sys_job` VALUES (5, '轮询-激活时间', 'POLLING', 'cardActivateDateTask.pollingActivateDate(\'Slight\', 120)', '0 0 0 * * ? ', '2', '1', '0', 'admin', '2021-07-07 15:32:32', 'admin', '2021-11-25 14:18:42', ''); +INSERT INTO `sys_job` VALUES (6, '轮询-同步通道数据', 'POLLING', 'passagewayPollingTask.SynChannel()', '0 0/10 * * * ?', '2', '0', '0', 'admin', '2021-07-15 17:07:12', 'admin', '2021-11-12 09:31:33', ''); +INSERT INTO `sys_job` VALUES (7, '轮询-卡状态', 'POLLING', 'cardStatusTask.pollingCardStatus(120)', '0 0 11,22 * * ? ', '1', '1', '0', 'admin', '2021-07-20 12:03:30', 'admin', '2021-11-25 14:18:56', ''); +INSERT INTO `sys_job` VALUES (8, '轮询-用量', 'POLLING', 'cardFlowTask.pollingCardFlow(120)', '0 0 6,18 * * ? ', '1', '1', '0', 'admin', '2021-07-21 13:33:23', 'admin', '2021-11-25 14:19:06', ''); +INSERT INTO `sys_job` VALUES (9, '达量停机', 'POLLING', 'cardStopTask.pollingCardStop(60)', '0 0/15 * * * ?', '1', '1', '0', 'admin', '2021-07-23 18:07:40', 'admin', '2021-09-14 15:54:19', ''); +INSERT INTO `sys_job` VALUES (10, '除 生效类型为 [激活生效] 外 所有加包 增加到生产任务中去', 'POLLING', 'orderAddPackageProductionTask.addPackageProduction(180)', '0 0/5 * * * ?', '1', '1', '0', 'admin', '2021-08-04 16:52:55', 'admin', '2021-08-24 10:07:11', ''); +INSERT INTO `sys_job` VALUES (11, '生效类型为 [激活生效] 且 已有生效时间 增加到生产任务中去', 'POLLING', 'orderAddPackageProductionTask.activationAddPackageProductionAndActivateDate(180)', '0 0/10 * * * ?', '1', '1', '0', 'admin', '2021-08-13 15:04:26', 'admin', '2021-08-24 10:03:52', ''); +INSERT INTO `sys_job` VALUES (12, '手动开启用量监听', 'POLLING', 'cardFlowTask.StartCardFlow(60)', '0 0/1 * * * ?', '1', '1', '1', 'admin', '2021-08-19 14:44:15', '', NULL, ''); +INSERT INTO `sys_job` VALUES (13, '删除对外接口日志', 'BACKUP', 'sysLogsTask.backups()', '0 0 0 * * ? *', '1', '1', '0', 'admin', '2021-08-19 17:57:28', 'admin', '2021-11-19 15:15:17', ''); +INSERT INTO `sys_job` VALUES (14, 'MQ初始化', 'DEFAULT', 'initMQ.initMQConfig', '0 0 0 * * ? *', '1', '1', '1', 'admin', '2021-08-31 13:16:27', '', NULL, ''); +INSERT INTO `sys_job` VALUES (15, '未订购停机', 'POLLING', 'cardDisconnectedTask.pollingCardDisconnected(120)', '0 0/20 * * * ? ', '1', '1', '0', 'admin', '2021-09-14 14:08:36', 'admin', '2021-12-01 17:28:35', ''); +INSERT INTO `sys_job` VALUES (16, '备份所有表', 'BACKUP', 'backupTest.gentable(30)', '0 0 0 * * ? *', '1', '1', '1', 'admin', '2021-09-16 18:12:41', 'admin', '2021-09-17 11:08:53', ''); +INSERT INTO `sys_job` VALUES (18, '轮询-激活时间有用量', 'POLLING', 'cardActivateDateTask.pollingActivateDate(\'Serious\', 60)', '0 0 0/8 * * ? ', '1', '1', '1', 'admin', '2021-10-28 17:21:14', 'admin', '2021-11-12 11:31:34', ''); +INSERT INTO `sys_job` VALUES (19, '月初流量卡进行复机', 'POLLING', 'month.gentable(120)', '0 0 0,2,4,6 1 * ? *', '1', '1', '0', 'admin', '2021-11-08 09:56:52', 'admin', '2021-11-25 14:17:52', ''); +INSERT INTO `sys_job` VALUES (21, '回滚 划卡备份', 'BACKUP', 'rollbackCardagent.rollbackError(\'1636963661697_csv_9bd5ee14a6814e8ba2ee7c70711ce4cd_CardDistributeBackup.csv\',236,246)', '0/20 * * * * ?', '1', '1', '1', 'admin', '2021-11-15 20:21:06', 'admin', '2021-11-24 13:14:35', ''); +INSERT INTO `sys_job` VALUES (22, '创建单通道用量监听', 'POLLING', 'cardFlowTask.pollingCardFlowOne(60,\'49\')', '0 0 0/1 * * ?', '1', '1', '1', 'admin', '2021-11-22 10:29:55', 'admin', '2021-12-06 18:20:51', ''); +INSERT INTO `sys_job` VALUES (23, '指定单个通道创建 消费者', 'POLLING', 'cardFlowTask.CardFlowCreateListener(60,\'49\')', '0 0 0/1 * * ?', '1', '1', '1', 'admin', '2021-11-22 10:46:08', 'admin', '2021-12-06 18:21:01', ''); +INSERT INTO `sys_job` VALUES (24, '轮询重启无记录消费者创建', 'POLLING', 'rebootTask.RebootFlowPolling(180)', '0 0 0/3 * * ?', '1', '1', '0', 'admin', '2021-11-23 17:37:44', 'admin', '2021-12-23 08:55:02', ''); +INSERT INTO `sys_job` VALUES (25, '停机阈值重启', 'POLLING', 'rebootTask.RebootCardStop(180)', '0 0 0/1 * * ?', '1', '1', '0', 'admin', '2021-11-27 13:47:23', '', '2021-11-27 14:26:57', ''); +INSERT INTO `sys_job` VALUES (26, '未订购停机重启', 'POLLING', 'rebootTask.RebootCardDisconnected(180)', '0 0 0/1 * * ?', '1', '1', '0', 'admin', '2021-11-27 13:48:00', '', '2021-11-27 14:26:59', ''); +INSERT INTO `sys_job` VALUES (27, '同步主表到期日期', 'POLLING', 'mqcardflow.gettime(30)', '0 0 0/2 * * ? *', '1', '1', '0', 'admin', '2021-11-26 10:22:57', 'admin', '2021-12-01 17:29:04', ''); + +-- ---------------------------- +-- Table structure for sys_job_log +-- ---------------------------- +DROP TABLE IF EXISTS `sys_job_log`; +CREATE TABLE `sys_job_log` ( + `job_log_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '任务日志ID', + `job_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务名称', + `job_group` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务组名', + `invoke_target` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调用目标字符串', + `job_message` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '日志信息', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '执行状态(0正常 1失败)', + `exception_info` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '异常信息', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`job_log_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 290761 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '定时任务调度日志表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_job_log +-- ---------------------------- +INSERT INTO `sys_job_log` VALUES (83, '除 生效类型为 [激活生效] 外 所有加包 增加到生产任务中去', 'POLLING', 'orderAddPackageProductionTask.addPackageProduction(180)', '除 生效类型为 [激活生效] 外 所有加包 增加到生产任务中去 总共耗时:12毫秒', '0', '', '2022-01-12 11:20:00'); +INSERT INTO `sys_job_log` VALUES (84, '生效类型为 [激活生效] 且 已有生效时间 增加到生产任务中去', 'POLLING', 'orderAddPackageProductionTask.activationAddPackageProductionAndActivateDate(180)', '生效类型为 [激活生效] 且 已有生效时间 增加到生产任务中去 总共耗时:10毫秒', '0', '', '2022-01-12 11:20:00'); +INSERT INTO `sys_job_log` VALUES (85, '未订购停机', 'POLLING', 'cardDisconnectedTask.pollingCardDisconnected(120)', '未订购停机 总共耗时:1毫秒', '0', '', '2022-01-12 11:20:00'); +INSERT INTO `sys_job_log` VALUES (86, '轮询-同步通道数据', 'POLLING', 'passagewayPollingTask.SynChannel()', '轮询-同步通道数据 总共耗时:1毫秒', '0', '', '2022-01-12 11:20:00'); + +-- ---------------------------- +-- Table structure for sys_logininfor +-- ---------------------------- +DROP TABLE IF EXISTS `sys_logininfor`; +CREATE TABLE `sys_logininfor` ( + `info_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '访问ID', + `user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户账号', + `ipaddr` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '登录IP地址', + `login_location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '登录地点', + `browser` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '浏览器类型', + `os` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '操作系统', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '登录状态(0成功 1失败)', + `msg` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '提示消息', + `login_time` datetime(0) NULL DEFAULT NULL COMMENT '访问时间', + PRIMARY KEY (`info_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 6967 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统访问记录' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_logininfor +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_menu +-- ---------------------------- +DROP TABLE IF EXISTS `sys_menu`; +CREATE TABLE `sys_menu` ( + `menu_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '菜单ID', + `menu_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单名称', + `parent_id` bigint(0) NULL DEFAULT 0 COMMENT '父菜单ID', + `order_num` int(0) NULL DEFAULT 0 COMMENT '显示顺序', + `path` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '路由地址', + `component` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '组件路径', + `is_frame` int(0) NULL DEFAULT 1 COMMENT '是否为外链(0是 1否)', + `is_cache` int(0) NULL DEFAULT 0 COMMENT '是否缓存(0缓存 1不缓存)', + `menu_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)', + `visible` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '菜单状态(0显示 1隐藏)', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '菜单状态(0正常 1停用)', + `perms` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限标识', + `icon` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '#' COMMENT '菜单图标', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '备注', + PRIMARY KEY (`menu_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2170 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '菜单权限表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_menu +-- ---------------------------- +INSERT INTO `sys_menu` VALUES (1, '系统管理', 0, 51, 'system', NULL, 1, 0, 'M', '0', '0', '', 'system', 'admin', '2021-06-05 09:12:09', 'admin', '2021-08-06 12:29:06', '系统管理目录'); +INSERT INTO `sys_menu` VALUES (2, '系统监控', 0, 52, 'monitor', NULL, 1, 0, 'M', '0', '0', '', 'monitor', 'admin', '2021-06-05 09:12:09', 'admin', '2021-08-06 12:29:12', '系统监控目录'); +INSERT INTO `sys_menu` VALUES (3, '系统工具', 0, 53, 'tool', NULL, 1, 0, 'M', '0', '0', '', 'tool', 'admin', '2021-06-05 09:12:09', 'admin', '2021-08-06 12:29:17', '系统工具目录'); +INSERT INTO `sys_menu` VALUES (100, '内部管理', 2027, 1, 'user', 'system/user/index', 1, 0, 'C', '0', '0', 'system:user:list', 'star', 'admin', '2021-06-05 09:12:09', 'admin', '2021-07-19 16:24:45', '用户管理菜单'); +INSERT INTO `sys_menu` VALUES (101, '角色管理', 2027, 6, 'role', 'system/role/index', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', '2021-06-05 09:12:09', 'admin', '2021-10-12 09:41:23', '角色管理菜单'); +INSERT INTO `sys_menu` VALUES (102, '菜单管理', 1, 3, 'menu', 'system/menu/index', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', '2021-06-05 09:12:09', '', NULL, '菜单管理菜单'); +INSERT INTO `sys_menu` VALUES (103, '集团管理', 2027, 4, 'dept', 'system/dept/index', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', '2021-06-05 09:12:09', 'admin', '2021-07-19 16:18:54', '部门管理菜单'); +INSERT INTO `sys_menu` VALUES (104, '岗位管理', 1, 5, 'post', 'system/post/index', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', '2021-06-05 09:12:09', '', NULL, '岗位管理菜单'); +INSERT INTO `sys_menu` VALUES (105, '字典管理', 1, 6, 'dict', 'system/dict/index', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', '2021-06-05 09:12:09', '', NULL, '字典管理菜单'); +INSERT INTO `sys_menu` VALUES (106, '参数设置', 1, 7, 'config', 'system/config/index', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', '2021-06-05 09:12:09', '', NULL, '参数设置菜单'); +INSERT INTO `sys_menu` VALUES (107, '通知公告', 1, 8, 'notice', 'system/notice/index', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', '2021-06-05 09:12:09', '', NULL, '通知公告菜单'); +INSERT INTO `sys_menu` VALUES (108, '日志管理', 1, 9, 'log', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', '2021-06-05 09:12:09', '', NULL, '日志管理菜单'); +INSERT INTO `sys_menu` VALUES (109, '在线用户', 2, 1, 'online', 'monitor/online/index', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', '2021-06-05 09:12:09', '', NULL, '在线用户菜单'); +INSERT INTO `sys_menu` VALUES (110, '定时任务', 2, 2, 'job', 'monitor/job/index', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', '2021-06-05 09:12:09', '', NULL, '定时任务菜单'); +INSERT INTO `sys_menu` VALUES (111, '数据监控', 2, 3, 'druid', 'monitor/druid/index', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', '2021-06-05 09:12:09', '', NULL, '数据监控菜单'); +INSERT INTO `sys_menu` VALUES (112, '服务监控', 2, 4, 'server', 'monitor/server/index', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', '2021-06-05 09:12:09', '', NULL, '服务监控菜单'); +INSERT INTO `sys_menu` VALUES (113, '缓存监控', 2, 5, 'cache', 'monitor/cache/index', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', '2021-06-05 09:12:09', '', NULL, '缓存监控菜单'); +INSERT INTO `sys_menu` VALUES (114, '表单构建', 3, 1, 'build', 'tool/build/index', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', '2021-06-05 09:12:09', '', NULL, '表单构建菜单'); +INSERT INTO `sys_menu` VALUES (115, '代码生成', 3, 2, 'gen', 'tool/gen/index', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', '2021-06-05 09:12:09', '', NULL, '代码生成菜单'); +INSERT INTO `sys_menu` VALUES (116, '系统接口', 3, 3, 'swagger', 'tool/swagger/index', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', '2021-06-05 09:12:09', '', NULL, '系统接口菜单'); +INSERT INTO `sys_menu` VALUES (500, '操作日志', 108, 1, 'operlog', 'monitor/operlog/index', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', '2021-06-05 09:12:09', '', NULL, '操作日志菜单'); +INSERT INTO `sys_menu` VALUES (501, '登录日志', 108, 2, 'logininfor', 'monitor/logininfor/index', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', '2021-06-05 09:12:09', '', NULL, '登录日志菜单'); +INSERT INTO `sys_menu` VALUES (1001, '用户查询', 100, 1, '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1002, '用户新增', 100, 2, '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1003, '用户修改', 100, 3, '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1004, '用户删除', 100, 4, '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1005, '用户导出', 100, 5, '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1006, '用户导入', 100, 6, '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1007, '重置密码', 100, 7, '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1008, '角色查询', 101, 1, '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1009, '角色新增', 101, 2, '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1010, '角色修改', 101, 3, '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1011, '角色删除', 101, 4, '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1012, '角色导出', 101, 5, '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1013, '菜单查询', 102, 1, '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1014, '菜单新增', 102, 2, '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1015, '菜单修改', 102, 3, '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1016, '菜单删除', 102, 4, '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1017, '部门查询', 103, 1, '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1018, '部门新增', 103, 2, '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1019, '部门修改', 103, 3, '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1020, '部门删除', 103, 4, '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1021, '岗位查询', 104, 1, '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1022, '岗位新增', 104, 2, '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1023, '岗位修改', 104, 3, '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1024, '岗位删除', 104, 4, '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1025, '岗位导出', 104, 5, '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1026, '字典查询', 105, 1, '#', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1027, '字典新增', 105, 2, '#', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1028, '字典修改', 105, 3, '#', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1029, '字典删除', 105, 4, '#', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1030, '字典导出', 105, 5, '#', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1031, '参数查询', 106, 1, '#', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1032, '参数新增', 106, 2, '#', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1033, '参数修改', 106, 3, '#', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1034, '参数删除', 106, 4, '#', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1035, '参数导出', 106, 5, '#', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1036, '公告查询', 107, 1, '#', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1037, '公告新增', 107, 2, '#', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1038, '公告修改', 107, 3, '#', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1039, '公告删除', 107, 4, '#', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1040, '操作查询', 500, 1, '#', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1041, '操作删除', 500, 2, '#', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1042, '日志导出', 500, 4, '#', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1043, '登录查询', 501, 1, '#', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1044, '登录删除', 501, 2, '#', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1045, '日志导出', 501, 3, '#', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1046, '在线查询', 109, 1, '#', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1047, '批量强退', 109, 2, '#', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1048, '单条强退', 109, 3, '#', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1049, '任务查询', 110, 1, '#', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1050, '任务新增', 110, 2, '#', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1051, '任务修改', 110, 3, '#', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1052, '任务删除', 110, 4, '#', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1053, '状态修改', 110, 5, '#', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1054, '任务导出', 110, 7, '#', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1055, '生成查询', 115, 1, '#', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1056, '生成修改', 115, 2, '#', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1057, '生成删除', 115, 3, '#', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1058, '导入代码', 115, 2, '#', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1059, '预览代码', 115, 4, '#', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1060, '生成代码', 115, 5, '#', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2000, '通信管理', 0, 21, 'card', NULL, 1, 0, 'M', '0', '0', '', 'excel', 'admin', '2021-06-05 10:59:36', 'admin', '2021-10-30 10:51:37', ''); +INSERT INTO `sys_menu` VALUES (2001, '物联卡管理', 2000, 0, 'card', 'yunze/flowcard/card/index', 1, 0, 'C', '0', '0', 'yunze:card:list', 'date', 'admin', '2021-06-05 11:00:26', 'admin', '2021-10-30 10:55:32', ''); +INSERT INTO `sys_menu` VALUES (2003, '详情查询', 2001, 2, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:find', '#', 'admin', '2021-06-09 13:48:19', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2004, '查询套餐信息', 2001, 99, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:queryflow', '#', 'admin', '2021-06-09 13:51:13', 'admin', '2021-06-11 14:20:22', ''); +INSERT INTO `sys_menu` VALUES (2005, '在线信息查询', 2003, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:queryOnlineStatus', '#', 'admin', '2021-06-11 09:21:29', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2006, '套餐简要信息查询', 2003, 0, '', NULL, 1, 0, 'F', '0', '0', 'yunze:cardFlow:queryflowSimple', '#', 'admin', '2021-06-11 09:23:33', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2008, '查询简要套餐名称', 2001, 3, '', NULL, 1, 0, 'F', '0', '0', 'yunze:cardFlow:queryPackageSimple', '#', 'admin', '2021-06-11 14:20:13', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2009, '导出', 2001, 4, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:exportData', '#', 'admin', '2021-06-15 12:34:30', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2010, '查询API通道名称', 2001, 5, '', NULL, 1, 0, 'F', '0', '0', 'yunze:cardRoute:findSp', '#', 'admin', '2021-06-15 17:10:14', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2011, '查询参数API通道', 2001, 6, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:queryParamsChannelId', '#', 'admin', '2021-06-16 09:13:34', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2012, '通道管理', 2000, 22, 'channel', NULL, 1, 0, 'M', '0', '0', '', 'tree', 'admin', '2021-06-19 11:22:42', 'admin', '2021-10-30 10:52:05', ''); +INSERT INTO `sys_menu` VALUES (2013, '上游通道', 2012, 0, 'cardRoute', 'yunze/API/cardRoute/index', 1, 0, 'C', '0', '0', 'yunze:cardRoute:list', 'cascader', 'admin', '2021-06-19 12:27:16', 'admin', '2021-06-19 13:57:55', ''); +INSERT INTO `sys_menu` VALUES (2014, '通道详情', 2013, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:cardRoute:find', '#', 'admin', '2021-06-21 09:04:27', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2015, '通道编辑', 2013, 2, '', NULL, 1, 0, 'F', '0', '0', 'yunze:cardRoute:edit', '#', 'admin', '2021-06-21 09:04:43', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2016, '通道删除', 2013, 3, '', NULL, 1, 0, 'F', '0', '0', 'yunze:cardRoute:remove', '#', 'admin', '2021-06-21 09:04:59', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2017, '查询公司所属', 0, 0, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:listAgent', '#', 'admin', '2021-06-21 11:18:33', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2018, '执行任务管理', 2000, 99, 'ExecutionTask', 'yunze/flowcard/executionTask', 1, 0, 'C', '0', '0', 'yunze:ExecutionTask:list', 'server', 'admin', '2021-06-21 13:39:44', 'admin', '2021-10-30 11:07:03', ''); +INSERT INTO `sys_menu` VALUES (2019, '执行任务下载', 2018, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:executionTask:download', '#', 'admin', '2021-06-21 14:32:39', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2020, '平台资费', 2109, 1, 'tariffGroup', 'yunze/flowcard/tariffGroup/index', 1, 0, 'C', '0', '0', 'yunze:tariffGroup:list', 'validCode', 'admin', '2021-06-22 10:44:50', 'admin', '2021-10-30 10:58:51', ''); +INSERT INTO `sys_menu` VALUES (2021, '客户资费', 2109, 2, 'agentTariffGroup', 'yunze/flowcard/tariffGroup/agent', 1, 0, 'C', '0', '0', 'yunze:agentTariffGroup:list', 'validCode', 'admin', '2021-06-22 11:58:20', 'admin', '2021-10-30 10:59:00', ''); +INSERT INTO `sys_menu` VALUES (2022, '平台资费组新增', 2020, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffGroup:add', '#', 'admin', '2021-06-23 16:00:39', 'admin', '2021-06-23 16:17:58', ''); +INSERT INTO `sys_menu` VALUES (2023, '平台资费组编辑', 2020, 2, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffGroup:edit', '#', 'admin', '2021-06-23 16:14:55', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2024, '平台资费计划新增', 2020, 3, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffPlan:add', '#', 'admin', '2021-06-23 16:16:22', 'admin', '2021-06-23 16:17:51', ''); +INSERT INTO `sys_menu` VALUES (2025, '平台资费计划详情', 2020, 4, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffPlan:find', '#', 'admin', '2021-06-23 16:17:05', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2026, '平台资费计划编辑', 2020, 5, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffPlan:edit', '#', 'admin', '2021-06-23 16:17:43', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2027, '用户管理', 0, 22, 'agent', NULL, 1, 0, 'M', '0', '0', NULL, 'peoples', 'admin', '2021-06-25 09:29:24', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2028, '集团列表', 2027, 2, 'agent', 'yunze/user/agent/index', 1, 0, 'C', '0', '0', 'yunze:agent:list', 'excel', 'admin', '2021-06-25 09:32:10', 'admin', '2021-07-19 16:24:54', ''); +INSERT INTO `sys_menu` VALUES (2029, '用户查询', 2028, 1, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2030, '用户新增', 2028, 2, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2031, '用户修改', 2028, 3, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2032, '用户删除', 2028, 4, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2033, '用户导出', 2028, 5, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:export', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2034, '用户导入', 2028, 6, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:import', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2035, '重置密码', 2028, 7, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:resetPwd', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2037, '划分资费查看', 2028, 0, '', NULL, 1, 0, 'F', '0', '0', 'yunze:agent:DividePlan', '#', 'admin', '2021-06-28 14:03:36', 'admin', '2021-06-28 14:14:43', ''); +INSERT INTO `sys_menu` VALUES (2038, '划分保存', 2037, 10, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffGroup:tariffDivision', '#', 'admin', '2021-06-28 14:15:33', 'admin', '2021-06-28 14:39:09', ''); +INSERT INTO `sys_menu` VALUES (2039, '资费组查询', 2037, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffGroup:findPackage', '#', 'admin', '2021-06-28 14:17:37', 'admin', '2021-06-28 14:18:03', ''); +INSERT INTO `sys_menu` VALUES (2040, '资费计划查询', 2037, 2, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffPlan:findPacket', '#', 'admin', '2021-06-28 14:39:01', 'admin', '2021-06-28 14:40:33', ''); +INSERT INTO `sys_menu` VALUES (2041, '用户列表', 2027, 3, 'agentUser', 'yunze/user/agentUser/index', 1, 0, 'C', '0', '0', 'yunze:agent:list', 'user', 'admin', '2021-06-25 09:32:10', 'admin', '2021-07-19 16:22:20', ''); +INSERT INTO `sys_menu` VALUES (2042, '用户查询', 2041, 1, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:query', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2043, '用户新增', 2041, 2, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:add', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2044, '用户修改', 2041, 3, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:edit', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2045, '用户删除', 2041, 4, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:remove', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2048, '重置密码', 2041, 7, '', '', 1, 0, 'F', '0', '0', 'yunze:agent:resetPwd', '#', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2050, '划分资费查看', 2041, 0, '', NULL, 1, 0, 'F', '0', '0', 'yunze:agent:DividePlan', '#', 'admin', '2021-06-28 14:03:36', 'admin', '2021-06-28 14:14:43', ''); +INSERT INTO `sys_menu` VALUES (2051, '划分保存', 2050, 10, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffGroup:agentTariffDivision', '#', 'admin', '2021-06-28 14:15:33', 'admin', '2021-06-29 13:33:58', ''); +INSERT INTO `sys_menu` VALUES (2052, '资费组查询', 2050, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffGroup:findPackage', '#', 'admin', '2021-06-28 14:17:37', 'admin', '2021-06-28 14:18:03', ''); +INSERT INTO `sys_menu` VALUES (2053, '资费计划查询', 2050, 2, '', NULL, 1, 0, 'F', '0', '0', 'yunze:tariffPlan:findPacket', '#', 'admin', '2021-06-28 14:39:01', 'admin', '2021-06-28 14:40:33', ''); +INSERT INTO `sys_menu` VALUES (2058, '卡板划分', 2001, 7, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:divide', '#', 'admin', '2021-07-02 10:00:00', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2059, '部门所属人员查询', 2058, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:findDeptUser', '#', 'admin', '2021-07-02 10:01:49', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2060, '同步用量', 2001, 8, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:SynFlow', '#', 'admin', '2021-07-21 18:04:29', 'admin', '2021-07-21 18:05:02', ''); +INSERT INTO `sys_menu` VALUES (2061, '同步状态', 2001, 9, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:SynStatus', '#', 'admin', '2021-07-21 18:04:46', 'admin', '2021-07-21 18:05:08', ''); +INSERT INTO `sys_menu` VALUES (2062, '机卡解绑', 2001, 10, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:CardBinding', '#', 'admin', '2021-07-26 13:09:59', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2063, '订单管理', 0, 23, 'order', NULL, 1, 0, 'M', '0', '0', '', 'chart', 'admin', '2021-08-06 12:28:49', 'admin', '2021-09-27 11:17:56', ''); +INSERT INTO `sys_menu` VALUES (2064, '全部订单', 2063, 10, 'OrderAll', 'yunze/order/ordeAll', 1, 0, 'C', '0', '0', 'yunze:order:list', 'chart', 'admin', '2021-08-06 12:32:11', 'admin', '2021-08-06 13:26:36', ''); +INSERT INTO `sys_menu` VALUES (2065, '订单列表查询', 2063, 0, '', NULL, 1, 0, 'F', '0', '0', 'yunze:order:list', '#', 'admin', '2021-08-06 12:32:56', 'admin', '2021-08-06 12:33:03', ''); +INSERT INTO `sys_menu` VALUES (2066, '可查询删除订单', 2063, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:order:dellist', '#', 'admin', '2021-08-09 11:04:05', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2067, '手动执行加包', 2063, 2, '', NULL, 1, 0, 'F', '0', '0', 'yunze:order:manualaddPackage', '#', 'admin', '2021-08-09 11:13:19', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2068, '金额订单', 2063, 11, 'OrderMoney', 'yunze/order/orderMoney', 1, 0, 'C', '0', '0', 'yunze:order:list', 'money', 'admin', '2021-08-09 11:51:56', 'admin', '2021-08-09 11:52:37', ''); +INSERT INTO `sys_menu` VALUES (2069, '资费订单', 2063, 12, 'OrderTariff', 'yunze/order/orderTariff', 1, 0, 'C', '0', '0', 'yunze:order:list', 'size', 'admin', '2021-08-09 12:03:34', 'admin', '2021-09-27 10:17:37', ''); +INSERT INTO `sys_menu` VALUES (2070, '订单详情', 2063, 3, '', NULL, 1, 0, 'F', '0', '0', 'yunze:order:findOrder', '#', 'admin', '2021-08-10 17:08:32', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2071, '资费订购', 2109, 3, 'RechargeTariff', 'yunze/flowcard/rechargeTariff', 1, 0, 'C', '0', '0', 'yunze:order:addPackage', 'money', 'admin', '2021-08-11 11:47:00', 'admin', '2021-10-30 11:02:12', ''); +INSERT INTO `sys_menu` VALUES (2072, '查询单条 资费计划 简要', 2071, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:cardFlow:FindPacket', '#', 'admin', '2021-08-12 11:04:20', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2073, '物联卡设置', 2000, 1, 'cardSetting', 'yunze/flowcard/cardSetting/index', 1, 0, 'C', '0', '0', 'yunze:card:Setting', 'system', 'admin', '2021-08-17 08:23:21', 'admin', '2021-10-30 11:06:55', ''); +INSERT INTO `sys_menu` VALUES (2074, '划分通道获取通道名称', 2073, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:cardRoute:findCr', '#', 'admin', '2021-08-17 12:16:00', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2075, '平台导入充值', 2071, 2, '', NULL, 1, 0, 'F', '0', '0', 'yunze:order:importRecharge', '#', 'admin', '2021-08-18 11:33:57', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2076, '连接管理导入设置', 2073, 2, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:importSet', '#', 'admin', '2021-08-18 11:35:15', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2079, '特殊操作', 3, 4, 'specialOperation', 'yunze/specialOperation/index', 1, 0, 'C', '0', '0', 'yunze:card:importSelImei', 'system', 'admin', '2021-08-20 15:09:10', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2080, '导入', 2001, 11, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:import', '#', 'admin', '2021-08-23 15:47:34', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2081, '是否内部人员', 0, 1, '', NULL, 1, 0, 'F', '0', '0', 'yunze:sys:internal', '#', 'admin', '2021-09-03 14:24:54', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2082, '用量详情', 2109, 7, 'flowhis', 'yunze/flowcard/card/cardFlowHis', 1, 0, 'C', '0', '0', 'yunze:flowhis:list', 'star', 'admin', '2021-08-25 10:55:35', 'admin', '2021-10-30 11:05:33', ''); +INSERT INTO `sys_menu` VALUES (2084, '通道进度', 2012, 2, 'polling', 'yunze/API/polling/index', 1, 0, 'C', '0', '0', 'yunze:polling:list', 'online', 'admin', '2021-08-26 11:19:57', 'admin', '2021-10-12 09:44:49', ''); +INSERT INTO `sys_menu` VALUES (2085, '订购历史', 2109, 6, 'flow', 'yunze/flowcard/card/cardFlow', 1, 0, 'C', '0', '0', 'yunze:flow:list', 'money', 'admin', '2021-09-02 08:48:44', 'admin', '2021-10-30 11:05:27', ''); +INSERT INTO `sys_menu` VALUES (2086, '日志执行', 108, 3, 'sysLog', 'yunze/system/sysLog/index', 1, 0, 'C', '0', '0', 'yunze:sysLog:list', 'skill', 'admin', '2021-08-23 14:53:03', 'admin', '2021-08-23 15:24:28', ''); +INSERT INTO `sys_menu` VALUES (2087, '订购资费查询', 2001, 12, '', NULL, 1, 0, 'F', '0', '0', 'yunze:flow:list', '#', 'admin', '2021-09-18 09:31:28', 'admin', '2021-09-30 14:47:33', ''); +INSERT INTO `sys_menu` VALUES (2088, '导入查询', 2001, 13, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:ImportQuery', '#', 'admin', '2021-09-23 09:22:31', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2089, '购物订单', 2063, 13, 'OrderShopping', 'yunze/order/OrderShopping', 1, 0, 'C', '0', '0', 'yunze:order:list', 'shopping', 'admin', '2021-09-27 10:16:46', 'admin', '2021-09-27 10:17:13', ''); +INSERT INTO `sys_menu` VALUES (2093, '卡信息变更查询', 2001, 14, '', NULL, 1, 0, 'F', '0', '0', 'yunze:change:list', '#', 'admin', '2021-09-27 13:31:00', 'admin', '2021-09-30 15:00:20', ''); +INSERT INTO `sys_menu` VALUES (2102, '查询发货订单', 2089, 21, '', NULL, 1, 0, 'F', '0', '0', 'yunze:order:findShip', '#', 'admin', '2021-09-30 11:28:54', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2104, '用量详情', 2001, 16, '', NULL, 1, 0, 'F', '0', '0', 'yunze:flowhis:list', '#', 'admin', '2021-09-30 15:00:11', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2106, '变更卡分组、备注', 2001, 17, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:importSetCardInfo', 'system', 'admin', '2021-10-14 09:45:45', 'admin', '2021-10-14 17:30:18', ''); +INSERT INTO `sys_menu` VALUES (2108, '设备管理', 2000, 8, 'card', 'yunze/flowcard/card/index', 1, 0, 'C', '0', '1', 'yunze:card:list', '#', 'admin', '2021-10-30 10:50:56', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2109, '资费管理', 2000, 3, 'TariffGroup', NULL, 1, 0, 'M', '0', '0', '', 'button', 'admin', '2021-10-30 10:58:35', 'admin', '2021-10-30 11:06:50', ''); +INSERT INTO `sys_menu` VALUES (2110, '批量停复机、断开网', 2001, 18, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:ApiUpdBatch', '#', 'admin', '2021-11-02 13:15:53', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2111, '自动化', 2114, 1, 'cc', 'yunze/automation/cc/index', 1, 0, 'C', '0', '0', 'yunze:cc:list', 'email', 'admin', '2021-10-13 13:46:33', 'admin', '2021-10-19 11:27:57', ''); +INSERT INTO `sys_menu` VALUES (2112, '推送记录', 2114, 2, 'cchis', 'yunze/automation/cchis/index', 1, 0, 'C', '0', '0', 'yunze:cchis:list', 'form', 'admin', '2021-10-19 15:27:32', 'admin', '2021-10-22 09:04:25', ''); +INSERT INTO `sys_menu` VALUES (2113, '配置', 2114, 3, 'ccurl', 'yunze/automation/ccurl/index', 1, 0, 'C', '0', '0', 'yunze:ccurl:list', 'upload', 'admin', '2021-10-19 16:59:20', 'admin', '2021-10-22 09:04:40', ''); +INSERT INTO `sys_menu` VALUES (2114, '自动化管理', 1, 10, 'loglog', NULL, 1, 0, 'M', '0', '0', '', 'guide', 'admin', '2021-10-13 13:39:34', 'admin', '2021-10-19 11:34:16', ''); +INSERT INTO `sys_menu` VALUES (2137, '导出订单', 2063, 4, '', NULL, 1, 0, 'F', '0', '0', 'yunze:order:outOrder', '#', 'admin', '2021-12-08 16:39:06', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2153, '勾选式停机', 2001, 20, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:Stopped', '#', 'admin', '2021-12-28 09:04:24', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2154, '勾选式复机', 2001, 21, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:MachineArr', '#', 'admin', '2021-12-28 09:04:52', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2155, '勾选式断网', 2001, 22, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:DisconnectNetworkArr', '#', 'admin', '2021-12-28 09:05:18', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2156, '勾选式开网', 2001, 23, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:OpenNetworkArr', '#', 'admin', '2021-12-28 09:05:38', 'admin', '2021-12-28 09:06:00', ''); +INSERT INTO `sys_menu` VALUES (2167, '勾选式批量同步用量', 2001, 24, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:ConsumptionArr', '#', 'admin', '2022-01-10 10:24:57', 'admin', '2022-01-10 10:26:46', ''); +INSERT INTO `sys_menu` VALUES (2168, '勾选式同步状态', 2001, 25, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:PublicMethodArr', '#', 'admin', '2022-01-10 10:25:15', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2169, '勾选式同步状态和用量', 2001, 26, '', NULL, 1, 0, 'F', '0', '0', 'yunze:card:ConsumptionAndStateArr', '#', 'admin', '2022-01-10 10:25:39', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (2170, '获取自动化管理抄送名字', 2114, 4, '', NULL, 1, 0, 'F', '0', '0', 'yunze:cc:nameadd', '#', 'admin', '2022-01-12 10:41:45', '', NULL, ''); + +-- ---------------------------- +-- Table structure for sys_notice +-- ---------------------------- +DROP TABLE IF EXISTS `sys_notice`; +CREATE TABLE `sys_notice` ( + `notice_id` int(0) NOT NULL AUTO_INCREMENT COMMENT '公告ID', + `notice_title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '公告标题', + `notice_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '公告类型(1通知 2公告)', + `notice_content` longblob NULL COMMENT '公告内容', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '公告状态(0正常 1关闭)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`notice_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '通知公告表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_notice +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_oper_log +-- ---------------------------- +DROP TABLE IF EXISTS `sys_oper_log`; +CREATE TABLE `sys_oper_log` ( + `oper_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '日志主键', + `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '模块标题', + `business_type` int(0) NULL DEFAULT 0 COMMENT '业务类型(0其它 1新增 2修改 3删除)', + `method` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '方法名称', + `request_method` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '请求方式', + `operator_type` int(0) NULL DEFAULT 0 COMMENT '操作类别(0其它 1后台用户 2手机端用户)', + `oper_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '操作人员', + `dept_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '部门名称', + `oper_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '请求URL', + `oper_ip` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '主机地址', + `oper_location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '操作地点', + `oper_param` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '请求参数', + `json_result` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '返回参数', + `status` int(0) NULL DEFAULT 0 COMMENT '操作状态(0正常 1异常)', + `error_msg` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '错误消息', + `oper_time` datetime(0) NULL DEFAULT NULL COMMENT '操作时间', + PRIMARY KEY (`oper_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 5785 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作日志记录' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_oper_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_post +-- ---------------------------- +DROP TABLE IF EXISTS `sys_post`; +CREATE TABLE `sys_post` ( + `post_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '岗位ID', + `post_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '岗位编码', + `post_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '岗位名称', + `post_sort` int(0) NOT NULL COMMENT '显示顺序', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '状态(0正常 1停用)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`post_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '岗位信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_post +-- ---------------------------- +INSERT INTO `sys_post` VALUES (1, 'ceo', '董事长', 1, '0', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_post` VALUES (2, 'se', '项目经理', 2, '0', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_post` VALUES (3, 'hr', '人力资源', 3, '0', 'admin', '2021-06-05 09:12:09', '', NULL, ''); +INSERT INTO `sys_post` VALUES (4, 'user', '普通员工', 4, '0', 'admin', '2021-06-05 09:12:09', '', NULL, ''); + +-- ---------------------------- +-- Table structure for sys_role +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role`; +CREATE TABLE `sys_role` ( + `role_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '角色ID', + `role_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色名称', + `role_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色权限字符串', + `role_sort` int(0) NOT NULL COMMENT '显示顺序', + `data_scope` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', + `menu_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '菜单树选择项是否关联显示', + `dept_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '部门树选择项是否关联显示', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色状态(0正常 1停用)', + `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`role_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_role +-- ---------------------------- +INSERT INTO `sys_role` VALUES (1, '超级管理员', 'admin', 1, '1', 1, 1, '0', '0', 'admin', '2021-06-05 09:12:09', '', NULL, '超级管理员'); +INSERT INTO `sys_role` VALUES (2, '集团客户', 'common', 2, '4', 1, 0, '0', '0', 'admin', '2021-06-05 09:12:09', '5iot', '2022-01-12 10:47:05', '普通角色'); +INSERT INTO `sys_role` VALUES (3, '开发', 'development', 99, '1', 1, 1, '0', '0', 'admin', '2021-06-22 11:49:48', 'admin', '2021-11-19 10:46:15', NULL); +INSERT INTO `sys_role` VALUES (4, '用户', 'user', 3, '4', 1, 1, '0', '0', 'admin', '2021-06-25 09:11:37', 'admin', '2021-10-15 10:36:40', '3级'); +INSERT INTO `sys_role` VALUES (5, '内部人员', 'adminUser', 5, '1', 0, 0, '0', '0', 'admin', '2021-07-06 10:17:03', '5iot', '2022-01-12 10:48:59', NULL); +INSERT INTO `sys_role` VALUES (6, '销售部经理', 'salesManager', 6, '1', 0, 0, '0', '0', 'admin', '2021-12-30 11:11:47', '5iot', '2022-01-12 10:49:40', NULL); +INSERT INTO `sys_role` VALUES (7, '销售业务员', 'Sales', 7, '1', 1, 1, '0', '0', 'admin', '2022-01-04 08:53:22', 'admin', '2022-01-05 17:25:45', NULL); +INSERT INTO `sys_role` VALUES (8, '仓库管理员', 'WarehouseManager', 8, '1', 1, 1, '0', '0', 'admin', '2022-01-04 14:02:35', 'admin', '2022-01-04 14:05:17', NULL); +INSERT INTO `sys_role` VALUES (9, '演示账号', 'testdome', 9, '1', 1, 1, '0', '0', 'admin', '2022-01-12 10:31:59', 'admin', '2022-01-12 11:18:24', NULL); + +-- ---------------------------- +-- Table structure for sys_role_dept +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role_dept`; +CREATE TABLE `sys_role_dept` ( + `role_id` bigint(0) NOT NULL COMMENT '角色ID', + `dept_id` bigint(0) NOT NULL COMMENT '部门ID', + PRIMARY KEY (`role_id`, `dept_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色和部门关联表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_role_dept +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_role_menu +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role_menu`; +CREATE TABLE `sys_role_menu` ( + `role_id` bigint(0) NOT NULL COMMENT '角色ID', + `menu_id` bigint(0) NOT NULL COMMENT '菜单ID', + PRIMARY KEY (`role_id`, `menu_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色和菜单关联表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_role_menu +-- ---------------------------- +INSERT INTO `sys_role_menu` VALUES (2, 103); +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, 2000); +INSERT INTO `sys_role_menu` VALUES (2, 2001); +INSERT INTO `sys_role_menu` VALUES (2, 2003); +INSERT INTO `sys_role_menu` VALUES (2, 2004); +INSERT INTO `sys_role_menu` VALUES (2, 2005); +INSERT INTO `sys_role_menu` VALUES (2, 2006); +INSERT INTO `sys_role_menu` VALUES (2, 2008); +INSERT INTO `sys_role_menu` VALUES (2, 2009); +INSERT INTO `sys_role_menu` VALUES (2, 2018); +INSERT INTO `sys_role_menu` VALUES (2, 2019); +INSERT INTO `sys_role_menu` VALUES (2, 2027); +INSERT INTO `sys_role_menu` VALUES (2, 2041); +INSERT INTO `sys_role_menu` VALUES (2, 2042); +INSERT INTO `sys_role_menu` VALUES (2, 2043); +INSERT INTO `sys_role_menu` VALUES (2, 2044); +INSERT INTO `sys_role_menu` VALUES (2, 2050); +INSERT INTO `sys_role_menu` VALUES (2, 2051); +INSERT INTO `sys_role_menu` VALUES (2, 2052); +INSERT INTO `sys_role_menu` VALUES (2, 2053); +INSERT INTO `sys_role_menu` VALUES (2, 2058); +INSERT INTO `sys_role_menu` VALUES (2, 2059); +INSERT INTO `sys_role_menu` VALUES (2, 2060); +INSERT INTO `sys_role_menu` VALUES (2, 2061); +INSERT INTO `sys_role_menu` VALUES (2, 2088); +INSERT INTO `sys_role_menu` VALUES (3, 1); +INSERT INTO `sys_role_menu` VALUES (3, 2); +INSERT INTO `sys_role_menu` VALUES (3, 3); +INSERT INTO `sys_role_menu` VALUES (3, 100); +INSERT INTO `sys_role_menu` VALUES (3, 101); +INSERT INTO `sys_role_menu` VALUES (3, 102); +INSERT INTO `sys_role_menu` VALUES (3, 103); +INSERT INTO `sys_role_menu` VALUES (3, 104); +INSERT INTO `sys_role_menu` VALUES (3, 105); +INSERT INTO `sys_role_menu` VALUES (3, 106); +INSERT INTO `sys_role_menu` VALUES (3, 107); +INSERT INTO `sys_role_menu` VALUES (3, 108); +INSERT INTO `sys_role_menu` VALUES (3, 109); +INSERT INTO `sys_role_menu` VALUES (3, 110); +INSERT INTO `sys_role_menu` VALUES (3, 111); +INSERT INTO `sys_role_menu` VALUES (3, 112); +INSERT INTO `sys_role_menu` VALUES (3, 113); +INSERT INTO `sys_role_menu` VALUES (3, 114); +INSERT INTO `sys_role_menu` VALUES (3, 115); +INSERT INTO `sys_role_menu` VALUES (3, 116); +INSERT INTO `sys_role_menu` VALUES (3, 500); +INSERT INTO `sys_role_menu` VALUES (3, 501); +INSERT INTO `sys_role_menu` VALUES (3, 1001); +INSERT INTO `sys_role_menu` VALUES (3, 1002); +INSERT INTO `sys_role_menu` VALUES (3, 1003); +INSERT INTO `sys_role_menu` VALUES (3, 1004); +INSERT INTO `sys_role_menu` VALUES (3, 1005); +INSERT INTO `sys_role_menu` VALUES (3, 1006); +INSERT INTO `sys_role_menu` VALUES (3, 1007); +INSERT INTO `sys_role_menu` VALUES (3, 1008); +INSERT INTO `sys_role_menu` VALUES (3, 1009); +INSERT INTO `sys_role_menu` VALUES (3, 1010); +INSERT INTO `sys_role_menu` VALUES (3, 1011); +INSERT INTO `sys_role_menu` VALUES (3, 1012); +INSERT INTO `sys_role_menu` VALUES (3, 1013); +INSERT INTO `sys_role_menu` VALUES (3, 1014); +INSERT INTO `sys_role_menu` VALUES (3, 1015); +INSERT INTO `sys_role_menu` VALUES (3, 1016); +INSERT INTO `sys_role_menu` VALUES (3, 1017); +INSERT INTO `sys_role_menu` VALUES (3, 1018); +INSERT INTO `sys_role_menu` VALUES (3, 1019); +INSERT INTO `sys_role_menu` VALUES (3, 1020); +INSERT INTO `sys_role_menu` VALUES (3, 1021); +INSERT INTO `sys_role_menu` VALUES (3, 1022); +INSERT INTO `sys_role_menu` VALUES (3, 1023); +INSERT INTO `sys_role_menu` VALUES (3, 1024); +INSERT INTO `sys_role_menu` VALUES (3, 1025); +INSERT INTO `sys_role_menu` VALUES (3, 1026); +INSERT INTO `sys_role_menu` VALUES (3, 1027); +INSERT INTO `sys_role_menu` VALUES (3, 1028); +INSERT INTO `sys_role_menu` VALUES (3, 1029); +INSERT INTO `sys_role_menu` VALUES (3, 1030); +INSERT INTO `sys_role_menu` VALUES (3, 1031); +INSERT INTO `sys_role_menu` VALUES (3, 1032); +INSERT INTO `sys_role_menu` VALUES (3, 1033); +INSERT INTO `sys_role_menu` VALUES (3, 1034); +INSERT INTO `sys_role_menu` VALUES (3, 1035); +INSERT INTO `sys_role_menu` VALUES (3, 1036); +INSERT INTO `sys_role_menu` VALUES (3, 1037); +INSERT INTO `sys_role_menu` VALUES (3, 1038); +INSERT INTO `sys_role_menu` VALUES (3, 1039); +INSERT INTO `sys_role_menu` VALUES (3, 1040); +INSERT INTO `sys_role_menu` VALUES (3, 1041); +INSERT INTO `sys_role_menu` VALUES (3, 1042); +INSERT INTO `sys_role_menu` VALUES (3, 1043); +INSERT INTO `sys_role_menu` VALUES (3, 1044); +INSERT INTO `sys_role_menu` VALUES (3, 1045); +INSERT INTO `sys_role_menu` VALUES (3, 1046); +INSERT INTO `sys_role_menu` VALUES (3, 1047); +INSERT INTO `sys_role_menu` VALUES (3, 1048); +INSERT INTO `sys_role_menu` VALUES (3, 1049); +INSERT INTO `sys_role_menu` VALUES (3, 1050); +INSERT INTO `sys_role_menu` VALUES (3, 1051); +INSERT INTO `sys_role_menu` VALUES (3, 1053); +INSERT INTO `sys_role_menu` VALUES (3, 1054); +INSERT INTO `sys_role_menu` VALUES (3, 1055); +INSERT INTO `sys_role_menu` VALUES (3, 1056); +INSERT INTO `sys_role_menu` VALUES (3, 1057); +INSERT INTO `sys_role_menu` VALUES (3, 1058); +INSERT INTO `sys_role_menu` VALUES (3, 1059); +INSERT INTO `sys_role_menu` VALUES (3, 1060); +INSERT INTO `sys_role_menu` VALUES (3, 2000); +INSERT INTO `sys_role_menu` VALUES (3, 2001); +INSERT INTO `sys_role_menu` VALUES (3, 2003); +INSERT INTO `sys_role_menu` VALUES (3, 2004); +INSERT INTO `sys_role_menu` VALUES (3, 2005); +INSERT INTO `sys_role_menu` VALUES (3, 2006); +INSERT INTO `sys_role_menu` VALUES (3, 2008); +INSERT INTO `sys_role_menu` VALUES (3, 2009); +INSERT INTO `sys_role_menu` VALUES (3, 2010); +INSERT INTO `sys_role_menu` VALUES (3, 2011); +INSERT INTO `sys_role_menu` VALUES (3, 2012); +INSERT INTO `sys_role_menu` VALUES (3, 2013); +INSERT INTO `sys_role_menu` VALUES (3, 2014); +INSERT INTO `sys_role_menu` VALUES (3, 2015); +INSERT INTO `sys_role_menu` VALUES (3, 2016); +INSERT INTO `sys_role_menu` VALUES (3, 2017); +INSERT INTO `sys_role_menu` VALUES (3, 2018); +INSERT INTO `sys_role_menu` VALUES (3, 2019); +INSERT INTO `sys_role_menu` VALUES (3, 2020); +INSERT INTO `sys_role_menu` VALUES (3, 2021); +INSERT INTO `sys_role_menu` VALUES (3, 2022); +INSERT INTO `sys_role_menu` VALUES (3, 2023); +INSERT INTO `sys_role_menu` VALUES (3, 2024); +INSERT INTO `sys_role_menu` VALUES (3, 2025); +INSERT INTO `sys_role_menu` VALUES (3, 2026); +INSERT INTO `sys_role_menu` VALUES (3, 2027); +INSERT INTO `sys_role_menu` VALUES (3, 2028); +INSERT INTO `sys_role_menu` VALUES (3, 2029); +INSERT INTO `sys_role_menu` VALUES (3, 2030); +INSERT INTO `sys_role_menu` VALUES (3, 2031); +INSERT INTO `sys_role_menu` VALUES (3, 2032); +INSERT INTO `sys_role_menu` VALUES (3, 2033); +INSERT INTO `sys_role_menu` VALUES (3, 2034); +INSERT INTO `sys_role_menu` VALUES (3, 2035); +INSERT INTO `sys_role_menu` VALUES (3, 2037); +INSERT INTO `sys_role_menu` VALUES (3, 2038); +INSERT INTO `sys_role_menu` VALUES (3, 2039); +INSERT INTO `sys_role_menu` VALUES (3, 2040); +INSERT INTO `sys_role_menu` VALUES (3, 2041); +INSERT INTO `sys_role_menu` VALUES (3, 2042); +INSERT INTO `sys_role_menu` VALUES (3, 2043); +INSERT INTO `sys_role_menu` VALUES (3, 2044); +INSERT INTO `sys_role_menu` VALUES (3, 2045); +INSERT INTO `sys_role_menu` VALUES (3, 2048); +INSERT INTO `sys_role_menu` VALUES (3, 2050); +INSERT INTO `sys_role_menu` VALUES (3, 2051); +INSERT INTO `sys_role_menu` VALUES (3, 2052); +INSERT INTO `sys_role_menu` VALUES (3, 2053); +INSERT INTO `sys_role_menu` VALUES (3, 2058); +INSERT INTO `sys_role_menu` VALUES (3, 2059); +INSERT INTO `sys_role_menu` VALUES (3, 2060); +INSERT INTO `sys_role_menu` VALUES (3, 2061); +INSERT INTO `sys_role_menu` VALUES (3, 2062); +INSERT INTO `sys_role_menu` VALUES (3, 2063); +INSERT INTO `sys_role_menu` VALUES (3, 2064); +INSERT INTO `sys_role_menu` VALUES (3, 2065); +INSERT INTO `sys_role_menu` VALUES (3, 2066); +INSERT INTO `sys_role_menu` VALUES (3, 2067); +INSERT INTO `sys_role_menu` VALUES (3, 2068); +INSERT INTO `sys_role_menu` VALUES (3, 2069); +INSERT INTO `sys_role_menu` VALUES (3, 2070); +INSERT INTO `sys_role_menu` VALUES (3, 2071); +INSERT INTO `sys_role_menu` VALUES (3, 2072); +INSERT INTO `sys_role_menu` VALUES (3, 2073); +INSERT INTO `sys_role_menu` VALUES (3, 2074); +INSERT INTO `sys_role_menu` VALUES (3, 2075); +INSERT INTO `sys_role_menu` VALUES (3, 2076); +INSERT INTO `sys_role_menu` VALUES (3, 2079); +INSERT INTO `sys_role_menu` VALUES (3, 2080); +INSERT INTO `sys_role_menu` VALUES (3, 2081); +INSERT INTO `sys_role_menu` VALUES (3, 2082); +INSERT INTO `sys_role_menu` VALUES (3, 2084); +INSERT INTO `sys_role_menu` VALUES (3, 2085); +INSERT INTO `sys_role_menu` VALUES (3, 2087); +INSERT INTO `sys_role_menu` VALUES (3, 2088); +INSERT INTO `sys_role_menu` VALUES (3, 2093); +INSERT INTO `sys_role_menu` VALUES (3, 2104); +INSERT INTO `sys_role_menu` VALUES (3, 2105); +INSERT INTO `sys_role_menu` VALUES (3, 2106); +INSERT INTO `sys_role_menu` VALUES (3, 2107); +INSERT INTO `sys_role_menu` VALUES (3, 2108); +INSERT INTO `sys_role_menu` VALUES (3, 2109); +INSERT INTO `sys_role_menu` VALUES (3, 2110); +INSERT INTO `sys_role_menu` VALUES (3, 2115); +INSERT INTO `sys_role_menu` VALUES (4, 2000); +INSERT INTO `sys_role_menu` VALUES (4, 2001); +INSERT INTO `sys_role_menu` VALUES (4, 2003); +INSERT INTO `sys_role_menu` VALUES (4, 2004); +INSERT INTO `sys_role_menu` VALUES (4, 2005); +INSERT INTO `sys_role_menu` VALUES (4, 2006); +INSERT INTO `sys_role_menu` VALUES (4, 2008); +INSERT INTO `sys_role_menu` VALUES (4, 2009); +INSERT INTO `sys_role_menu` VALUES (4, 2010); +INSERT INTO `sys_role_menu` VALUES (4, 2017); +INSERT INTO `sys_role_menu` VALUES (4, 2018); +INSERT INTO `sys_role_menu` VALUES (4, 2019); +INSERT INTO `sys_role_menu` VALUES (4, 2021); +INSERT INTO `sys_role_menu` VALUES (4, 2027); +INSERT INTO `sys_role_menu` VALUES (4, 2041); +INSERT INTO `sys_role_menu` VALUES (4, 2042); +INSERT INTO `sys_role_menu` VALUES (4, 2050); +INSERT INTO `sys_role_menu` VALUES (4, 2052); +INSERT INTO `sys_role_menu` VALUES (4, 2053); +INSERT INTO `sys_role_menu` VALUES (4, 2060); +INSERT INTO `sys_role_menu` VALUES (4, 2061); +INSERT INTO `sys_role_menu` VALUES (4, 2063); +INSERT INTO `sys_role_menu` VALUES (4, 2064); +INSERT INTO `sys_role_menu` VALUES (4, 2065); +INSERT INTO `sys_role_menu` VALUES (4, 2068); +INSERT INTO `sys_role_menu` VALUES (4, 2069); +INSERT INTO `sys_role_menu` VALUES (4, 2087); +INSERT INTO `sys_role_menu` VALUES (4, 2093); +INSERT INTO `sys_role_menu` VALUES (5, 1); +INSERT INTO `sys_role_menu` VALUES (5, 2); +INSERT INTO `sys_role_menu` VALUES (5, 3); +INSERT INTO `sys_role_menu` VALUES (5, 100); +INSERT INTO `sys_role_menu` VALUES (5, 101); +INSERT INTO `sys_role_menu` VALUES (5, 103); +INSERT INTO `sys_role_menu` VALUES (5, 109); +INSERT INTO `sys_role_menu` VALUES (5, 1001); +INSERT INTO `sys_role_menu` VALUES (5, 1002); +INSERT INTO `sys_role_menu` VALUES (5, 1003); +INSERT INTO `sys_role_menu` VALUES (5, 1004); +INSERT INTO `sys_role_menu` VALUES (5, 1005); +INSERT INTO `sys_role_menu` VALUES (5, 1006); +INSERT INTO `sys_role_menu` VALUES (5, 1007); +INSERT INTO `sys_role_menu` VALUES (5, 1008); +INSERT INTO `sys_role_menu` VALUES (5, 1017); +INSERT INTO `sys_role_menu` VALUES (5, 1018); +INSERT INTO `sys_role_menu` VALUES (5, 1019); +INSERT INTO `sys_role_menu` VALUES (5, 1046); +INSERT INTO `sys_role_menu` VALUES (5, 2000); +INSERT INTO `sys_role_menu` VALUES (5, 2001); +INSERT INTO `sys_role_menu` VALUES (5, 2003); +INSERT INTO `sys_role_menu` VALUES (5, 2004); +INSERT INTO `sys_role_menu` VALUES (5, 2005); +INSERT INTO `sys_role_menu` VALUES (5, 2006); +INSERT INTO `sys_role_menu` VALUES (5, 2008); +INSERT INTO `sys_role_menu` VALUES (5, 2009); +INSERT INTO `sys_role_menu` VALUES (5, 2010); +INSERT INTO `sys_role_menu` VALUES (5, 2011); +INSERT INTO `sys_role_menu` VALUES (5, 2012); +INSERT INTO `sys_role_menu` VALUES (5, 2013); +INSERT INTO `sys_role_menu` VALUES (5, 2014); +INSERT INTO `sys_role_menu` VALUES (5, 2015); +INSERT INTO `sys_role_menu` VALUES (5, 2016); +INSERT INTO `sys_role_menu` VALUES (5, 2017); +INSERT INTO `sys_role_menu` VALUES (5, 2018); +INSERT INTO `sys_role_menu` VALUES (5, 2019); +INSERT INTO `sys_role_menu` VALUES (5, 2020); +INSERT INTO `sys_role_menu` VALUES (5, 2021); +INSERT INTO `sys_role_menu` VALUES (5, 2022); +INSERT INTO `sys_role_menu` VALUES (5, 2023); +INSERT INTO `sys_role_menu` VALUES (5, 2024); +INSERT INTO `sys_role_menu` VALUES (5, 2025); +INSERT INTO `sys_role_menu` VALUES (5, 2026); +INSERT INTO `sys_role_menu` VALUES (5, 2027); +INSERT INTO `sys_role_menu` VALUES (5, 2028); +INSERT INTO `sys_role_menu` VALUES (5, 2029); +INSERT INTO `sys_role_menu` VALUES (5, 2030); +INSERT INTO `sys_role_menu` VALUES (5, 2031); +INSERT INTO `sys_role_menu` VALUES (5, 2032); +INSERT INTO `sys_role_menu` VALUES (5, 2033); +INSERT INTO `sys_role_menu` VALUES (5, 2034); +INSERT INTO `sys_role_menu` VALUES (5, 2035); +INSERT INTO `sys_role_menu` VALUES (5, 2037); +INSERT INTO `sys_role_menu` VALUES (5, 2038); +INSERT INTO `sys_role_menu` VALUES (5, 2039); +INSERT INTO `sys_role_menu` VALUES (5, 2040); +INSERT INTO `sys_role_menu` VALUES (5, 2041); +INSERT INTO `sys_role_menu` VALUES (5, 2042); +INSERT INTO `sys_role_menu` VALUES (5, 2043); +INSERT INTO `sys_role_menu` VALUES (5, 2044); +INSERT INTO `sys_role_menu` VALUES (5, 2045); +INSERT INTO `sys_role_menu` VALUES (5, 2048); +INSERT INTO `sys_role_menu` VALUES (5, 2050); +INSERT INTO `sys_role_menu` VALUES (5, 2051); +INSERT INTO `sys_role_menu` VALUES (5, 2052); +INSERT INTO `sys_role_menu` VALUES (5, 2053); +INSERT INTO `sys_role_menu` VALUES (5, 2058); +INSERT INTO `sys_role_menu` VALUES (5, 2059); +INSERT INTO `sys_role_menu` VALUES (5, 2060); +INSERT INTO `sys_role_menu` VALUES (5, 2061); +INSERT INTO `sys_role_menu` VALUES (5, 2062); +INSERT INTO `sys_role_menu` VALUES (5, 2063); +INSERT INTO `sys_role_menu` VALUES (5, 2064); +INSERT INTO `sys_role_menu` VALUES (5, 2065); +INSERT INTO `sys_role_menu` VALUES (5, 2066); +INSERT INTO `sys_role_menu` VALUES (5, 2067); +INSERT INTO `sys_role_menu` VALUES (5, 2068); +INSERT INTO `sys_role_menu` VALUES (5, 2069); +INSERT INTO `sys_role_menu` VALUES (5, 2070); +INSERT INTO `sys_role_menu` VALUES (5, 2071); +INSERT INTO `sys_role_menu` VALUES (5, 2072); +INSERT INTO `sys_role_menu` VALUES (5, 2073); +INSERT INTO `sys_role_menu` VALUES (5, 2074); +INSERT INTO `sys_role_menu` VALUES (5, 2075); +INSERT INTO `sys_role_menu` VALUES (5, 2076); +INSERT INTO `sys_role_menu` VALUES (5, 2079); +INSERT INTO `sys_role_menu` VALUES (5, 2080); +INSERT INTO `sys_role_menu` VALUES (5, 2081); +INSERT INTO `sys_role_menu` VALUES (5, 2082); +INSERT INTO `sys_role_menu` VALUES (5, 2084); +INSERT INTO `sys_role_menu` VALUES (5, 2085); +INSERT INTO `sys_role_menu` VALUES (5, 2087); +INSERT INTO `sys_role_menu` VALUES (5, 2088); +INSERT INTO `sys_role_menu` VALUES (5, 2089); +INSERT INTO `sys_role_menu` VALUES (5, 2090); +INSERT INTO `sys_role_menu` VALUES (5, 2093); +INSERT INTO `sys_role_menu` VALUES (5, 2102); +INSERT INTO `sys_role_menu` VALUES (5, 2104); +INSERT INTO `sys_role_menu` VALUES (5, 2105); +INSERT INTO `sys_role_menu` VALUES (5, 2106); +INSERT INTO `sys_role_menu` VALUES (5, 2107); +INSERT INTO `sys_role_menu` VALUES (5, 2109); +INSERT INTO `sys_role_menu` VALUES (5, 2110); +INSERT INTO `sys_role_menu` VALUES (5, 2115); +INSERT INTO `sys_role_menu` VALUES (5, 2116); +INSERT INTO `sys_role_menu` VALUES (5, 2120); +INSERT INTO `sys_role_menu` VALUES (5, 2123); +INSERT INTO `sys_role_menu` VALUES (5, 2124); +INSERT INTO `sys_role_menu` VALUES (5, 2125); +INSERT INTO `sys_role_menu` VALUES (5, 2129); +INSERT INTO `sys_role_menu` VALUES (5, 2130); +INSERT INTO `sys_role_menu` VALUES (5, 2131); +INSERT INTO `sys_role_menu` VALUES (5, 2132); +INSERT INTO `sys_role_menu` VALUES (5, 2134); +INSERT INTO `sys_role_menu` VALUES (5, 2135); +INSERT INTO `sys_role_menu` VALUES (5, 2136); +INSERT INTO `sys_role_menu` VALUES (5, 2137); +INSERT INTO `sys_role_menu` VALUES (5, 2138); +INSERT INTO `sys_role_menu` VALUES (5, 2139); +INSERT INTO `sys_role_menu` VALUES (5, 2140); +INSERT INTO `sys_role_menu` VALUES (5, 2141); +INSERT INTO `sys_role_menu` VALUES (5, 2142); +INSERT INTO `sys_role_menu` VALUES (5, 2143); +INSERT INTO `sys_role_menu` VALUES (5, 2144); +INSERT INTO `sys_role_menu` VALUES (5, 2145); +INSERT INTO `sys_role_menu` VALUES (5, 2148); +INSERT INTO `sys_role_menu` VALUES (5, 2149); +INSERT INTO `sys_role_menu` VALUES (5, 2150); +INSERT INTO `sys_role_menu` VALUES (5, 2152); +INSERT INTO `sys_role_menu` VALUES (5, 2153); +INSERT INTO `sys_role_menu` VALUES (5, 2154); +INSERT INTO `sys_role_menu` VALUES (5, 2155); +INSERT INTO `sys_role_menu` VALUES (5, 2156); +INSERT INTO `sys_role_menu` VALUES (5, 2157); +INSERT INTO `sys_role_menu` VALUES (5, 2158); +INSERT INTO `sys_role_menu` VALUES (5, 2159); +INSERT INTO `sys_role_menu` VALUES (5, 2161); +INSERT INTO `sys_role_menu` VALUES (5, 2162); +INSERT INTO `sys_role_menu` VALUES (5, 2163); +INSERT INTO `sys_role_menu` VALUES (5, 2164); +INSERT INTO `sys_role_menu` VALUES (5, 2167); +INSERT INTO `sys_role_menu` VALUES (5, 2168); +INSERT INTO `sys_role_menu` VALUES (5, 2169); +INSERT INTO `sys_role_menu` VALUES (6, 2105); +INSERT INTO `sys_role_menu` VALUES (6, 2118); +INSERT INTO `sys_role_menu` VALUES (6, 2119); +INSERT INTO `sys_role_menu` VALUES (6, 2121); +INSERT INTO `sys_role_menu` VALUES (6, 2125); +INSERT INTO `sys_role_menu` VALUES (6, 2166); +INSERT INTO `sys_role_menu` VALUES (7, 2105); +INSERT INTO `sys_role_menu` VALUES (7, 2119); +INSERT INTO `sys_role_menu` VALUES (7, 2125); +INSERT INTO `sys_role_menu` VALUES (7, 2165); +INSERT INTO `sys_role_menu` VALUES (8, 2090); +INSERT INTO `sys_role_menu` VALUES (8, 2105); +INSERT INTO `sys_role_menu` VALUES (8, 2116); +INSERT INTO `sys_role_menu` VALUES (8, 2117); +INSERT INTO `sys_role_menu` VALUES (8, 2123); +INSERT INTO `sys_role_menu` VALUES (8, 2124); +INSERT INTO `sys_role_menu` VALUES (8, 2125); +INSERT INTO `sys_role_menu` VALUES (8, 2126); +INSERT INTO `sys_role_menu` VALUES (8, 2127); +INSERT INTO `sys_role_menu` VALUES (8, 2128); +INSERT INTO `sys_role_menu` VALUES (8, 2129); +INSERT INTO `sys_role_menu` VALUES (8, 2140); +INSERT INTO `sys_role_menu` VALUES (8, 2141); +INSERT INTO `sys_role_menu` VALUES (8, 2142); +INSERT INTO `sys_role_menu` VALUES (8, 2143); +INSERT INTO `sys_role_menu` VALUES (8, 2144); +INSERT INTO `sys_role_menu` VALUES (8, 2145); +INSERT INTO `sys_role_menu` VALUES (8, 2146); +INSERT INTO `sys_role_menu` VALUES (8, 2147); +INSERT INTO `sys_role_menu` VALUES (8, 2148); +INSERT INTO `sys_role_menu` VALUES (8, 2149); +INSERT INTO `sys_role_menu` VALUES (8, 2150); +INSERT INTO `sys_role_menu` VALUES (8, 2151); +INSERT INTO `sys_role_menu` VALUES (8, 2152); +INSERT INTO `sys_role_menu` VALUES (8, 2157); +INSERT INTO `sys_role_menu` VALUES (8, 2159); +INSERT INTO `sys_role_menu` VALUES (8, 2160); +INSERT INTO `sys_role_menu` VALUES (8, 2162); +INSERT INTO `sys_role_menu` VALUES (8, 2163); +INSERT INTO `sys_role_menu` VALUES (8, 2164); +INSERT INTO `sys_role_menu` VALUES (9, 1); +INSERT INTO `sys_role_menu` VALUES (9, 2); +INSERT INTO `sys_role_menu` VALUES (9, 3); +INSERT INTO `sys_role_menu` VALUES (9, 100); +INSERT INTO `sys_role_menu` VALUES (9, 101); +INSERT INTO `sys_role_menu` VALUES (9, 102); +INSERT INTO `sys_role_menu` VALUES (9, 103); +INSERT INTO `sys_role_menu` VALUES (9, 104); +INSERT INTO `sys_role_menu` VALUES (9, 105); +INSERT INTO `sys_role_menu` VALUES (9, 106); +INSERT INTO `sys_role_menu` VALUES (9, 108); +INSERT INTO `sys_role_menu` VALUES (9, 110); +INSERT INTO `sys_role_menu` VALUES (9, 114); +INSERT INTO `sys_role_menu` VALUES (9, 115); +INSERT INTO `sys_role_menu` VALUES (9, 116); +INSERT INTO `sys_role_menu` VALUES (9, 1001); +INSERT INTO `sys_role_menu` VALUES (9, 1002); +INSERT INTO `sys_role_menu` VALUES (9, 1006); +INSERT INTO `sys_role_menu` VALUES (9, 1008); +INSERT INTO `sys_role_menu` VALUES (9, 1009); +INSERT INTO `sys_role_menu` VALUES (9, 1013); +INSERT INTO `sys_role_menu` VALUES (9, 1014); +INSERT INTO `sys_role_menu` VALUES (9, 1015); +INSERT INTO `sys_role_menu` VALUES (9, 1017); +INSERT INTO `sys_role_menu` VALUES (9, 1018); +INSERT INTO `sys_role_menu` VALUES (9, 1019); +INSERT INTO `sys_role_menu` VALUES (9, 1021); +INSERT INTO `sys_role_menu` VALUES (9, 1022); +INSERT INTO `sys_role_menu` VALUES (9, 1023); +INSERT INTO `sys_role_menu` VALUES (9, 1026); +INSERT INTO `sys_role_menu` VALUES (9, 1027); +INSERT INTO `sys_role_menu` VALUES (9, 1028); +INSERT INTO `sys_role_menu` VALUES (9, 1031); +INSERT INTO `sys_role_menu` VALUES (9, 1032); +INSERT INTO `sys_role_menu` VALUES (9, 1033); +INSERT INTO `sys_role_menu` VALUES (9, 1049); +INSERT INTO `sys_role_menu` VALUES (9, 1055); +INSERT INTO `sys_role_menu` VALUES (9, 2000); +INSERT INTO `sys_role_menu` VALUES (9, 2001); +INSERT INTO `sys_role_menu` VALUES (9, 2003); +INSERT INTO `sys_role_menu` VALUES (9, 2004); +INSERT INTO `sys_role_menu` VALUES (9, 2005); +INSERT INTO `sys_role_menu` VALUES (9, 2006); +INSERT INTO `sys_role_menu` VALUES (9, 2008); +INSERT INTO `sys_role_menu` VALUES (9, 2009); +INSERT INTO `sys_role_menu` VALUES (9, 2010); +INSERT INTO `sys_role_menu` VALUES (9, 2011); +INSERT INTO `sys_role_menu` VALUES (9, 2012); +INSERT INTO `sys_role_menu` VALUES (9, 2013); +INSERT INTO `sys_role_menu` VALUES (9, 2014); +INSERT INTO `sys_role_menu` VALUES (9, 2015); +INSERT INTO `sys_role_menu` VALUES (9, 2017); +INSERT INTO `sys_role_menu` VALUES (9, 2018); +INSERT INTO `sys_role_menu` VALUES (9, 2019); +INSERT INTO `sys_role_menu` VALUES (9, 2020); +INSERT INTO `sys_role_menu` VALUES (9, 2021); +INSERT INTO `sys_role_menu` VALUES (9, 2022); +INSERT INTO `sys_role_menu` VALUES (9, 2023); +INSERT INTO `sys_role_menu` VALUES (9, 2024); +INSERT INTO `sys_role_menu` VALUES (9, 2025); +INSERT INTO `sys_role_menu` VALUES (9, 2026); +INSERT INTO `sys_role_menu` VALUES (9, 2027); +INSERT INTO `sys_role_menu` VALUES (9, 2028); +INSERT INTO `sys_role_menu` VALUES (9, 2029); +INSERT INTO `sys_role_menu` VALUES (9, 2030); +INSERT INTO `sys_role_menu` VALUES (9, 2034); +INSERT INTO `sys_role_menu` VALUES (9, 2037); +INSERT INTO `sys_role_menu` VALUES (9, 2038); +INSERT INTO `sys_role_menu` VALUES (9, 2039); +INSERT INTO `sys_role_menu` VALUES (9, 2040); +INSERT INTO `sys_role_menu` VALUES (9, 2041); +INSERT INTO `sys_role_menu` VALUES (9, 2042); +INSERT INTO `sys_role_menu` VALUES (9, 2043); +INSERT INTO `sys_role_menu` VALUES (9, 2050); +INSERT INTO `sys_role_menu` VALUES (9, 2051); +INSERT INTO `sys_role_menu` VALUES (9, 2052); +INSERT INTO `sys_role_menu` VALUES (9, 2053); +INSERT INTO `sys_role_menu` VALUES (9, 2058); +INSERT INTO `sys_role_menu` VALUES (9, 2059); +INSERT INTO `sys_role_menu` VALUES (9, 2060); +INSERT INTO `sys_role_menu` VALUES (9, 2061); +INSERT INTO `sys_role_menu` VALUES (9, 2062); +INSERT INTO `sys_role_menu` VALUES (9, 2063); +INSERT INTO `sys_role_menu` VALUES (9, 2064); +INSERT INTO `sys_role_menu` VALUES (9, 2065); +INSERT INTO `sys_role_menu` VALUES (9, 2066); +INSERT INTO `sys_role_menu` VALUES (9, 2067); +INSERT INTO `sys_role_menu` VALUES (9, 2068); +INSERT INTO `sys_role_menu` VALUES (9, 2069); +INSERT INTO `sys_role_menu` VALUES (9, 2070); +INSERT INTO `sys_role_menu` VALUES (9, 2071); +INSERT INTO `sys_role_menu` VALUES (9, 2072); +INSERT INTO `sys_role_menu` VALUES (9, 2073); +INSERT INTO `sys_role_menu` VALUES (9, 2074); +INSERT INTO `sys_role_menu` VALUES (9, 2075); +INSERT INTO `sys_role_menu` VALUES (9, 2076); +INSERT INTO `sys_role_menu` VALUES (9, 2079); +INSERT INTO `sys_role_menu` VALUES (9, 2080); +INSERT INTO `sys_role_menu` VALUES (9, 2081); +INSERT INTO `sys_role_menu` VALUES (9, 2082); +INSERT INTO `sys_role_menu` VALUES (9, 2084); +INSERT INTO `sys_role_menu` VALUES (9, 2085); +INSERT INTO `sys_role_menu` VALUES (9, 2086); +INSERT INTO `sys_role_menu` VALUES (9, 2087); +INSERT INTO `sys_role_menu` VALUES (9, 2088); +INSERT INTO `sys_role_menu` VALUES (9, 2089); +INSERT INTO `sys_role_menu` VALUES (9, 2093); +INSERT INTO `sys_role_menu` VALUES (9, 2102); +INSERT INTO `sys_role_menu` VALUES (9, 2104); +INSERT INTO `sys_role_menu` VALUES (9, 2106); +INSERT INTO `sys_role_menu` VALUES (9, 2108); +INSERT INTO `sys_role_menu` VALUES (9, 2109); +INSERT INTO `sys_role_menu` VALUES (9, 2110); +INSERT INTO `sys_role_menu` VALUES (9, 2111); +INSERT INTO `sys_role_menu` VALUES (9, 2112); +INSERT INTO `sys_role_menu` VALUES (9, 2113); +INSERT INTO `sys_role_menu` VALUES (9, 2114); +INSERT INTO `sys_role_menu` VALUES (9, 2137); +INSERT INTO `sys_role_menu` VALUES (9, 2153); +INSERT INTO `sys_role_menu` VALUES (9, 2154); +INSERT INTO `sys_role_menu` VALUES (9, 2155); +INSERT INTO `sys_role_menu` VALUES (9, 2156); +INSERT INTO `sys_role_menu` VALUES (9, 2167); +INSERT INTO `sys_role_menu` VALUES (9, 2168); +INSERT INTO `sys_role_menu` VALUES (9, 2169); +INSERT INTO `sys_role_menu` VALUES (9, 2170); + +-- ---------------------------- +-- Table structure for sys_user +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user`; +CREATE TABLE `sys_user` ( + `user_id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '用户ID', + `dept_id` bigint(0) NULL DEFAULT NULL COMMENT '部门ID', + `user_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户账号', + `nick_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户昵称', + `user_type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '00' COMMENT '用户类型(00系统用户)', + `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户邮箱', + `phonenumber` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '手机号码', + `sex` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '用户性别(0男 1女 2未知)', + `avatar` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '头像地址', + `password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '密码', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '帐号状态(0正常 1停用)', + `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', + `login_ip` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '最后登录IP', + `login_date` datetime(0) NULL DEFAULT NULL COMMENT '最后登录时间', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + `isSales` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '是否销售', + `isPartner` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '是否合伙人', + PRIMARY KEY (`user_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 335 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_user +-- ---------------------------- +INSERT INTO `sys_user` VALUES (1, 100, 'admin', '管理员', '00', '', '15888888899', '0', '/profile/avatar/2022/01/12/86bb5301-5e36-4e6a-bc9c-d83d345ff6e5.jpeg', '$2a$10$6rlILudDyVDrQZ5emMCNj.GWPlMNeXA2eK9qUkfuAZabOF/YzYaJS', '0', '0', '120.224.39.28', '2022-01-12 10:44:02', 'admin', '2021-06-05 09:12:09', '', '2022-01-12 10:44:02', '管理员', '1', '1'); +INSERT INTO `sys_user` VALUES (100, 100, '5iot', '演示账号', '00', 'yunye@5iot.cn', '', '0', '', '$2a$10$Z03ZGxYMD.p3qk3bKQTQcOCr42DcuDhDVnAa9vgxidpB823psbmSS', '0', '0', '120.224.39.28', '2022-01-12 10:53:33', 'admin', '2021-06-11 09:11:25', '5iot', '2022-01-12 10:53:32', '演示账号', '0', '0'); + +-- ---------------------------- +-- Table structure for sys_user_post +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_post`; +CREATE TABLE `sys_user_post` ( + `user_id` bigint(0) NOT NULL COMMENT '用户ID', + `post_id` bigint(0) NOT NULL COMMENT '岗位ID', + PRIMARY KEY (`user_id`, `post_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户与岗位关联表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_user_post +-- ---------------------------- +INSERT INTO `sys_user_post` VALUES (1, 1); +INSERT INTO `sys_user_post` VALUES (2, 2); +INSERT INTO `sys_user_post` VALUES (102, 4); +INSERT INTO `sys_user_post` VALUES (166, 4); +INSERT INTO `sys_user_post` VALUES (241, 1); +INSERT INTO `sys_user_post` VALUES (243, 1); + +-- ---------------------------- +-- Table structure for sys_user_role +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_role`; +CREATE TABLE `sys_user_role` ( + `user_id` bigint(0) NOT NULL COMMENT '用户ID', + `role_id` bigint(0) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`user_id`, `role_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户和角色关联表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_user_role +-- ---------------------------- +INSERT INTO `sys_user_role` VALUES (1, 1); +INSERT INTO `sys_user_role` VALUES (2, 2); +INSERT INTO `sys_user_role` VALUES (100, 9); +INSERT INTO `sys_user_role` VALUES (102, 3); +INSERT INTO `sys_user_role` VALUES (104, 2); +INSERT INTO `sys_user_role` VALUES (104, 4); +INSERT INTO `sys_user_role` VALUES (107, 4); +INSERT INTO `sys_user_role` VALUES (108, 4); +INSERT INTO `sys_user_role` VALUES (109, 5); +INSERT INTO `sys_user_role` VALUES (109, 6); +INSERT INTO `sys_user_role` VALUES (110, 5); +INSERT INTO `sys_user_role` VALUES (110, 7); +INSERT INTO `sys_user_role` VALUES (111, 2); +INSERT INTO `sys_user_role` VALUES (111, 4); +INSERT INTO `sys_user_role` VALUES (112, 2); +INSERT INTO `sys_user_role` VALUES (112, 4); +INSERT INTO `sys_user_role` VALUES (113, 5); +INSERT INTO `sys_user_role` VALUES (113, 8); +INSERT INTO `sys_user_role` VALUES (114, 2); +INSERT INTO `sys_user_role` VALUES (114, 4); +INSERT INTO `sys_user_role` VALUES (115, 4); +INSERT INTO `sys_user_role` VALUES (117, 2); +INSERT INTO `sys_user_role` VALUES (117, 4); +INSERT INTO `sys_user_role` VALUES (118, 2); +INSERT INTO `sys_user_role` VALUES (118, 4); +INSERT INTO `sys_user_role` VALUES (119, 2); +INSERT INTO `sys_user_role` VALUES (119, 4); +INSERT INTO `sys_user_role` VALUES (120, 2); +INSERT INTO `sys_user_role` VALUES (120, 4); +INSERT INTO `sys_user_role` VALUES (121, 2); +INSERT INTO `sys_user_role` VALUES (121, 4); +INSERT INTO `sys_user_role` VALUES (122, 2); +INSERT INTO `sys_user_role` VALUES (122, 4); +INSERT INTO `sys_user_role` VALUES (123, 2); +INSERT INTO `sys_user_role` VALUES (123, 4); +INSERT INTO `sys_user_role` VALUES (124, 2); +INSERT INTO `sys_user_role` VALUES (125, 2); +INSERT INTO `sys_user_role` VALUES (125, 4); +INSERT INTO `sys_user_role` VALUES (126, 4); +INSERT INTO `sys_user_role` VALUES (128, 2); +INSERT INTO `sys_user_role` VALUES (128, 4); +INSERT INTO `sys_user_role` VALUES (129, 2); +INSERT INTO `sys_user_role` VALUES (129, 4); +INSERT INTO `sys_user_role` VALUES (130, 2); +INSERT INTO `sys_user_role` VALUES (130, 4); +INSERT INTO `sys_user_role` VALUES (131, 2); +INSERT INTO `sys_user_role` VALUES (131, 4); +INSERT INTO `sys_user_role` VALUES (132, 2); +INSERT INTO `sys_user_role` VALUES (132, 4); +INSERT INTO `sys_user_role` VALUES (133, 2); +INSERT INTO `sys_user_role` VALUES (133, 4); +INSERT INTO `sys_user_role` VALUES (134, 2); +INSERT INTO `sys_user_role` VALUES (134, 4); +INSERT INTO `sys_user_role` VALUES (135, 2); +INSERT INTO `sys_user_role` VALUES (135, 4); +INSERT INTO `sys_user_role` VALUES (136, 2); +INSERT INTO `sys_user_role` VALUES (136, 4); +INSERT INTO `sys_user_role` VALUES (137, 2); +INSERT INTO `sys_user_role` VALUES (137, 4); +INSERT INTO `sys_user_role` VALUES (138, 2); +INSERT INTO `sys_user_role` VALUES (138, 4); +INSERT INTO `sys_user_role` VALUES (139, 2); +INSERT INTO `sys_user_role` VALUES (139, 4); +INSERT INTO `sys_user_role` VALUES (140, 2); +INSERT INTO `sys_user_role` VALUES (140, 4); +INSERT INTO `sys_user_role` VALUES (141, 2); +INSERT INTO `sys_user_role` VALUES (141, 4); +INSERT INTO `sys_user_role` VALUES (142, 2); +INSERT INTO `sys_user_role` VALUES (142, 4); +INSERT INTO `sys_user_role` VALUES (143, 2); +INSERT INTO `sys_user_role` VALUES (143, 4); +INSERT INTO `sys_user_role` VALUES (144, 2); +INSERT INTO `sys_user_role` VALUES (144, 4); +INSERT INTO `sys_user_role` VALUES (145, 2); +INSERT INTO `sys_user_role` VALUES (145, 4); +INSERT INTO `sys_user_role` VALUES (146, 2); +INSERT INTO `sys_user_role` VALUES (146, 4); +INSERT INTO `sys_user_role` VALUES (148, 2); +INSERT INTO `sys_user_role` VALUES (148, 4); +INSERT INTO `sys_user_role` VALUES (150, 2); +INSERT INTO `sys_user_role` VALUES (150, 4); +INSERT INTO `sys_user_role` VALUES (151, 2); +INSERT INTO `sys_user_role` VALUES (151, 4); +INSERT INTO `sys_user_role` VALUES (152, 2); +INSERT INTO `sys_user_role` VALUES (152, 4); +INSERT INTO `sys_user_role` VALUES (154, 2); +INSERT INTO `sys_user_role` VALUES (154, 4); +INSERT INTO `sys_user_role` VALUES (155, 2); +INSERT INTO `sys_user_role` VALUES (155, 4); +INSERT INTO `sys_user_role` VALUES (156, 2); +INSERT INTO `sys_user_role` VALUES (156, 4); +INSERT INTO `sys_user_role` VALUES (157, 2); +INSERT INTO `sys_user_role` VALUES (157, 4); +INSERT INTO `sys_user_role` VALUES (158, 2); +INSERT INTO `sys_user_role` VALUES (158, 4); +INSERT INTO `sys_user_role` VALUES (159, 2); +INSERT INTO `sys_user_role` VALUES (159, 4); +INSERT INTO `sys_user_role` VALUES (160, 2); +INSERT INTO `sys_user_role` VALUES (160, 4); +INSERT INTO `sys_user_role` VALUES (161, 2); +INSERT INTO `sys_user_role` VALUES (161, 4); +INSERT INTO `sys_user_role` VALUES (163, 2); +INSERT INTO `sys_user_role` VALUES (163, 4); +INSERT INTO `sys_user_role` VALUES (164, 2); +INSERT INTO `sys_user_role` VALUES (164, 4); +INSERT INTO `sys_user_role` VALUES (165, 2); +INSERT INTO `sys_user_role` VALUES (165, 4); +INSERT INTO `sys_user_role` VALUES (166, 3); +INSERT INTO `sys_user_role` VALUES (167, 2); +INSERT INTO `sys_user_role` VALUES (167, 4); +INSERT INTO `sys_user_role` VALUES (168, 4); +INSERT INTO `sys_user_role` VALUES (170, 4); +INSERT INTO `sys_user_role` VALUES (171, 4); +INSERT INTO `sys_user_role` VALUES (172, 2); +INSERT INTO `sys_user_role` VALUES (172, 4); +INSERT INTO `sys_user_role` VALUES (173, 2); +INSERT INTO `sys_user_role` VALUES (173, 4); +INSERT INTO `sys_user_role` VALUES (174, 2); +INSERT INTO `sys_user_role` VALUES (174, 4); +INSERT INTO `sys_user_role` VALUES (175, 2); +INSERT INTO `sys_user_role` VALUES (175, 4); +INSERT INTO `sys_user_role` VALUES (176, 2); +INSERT INTO `sys_user_role` VALUES (176, 4); +INSERT INTO `sys_user_role` VALUES (177, 5); +INSERT INTO `sys_user_role` VALUES (178, 4); +INSERT INTO `sys_user_role` VALUES (179, 3); +INSERT INTO `sys_user_role` VALUES (181, 2); +INSERT INTO `sys_user_role` VALUES (181, 4); +INSERT INTO `sys_user_role` VALUES (183, 2); +INSERT INTO `sys_user_role` VALUES (183, 4); +INSERT INTO `sys_user_role` VALUES (184, 2); +INSERT INTO `sys_user_role` VALUES (184, 4); +INSERT INTO `sys_user_role` VALUES (185, 4); +INSERT INTO `sys_user_role` VALUES (186, 2); +INSERT INTO `sys_user_role` VALUES (186, 4); +INSERT INTO `sys_user_role` VALUES (187, 2); +INSERT INTO `sys_user_role` VALUES (187, 4); +INSERT INTO `sys_user_role` VALUES (188, 2); +INSERT INTO `sys_user_role` VALUES (188, 4); +INSERT INTO `sys_user_role` VALUES (189, 2); +INSERT INTO `sys_user_role` VALUES (189, 4); +INSERT INTO `sys_user_role` VALUES (190, 2); +INSERT INTO `sys_user_role` VALUES (190, 4); +INSERT INTO `sys_user_role` VALUES (191, 2); +INSERT INTO `sys_user_role` VALUES (191, 4); +INSERT INTO `sys_user_role` VALUES (192, 2); +INSERT INTO `sys_user_role` VALUES (192, 4); +INSERT INTO `sys_user_role` VALUES (194, 2); +INSERT INTO `sys_user_role` VALUES (194, 4); +INSERT INTO `sys_user_role` VALUES (195, 2); +INSERT INTO `sys_user_role` VALUES (195, 4); +INSERT INTO `sys_user_role` VALUES (196, 2); +INSERT INTO `sys_user_role` VALUES (196, 4); +INSERT INTO `sys_user_role` VALUES (197, 2); +INSERT INTO `sys_user_role` VALUES (197, 4); +INSERT INTO `sys_user_role` VALUES (198, 2); +INSERT INTO `sys_user_role` VALUES (198, 4); +INSERT INTO `sys_user_role` VALUES (199, 2); +INSERT INTO `sys_user_role` VALUES (199, 4); +INSERT INTO `sys_user_role` VALUES (200, 2); +INSERT INTO `sys_user_role` VALUES (200, 4); +INSERT INTO `sys_user_role` VALUES (201, 2); +INSERT INTO `sys_user_role` VALUES (201, 4); +INSERT INTO `sys_user_role` VALUES (202, 2); +INSERT INTO `sys_user_role` VALUES (202, 4); +INSERT INTO `sys_user_role` VALUES (203, 5); +INSERT INTO `sys_user_role` VALUES (203, 7); +INSERT INTO `sys_user_role` VALUES (204, 5); +INSERT INTO `sys_user_role` VALUES (204, 7); +INSERT INTO `sys_user_role` VALUES (205, 5); +INSERT INTO `sys_user_role` VALUES (205, 7); +INSERT INTO `sys_user_role` VALUES (206, 2); +INSERT INTO `sys_user_role` VALUES (206, 4); +INSERT INTO `sys_user_role` VALUES (207, 2); +INSERT INTO `sys_user_role` VALUES (207, 4); +INSERT INTO `sys_user_role` VALUES (208, 2); +INSERT INTO `sys_user_role` VALUES (208, 4); +INSERT INTO `sys_user_role` VALUES (209, 2); +INSERT INTO `sys_user_role` VALUES (209, 4); +INSERT INTO `sys_user_role` VALUES (210, 2); +INSERT INTO `sys_user_role` VALUES (210, 4); +INSERT INTO `sys_user_role` VALUES (211, 2); +INSERT INTO `sys_user_role` VALUES (211, 4); +INSERT INTO `sys_user_role` VALUES (212, 2); +INSERT INTO `sys_user_role` VALUES (212, 4); +INSERT INTO `sys_user_role` VALUES (213, 2); +INSERT INTO `sys_user_role` VALUES (213, 4); +INSERT INTO `sys_user_role` VALUES (214, 2); +INSERT INTO `sys_user_role` VALUES (214, 4); +INSERT INTO `sys_user_role` VALUES (215, 2); +INSERT INTO `sys_user_role` VALUES (215, 4); +INSERT INTO `sys_user_role` VALUES (216, 2); +INSERT INTO `sys_user_role` VALUES (216, 4); +INSERT INTO `sys_user_role` VALUES (217, 2); +INSERT INTO `sys_user_role` VALUES (217, 4); +INSERT INTO `sys_user_role` VALUES (218, 2); +INSERT INTO `sys_user_role` VALUES (218, 4); +INSERT INTO `sys_user_role` VALUES (219, 2); +INSERT INTO `sys_user_role` VALUES (219, 4); +INSERT INTO `sys_user_role` VALUES (220, 2); +INSERT INTO `sys_user_role` VALUES (220, 4); +INSERT INTO `sys_user_role` VALUES (222, 2); +INSERT INTO `sys_user_role` VALUES (222, 4); +INSERT INTO `sys_user_role` VALUES (223, 2); +INSERT INTO `sys_user_role` VALUES (223, 4); +INSERT INTO `sys_user_role` VALUES (224, 2); +INSERT INTO `sys_user_role` VALUES (224, 4); +INSERT INTO `sys_user_role` VALUES (225, 2); +INSERT INTO `sys_user_role` VALUES (225, 4); +INSERT INTO `sys_user_role` VALUES (226, 2); +INSERT INTO `sys_user_role` VALUES (226, 4); +INSERT INTO `sys_user_role` VALUES (228, 4); +INSERT INTO `sys_user_role` VALUES (229, 4); +INSERT INTO `sys_user_role` VALUES (230, 2); +INSERT INTO `sys_user_role` VALUES (230, 4); +INSERT INTO `sys_user_role` VALUES (231, 2); +INSERT INTO `sys_user_role` VALUES (231, 4); +INSERT INTO `sys_user_role` VALUES (232, 2); +INSERT INTO `sys_user_role` VALUES (232, 4); +INSERT INTO `sys_user_role` VALUES (233, 2); +INSERT INTO `sys_user_role` VALUES (233, 4); +INSERT INTO `sys_user_role` VALUES (234, 2); +INSERT INTO `sys_user_role` VALUES (234, 4); +INSERT INTO `sys_user_role` VALUES (235, 2); +INSERT INTO `sys_user_role` VALUES (235, 4); +INSERT INTO `sys_user_role` VALUES (236, 2); +INSERT INTO `sys_user_role` VALUES (236, 4); +INSERT INTO `sys_user_role` VALUES (237, 2); +INSERT INTO `sys_user_role` VALUES (237, 4); +INSERT INTO `sys_user_role` VALUES (238, 2); +INSERT INTO `sys_user_role` VALUES (238, 4); +INSERT INTO `sys_user_role` VALUES (239, 2); +INSERT INTO `sys_user_role` VALUES (239, 4); +INSERT INTO `sys_user_role` VALUES (240, 2); +INSERT INTO `sys_user_role` VALUES (240, 4); +INSERT INTO `sys_user_role` VALUES (241, 4); +INSERT INTO `sys_user_role` VALUES (242, 2); +INSERT INTO `sys_user_role` VALUES (242, 4); +INSERT INTO `sys_user_role` VALUES (243, 2); +INSERT INTO `sys_user_role` VALUES (243, 4); +INSERT INTO `sys_user_role` VALUES (244, 2); +INSERT INTO `sys_user_role` VALUES (244, 4); +INSERT INTO `sys_user_role` VALUES (245, 2); +INSERT INTO `sys_user_role` VALUES (245, 4); +INSERT INTO `sys_user_role` VALUES (246, 4); +INSERT INTO `sys_user_role` VALUES (247, 2); +INSERT INTO `sys_user_role` VALUES (247, 4); +INSERT INTO `sys_user_role` VALUES (248, 2); +INSERT INTO `sys_user_role` VALUES (248, 4); +INSERT INTO `sys_user_role` VALUES (249, 2); +INSERT INTO `sys_user_role` VALUES (249, 4); +INSERT INTO `sys_user_role` VALUES (250, 2); +INSERT INTO `sys_user_role` VALUES (250, 4); +INSERT INTO `sys_user_role` VALUES (251, 2); +INSERT INTO `sys_user_role` VALUES (251, 4); +INSERT INTO `sys_user_role` VALUES (252, 2); +INSERT INTO `sys_user_role` VALUES (252, 4); +INSERT INTO `sys_user_role` VALUES (253, 2); +INSERT INTO `sys_user_role` VALUES (253, 4); +INSERT INTO `sys_user_role` VALUES (254, 2); +INSERT INTO `sys_user_role` VALUES (254, 4); +INSERT INTO `sys_user_role` VALUES (255, 2); +INSERT INTO `sys_user_role` VALUES (255, 4); +INSERT INTO `sys_user_role` VALUES (256, 2); +INSERT INTO `sys_user_role` VALUES (256, 4); +INSERT INTO `sys_user_role` VALUES (257, 2); +INSERT INTO `sys_user_role` VALUES (257, 4); +INSERT INTO `sys_user_role` VALUES (258, 2); +INSERT INTO `sys_user_role` VALUES (258, 4); +INSERT INTO `sys_user_role` VALUES (259, 2); +INSERT INTO `sys_user_role` VALUES (259, 4); +INSERT INTO `sys_user_role` VALUES (260, 2); +INSERT INTO `sys_user_role` VALUES (260, 4); +INSERT INTO `sys_user_role` VALUES (261, 2); +INSERT INTO `sys_user_role` VALUES (261, 4); +INSERT INTO `sys_user_role` VALUES (262, 2); +INSERT INTO `sys_user_role` VALUES (262, 4); +INSERT INTO `sys_user_role` VALUES (263, 2); +INSERT INTO `sys_user_role` VALUES (263, 4); +INSERT INTO `sys_user_role` VALUES (264, 2); +INSERT INTO `sys_user_role` VALUES (264, 4); +INSERT INTO `sys_user_role` VALUES (265, 2); +INSERT INTO `sys_user_role` VALUES (265, 4); +INSERT INTO `sys_user_role` VALUES (266, 2); +INSERT INTO `sys_user_role` VALUES (266, 4); +INSERT INTO `sys_user_role` VALUES (267, 2); +INSERT INTO `sys_user_role` VALUES (267, 4); +INSERT INTO `sys_user_role` VALUES (268, 2); +INSERT INTO `sys_user_role` VALUES (268, 4); +INSERT INTO `sys_user_role` VALUES (269, 2); +INSERT INTO `sys_user_role` VALUES (269, 4); +INSERT INTO `sys_user_role` VALUES (270, 2); +INSERT INTO `sys_user_role` VALUES (270, 4); +INSERT INTO `sys_user_role` VALUES (271, 2); +INSERT INTO `sys_user_role` VALUES (271, 4); +INSERT INTO `sys_user_role` VALUES (272, 2); +INSERT INTO `sys_user_role` VALUES (272, 4); +INSERT INTO `sys_user_role` VALUES (273, 2); +INSERT INTO `sys_user_role` VALUES (273, 4); +INSERT INTO `sys_user_role` VALUES (274, 2); +INSERT INTO `sys_user_role` VALUES (274, 4); +INSERT INTO `sys_user_role` VALUES (275, 2); +INSERT INTO `sys_user_role` VALUES (275, 4); +INSERT INTO `sys_user_role` VALUES (276, 2); +INSERT INTO `sys_user_role` VALUES (276, 4); +INSERT INTO `sys_user_role` VALUES (277, 2); +INSERT INTO `sys_user_role` VALUES (277, 4); +INSERT INTO `sys_user_role` VALUES (278, 2); +INSERT INTO `sys_user_role` VALUES (278, 4); +INSERT INTO `sys_user_role` VALUES (279, 2); +INSERT INTO `sys_user_role` VALUES (279, 4); +INSERT INTO `sys_user_role` VALUES (280, 2); +INSERT INTO `sys_user_role` VALUES (280, 4); +INSERT INTO `sys_user_role` VALUES (281, 2); +INSERT INTO `sys_user_role` VALUES (281, 4); +INSERT INTO `sys_user_role` VALUES (282, 2); +INSERT INTO `sys_user_role` VALUES (282, 4); +INSERT INTO `sys_user_role` VALUES (285, 2); +INSERT INTO `sys_user_role` VALUES (285, 4); +INSERT INTO `sys_user_role` VALUES (286, 2); +INSERT INTO `sys_user_role` VALUES (286, 4); +INSERT INTO `sys_user_role` VALUES (287, 2); +INSERT INTO `sys_user_role` VALUES (287, 4); +INSERT INTO `sys_user_role` VALUES (288, 2); +INSERT INTO `sys_user_role` VALUES (288, 4); +INSERT INTO `sys_user_role` VALUES (289, 2); +INSERT INTO `sys_user_role` VALUES (289, 4); +INSERT INTO `sys_user_role` VALUES (290, 4); +INSERT INTO `sys_user_role` VALUES (291, 2); +INSERT INTO `sys_user_role` VALUES (291, 4); +INSERT INTO `sys_user_role` VALUES (292, 2); +INSERT INTO `sys_user_role` VALUES (292, 4); +INSERT INTO `sys_user_role` VALUES (293, 2); +INSERT INTO `sys_user_role` VALUES (293, 4); +INSERT INTO `sys_user_role` VALUES (294, 2); +INSERT INTO `sys_user_role` VALUES (294, 4); +INSERT INTO `sys_user_role` VALUES (295, 2); +INSERT INTO `sys_user_role` VALUES (295, 4); +INSERT INTO `sys_user_role` VALUES (296, 2); +INSERT INTO `sys_user_role` VALUES (296, 4); +INSERT INTO `sys_user_role` VALUES (297, 2); +INSERT INTO `sys_user_role` VALUES (297, 4); +INSERT INTO `sys_user_role` VALUES (298, 2); +INSERT INTO `sys_user_role` VALUES (298, 4); +INSERT INTO `sys_user_role` VALUES (299, 2); +INSERT INTO `sys_user_role` VALUES (299, 4); +INSERT INTO `sys_user_role` VALUES (300, 2); +INSERT INTO `sys_user_role` VALUES (300, 4); +INSERT INTO `sys_user_role` VALUES (301, 2); +INSERT INTO `sys_user_role` VALUES (301, 4); +INSERT INTO `sys_user_role` VALUES (302, 2); +INSERT INTO `sys_user_role` VALUES (302, 4); +INSERT INTO `sys_user_role` VALUES (303, 2); +INSERT INTO `sys_user_role` VALUES (303, 4); +INSERT INTO `sys_user_role` VALUES (304, 2); +INSERT INTO `sys_user_role` VALUES (304, 4); +INSERT INTO `sys_user_role` VALUES (305, 2); +INSERT INTO `sys_user_role` VALUES (305, 4); +INSERT INTO `sys_user_role` VALUES (306, 2); +INSERT INTO `sys_user_role` VALUES (306, 4); +INSERT INTO `sys_user_role` VALUES (307, 2); +INSERT INTO `sys_user_role` VALUES (307, 4); +INSERT INTO `sys_user_role` VALUES (308, 2); +INSERT INTO `sys_user_role` VALUES (308, 4); +INSERT INTO `sys_user_role` VALUES (309, 2); +INSERT INTO `sys_user_role` VALUES (309, 4); +INSERT INTO `sys_user_role` VALUES (310, 2); +INSERT INTO `sys_user_role` VALUES (310, 4); +INSERT INTO `sys_user_role` VALUES (311, 2); +INSERT INTO `sys_user_role` VALUES (311, 4); +INSERT INTO `sys_user_role` VALUES (312, 2); +INSERT INTO `sys_user_role` VALUES (312, 4); +INSERT INTO `sys_user_role` VALUES (313, 2); +INSERT INTO `sys_user_role` VALUES (313, 4); +INSERT INTO `sys_user_role` VALUES (314, 2); +INSERT INTO `sys_user_role` VALUES (314, 4); +INSERT INTO `sys_user_role` VALUES (315, 2); +INSERT INTO `sys_user_role` VALUES (315, 4); +INSERT INTO `sys_user_role` VALUES (316, 2); +INSERT INTO `sys_user_role` VALUES (316, 4); +INSERT INTO `sys_user_role` VALUES (317, 2); +INSERT INTO `sys_user_role` VALUES (317, 4); +INSERT INTO `sys_user_role` VALUES (318, 2); +INSERT INTO `sys_user_role` VALUES (318, 4); +INSERT INTO `sys_user_role` VALUES (319, 2); +INSERT INTO `sys_user_role` VALUES (319, 4); +INSERT INTO `sys_user_role` VALUES (320, 2); +INSERT INTO `sys_user_role` VALUES (320, 4); +INSERT INTO `sys_user_role` VALUES (321, 2); +INSERT INTO `sys_user_role` VALUES (321, 4); +INSERT INTO `sys_user_role` VALUES (322, 2); +INSERT INTO `sys_user_role` VALUES (322, 4); +INSERT INTO `sys_user_role` VALUES (323, 4); +INSERT INTO `sys_user_role` VALUES (324, 2); +INSERT INTO `sys_user_role` VALUES (324, 4); +INSERT INTO `sys_user_role` VALUES (325, 2); +INSERT INTO `sys_user_role` VALUES (325, 4); +INSERT INTO `sys_user_role` VALUES (326, 2); +INSERT INTO `sys_user_role` VALUES (326, 4); +INSERT INTO `sys_user_role` VALUES (327, 2); +INSERT INTO `sys_user_role` VALUES (327, 4); +INSERT INTO `sys_user_role` VALUES (328, 2); +INSERT INTO `sys_user_role` VALUES (328, 4); +INSERT INTO `sys_user_role` VALUES (329, 2); +INSERT INTO `sys_user_role` VALUES (329, 4); +INSERT INTO `sys_user_role` VALUES (330, 2); +INSERT INTO `sys_user_role` VALUES (330, 4); +INSERT INTO `sys_user_role` VALUES (331, 2); +INSERT INTO `sys_user_role` VALUES (331, 4); +INSERT INTO `sys_user_role` VALUES (332, 2); +INSERT INTO `sys_user_role` VALUES (332, 4); +INSERT INTO `sys_user_role` VALUES (333, 2); +INSERT INTO `sys_user_role` VALUES (333, 4); +INSERT INTO `sys_user_role` VALUES (334, 2); +INSERT INTO `sys_user_role` VALUES (334, 4); + +-- ---------------------------- +-- Table structure for yz_agent_package +-- ---------------------------- +DROP TABLE IF EXISTS `yz_agent_package`; +CREATE TABLE `yz_agent_package` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', + `package_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '套餐唯一识别号', + `package_agentname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '代理商查看名称', + `package_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '套餐名', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `error_so` double(10, 2) NULL DEFAULT 1.00 COMMENT '套餐SO', + `dept_id` int(0) NULL DEFAULT NULL COMMENT '代理编号 与 agent_id 一致 但需要用于系统结构 数据验证 (所属公司)', + `user_id` int(0) NULL DEFAULT NULL COMMENT '系统登录账户id 用于系统结构数据验证(所属人)', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 62 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资费组' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_agent_package +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_agent_packet +-- ---------------------------- +DROP TABLE IF EXISTS `yz_agent_packet`; +CREATE TABLE `yz_agent_packet` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', + `package_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '套餐ID', + `packet_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '套餐包ID', + `packet_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '套餐包名', + `packet_wx_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信端显示名称', + `packet_price` double(10, 2) NULL DEFAULT 0.00 COMMENT '套餐包金额', + `packet_flow` double(10, 2) NULL DEFAULT 0.00 COMMENT '套餐包流量', + `base_packet_type` int(0) NULL DEFAULT 0 COMMENT '资费计划 类型 0:仅一次,1可叠加', + `packet_type` int(0) NULL DEFAULT 0 COMMENT '加油包类型:0基础加油包-1叠加油包', + `is_profit` int(0) NULL DEFAULT 0 COMMENT '是否分润:0否 1是', + `show_profit` int(0) NULL DEFAULT 0 COMMENT '是否显示分润:0否-1是', + `wechat_pay` int(0) NULL DEFAULT 1 COMMENT '是否可微信支付:0否1是', + `balance_pay` int(0) NULL DEFAULT 0 COMMENT '是否可余额支付:0否-1是', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `error_flow` double(10, 2) NULL DEFAULT 0.00 COMMENT '套餐流量', + `error_so` double(10, 2) NULL DEFAULT 0.00 COMMENT '套餐包SO倍数', + `packet_valid_time` int(0) NULL DEFAULT NULL COMMENT '资费计划规格\r\n\r\n,根据packet_valid_name定义,表示为月或年', + `packet_cost` double(10, 2) NULL DEFAULT NULL COMMENT '成本价', + `is_month` int(0) NULL DEFAULT NULL COMMENT '是否分月到账:0否 1是', + `date_limit` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '限制不可充值日期', + `deduction` int(0) NULL DEFAULT NULL COMMENT '是否支持 自动扣代理预存授信延续', + `in_stock` int(0) NULL DEFAULT NULL COMMENT '是否在售 0 否 1 是', + `packet_valid_type` int(0) NULL DEFAULT NULL COMMENT '资费计划生效类型 当月生效 yunze_card_takeEffect_type', + `dept_id` int(0) NULL DEFAULT NULL COMMENT '代理编号 与 agent_id 一致 但需要用于系统结构 数据验证', + `user_id` int(0) NULL DEFAULT NULL COMMENT '系统登录账户id 用于系统结构数据验证', + `packet_valid_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '月' COMMENT '资费计划规则 月 年 ', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 103 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资费计划' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_agent_packet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_automation_cc +-- ---------------------------- +DROP TABLE IF EXISTS `yz_automation_cc`; +CREATE TABLE `yz_automation_cc` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `trigger_type` int(0) NOT NULL COMMENT '触发类型', + `channel_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '通道id', + `operation_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '运营商类型', + `triggering_conditions` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '判断条件', + `conditions_type` int(0) NULL DEFAULT NULL COMMENT '条件类型', + `execution_type` int(0) NOT NULL COMMENT '执行动作类型', + `status` int(0) NOT NULL COMMENT '状态', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注', + `execution_template` int(0) NOT NULL COMMENT '执行模板', + `dep_id` int(0) NOT NULL COMMENT '所属集团', + `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', + `cc_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '抄送名称', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '自动化抄送' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_automation_cc +-- ---------------------------- +INSERT INTO `yz_automation_cc` VALUES (1, 99, NULL, NULL, NULL, NULL, 1, 1, NULL, 1, 100, '2021-09-24 15:58:36', ''); + +-- ---------------------------- +-- Table structure for yz_automation_cc_his +-- ---------------------------- +DROP TABLE IF EXISTS `yz_automation_cc_his`; +CREATE TABLE `yz_automation_cc_his` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `cc_id` int(0) NOT NULL COMMENT '抄送任务id', + `cc_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '推送API', + `cc_email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '推送邮件', + `cc_state` int(0) NOT NULL COMMENT '抄送状态', + `cc_result` int(0) NOT NULL COMMENT '抄送结果', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注', + `cc_parameter` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '抄送参数', + `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', + `cc_count` int(0) UNSIGNED NOT NULL DEFAULT 0 COMMENT '抄送次数', + `cc_time` datetime(0) NULL DEFAULT NULL COMMENT '最近一次抄送时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '推送记录' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_automation_cc_his +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_automation_cc_url +-- ---------------------------- +DROP TABLE IF EXISTS `yz_automation_cc_url`; +CREATE TABLE `yz_automation_cc_url` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `cc_id` int(0) NOT NULL COMMENT '对应自动化规则表', + `url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '推送API', + `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '推送邮件', + `create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '触发任务推送地址邮箱配置' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_automation_cc_url +-- ---------------------------- +INSERT INTO `yz_automation_cc_url` VALUES (1, 1, '', 'yunye@5iot.cn', '2021-09-24 15:59:00'); + +-- ---------------------------- +-- Table structure for yz_by_package +-- ---------------------------- +DROP TABLE IF EXISTS `yz_by_package`; +CREATE TABLE `yz_by_package` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `package_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '套餐唯一识别号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '购卡资费组关联表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_by_package +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_card_flow +-- ---------------------------- +DROP TABLE IF EXISTS `yz_card_flow`; +CREATE TABLE `yz_card_flow` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', + `package_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '充值套餐', + `packet_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '充值流量包', + `ord_no` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '订单号', + `true_flow` double(10, 2) NULL DEFAULT 0.00 COMMENT '真实流量,显示在前端的', + `error_flow` double(10, 2) NULL DEFAULT 0.00 COMMENT '虚后流量,后台以此作控制', + `start_time` datetime(0) NULL DEFAULT NULL COMMENT '生效时间', + `end_time` datetime(0) NULL DEFAULT NULL COMMENT '到期时间', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `ord_type` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '资费计划 月包 年包 包规格类型', + `status` int(0) NULL DEFAULT 0 COMMENT '状态:0已失效-2未生效-1生效', + `packet_type` int(0) NOT NULL COMMENT '叠加包 基础包', + `use_flow` double(10, 2) NULL DEFAULT 0.00 COMMENT '使用流量(针对累计卡保存)', + `iccid` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '对应串号', + `error_time` double(30, 2) NOT NULL COMMENT '防超系数', + `validate_type` int(0) NULL DEFAULT NULL COMMENT '资费生效类别:当月生效,次月生效,周期延顺', + `validate_time` datetime(0) NULL DEFAULT NULL COMMENT '更新累计包时间', + `use_true_flow` double(10, 2) NULL DEFAULT NULL COMMENT '天包真实已用流量', + `use_so_flow` double(10, 2) NULL DEFAULT NULL COMMENT '天包记录已用流量so', + PRIMARY KEY (`id`) USING BTREE, + INDEX `IDU_Busi_iccid_ord_no`(`iccid`, `ord_no`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1256704 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '流量包记录表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_card_flow +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_card_flow_his +-- ---------------------------- +DROP TABLE IF EXISTS `yz_card_flow_his`; +CREATE TABLE `yz_card_flow_his` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', + `total_flow` double(10, 2) NULL DEFAULT 0.00 COMMENT '当月使用总量 接口', + `total_flow_now` double(10, 2) NULL DEFAULT 0.00 COMMENT '当天使用总量 接口', + `month` int(0) NOT NULL COMMENT '月份', + `year` int(0) NOT NULL COMMENT '年份', + `day` int(0) NOT NULL COMMENT '日', + `iccid` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '对应串号', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间', + `total_show_flow` double(10, 2) NULL DEFAULT 0.00 COMMENT '当月使用总量 展示用', + `total_show_flow_now` double(10, 2) NULL DEFAULT 0.00 COMMENT '当天使用总量 展示用', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `sel_id`(`id`) USING BTREE, + INDEX `find_iccid`(`iccid`, `year`, `month`, `day`) USING BTREE, + INDEX `IDU_Busi_iccid_create_time_update_time`(`create_time`, `update_time`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 26142703 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '历史流量使用记录表' ROW_FORMAT = Compact; + +-- ---------------------------- +-- Records of yz_card_flow_his +-- ---------------------------- +INSERT INTO `yz_card_flow_his` VALUES (26142701, 0.00, 0.00, 1, 2022, 10, '89860799999999999999', '2022-01-10 17:14:08', '2022-01-10 18:00:12', 0.00, 0.00); +INSERT INTO `yz_card_flow_his` VALUES (26142702, 0.00, 0.00, 1, 2022, 11, '89860799999999999999', '2022-01-11 09:45:30', NULL, 0.00, 0.00); + +-- ---------------------------- +-- Table structure for yz_card_info +-- ---------------------------- +DROP TABLE IF EXISTS `yz_card_info`; +CREATE TABLE `yz_card_info` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT '编号', + `vid` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '虚拟编号', + `msisdn` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'SIM 号码', + `iccid` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'SIM 卡号', + `imsi` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'SIM 识别码', + `open_date` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开卡日期', + `activate_date` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '激活日期', + `agent_id` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '代理编号', + `channel_id` int(0) NULL DEFAULT NULL COMMENT '通道编号', + `is_pool` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是否流量池', + `pool_id` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '流量池编号', + `remind_ratio` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提醒阈值', + `virtual_ratio` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '虚量阈值', + `batch_date` varchar(0) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '入库日期', + `syn_Time` datetime(0) NULL DEFAULT NULL COMMENT '同步时间', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者', + `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者', + `update_date` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `del_flag` tinyint(1) NULL DEFAULT 0 COMMENT '删除标记', + `status_id` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '卡状态描述', + `package_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资费组', + `used` double(10, 2) NOT NULL DEFAULT 0.00 COMMENT '账期用量', + `remaining` double(10, 2) NOT NULL DEFAULT 0.00 COMMENT '剩余用量', + `deliver_date` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发货日期', + `imei` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'IMEI', + `type` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '卡类型 对应字典表', + `network_type` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '网络类型 对应字典表', + `is_sms` int(0) NULL DEFAULT NULL COMMENT '是否支持短信发送', + `sms_number` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '短信服务号码', + `gprs` int(0) NULL DEFAULT NULL COMMENT 'GPRS是否开启', + `dept_id` int(0) NULL DEFAULT NULL COMMENT '代理编号 与 agent_id 一致 但需要用于系统结构 数据验证', + `user_id` int(0) NULL DEFAULT NULL COMMENT '系统登录账户id 用于系统结构数据验证', + `out_of_stock` date NULL DEFAULT NULL COMMENT '出库日期', + `is_Disconnected` int(0) NULL DEFAULT NULL COMMENT '未订购资费 是否 轮询断网', + `connection_status` int(0) NULL DEFAULT NULL COMMENT '断开网状态', + `customize_grouping` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '自定义分组', + `remarks` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注信息', + `due_expire_time` datetime(0) NULL DEFAULT NULL COMMENT '到期时间', + `status_ShowId` int(0) NULL DEFAULT NULL COMMENT '卡状状态', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `IDU_Busi_Card_id`(`id`) USING BTREE, + UNIQUE INDEX `iccid_sel`(`iccid`) USING BTREE, + INDEX `IDU_Busi_Card_vid`(`vid`) USING BTREE, + INDEX `IDU_Busi_Card_imsi`(`imsi`) USING BTREE, + INDEX `IDU_Busi_Card_msisdn`(`msisdn`) USING BTREE, + INDEX `IDU_Busi_Card_status_id`(`status_id`) USING BTREE, + INDEX `IDU_Busi_Card_iccid_used_remaining`(`used`, `customize_grouping`) USING BTREE, + INDEX `IDU_Busi_Card_agent_id_user_id_iccid`(`agent_id`, `user_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1129786 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '模块-智能卡信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_card_info +-- ---------------------------- +INSERT INTO `yz_card_info` VALUES (1129785, '16800000001', '1069999999999', '89860799999999999999', NULL, NULL, '2021-02-01', '100', 1, '0', NULL, NULL, NULL, NULL, '2022-01-11 09:45:30', ' [ 总集团 ] - [ admin ] ', '2022-01-10 17:14:00', NULL, NULL, 0, '1', NULL, 0.00, 0.00, NULL, NULL, NULL, NULL, 0, NULL, 0, 100, 1, NULL, NULL, NULL, NULL, NULL, NULL, 4); + +-- ---------------------------- +-- Table structure for yz_card_info_change +-- ---------------------------- +DROP TABLE IF EXISTS `yz_card_info_change`; +CREATE TABLE `yz_card_info_change` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `iccid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `ctype` int(0) NOT NULL COMMENT '变更类型', + `cbefore` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '变更前', + `cafterward` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '变更后', + `createTime` datetime(0) NOT NULL COMMENT '创建时间', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注', + `source_type` int(0) NOT NULL COMMENT '来源类型', + `execution_status` int(0) NOT NULL COMMENT '执行状态', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1502631 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '卡状态变更记录表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_card_info_change +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_card_isstop +-- ---------------------------- +DROP TABLE IF EXISTS `yz_card_isstop`; +CREATE TABLE `yz_card_isstop` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `iccid` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '串号', + `order_no` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '唯一订单号', + `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '状态', + `create_time` datetime(0) NOT NULL COMMENT '创建时间', + `update_time` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '月初复机有用量 记录\r\n' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_card_isstop +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_card_operating +-- ---------------------------- +DROP TABLE IF EXISTS `yz_card_operating`; +CREATE TABLE `yz_card_operating` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者', + `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者', + `update_date` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `remarks` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注信息', + `operating` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作说明', + `operating_type` int(0) NULL DEFAULT NULL COMMENT '操作类型 对应字典', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '卡信息操作表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_card_operating +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_card_package +-- ---------------------------- +DROP TABLE IF EXISTS `yz_card_package`; +CREATE TABLE `yz_card_package` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', + `package_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '套餐唯一识别号', + `package_agentname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '代理商查看名称', + `package_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '套餐名', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `error_so` double(10, 2) NULL DEFAULT 1.00 COMMENT '套餐SO', + `dept_id` int(0) NULL DEFAULT NULL COMMENT '代理编号 与 agent_id 一致 但需要用于系统结构 数据验证 (所属公司)', + `user_id` int(0) NULL DEFAULT NULL COMMENT '系统登录账户id 用于系统结构数据验证(所属人)', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `package_id`(`package_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资费组' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_card_package +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_card_packet +-- ---------------------------- +DROP TABLE IF EXISTS `yz_card_packet`; +CREATE TABLE `yz_card_packet` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', + `package_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '套餐ID', + `packet_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '套餐包ID', + `packet_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '套餐包名', + `packet_wx_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信端显示名称', + `packet_price` double(10, 2) NULL DEFAULT 0.00 COMMENT '套餐包金额', + `packet_flow` double(10, 2) NULL DEFAULT 0.00 COMMENT '套餐包流量', + `base_packet_type` int(0) NULL DEFAULT 0 COMMENT '资费计划 类型 0:仅一次,1可叠加', + `packet_type` int(0) NULL DEFAULT 0 COMMENT '加油包类型:0基础加油包-1叠加油包', + `is_profit` int(0) NULL DEFAULT 0 COMMENT '是否分润:0否 1是', + `show_profit` int(0) NULL DEFAULT 0 COMMENT '是否显示分润:0否-1是', + `wechat_pay` int(0) NULL DEFAULT 1 COMMENT '是否可微信支付:0否1是', + `balance_pay` int(0) NULL DEFAULT 0 COMMENT '是否可余额支付:0否-1是', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `error_flow` double(10, 2) NULL DEFAULT 0.00 COMMENT '套餐流量', + `error_so` double(10, 2) NULL DEFAULT 0.00 COMMENT '套餐包SO倍数', + `packet_valid_time` int(0) NULL DEFAULT NULL COMMENT '资费计划规格\r\n\r\n,根据packet_valid_name定义,表示为月或年', + `packet_cost` double(10, 2) NULL DEFAULT NULL COMMENT '成本价', + `is_month` int(0) NULL DEFAULT NULL COMMENT '是否分月到账:0否 1是', + `date_limit` varchar(150) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '限制不可充值日期', + `deduction` int(0) NULL DEFAULT NULL COMMENT '是否支持 自动扣代理预存授信延续', + `in_stock` int(0) NULL DEFAULT NULL COMMENT '是否在售 0 否 1 是', + `packet_valid_type` int(0) NULL DEFAULT NULL COMMENT '资费计划生效类型 当月生效 yunze_card_takeEffect_type', + `dept_id` int(0) NULL DEFAULT NULL COMMENT '代理编号 与 agent_id 一致 但需要用于系统结构 数据验证', + `user_id` int(0) NULL DEFAULT NULL COMMENT '系统登录账户id 用于系统结构数据验证', + `packet_valid_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '月' COMMENT '资费计划规则 月 年 ', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `packet_id`(`packet_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 99 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资费计划' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_card_packet +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_card_route +-- ---------------------------- +DROP TABLE IF EXISTS `yz_card_route`; +CREATE TABLE `yz_card_route` ( + `cd_id` int(0) NOT NULL AUTO_INCREMENT, + `cd_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '通道编号', + `cd_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '通道名称', + `cd_username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '通道注册用户名', + `cd_pwd` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '通道用户登录密码', + `cd_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '通道key码', + `cd_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '通道url', + `cd_operator_type` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '运营商类型1移动2联通3电信4其他', + `cd_concurrency` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '线程数', + `cd_lunxun` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否轮训:0否1是', + `cd_control_type` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'API请求 控制类型 0 无 1 内部请求', + `cd_max_use` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '达量断网阈值', + `createTime` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `updateTime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', + `cd_delete` datetime(0) NULL DEFAULT NULL COMMENT '删除时间', + `cd_agent_id` char(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '代理商id', + `cd_status` char(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '通道状态 1 启用 2 停用 3 已删除', + `cd_alias` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '通道别名 ', + PRIMARY KEY (`cd_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 55 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '通道表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_card_route +-- ---------------------------- +INSERT INTO `yz_card_route` VALUES (1, 'YiDong_EC', '济南移动', '200222222221111', 'Fjkio@33fffG', '1', NULL, '1', NULL, '0', NULL, NULL, '2022-01-10 16:55:13', '2022-01-11 10:23:33', NULL, '100', '2', '中国移动01'); + +-- ---------------------------- +-- Table structure for yz_execution_task +-- ---------------------------- +DROP TABLE IF EXISTS `yz_execution_task`; +CREATE TABLE `yz_execution_task` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `create_time` datetime(0) NOT NULL, + `update_time` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0), + `start_time` datetime(0) NOT NULL COMMENT '开始时间', + `end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间', + `task_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '任务名', + `url` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '任务下载地址 1,2,3', + `auth` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '任务创建人', + `agent_id` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '代理编号', + `type` int(0) NULL DEFAULT NULL COMMENT '任务类别', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `id`(`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2060 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '执行任务表 系统下载 上传任务\r\n' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_execution_task +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_order +-- ---------------------------- +DROP TABLE IF EXISTS `yz_order`; +CREATE TABLE `yz_order` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'ID', + `ord_no` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '唯一订单号', + `ord_type` int(0) NULL DEFAULT 0 COMMENT '订单类型:1金额充值\r\n-2用量充值', + `ord_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '交易名称:账户充值-流量加油包', + `iccid` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '串号', + `wx_ord_no` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '微信订单号', + `status` int(0) NULL DEFAULT 0 COMMENT '支付状态:0未支付-1支付成功-2加包成功-3退订', + `price` double(10, 2) NULL DEFAULT 0.00 COMMENT '交易金额', + `account` double(10, 2) NULL DEFAULT 0.00 COMMENT '交易后金额', + `packet_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '交易流量包,充值填0', + `pay_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '支付方式:w微信支付-b余额支付-s平台记录', + `cre_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '生成方式:sys系统-man人工', + `is_profit` int(0) NULL DEFAULT 0 COMMENT '是否需要分润:0否-1是', + `add_package` int(0) NULL DEFAULT 0 COMMENT '是否已经执行过加包 0否 1 是', + `show_status` int(0) NULL DEFAULT 0 COMMENT '是否显示交易记录:0否-1显示', + `open_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'openid', + `agent_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '代理商id', + `profit_type` int(0) NULL DEFAULT 0 COMMENT '分润类型:0否-1分润比-2差价', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `validate_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生效类型:yunze_card_takeEffect_type', + `info` varchar(3000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注信息', + `add_parameter` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '加包参数 需要加包时获取', + `add_package_time` datetime(0) NULL DEFAULT NULL COMMENT '加包执行时间', + `del_flag` tinyint(1) NULL DEFAULT 0 COMMENT '删除标记', + `is_profit_sharing` tinyint(1) NULL DEFAULT NULL COMMENT '是否已分润 0否 1 是', + `profit_sharing_time` datetime(0) NULL DEFAULT NULL COMMENT '分润执行时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `ord_no`(`ord_no`) USING BTREE, + INDEX `agent_id_idx`(`agent_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 452017 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '订单表' ROW_FORMAT = Compact; + +-- ---------------------------- +-- Records of yz_order +-- ---------------------------- + +-- ---------------------------- +-- Table structure for yz_passageway_polling +-- ---------------------------- +DROP TABLE IF EXISTS `yz_passageway_polling`; +CREATE TABLE `yz_passageway_polling` ( + `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', + `cd_id` int(0) NOT NULL COMMENT '通道编号', + `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `upd_date` datetime(0) NOT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', + `cd_count` int(0) NOT NULL COMMENT '轮序总数', + `cd_current` int(0) NULL DEFAULT NULL COMMENT '当前轮序数量', + `polling_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '轮序批次编码', + `syn_date` datetime(0) NULL DEFAULT NULL COMMENT '最近一次同步时间', + `polling_type` int(0) NULL DEFAULT NULL COMMENT '轮询类型 ', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 70714 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '通道轮序详情表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_passageway_polling +-- ---------------------------- +INSERT INTO `yz_passageway_polling` VALUES (70711, 1, '2022-01-10 17:22:33', '2022-01-10 17:30:05', 1, 1, '202201100522305358', '2022-01-10 17:30:05', 3); +INSERT INTO `yz_passageway_polling` VALUES (70712, 1, '2022-01-10 17:26:14', '2022-01-10 17:30:05', 1, 1, '202201100526106680', '2022-01-10 17:30:05', 2); +INSERT INTO `yz_passageway_polling` VALUES (70713, 1, '2022-01-10 18:00:10', '2022-01-10 18:10:05', 1, 1, '202201100600077073', '2022-01-10 18:10:05', 3); + +-- ---------------------------- +-- Table structure for yz_sys_logs +-- ---------------------------- +DROP TABLE IF EXISTS `yz_sys_logs`; +CREATE TABLE `yz_sys_logs` ( + `id` char(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'id', + `res_url` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '请求url', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `class_method` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '执行的类方法', + `ip` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'ip', + `request_args` longblob NOT NULL COMMENT '请求参数', + `response_args` longblob NOT NULL COMMENT '响应参数', + `user_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作人', + `project` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模块', + `action_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作名称' +) ENGINE = InnoDB AUTO_INCREMENT = 8517830 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统级日志' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of yz_sys_logs +-- ---------------------------- + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/yunze-admin/pom.xml b/yunze-admin/pom.xml new file mode 100644 index 0000000..85ff54a --- /dev/null +++ b/yunze-admin/pom.xml @@ -0,0 +1,111 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + jar + yunze-admin + + + web服务入口 + + + + + + + org.springframework.boot + spring-boot-devtools + true + + + + + io.springfox + springfox-swagger2 + + + + + io.swagger + swagger-annotations + 1.5.21 + + + + io.swagger + swagger-models + 1.5.21 + + + + + io.springfox + springfox-swagger-ui + + + + + mysql + mysql-connector-java + + + + + com.yunze + yunze-framework + + + + + com.yunze + yunze-quartz + + + + + com.yunze + yunze-generator + + + + + + + + + + + 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/yunze-admin/src/main/java/com/yunze/YunZeApplication.java b/yunze-admin/src/main/java/com/yunze/YunZeApplication.java new file mode 100644 index 0000000..6fc1940 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/YunZeApplication.java @@ -0,0 +1,43 @@ +package com.yunze; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; + +/** + * 启动程序 + * + * @author yunze + */ +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) +public class YunZeApplication +{ + public static void main(String[] args) + { + // System.setProperty("spring.devtools.restart.enabled", "false"); + SpringApplication.run(YunZeApplication.class, args); + System.out.println(" IOT综合业务支撑平台 启动成功 \n" + + " ..,]. \n" + + " .,@\\`.]@@@@. \n" + + " ./@@@@@@@@@@@^ \n" + + " .. ...,@@@@@@@@@@@@@/. \n" + + " .=\\`..,]/@@@@@@@@@@/[.. .. \n" + + " ...[O@@@@@@@@@/`........ \n" + + " ../@@@@@/`..,]@@@@@@@@O`.. \n" + + " ../@@@@/.../@@@@@@@@@@@@@@@^ \n" + + " .=@@@@/..,@@@@@@@@[...,@@@@@@`. \n" + + " .=@@@@.../@@@@@@`. ..@@@@@^. \n" + + " .=@@@@..,@@@@@@`.. .=@@@@O.. \n" + + " .O@@@`..@@@@@@. ../@@@@/. ..\n" + + " ,@@@/ ./@@@@@. ...]@@@@@/`. .,/.\n" + + " ,@@@^..@@@@@^. ...[[[.... ../@`. \n" + + " .@@@^ =@@@@@\\. ../@@/.. \n" + + " ..\\@@ .@@@@@@^. ..]@@@@/.. \n" + + " ..\\..=@@@@@@@]... .....]/@@@@@@/.. \n" + + " .,@@@@@@@@@@@@@@@@@@@@@@@@/`. \n" + + " \\@@@@@@@@@@@@@@@@@@@[... \n" + + " ..[\\@@@@@@@@@/[`.. \n" + + " . .. "); + + } +} diff --git a/yunze-admin/src/main/java/com/yunze/YunZeServletInitializer.java b/yunze-admin/src/main/java/com/yunze/YunZeServletInitializer.java new file mode 100644 index 0000000..4ecb85a --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/YunZeServletInitializer.java @@ -0,0 +1,18 @@ +package com.yunze; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * web容器中进行部署 + * + * @author yunze + */ +public class YunZeServletInitializer extends SpringBootServletInitializer +{ + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) + { + return application.sources(YunZeApplication.class); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/common/CaptchaController.java b/yunze-admin/src/main/java/com/yunze/web/controller/common/CaptchaController.java new file mode 100644 index 0000000..30e9259 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/common/CaptchaController.java @@ -0,0 +1,86 @@ +package com.yunze.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.beans.factory.annotation.Value; +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.yunze.common.constant.Constants; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.utils.sign.Base64; +import com.yunze.common.utils.uuid.IdUtils; + +/** + * 验证码操作处理 + * + * @author yunze + */ +@RestController +public class CaptchaController +{ + @Resource(name = "captchaProducer") + private Producer captchaProducer; + + @Resource(name = "captchaProducerMath") + private Producer captchaProducerMath; + + @Resource + private RedisCache redisCache; + + // 验证码类型 + @Value("${yunze.captchaType}") + private String captchaType; + + /** + * 生成验证码 + */ + @GetMapping("/captchaImage") + public AjaxResult getCode(HttpServletResponse response) throws IOException + { + // 保存验证码信息 + String uuid = IdUtils.simpleUUID(); + String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; + + String capStr = null, code = null; + BufferedImage image = null; + + // 生成验证码 + 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()); + } + + AjaxResult ajax = AjaxResult.success(); + ajax.put("uuid", uuid); + ajax.put("img", Base64.encode(os.toByteArray())); + return ajax; + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/common/CommonController.java b/yunze-admin/src/main/java/com/yunze/web/controller/common/CommonController.java new file mode 100644 index 0000000..74344bc --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/common/CommonController.java @@ -0,0 +1,118 @@ +package com.yunze.web.controller.common; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +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.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import com.yunze.common.config.YunZeConfig; +import com.yunze.common.constant.Constants; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.file.FileUploadUtils; +import com.yunze.common.utils.file.FileUtils; +import com.yunze.framework.config.ServerConfig; + +/** + * 通用请求处理 + * + * @author yunze + */ +@RestController +public class CommonController +{ + private static final Logger log = LoggerFactory.getLogger(CommonController.class); + + @Autowired + private ServerConfig serverConfig; + + /** + * 通用下载请求 + * + * @param fileName 文件名称 + * @param delete 是否删除 + */ + @GetMapping("common/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 = YunZeConfig.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); + } + } + + /** + * 通用上传请求 + */ + @PostMapping("/common/upload") + public AjaxResult uploadFile(MultipartFile file) throws Exception + { + try + { + // 上传文件路径 + String filePath = YunZeConfig.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + AjaxResult ajax = AjaxResult.success(); + ajax.put("fileName", fileName); + ajax.put("url", url); + return ajax; + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 本地资源通用下载 + */ + @GetMapping("/common/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 = YunZeConfig.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); + } + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/monitor/CacheController.java b/yunze-admin/src/main/java/com/yunze/web/controller/monitor/CacheController.java new file mode 100644 index 0000000..8666b11 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/monitor/CacheController.java @@ -0,0 +1,53 @@ +package com.yunze.web.controller.monitor; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +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.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.utils.StringUtils; + +/** + * 缓存监控 + * + * @author yunze + */ +@RestController +@RequestMapping("/monitor/cache") +public class CacheController +{ + @Autowired + private RedisTemplate redisTemplate; + + @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); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/monitor/ServerController.java b/yunze-admin/src/main/java/com/yunze/web/controller/monitor/ServerController.java new file mode 100644 index 0000000..02d7979 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/monitor/ServerController.java @@ -0,0 +1,27 @@ +package com.yunze.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.yunze.common.core.domain.AjaxResult; +import com.yunze.framework.web.domain.Server; + +/** + * 服务器监控 + * + * @author yunze + */ +@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/yunze-admin/src/main/java/com/yunze/web/controller/monitor/SysLogininforController.java b/yunze-admin/src/main/java/com/yunze/web/controller/monitor/SysLogininforController.java new file mode 100644 index 0000000..fba2e0b --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/monitor/SysLogininforController.java @@ -0,0 +1,67 @@ +package com.yunze.web.controller.monitor; + +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.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.system.domain.SysLogininfor; +import com.yunze.system.service.ISysLogininforService; + +/** + * 系统访问记录 + * + * @author yunze + */ +@RestController +@RequestMapping("/monitor/logininfor") +public class SysLogininforController extends BaseController +{ + @Autowired + private ISysLogininforService logininforService; + + @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')") + @GetMapping("/export") + public AjaxResult export(SysLogininfor logininfor) + { + List list = logininforService.selectLogininforList(logininfor); + ExcelUtil util = new ExcelUtil(SysLogininfor.class); + return util.exportExcel(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 AjaxResult.success(); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/monitor/SysOperlogController.java b/yunze-admin/src/main/java/com/yunze/web/controller/monitor/SysOperlogController.java new file mode 100644 index 0000000..c1e77bc --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/monitor/SysOperlogController.java @@ -0,0 +1,67 @@ +package com.yunze.web.controller.monitor; + +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.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.system.domain.SysOperLog; +import com.yunze.system.service.ISysOperLogService; + +/** + * 操作日志记录 + * + * @author yunze + */ +@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')") + @GetMapping("/export") + public AjaxResult export(SysOperLog operLog) + { + List list = operLogService.selectOperLogList(operLog); + ExcelUtil util = new ExcelUtil(SysOperLog.class); + return util.exportExcel(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 AjaxResult.success(); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/monitor/SysUserOnlineController.java b/yunze-admin/src/main/java/com/yunze/web/controller/monitor/SysUserOnlineController.java new file mode 100644 index 0000000..8f42045 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/monitor/SysUserOnlineController.java @@ -0,0 +1,94 @@ +package com.yunze.web.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.yunze.common.annotation.Log; +import com.yunze.common.constant.Constants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.StringUtils; +import com.yunze.system.domain.SysUserOnline; +import com.yunze.system.service.ISysUserOnlineService; + +import javax.annotation.Resource; + +/** + * 在线用户监控 + * + * @author yunze + */ +@RestController +@RequestMapping("/monitor/online") +public class SysUserOnlineController extends BaseController +{ + @Autowired + private ISysUserOnlineService userOnlineService; + + @Resource + private RedisCache redisCache; + + @PreAuthorize("@ss.hasPermi('monitor:online:list')") + @GetMapping("/list") + public TableDataInfo list(String ipaddr, String userName) + { + Collection keys = redisCache.keys(Constants.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(Constants.LOGIN_TOKEN_KEY + tokenId); + return AjaxResult.success(); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/system/SysConfigController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysConfigController.java new file mode 100644 index 0000000..fadc27d --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysConfigController.java @@ -0,0 +1,136 @@ +package com.yunze.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.yunze.common.annotation.Log; +import com.yunze.common.annotation.RepeatSubmit; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.system.domain.SysConfig; +import com.yunze.system.service.ISysConfigService; + +/** + * 参数配置 信息操作处理 + * + * @author yunze + */ +@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')") + @GetMapping("/export") + public AjaxResult export(SysConfig config) + { + List list = configService.selectConfigList(config); + ExcelUtil util = new ExcelUtil(SysConfig.class); + return util.exportExcel(list, "参数数据"); + } + + /** + * 根据参数编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:config:query')") + @GetMapping(value = "/{configId}") + public AjaxResult getInfo(@PathVariable Long configId) + { + return AjaxResult.success(configService.selectConfigById(configId)); + } + + /** + * 根据参数键名查询参数值 + */ + @GetMapping(value = "/configKey/{configKey}") + public AjaxResult getConfigKey(@PathVariable String configKey) + { + return AjaxResult.success(configService.selectConfigByKey(configKey)); + } + + /** + * 新增参数配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:add')") + @Log(title = "参数管理", businessType = BusinessType.INSERT) + @PostMapping + @RepeatSubmit + public AjaxResult add(@Validated @RequestBody SysConfig config) + { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) + { + return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setCreateBy(SecurityUtils.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 AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setUpdateBy(SecurityUtils.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 AjaxResult.success(); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/system/SysDeptController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysDeptController.java new file mode 100644 index 0000000..2aba183 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysDeptController.java @@ -0,0 +1,163 @@ +package com.yunze.web.controller.system; + +import java.util.Iterator; +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.yunze.common.annotation.Log; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysDept; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.system.service.ISysDeptService; + +/** + * 部门信息 + * + * @author yunze + */ +@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 AjaxResult.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()); + Iterator it = depts.iterator(); + while (it.hasNext()) + { + SysDept d = (SysDept) it.next(); + if (d.getDeptId().intValue() == deptId + || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) + { + it.remove(); + } + } + return AjaxResult.success(depts); + } + + /** + * 根据部门编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:dept:query')") + @GetMapping(value = "/{deptId}") + public AjaxResult getInfo(@PathVariable Long deptId) + { + return AjaxResult.success(deptService.selectDeptById(deptId)); + } + + /** + * 获取部门下拉树列表 + */ + @GetMapping("/treeselect") + public AjaxResult treeselect(SysDept dept) + { + List depts = deptService.selectDeptList(dept); + return AjaxResult.success(deptService.buildDeptTreeSelect(depts)); + } + + /** + * 加载对应角色部门列表树 + */ + @GetMapping(value = "/roleDeptTreeselect/{roleId}") + public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) + { + List depts = deptService.selectDeptList(new SysDept()); + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); + ajax.put("depts", deptService.buildDeptTreeSelect(depts)); + return ajax; + } + + /** + * 新增部门 + */ + @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 AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + dept.setCreateBy(SecurityUtils.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) + { + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) + { + return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + else if (dept.getParentId().equals(dept.getDeptId())) + { + return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); + } + else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) + && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) + { + return AjaxResult.error("该部门包含未停用的子部门!"); + } + dept.setUpdateBy(SecurityUtils.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 AjaxResult.error("存在下级部门,不允许删除"); + } + if (deptService.checkDeptExistUser(deptId)) + { + return AjaxResult.error("部门存在用户,不允许删除"); + } + return toAjax(deptService.deleteDeptById(deptId)); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/system/SysDictDataController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysDictDataController.java new file mode 100644 index 0000000..654015c --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysDictDataController.java @@ -0,0 +1,121 @@ +package com.yunze.web.controller.system; + +import java.util.ArrayList; +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.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.system.service.ISysDictDataService; +import com.yunze.system.service.ISysDictTypeService; + +/** + * 数据字典信息 + * + * @author yunze + */ +@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')") + @GetMapping("/export") + public AjaxResult export(SysDictData dictData) + { + List list = dictDataService.selectDictDataList(dictData); + ExcelUtil util = new ExcelUtil(SysDictData.class); + return util.exportExcel(list, "字典数据"); + } + + /** + * 查询字典数据详细 + */ + @PreAuthorize("@ss.hasPermi('system:dict:query')") + @GetMapping(value = "/{dictCode}") + public AjaxResult getInfo(@PathVariable Long dictCode) + { + return AjaxResult.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 AjaxResult.success(data); + } + + /** + * 新增字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:add')") + @Log(title = "字典数据", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDictData dict) + { + dict.setCreateBy(SecurityUtils.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(SecurityUtils.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/yunze-admin/src/main/java/com/yunze/web/controller/system/SysDictTypeController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysDictTypeController.java new file mode 100644 index 0000000..531136a --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysDictTypeController.java @@ -0,0 +1,132 @@ +package com.yunze.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.yunze.common.annotation.Log; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysDictType; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.system.service.ISysDictTypeService; + +/** + * 数据字典信息 + * + * @author yunze + */ +@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')") + @GetMapping("/export") + public AjaxResult export(SysDictType dictType) + { + List list = dictTypeService.selectDictTypeList(dictType); + ExcelUtil util = new ExcelUtil(SysDictType.class); + return util.exportExcel(list, "字典类型"); + } + + /** + * 查询字典类型详细 + */ + @PreAuthorize("@ss.hasPermi('system:dict:query')") + @GetMapping(value = "/{dictId}") + public AjaxResult getInfo(@PathVariable Long dictId) + { + return AjaxResult.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 AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setCreateBy(SecurityUtils.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 AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setUpdateBy(SecurityUtils.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 AjaxResult.success(); + } + + /** + * 获取字典选择框列表 + */ + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + List dictTypes = dictTypeService.selectDictTypeAll(); + return AjaxResult.success(dictTypes); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/system/SysLoginController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysLoginController.java new file mode 100644 index 0000000..84a454a --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysLoginController.java @@ -0,0 +1,94 @@ +package com.yunze.web.controller.system; + +import java.util.List; +import java.util.Set; +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 com.yunze.common.constant.Constants; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysMenu; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginBody; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.utils.ServletUtils; +import com.yunze.framework.web.service.SysLoginService; +import com.yunze.framework.web.service.SysPermissionService; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.ISysMenuService; + +/** + * 登录验证 + * + * @author yunze + */ +@RestController +public class SysLoginController +{ + @Autowired + private SysLoginService loginService; + + @Autowired + private ISysMenuService menuService; + + @Autowired + private SysPermissionService permissionService; + + @Autowired + private TokenService tokenService; + + /** + * 登录方法 + * + * @param loginBody 登录信息 + * @return 结果 + */ + @PostMapping("/login") + public AjaxResult login(@RequestBody LoginBody loginBody) + { + AjaxResult ajax = AjaxResult.success(); + // 生成令牌 + String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), + loginBody.getUuid()); + ajax.put(Constants.TOKEN, token); + return ajax; + } + + /** + * 获取用户信息 + * + * @return 用户信息 + */ + @GetMapping("getInfo") + public AjaxResult getInfo() + { + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + SysUser user = loginUser.getUser(); + // 角色集合 + Set roles = permissionService.getRolePermission(user); + // 权限集合 + Set permissions = permissionService.getMenuPermission(user); + AjaxResult ajax = AjaxResult.success(); + ajax.put("user", user); + ajax.put("roles", roles); + ajax.put("permissions", permissions); + return ajax; + } + + /** + * 获取路由信息 + * + * @return 路由信息 + */ + @GetMapping("getRouters") + public AjaxResult getRouters() + { + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + // 用户信息 + SysUser user = loginUser.getUser(); + List menus = menuService.selectMenuTreeByUserId(user.getUserId()); + return AjaxResult.success(menuService.buildMenus(menus)); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/system/SysMenuController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysMenuController.java new file mode 100644 index 0000000..a34df1e --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysMenuController.java @@ -0,0 +1,157 @@ +package com.yunze.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.yunze.common.annotation.Log; +import com.yunze.common.constant.Constants; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysMenu; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.ISysMenuService; + +/** + * 菜单信息 + * + * @author yunze + */ +@RestController +@RequestMapping("/system/menu") +public class SysMenuController extends BaseController +{ + @Autowired + private ISysMenuService menuService; + + @Autowired + private TokenService tokenService; + + /** + * 获取菜单列表 + */ + @PreAuthorize("@ss.hasPermi('system:menu:list')") + @GetMapping("/list") + public AjaxResult list(SysMenu menu) + { + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + Long userId = loginUser.getUser().getUserId(); + List menus = menuService.selectMenuList(menu, userId); + return AjaxResult.success(menus); + } + + /** + * 根据菜单编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:menu:query')") + @GetMapping(value = "/{menuId}") + public AjaxResult getInfo(@PathVariable Long menuId) + { + return AjaxResult.success(menuService.selectMenuById(menuId)); + } + + /** + * 获取菜单下拉树列表 + */ + @GetMapping("/treeselect") + public AjaxResult treeselect(SysMenu menu) + { + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + Long userId = loginUser.getUser().getUserId(); + List menus = menuService.selectMenuList(menu, userId); + return AjaxResult.success(menuService.buildMenuTreeSelect(menus)); + } + + /** + * 加载对应角色菜单列表树 + */ + @GetMapping(value = "/roleMenuTreeselect/{roleId}") + public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) + { + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + List menus = menuService.selectMenuList(loginUser.getUser().getUserId()); + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); + 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 AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) + && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) + { + return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } + menu.setCreateBy(SecurityUtils.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 AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) + && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) + { + return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } + else if (menu.getMenuId().equals(menu.getParentId())) + { + return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); + } + menu.setUpdateBy(SecurityUtils.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 AjaxResult.error("存在子菜单,不允许删除"); + } + if (menuService.checkMenuExistRole(menuId)) + { + return AjaxResult.error("菜单已分配,不允许删除"); + } + return toAjax(menuService.deleteMenuById(menuId)); + } +} \ No newline at end of file diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/system/SysNoticeController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysNoticeController.java new file mode 100644 index 0000000..68cc955 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysNoticeController.java @@ -0,0 +1,92 @@ +package com.yunze.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.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.system.domain.SysNotice; +import com.yunze.system.service.ISysNoticeService; + +/** + * 公告 信息操作处理 + * + * @author yunze + */ +@RestController +@RequestMapping("/system/notice") +public class SysNoticeController extends BaseController +{ + @Autowired + private ISysNoticeService noticeService; + + /** + * 获取通知公告列表 + */ + @PreAuthorize("@ss.hasPermi('system:notice:list')") + @GetMapping("/list") + public TableDataInfo list(SysNotice notice) + { + startPage(); + List list = noticeService.selectNoticeList(notice); + return getDataTable(list); + } + + /** + * 根据通知公告编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:notice:query')") + @GetMapping(value = "/{noticeId}") + public AjaxResult getInfo(@PathVariable Long noticeId) + { + return AjaxResult.success(noticeService.selectNoticeById(noticeId)); + } + + /** + * 新增通知公告 + */ + @PreAuthorize("@ss.hasPermi('system:notice:add')") + @Log(title = "通知公告", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysNotice notice) + { + notice.setCreateBy(SecurityUtils.getUsername()); + return toAjax(noticeService.insertNotice(notice)); + } + + /** + * 修改通知公告 + */ + @PreAuthorize("@ss.hasPermi('system:notice:edit')") + @Log(title = "通知公告", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysNotice notice) + { + notice.setUpdateBy(SecurityUtils.getUsername()); + return toAjax(noticeService.updateNotice(notice)); + } + + /** + * 删除通知公告 + */ + @PreAuthorize("@ss.hasPermi('system:notice:remove')") + @Log(title = "通知公告", businessType = BusinessType.DELETE) + @DeleteMapping("/{noticeIds}") + public AjaxResult remove(@PathVariable Long[] noticeIds) + { + return toAjax(noticeService.deleteNoticeByIds(noticeIds)); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/system/SysPostController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysPostController.java new file mode 100644 index 0000000..4d1d59f --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysPostController.java @@ -0,0 +1,130 @@ +package com.yunze.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.yunze.common.annotation.Log; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.system.domain.SysPost; +import com.yunze.system.service.ISysPostService; + +/** + * 岗位信息操作处理 + * + * @author yunze + */ +@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')") + @GetMapping("/export") + public AjaxResult export(SysPost post) + { + List list = postService.selectPostList(post); + ExcelUtil util = new ExcelUtil(SysPost.class); + return util.exportExcel(list, "岗位数据"); + } + + /** + * 根据岗位编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:post:query')") + @GetMapping(value = "/{postId}") + public AjaxResult getInfo(@PathVariable Long postId) + { + return AjaxResult.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 AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) + { + return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); + } + post.setCreateBy(SecurityUtils.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 AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) + { + return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); + } + post.setUpdateBy(SecurityUtils.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 AjaxResult.success(posts); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/system/SysProfileController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysProfileController.java new file mode 100644 index 0000000..ed178a7 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysProfileController.java @@ -0,0 +1,139 @@ +package com.yunze.web.controller.system; + +import java.io.IOException; +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.yunze.common.annotation.Log; +import com.yunze.common.config.YunZeConfig; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.file.FileUploadUtils; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.ISysUserService; + +/** + * 个人信息 业务处理 + * + * @author yunze + */ +@RestController +@RequestMapping("/system/user/profile") +public class SysProfileController extends BaseController +{ + @Autowired + private ISysUserService userService; + + @Autowired + private TokenService tokenService; + + /** + * 个人信息 + */ + @GetMapping + public AjaxResult profile() + { + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + 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) + { + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + if (userService.updateUserProfile(user) > 0) + { + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + // 更新缓存用户信息 + loginUser.getUser().setNickName(user.getNickName()); + loginUser.getUser().setPhonenumber(user.getPhonenumber()); + loginUser.getUser().setEmail(user.getEmail()); + loginUser.getUser().setSex(user.getSex()); + tokenService.setLoginUser(loginUser); + return AjaxResult.success(); + } + return AjaxResult.error("修改个人信息异常,请联系管理员"); + } + + /** + * 重置密码 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PutMapping("/updatePwd") + public AjaxResult updatePwd(String oldPassword, String newPassword) + { + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + String userName = loginUser.getUsername(); + String password = loginUser.getPassword(); + if (!SecurityUtils.matchesPassword(oldPassword, password)) + { + return AjaxResult.error("修改密码失败,旧密码错误"); + } + if (SecurityUtils.matchesPassword(newPassword, password)) + { + return AjaxResult.error("新密码不能与旧密码相同"); + } + if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) + { + // 更新缓存用户密码 + loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); + tokenService.setLoginUser(loginUser); + return AjaxResult.success(); + } + return AjaxResult.error("修改密码异常,请联系管理员"); + } + + /** + * 头像上传 + */ + @Log(title = "用户头像", businessType = BusinessType.UPDATE) + @PostMapping("/avatar") + public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException + { + if (!file.isEmpty()) + { + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + String avatar = FileUploadUtils.upload(YunZeConfig.getAvatarPath(), file); + if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) + { + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", avatar); + // 更新缓存用户头像 + loginUser.getUser().setAvatar(avatar); + tokenService.setLoginUser(loginUser); + return ajax; + } + } + return AjaxResult.error("上传图片异常,请联系管理员"); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/system/SysRoleController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysRoleController.java new file mode 100644 index 0000000..de5f174 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysRoleController.java @@ -0,0 +1,182 @@ +package com.yunze.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.yunze.common.annotation.Log; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysRole; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.framework.web.service.SysPermissionService; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.ISysRoleService; +import com.yunze.system.service.ISysUserService; + +/** + * 角色信息 + * + * @author yunze + */ +@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; + + @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')") + @GetMapping("/export") + public AjaxResult export(SysRole role) + { + List list = roleService.selectRoleList(role); + ExcelUtil util = new ExcelUtil(SysRole.class); + return util.exportExcel(list, "角色数据"); + } + + /** + * 根据角色编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping(value = "/{roleId}") + public AjaxResult getInfo(@PathVariable Long roleId) + { + return AjaxResult.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 AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) + { + return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setCreateBy(SecurityUtils.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); + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) + { + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) + { + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setUpdateBy(SecurityUtils.getUsername()); + + if (roleService.updateRole(role) > 0) + { + // 更新缓存用户权限 + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) + { + loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); + loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); + tokenService.setLoginUser(loginUser); + } + return AjaxResult.success(); + } + return AjaxResult.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); + 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); + role.setUpdateBy(SecurityUtils.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 AjaxResult.success(roleService.selectRoleAll()); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/system/SysUserController.java b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysUserController.java new file mode 100644 index 0000000..da27386 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/system/SysUserController.java @@ -0,0 +1,205 @@ +package com.yunze.web.controller.system; + +import java.util.List; +import java.util.stream.Collectors; +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 org.springframework.web.multipart.MultipartFile; +import com.yunze.common.annotation.Log; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysRole; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.ISysPostService; +import com.yunze.system.service.ISysRoleService; +import com.yunze.system.service.ISysUserService; + +/** + * 用户信息 + * + * @author yunze + */ +@RestController +@RequestMapping("/system/user") +public class SysUserController extends BaseController +{ + @Autowired + private ISysUserService userService; + + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysPostService postService; + + @Autowired + private TokenService tokenService; + + /** + * 获取用户列表 + */ + @PreAuthorize("@ss.hasPermi('system:user:list')") + @GetMapping("/list") + public TableDataInfo list(SysUser user) + { + startPage(); + List list = userService.selectUserList(user); + return getDataTable(list); + } + + @Log(title = "用户管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:user:export')") + @GetMapping("/export") + public AjaxResult export(SysUser user) + { + List list = userService.selectUserList(user); + ExcelUtil util = new ExcelUtil(SysUser.class); + return util.exportExcel(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()); + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + String operName = loginUser.getUsername(); + String message = userService.importUser(userList, updateSupport, operName); + return AjaxResult.success(message); + } + + @GetMapping("/importTemplate") + public AjaxResult importTemplate() + { + ExcelUtil util = new ExcelUtil(SysUser.class); + return util.importTemplateExcel("用户数据"); + } + + /** + * 根据用户编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:user:query')") + @GetMapping(value = { "/", "/{userId}" }) + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long 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)) + { + ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); + ajax.put("postIds", postService.selectPostListByUserId(userId)); + ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); + } + return ajax; + } + + /** + * 新增用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:add')") + @Log(title = "用户管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysUser user) + { + if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) + { + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); + } + else if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setCreateBy(SecurityUtils.getUsername()); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + return toAjax(userService.insertUser(user)); + } + + /** + * 修改用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysUser user) + { + userService.checkUserAllowed(user); + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setUpdateBy(SecurityUtils.getUsername()); + return toAjax(userService.updateUser(user)); + } + + /** + * 删除用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:remove')") + @Log(title = "用户管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{userIds}") + public AjaxResult remove(@PathVariable Long[] userIds) + { + 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); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + user.setUpdateBy(SecurityUtils.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); + user.setUpdateBy(SecurityUtils.getUsername()); + return toAjax(userService.updateUserStatus(user)); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/tool/SwaggerController.java b/yunze-admin/src/main/java/com/yunze/web/controller/tool/SwaggerController.java new file mode 100644 index 0000000..059ccfe --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/tool/SwaggerController.java @@ -0,0 +1,24 @@ +package com.yunze.web.controller.tool; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import com.yunze.common.core.controller.BaseController; + +/** + * swagger 接口 + * + * @author yunze + */ +@Controller +@RequestMapping("/tool/swagger") +public class SwaggerController extends BaseController +{ + @PreAuthorize("@ss.hasPermi('tool:swagger:view')") + @GetMapping() + public String index() + { + return redirect("/swagger-ui.html"); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/tool/TestController.java b/yunze-admin/src/main/java/com/yunze/web/controller/tool/TestController.java new file mode 100644 index 0000000..c31dcd2 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/tool/TestController.java @@ -0,0 +1,181 @@ +package com.yunze.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.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.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 yunze + */ +@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 AjaxResult userList() + { + List userList = new ArrayList(users.values()); + return AjaxResult.success(userList); + } + + @ApiOperation("获取用户详细") + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") + @GetMapping("/{userId}") + public AjaxResult getUser(@PathVariable Integer userId) + { + if (!users.isEmpty() && users.containsKey(userId)) + { + return AjaxResult.success(users.get(userId)); + } + else + { + return error("用户不存在"); + } + } + + @ApiOperation("新增用户") + @ApiImplicitParams({ + @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer"), + @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String"), + @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String"), + @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String") + }) + @PostMapping("/save") + public AjaxResult save(UserEntity user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) + { + return error("用户ID不能为空"); + } + return AjaxResult.success(users.put(user.getUserId(), user)); + } + + @ApiOperation("更新用户") + @PutMapping("/update") + public AjaxResult update(@RequestBody UserEntity user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) + { + return error("用户ID不能为空"); + } + if (users.isEmpty() || !users.containsKey(user.getUserId())) + { + return error("用户不存在"); + } + users.remove(user.getUserId()); + return AjaxResult.success(users.put(user.getUserId(), user)); + } + + @ApiOperation("删除用户信息") + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path") + @DeleteMapping("/{userId}") + public AjaxResult delete(@PathVariable Integer userId) + { + if (!users.isEmpty() && users.containsKey(userId)) + { + users.remove(userId); + return success(); + } + else + { + return error("用户不存在"); + } + } +} + +@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/yunze-admin/src/main/java/com/yunze/web/controller/yunze/PollingController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/PollingController.java new file mode 100644 index 0000000..b59f251 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/PollingController.java @@ -0,0 +1,61 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.system.service.yunze.IYPollingService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; + +/** + * 通道进度 + * 2021-8-26 + */ +@Api("通道进度") +@RestController +@RequestMapping("/yunze/polling") +public class PollingController extends BaseController { + + @Autowired + private IYPollingService iyPollingService; + + /** + * 执行通道查询 + */ + @PreAuthorize("@ss.hasPermi('yunze:polling:list')") + @PostMapping(value = "/list", produces = {"application/json;charset=UTF-8"}) + public String SynFlow(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(iyPollingService.getList(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
system:polling:list
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("通道进度 异常!"); + } +} + + + + + + + + + + + + + diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzAgentPackageController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzAgentPackageController.java new file mode 100644 index 0000000..c8ddad6 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzAgentPackageController.java @@ -0,0 +1,154 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.yunze.IYzAgentPackageService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +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.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * 代理资费组 管理 + * 2021-06-22 + * @author root + */ +@Api("代理资费组管理") +@RestController +@RequestMapping("/yunze/agentTariffGroup") +public class YzAgentPackageController extends BaseController +{ + + @Autowired + private IYzAgentPackageService agentPackageService; + + + + /** + * 代理资费组 列表 + */ + @PreAuthorize("@ss.hasPermi('yunze:agentTariffGroup:list')") + @PostMapping(value = "/list", produces = { "application/json;charset=UTF-8" }) + public String list(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Object agent_idObj = Parammap.get("agent_id"); + if(agent_idObj==null){ + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + List agent_id = new ArrayList<>(); + agent_id.add(currentUser.getDeptId().toString()); + Parammap.put("agent_id",agent_id); + } + return MyRetunSuccess(agentPackageService.selMap(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:agentTariffGroup:list
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取代理资费组列表 异常!"); + } + + + /* *//** + * 代理资费组 新增 + *//* + @Log(title = "代理资费组", businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('yunze:agentTariffGroup:add')") + @PostMapping(value = "/add", produces = { "application/json;charset=UTF-8" }) + public String add(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(agentPackageService.add(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:agentTariffGroup:add
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("代理资费组 新增 异常!"); + } + + + *//** + * 代理资费组 详情 + *//* + @PreAuthorize("@ss.hasPermi('yunze:agentTariffGroup:find')") + @PostMapping(value = "/find", produces = { "application/json;charset=UTF-8" }) + public String find(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(agentPackageService.find(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:agentTariffGroup:find
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("代理资费组 详情 异常!"); + } + + + *//** + * 代理资费组 修改 + *//* + @Log(title = "代理资费组", businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('yunze:agentTariffGroup:edit')") + @PostMapping(value = "/edit", produces = { "application/json;charset=UTF-8" }) + public String edit(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + boolean bool = agentPackageService.update(Parammap); + String msg = bool?"修改 代理资费组成功!":"网络异常请稍后重试!!!"; + return MyRetunSuccess(bool,msg); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:agentTariffGroup:edit
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("代理资费组 修改 异常!"); + } +*/ + + + + + + + + + + +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzAgentPacketController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzAgentPacketController.java new file mode 100644 index 0000000..3bc3781 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzAgentPacketController.java @@ -0,0 +1,144 @@ +package com.yunze.web.controller.yunze; + +import com.yunze.common.core.controller.BaseController; +import com.yunze.system.service.yunze.IYzAgentPacketService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; + +/** + * 代理代理资费计划 管理 + * 2021-06-24 + * @author root + */ +@Api("代理资费计划管理") +@RestController +@RequestMapping("/yunze/agentTariffPlan") +public class YzAgentPacketController extends BaseController +{ + + @Autowired + private IYzAgentPacketService agentPacketService; + + + + + /* *//** + * 代理资费计划 新增 + *//* + @Log(title = "代理资费计划", businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('yunze:agentTariffPlan:add')") + @PostMapping(value = "/add", produces = { "application/json;charset=UTF-8" }) + public String add(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Double error_so = Double.parseDouble(Parammap.get("error_so").toString()); + Double packet_flow = Double.parseDouble(Parammap.get("packet_flow").toString()); + Double error_flow = Double.parseDouble(Parammap.get("error_flow").toString()); + + if(error_so>=1){ + if(packet_flow>=error_flow) { + //校验计算 用量 + Parammap.put("error_flow",Arith.div(packet_flow,error_so,0)); + return MyRetunSuccess(agentPacketService.add(Parammap),null); + }else{ + return Myerr("资费计划 流量 不能小于 资费计划 用量 !"); + } + }else{ + return Myerr("资费计划系数不能 小于 1 !"); + } + + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:agentTariffPlan:add
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("代理资费计划 新增 异常!"); + } + + + + *//** + * 代理资费计划 详情 + *//* + @PreAuthorize("@ss.hasPermi('yunze:agentTariffPlan:find')") + @PostMapping(value = "/find", produces = { "application/json;charset=UTF-8" }) + public String find(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + //校验计算 用量 + return MyRetunSuccess(agentPacketService.find(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:agentTariffPlan:find
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("代理资费计划 详情 异常!"); + } + + + *//** + * 代理资费计划 编辑 + *//* + @Log(title = "代理资费计划", businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('yunze:agentTariffPlan:edit')") + @PostMapping(value = "/edit", produces = { "application/json;charset=UTF-8" }) + public String edit(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Double error_so = Double.parseDouble(Parammap.get("error_so").toString()); + Double packet_flow = Double.parseDouble(Parammap.get("packet_flow").toString()); + Double error_flow = Double.parseDouble(Parammap.get("error_flow").toString()); + + Double packet_price = Double.parseDouble(Parammap.get("packet_price").toString()); + Double packet_cost = Double.parseDouble(Parammap.get("packet_cost").toString()); + + if(error_so>=1){ + if(packet_flow>=error_flow) { + //校验计算 用量 + if(packet_price>=packet_cost){ + //售价大等于 成本 + Parammap.put("error_flow",Arith.div(packet_flow,error_so,0)); + return MyRetunSuccess(agentPacketService.update(Parammap),null); + }else{ + return Myerr("售价 不能小于 成本 !"); + } + }else{ + return Myerr("资费计划 流量 不能小于 资费计划 用量 !"); + } + }else{ + return Myerr("资费计划系数不能 小于 1 !"); + } + + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:agentTariffPlan:edit
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("代理资费计划 编辑 异常!"); + } +*/ + + + + + +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardController.java new file mode 100644 index 0000000..70cdd79 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardController.java @@ -0,0 +1,980 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.entity.YzCard; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.*; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.ISysUserService; +import com.yunze.system.service.impl.yunze.YzCardServiceImpl; +import com.yunze.system.service.yunze.IYzCardService; +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 org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 卡信息 + * 2021-06-05 + * @author root + */ +@Api("卡信息") +@RestController +@RequestMapping("/yunze/card") +public class YzCardController extends BaseController +{ + @Resource + private YzCardServiceImpl yzCardServiceImpl; + @Resource + private ApiParamMap apiParamMap; + @Autowired + private ISysUserService userService; + @Resource + private TokenService tokenService; + @Resource + private CardFlowSyn cardFlowSyn; + @Resource + private GetShowStatIdArr getShowStatIdArr; + @Resource + private InternalApiRequest internalApiRequest; + + + /** + * 卡板信息列表 + */ + @PreAuthorize("@ss.hasPermi('yunze:card:list')") + /* @PostMapping("/list", produces = { "application/json;charset=UTF-8" })*/ + @PostMapping(value = "/list", produces = { "application/json;charset=UTF-8" }) + public String list(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + List agent_id = new ArrayList<>(); + if(currentUser.getDeptId()!=100){ + if(Parammap.get("agent_id")!=null){ + List P_agent_id = (List) Parammap.get("agent_id"); + agent_id.addAll(P_agent_id); + }else{ + agent_id.add(Integer.parseInt(currentUser.getDeptId().toString())); + Parammap.put("agent_id",agent_id); + } + } + return MyRetunSuccess(yzCardServiceImpl.selMap(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:list
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取卡板信息列表 异常!"); + } + + + + + + /** + * 获取 所属代理下 卡分组 + */ + @PreAuthorize("@ss.hasPermi('yunze:card:list')") + @PostMapping(value = "/getCardGrouping", produces = { "application/json;charset=UTF-8" }) + public String getCardGrouping(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + List agent_id = new ArrayList<>(); + String StrAgent_id = currentUser.getDeptId().toString()+","; + if(Parammap.get("agent_id")!=null){ + List P_agent_id = (List) Parammap.get("agent_id"); + for (int i = 0; i < P_agent_id.size(); i++) { + StrAgent_id += ""+P_agent_id.get(i)+","; + } + } + if(currentUser.getDeptId()==100){ + if(Parammap.get("agent_id")!=null){ + Parammap.put("agent_id",StrAgent_id); + } + }else{ + Parammap.put("agent_id",StrAgent_id); + } + return MyRetunSuccess(yzCardServiceImpl.getCardGrouping(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
/yunze/card/getCardGrouping
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取 所属代理下 卡分组 异常!"); + } + + + + + + + + + + + /** + * 查询卡板详情 + */ + @PreAuthorize("@ss.hasPermi('yunze:card:find')") + @PostMapping(value = "/find", produces = { "application/json;charset=utf-8" })// + public String find(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(yzCardServiceImpl.find(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:find
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询卡板详情 异常!"); + } + + + /** + * 导入 + * @param file + * @param updateSupport + * @return + */ + @Log(title = "卡列表", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('yunze:card:import')") + @PostMapping(value = "/importData", produces = { "application/json;charset=utf-8" }) + public AjaxResult importData(MultipartFile file, boolean updateSupport) + { + try { + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser User = loginUser.getUser(); + return AjaxResult.success(yzCardServiceImpl.uploadCard(file,updateSupport,User)); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:import
ip = " + ip + "
",e.getCause().toString()); + } + return AjaxResult.error("导入卡列表 异常!"); + } + + + + /** + * 下载导入模板 + * @return + */ + @GetMapping("/importTemplate") + public AjaxResult importTemplate() + { + ExcelUtil util = new ExcelUtil(YzCard.class); + return util.importTemplateExcel("卡列表数据"); + } + + + /** + * 连接管理获取部门名称 + * @return + */ + @PreAuthorize("@ss.hasPermi('yunze:card:list')") + @PostMapping(value = "/getDeptName", produces = { "application/json;charset=utf-8" }) + public String getDeptName() + { + try { + return MyRetunSuccess(yzCardServiceImpl.getDeptName(),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:list " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("连接管理获取部门名称 异常!"); + } + + + + + + /** + * 导出 + * @return + */ + @Log(title = "卡列表", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('yunze:card:exportData')") + @PostMapping(value = "/exportData", produces = { "application/json;charset=utf-8" }) + public String exportData(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + + + return MyRetunSuccess(yzCardServiceImpl.exportData(Parammap,currentUser),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:exportData
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("导出卡列表 异常!"); + } + + + + /** + * 查询 集团下所属人员 + * @return + */ + @PreAuthorize("@ss.hasPermi('yunze:card:findDeptUser')") + @PostMapping(value = "/findDeptUser", produces = { "application/json;charset=utf-8" }) + public String findDeptUser(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + String dept_id = Parammap.get("dept_id").toString(); + if(dept_id!=null && dept_id!=""){ + return MyRetunSuccess(userService.findDeptUser(Parammap),null); + }else{ + return Myerr("参数不全请核对后重试!"); + } + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:findDeptUser " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询 集团下所属人员 异常!"); + } + + + + /** + * 划分卡信息 + * @return + */ + @Log(title = "划卡操作", businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('yunze:card:divide')") + @PostMapping(value = "/divide", produces = { "application/json;charset=utf-8" }) + public String divide(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Object set_dept_id = Parammap.get("set_dept_id"); + Object set_user_id = Parammap.get("set_user_id"); + Object set_dept_name = Parammap.get("set_dept_name"); + Object set_user_name = Parammap.get("set_user_name"); + if(set_dept_id!=null && set_dept_id.toString()!="" && set_user_id!=null && set_user_id.toString()!="" + && set_dept_name!=null && set_dept_name.toString()!=""&& set_user_name!=null && set_user_name.toString()!=""){ + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + String agent_id = currentUser.getDeptId().toString(); + // if(!set_dept_id.equals(agent_id)){ + //权限 管理 操作必须传入当前操作人 id + List agent_idArr = new ArrayList<>(); + if(currentUser.getDeptId()!=100){ + if(Parammap.get("agent_id")!=null){ + List P_agent_id = (List) Parammap.get("agent_id"); + agent_idArr.addAll(P_agent_id); + }else{ + agent_idArr.add(Integer.parseInt(currentUser.getDeptId().toString())); + Parammap.put("agent_id",agent_idArr); + } + } + Parammap.put("TaskAgent_id",agent_id); + return MyRetunSuccess(yzCardServiceImpl.dividCard(Parammap),null); + /*}else{ + return Myerr("不能操作!"); + }*/ + }else{ + return Myerr("参数不全请核对后重试!"); + } + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:divide " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("划分卡信息 异常!"); + } + + + + /** + * 同步用量 + * @param Pstr + * @return + */ + @PreAuthorize("@ss.hasPermi('yunze:card:SynFlow')") + @PostMapping(value = "/SynFlow", produces = { "application/json;charset=utf-8" }) + public String SynFlow(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Map Route = yzCardServiceImpl.findRoute(Parammap); + if(Route!=null ){ + String cd_status = Route.get("cd_status").toString(); + if(cd_status!=null && cd_status!="" && cd_status.equals("1")){ + + Map Rmap = internalApiRequest.queryFlow(Parammap,Route); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + if(code.equals("200")){ + //获取 卡用量 开卡日期 更新 card info + if(Rmap.get("Use")!=null && Rmap.get("Use")!="" && Rmap.get("Use").toString().trim().length()>0){ + Double Use = Double.parseDouble(Rmap.get("Use").toString()); + if(Use>=0){ + try { + Map RMap = cardFlowSyn.CalculationFlow(Parammap.get("iccid").toString(),Use); + return MyRetunSuccess(RMap,"已成功同步用量!"); + }catch (Exception e){ + return Myerr("用量内部计算错误!"+e.getMessage().toString()); + } + }else{ + return Myerr("接口超频返回暂无数据返回,请稍后重试!"); + } + } + }else{ + return Myerr("网络繁忙稍后重试!"+Rmap.get("Message").toString()); + } + }else{ + String statusVal = cd_status.equals("2")?"已停用":cd_status.equals("3")?"已删除":"状态未知"; + return Myerr("同步用量 异常!"+" 通道 ["+statusVal+"]"); + } + }else{ + return Myerr(" iccid ["+Parammap.get("iccid")+"] 未划分 API通道 !请划分通道后重试!"); + } + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:SynFlow " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("同步用量 异常!"); + } + + + + /** + * 同步卡状态 + * @param Pstr + * @return + */ + @PreAuthorize("@ss.hasPermi('yunze:card:SynStatus')") + @PostMapping(value = "/SynStatus", produces = { "application/json;charset=utf-8" }) + public String SynStatus(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Map Route = yzCardServiceImpl.findRoute(Parammap); + if(Route!=null ){ + String cd_status = Route.get("cd_status").toString(); + if(cd_status!=null && cd_status!="" && cd_status.equals("1")){ + Map Rmap = internalApiRequest.queryCardStatus(Parammap,Route); + + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + if(code.equals("200")){ + //获取 卡状态 开卡日期 更新 card info + if(Rmap.get("statusCode")!=null && Rmap.get("statusCode")!="" && Rmap.get("statusCode").toString().trim().length()>0){ + String statusCode = Rmap.get("statusCode").toString().trim(); + if(!statusCode.equals("0")){ + Map Upd_Map = new HashMap<>(); + Upd_Map.put("status_id",statusCode); + Upd_Map.put("status_ShowId",getShowStatIdArr.GetShowStatId(statusCode)); + Upd_Map.put("iccid",Parammap.get("iccid").toString()); + try { + boolean bool = yzCardServiceImpl.updStatusId(Upd_Map);//变更卡状态 + if(bool){ + return MyRetunSuccess("","已成功同步卡状态!"); + }else{ + return Myerr("保存状态异常:False!"); + } + }catch (Exception e){ + return Myerr("DB保存状态异常!"+e.getMessage().toString()); + } + }else{ + return Myerr("接口超频返回暂无数据返回,请稍后重试!"); + } + } + }else{ + return Myerr("网络繁忙稍后重试!"+Rmap.get("Message").toString()); + } + + }else{ + String statusVal = cd_status.equals("2")?"已停用":cd_status.equals("3")?"已删除":"状态未知"; + return Myerr("同步卡状态 异常!"+" 通道 ["+statusVal+"]"); + } + }else{ + return Myerr(" iccid ["+Parammap.get("iccid")+"] 未划分 API通道 !请划分通道后重试!"); + } + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:SynStatus " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("同步卡状态 异常!"); + } + + + + + /** + * 同步 激活时间 + * @param Pstr + * @return + */ + @PreAuthorize("@ss.hasPermi('yunze:card:SynActivateDate')") + @PostMapping(value = "/SynActivateDate", produces = { "application/json;charset=utf-8" }) + public String SynActivateDate(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Map Route = yzCardServiceImpl.findRoute(Parammap); + if(Route!=null ){ + String cd_status = Route.get("cd_status").toString(); + if(cd_status!=null && cd_status!="" && cd_status.equals("1")){ + Map Rmap = internalApiRequest.queryCardActiveTime(Parammap,Route); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + if(code.equals("200")){ + //获取 激活时间 + if(Rmap.get("activateDate")!=null && Rmap.get("activateDate")!="" && Rmap.get("activateDate").toString().trim().length()>0){ + String activateDate = Rmap.get("activateDate").toString().trim(); + activateDate = activateDate.length()>10?activateDate.substring(0,10):activateDate; + Map Upd_Map = new HashMap<>(); + Upd_Map.put("activate_date",activateDate); + Upd_Map.put("open_date",null); + Upd_Map.put("iccid",Parammap.get("iccid").toString()); + try { + boolean bool = yzCardServiceImpl.updActivate(Upd_Map);//变更卡状态 + if(bool){ + return MyRetunSuccess("","已成功同步激活时间!"); + }else{ + return Myerr("保存激活时间异常:False!"); + } + }catch (Exception e){ + return Myerr("DB保存状态异常!"+e.getMessage().toString()); + } + }else{ + System.out.println(Rmap); + return Myerr("上游接口返回数据异常,稍后重试!"); + } + }else{ + return Myerr("网络繁忙稍后重试!"+Rmap.get("Message").toString()); + } + }else{ + String statusVal = cd_status.equals("2")?"已停用":cd_status.equals("3")?"已删除":"状态未知"; + return Myerr("同步激活时间 异常!"+" 通道 ["+statusVal+"]"); + } + }else{ + return Myerr(" iccid ["+Parammap.get("iccid")+"] 未划分 API通道 !请划分通道后重试!"); + } + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
SynActivateDate " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("同步激活时间 异常!"); + } + + + + + + /** + * 查询在线信息 + * @param Pstr + * @return + */ + @ApiOperation("查询在线信息") + @PreAuthorize("@ss.hasPermi('yunze:card:queryOnlineStatus')") + @PostMapping(value = "/queryOnlineStatus", produces = { "application/json;charset=utf-8" }) + public String queryOnlineStatus(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Map Route = yzCardServiceImpl.findRoute(Parammap); + if(Route!=null ){ + String cd_status = Route.get("cd_status").toString(); + if(cd_status!=null && cd_status!="" && cd_status.equals("1")){ + Map Rmap = internalApiRequest.queryOnlineStatus(Parammap,Route); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + if(code.equals("200")){ + return MyRetunSuccess(Rmap,"查询在线信息成功!"); + }else{ + return Myerr("暂未查询到在线信息!"); + } + }else{ + String statusVal = cd_status.equals("2")?"已停用":cd_status.equals("3")?"已删除":"状态未知"; + return Myerr("查询在线信息 异常!"+" 通道 ["+statusVal+"]"); + } + }else{ + return Myerr(" iccid ["+Parammap.get("iccid")+"] 未划分 API通道 !请划分通道后重试!"); + } + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:queryOnlineStatus " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询在线信息 异常!"); + } + + + + /** + * 机卡重绑 + * @param Pstr + * @return + */ + @ApiOperation("机卡重绑") + @PreAuthorize("@ss.hasPermi('yunze:card:CardBinding')") + @PostMapping(value = "/CardBinding", produces = { "application/json;charset=utf-8" }) + public String CardBinding(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Map Route = yzCardServiceImpl.findRoute(Parammap); + if(Route!=null ){ + String cd_status = Route.get("cd_status").toString(); + if(cd_status!=null && cd_status!="" && cd_status.equals("1")){ + Map Rmap = internalApiRequest.unbundling(Parammap,Route); + String code = Rmap.get("code").toString(); + if(code.equals("200")){ + return MyRetunSuccess(Rmap.get("Message"),"操作完成!"); + }else{ + return Myerr(Rmap.get("Message").toString()); + } + }else{ + String statusVal = cd_status.equals("2")?"已停用":cd_status.equals("3")?"已删除":"状态未知"; + return Myerr("机卡重绑 异常!"+" 通道 ["+statusVal+"]"); + } + }else{ + return Myerr(" iccid ["+Parammap.get("iccid")+"] 未划分 API通道 !请划分通道后重试!"); + } + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:CardBinding " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("机卡重绑 异常!"); + } + + + + /** + * 连接管理设置 + * @param file + * @return + */ + @Log(title = "连接管理设置", businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('yunze:card:importSet')") + @PostMapping(value = "/importSet", produces = { "application/json;charset=utf-8" }) + public AjaxResult importSet(MultipartFile file, @RequestParam Map map) + { + String Pstr = map.get("Pstr").toString(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + HashMap Parammap = new HashMap(); + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser User = loginUser.getUser(); + Parammap.put("User",User); + Parammap.put("agent_id",User.getDeptId()); + return AjaxResult.success(yzCardServiceImpl.importSet(file,Parammap)); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:import
ip = " + ip + "
",e.getCause().toString()); + } + return AjaxResult.error("连接管理设置 异常!"); + } + + + + /** + * 特殊操作查询IMEI + * @param file + * @return + */ + @Log(title = "特殊操作查询IMEI", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('yunze:card:importSelImei')") + @PostMapping(value = "/importSelImei", produces = { "application/json;charset=utf-8" }) + public AjaxResult importSelImei(MultipartFile file) + { + HashMap Parammap = new HashMap(); + try { + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser User = loginUser.getUser(); + Parammap.put("User",User); + Parammap.put("agent_id",User.getDeptId()); + return AjaxResult.success(yzCardServiceImpl.importSelImei(file,Parammap)); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:importSelImei
ip = " + ip + "
",e.getCause().toString()); + } + return AjaxResult.error("特殊操作查询IMEI 异常!"); + } + + + + /** + * 特殊操作 变更卡分组、备注 + * @param file + * @return + */ + @Log(title = "特殊操作变更卡分组、备注", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('yunze:card:importSetCardInfo')") + @PostMapping(value = "/importSetCardInfo", produces = { "application/json;charset=utf-8" }) + public AjaxResult importSetCardInfo(MultipartFile file) + { + HashMap Parammap = new HashMap(); + try { + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser User = loginUser.getUser(); + Parammap.put("User",User); + Parammap.put("agent_id",User.getDeptId()); + return AjaxResult.success(yzCardServiceImpl.importSetCardInfo(file,Parammap)); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:importSetCardInfo
ip = " + ip + "
",e.getCause().toString()); + } + return AjaxResult.error("特殊操作 变更卡分组、备注 异常!"); + } + + + /** + * 导入查询、卡号类别 + * @param file + * @return + */ + @Log(title = "卡号导入查询", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('yunze:card:ImportQuery')") + @PostMapping(value = "/cardNumber", produces = { "application/json;charset=utf-8" }) + public AjaxResult CardNumberImport(MultipartFile file, @RequestParam Map map) + { + String Pstr = map.get("Pstr").toString(); + + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + HashMap Parammap = new HashMap(); + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser User = loginUser.getUser(); + Parammap.put("User",User); + List agent_id = new ArrayList<>(); + if(User.getDeptId()!=100){ + if(Parammap.get("agent_id")!=null){ + List P_agent_id = (List) Parammap.get("agent_id"); + agent_id.addAll(P_agent_id); + }else{ + agent_id.add(Integer.parseInt(User.getDeptId().toString())); + Parammap.put("agent_id",agent_id); + } + } + try { + return AjaxResult.success(AesEncryptUtil.encrypt(JSON.toJSONString(yzCardServiceImpl.CardNumberImport(file,Parammap)))); + }catch (Exception e){ + return AjaxResult.error(AesEncryptUtil.encrypt(JSON.toJSONString("返回数据加密异常"))); + } + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:ImportQuery
ip = " + ip + "
",e.getCause().toString()); + } + return AjaxResult.error("卡号导入查询 异常!"); + } + + + + + /** + * 批量停复机、断开网 + * @param file + * @return + */ + @Log(title = "批量停复机、断开网 ", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('yunze:card:ApiUpdBatch')") + @PostMapping(value = "/status", produces = { "application/json;charset=utf-8" }) + public AjaxResult importSelImei(MultipartFile file,@RequestParam Map map) + { + String Pstr = map.get("Pstr").toString(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + HashMap Parammap = new HashMap(); + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser User = loginUser.getUser(); + Parammap.put("User",User); + Parammap.put("agent_id",User.getDeptId()); + + return AjaxResult.success(yzCardServiceImpl.status(file,Parammap)); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:ApiUpdBatch
ip = " + ip + "
",e.getCause().toString()); + } + return AjaxResult.error("批量停复机、断开网 异常!"); + } + + /**修改 备注 分组*/ + + @PreAuthorize("@ss.hasPermi('yunze:card:importSetCardInfo')") + @PostMapping(value = "/updatefill", produces = {"application/json;charset=UTF-8"}) + public String Update(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCardServiceImpl.UpdateFill(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:updatefill
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("修改 备注 分组 异常!"); + } + + /** + * 下面是 操作 + * */ + /**停机*/ + @PreAuthorize("@ss.hasPermi('yunze:card:Stopped')") + @PostMapping(value = "/stopped", produces = {"application/json;charset=UTF-8"}) + public String StoppedArr(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCardServiceImpl.stoppedarr(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:Stopped
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("批量 【停机】 异常!"); + } + + /**复机*/ + @PreAuthorize("@ss.hasPermi('yunze:card:MachineArr')") + @PostMapping(value = "/machine", produces = {"application/json;charset=UTF-8"}) + public String MachineArr(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCardServiceImpl.machinearr(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:machine
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("批量 【复机】 异常!"); + } + + /**断网*/ + @PreAuthorize("@ss.hasPermi('yunze:card:DisconnectNetworkArr')") + @PostMapping(value = "/disconnectNetwork", produces = {"application/json;charset=UTF-8"}) + public String DisconnectNetworkArr(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCardServiceImpl.disconnectNetworkarr(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:disconnectNetwork
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("批量 【断网】 异常!"); + } + + /**开网*/ + @PreAuthorize("@ss.hasPermi('yunze:card:OpenNetworkArr')") + @PostMapping(value = "/openNetwork", produces = {"application/json;charset=UTF-8"}) + public String OpenNetworkArr(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCardServiceImpl.openNetworkarr(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:OpenNetworkArr
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("批量 【开网】 异常!"); + } + + /**同步流量*/ + @PreAuthorize("@ss.hasPermi('yunze:card:ConsumptionArr')") + @PostMapping(value = "/consumption", produces = {"application/json;charset=UTF-8"}) + public String ConsumptionArr(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCardServiceImpl.consumptionarr(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:ConsumptionArr
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("批量 【同步流量】 异常!"); + } + + /**同步状态*/ + @PreAuthorize("@ss.hasPermi('yunze:card:PublicMethodArr')") + @PostMapping(value = "/publicmethod", produces = {"application/json;charset=UTF-8"}) + public String PublicMethodArr(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCardServiceImpl.publicmethodarr(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:PublicMethodArr
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("批量 【同步状态】 异常!"); + } + + /**同步状态和用量*/ + @PreAuthorize("@ss.hasPermi('yunze:card:ConsumptionAndStateArr')") + @PostMapping(value = "/consumptionandstate", produces = {"application/json;charset=UTF-8"}) + public String ConsumptionAndStateArr(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCardServiceImpl.consumptionandstatearr(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:card:ConsumptionAndStateArr
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("批量 【同步状态和用量】 异常!"); + } + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardFlowController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardFlowController.java new file mode 100644 index 0000000..5470553 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardFlowController.java @@ -0,0 +1,215 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.yunze.IYzCardFlowService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +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.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * 资费信息 + * 2021-06-09 + * @author root + */ +@RestController +@RequestMapping("/yunze/cardFlow") +public class YzCardFlowController extends BaseController +{ + + @Autowired + private IYzCardFlowService cardFlowService; + + + + /** + * 查询套餐信息 + */ + @PreAuthorize("@ss.hasPermi('yunze:cardFlow:queryflow')") + @PostMapping(value = "/queryflow", produces = { "application/json;charset=utf-8" }) + public String queryflow(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(cardFlowService.queryflow(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + System.err.println(e); + } + return Myerr("查询套餐信息 异常!"); + } + + + + /** + * 查询当前套餐简要信息 + */ + @PreAuthorize("@ss.hasPermi('yunze:cardFlow:queryflowSimple')") + @PostMapping(value = "/queryflowSimple", produces = { "application/json;charset=utf-8" }) + public String queryflowSimple(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + Parammap.put("agent_id",currentUser.getDeptId()); + return MyRetunSuccess(cardFlowService.queryflow_simple(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardFlow:queryflowSimple
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询当前套餐简要信息 异常!"); + } + + + + /** + * 查询 简要 资费计划 名称 + */ + @PreAuthorize("@ss.hasPermi('yunze:cardFlow:queryPackageSimple')") + @PostMapping(value = "/queryPackageSimple", produces = { "application/json;charset=utf-8" }) + public String queryPackageSimple() + { + HashMap Parammap = new HashMap(); + try { + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + Parammap.put("agent_id",currentUser.getDeptId()); + return MyRetunSuccess(cardFlowService.queryPackage_simple(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardFlow:queryPackageSimple " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询套餐信息 异常!"); + } + + + /** + * 查询单条 资费计划 简要 + * @return + */ + @PreAuthorize("@ss.hasPermi('yunze:cardFlow:FindPacket')") + @PostMapping(value = "/FindPacket", produces = { "application/json;charset=utf-8" }) + public String FindPacket(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + Parammap.put("agent_id",currentUser.getDeptId()); + return MyRetunSuccess(cardFlowService.FindPacket(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardFlow:FindPacket " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询单条 资费计划 简要 异常!"); + } + + /** + * 订购资费查询 + * */ + @PreAuthorize("@ss.hasPermi('yunze:flow:list')") + @PostMapping(value = "/list", produces = { "application/json;charset=UTF-8" }) + public String SynFlow(@RequestBody String Pstr){ + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + List agent_id = new ArrayList<>(); + if(currentUser.getDeptId()!=100){ + if(Parammap.get("agent_id")!=null){ + List P_agent_id = (List) Parammap.get("agent_id"); + agent_id.addAll(P_agent_id); + }else{ + agent_id.add(Integer.parseInt(currentUser.getDeptId().toString())); + Parammap.put("agent_id",agent_id); + } + } + + + return MyRetunSuccess(cardFlowService.getList(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
system:flow:list
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("订购资费查询 异常!"); + } + + /** + * 订购资费导出 + * */ + @Log(title = "订购资费导出", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('yunze:flow:exportflow')") + @PostMapping(value = "/exportflow", produces = { "application/json;charset=utf-8" }) + public String exportFlow(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + + return MyRetunSuccess(cardFlowService.exportflow(Parammap,currentUser),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:flow:exportflow
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("订购资费导出 异常!"); + } + + + + + + + + + + +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardFlowHisController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardFlowHisController.java new file mode 100644 index 0000000..18992ba --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardFlowHisController.java @@ -0,0 +1,126 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.yunze.YzCardFlowHisService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 用量详情 + * 2021-8-25 + */ +@Api("用量详情") +@RestController +@RequestMapping("/yunze/flowhis") +public class YzCardFlowHisController extends BaseController { + @Autowired + private YzCardFlowHisService yrootlowHisService; + + /** + * 执行用量详情 + */ + @PreAuthorize("@ss.hasPermi('yunze:flowhis:list')") + @PostMapping(value = "/list", produces = {"application/json;charset=UTF-8"}) + public String SynFlow(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + List agent_id = new ArrayList<>(); + if (currentUser.getDeptId() != 100) { + if (Parammap.get("agent_id") != null) { + List P_agent_id = (List) Parammap.get("agent_id"); + agent_id.addAll(P_agent_id); + } else { + agent_id.add(Integer.parseInt(currentUser.getDeptId().toString())); + Parammap.put("agent_id", agent_id); + } + } + return MyRetunSuccess(yrootlowHisService.ListHis(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
system:flowhis:list
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("获取卡板信息列表 异常!"); + } + + /** + * 根据id查询 + */ + @PreAuthorize("@ss.hasPermi('/yunze/flowhis/find')") + @PostMapping(value = "/find", produces = {"application/json;charset=UTF-8"}) + public String find(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(yrootlowHisService.getById(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:flowhis:YrootlowHisController.java
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("查询 【订单详情】 异常!"); + } + + + /** + * 用量详情导出 (同步导出 分组 、备注、发货时间) + */ + @Log(title = "用量详情导出", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('yunze:flowhis:exportflowhis')") + @PostMapping(value = "/exportflowhis", produces = {"application/json;charset=utf-8"}) + public String exportFlowHis(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + String dept_id = currentUser.getDeptId().toString(); + Parammap.put("dept_id",dept_id ); + return MyRetunSuccess(yrootlowHisService.FlowHis(Parammap,currentUser), null); + + + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:flowhis:exportflowhis
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("用量详情导出 异常!"); + } + + +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardPackageController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardPackageController.java new file mode 100644 index 0000000..6e09641 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardPackageController.java @@ -0,0 +1,284 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.yunze.IYzCardPackageService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +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.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * 资费组 管理 + * 2021-06-22 + * @author root + */ +@Api("资费组管理") +@RestController +@RequestMapping("/yunze/tariffGroup") +public class YzCardPackageController extends BaseController +{ + + @Autowired + private IYzCardPackageService cardPackageService; + + + + /** + * 平台资费组 列表 + */ + @PreAuthorize("@ss.hasPermi('yunze:tariffGroup:list')") + @PostMapping(value = "/list", produces = { "application/json;charset=UTF-8" }) + public String list(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(cardPackageService.selMap(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffGroup:list
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取平台资费组列表 异常!"); + } + + + /** + * 平台资费组 新增 + */ + @Log(title = "平台资费组", businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('yunze:tariffGroup:add')") + @PostMapping(value = "/add", produces = { "application/json;charset=UTF-8" }) + public String add(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(cardPackageService.add(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffGroup:add
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("平台资费组 新增 异常!"); + } + + + /** + * 平台资费组 详情 + */ + @PreAuthorize("@ss.hasPermi('yunze:tariffGroup:find')") + @PostMapping(value = "/find", produces = { "application/json;charset=UTF-8" }) + public String find(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(cardPackageService.find(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffGroup:find
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("平台资费组 详情 异常!"); + } + + + /** + * 平台资费组 修改 + */ + @Log(title = "平台资费组", businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('yunze:tariffGroup:edit')") + @PostMapping(value = "/edit", produces = { "application/json;charset=UTF-8" }) + public String edit(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + boolean bool = cardPackageService.update(Parammap); + String msg = bool?"修改 平台资费组成功!":"网络异常请稍后重试!!!"; + return MyRetunSuccess(bool,msg); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffGroup:edit
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("平台资费组 修改 异常!"); + } + + /** + * 划分资费组查询 + */ + @PreAuthorize("@ss.hasPermi('yunze:tariffGroup:findPackage')") + @PostMapping(value = "/findPackage", produces = { "application/json;charset=UTF-8" }) + public String findPackage(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + List agent_id = new ArrayList<>(); + agent_id.add(currentUser.getDeptId().toString()); + Parammap.put("agent_id",agent_id); + return MyRetunSuccess(cardPackageService.findPackage(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffGroup:findPackage
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("划分资费组查询 异常!"); + } + + + + /** + * 平台资费组 划分 + */ + @Log(title = "平台资费组>划分资费", businessType = BusinessType.OTHER) + @PreAuthorize("@ss.hasPermi('yunze:tariffGroup:tariffDivision')") + @PostMapping(value = "/tariffDivision", produces = { "application/json;charset=UTF-8" }) + public String tariffDivision(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Double set_error_so = 0.0,set_packet_cost = 0.0,set_packet_price = 0.0; + try { + set_error_so = Double.parseDouble(Parammap.get("set_error_so").toString()); + set_packet_cost = Double.parseDouble(Parammap.get("set_packet_cost").toString()); + set_packet_price = Double.parseDouble(Parammap.get("set_packet_price").toString()); + }catch (Exception e){ + return Myerr("平台资费组 划分 参数数据 异常!"); + } + if(set_error_so>=1.0){ + if(set_packet_price>=set_packet_cost){ + //售价大等于 成本 + //不能设置平台的数据 + String dept_id = Parammap.get("dept_id").toString(); + if(!dept_id.equals("100")){ + //判断为总部管理才能操作划分资费计划 + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + String ParentDept_id = currentUser.getDeptId().toString(); + if(ParentDept_id.equals("100")){ + Parammap.put("ParentDept_id",ParentDept_id);//复制 来源 父类 编号 + return MyRetunSuccess(true,cardPackageService.tariffDivision(Parammap)); + }else{ + return Myerr("非平台总集团不可操作集团资费划分 !请联系管理员先变更所属集团!"); + } + }else{ + return Myerr("无需划分资费到总平台 !"); + } + }else{ + return Myerr("售价 不能小于 成本 !"); + } + }else{ + return Myerr("资费计划系数不能 小于 1 !"); + } + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffGroup:tariffDivision
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("平台资费组 划分 异常!"); + } + + + + /** + * 集团 资费组 划分 + */ + @Log(title = "集团资费组>划分资费", businessType = BusinessType.OTHER) + @PreAuthorize("@ss.hasPermi('yunze:tariffGroup:agentTariffDivision')") + @PostMapping(value = "/agentTariffDivision", produces = { "application/json;charset=UTF-8" }) + public String agentTariffDivision(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Double set_error_so = 0.0,set_packet_cost = 0.0,set_packet_price = 0.0; + try { + set_error_so = Double.parseDouble(Parammap.get("set_error_so").toString()); + set_packet_cost = Double.parseDouble(Parammap.get("set_packet_cost").toString()); + set_packet_price = Double.parseDouble(Parammap.get("set_packet_price").toString()); + }catch (Exception e){ + return Myerr("平台资费组 划分 参数数据 异常!"); + } + if(set_error_so>=1.0){ + //售价大等于 成本 + if(set_packet_price>=set_packet_cost){ + //不能设置平台的数据 + String dept_id = Parammap.get("dept_id").toString(); + if(!dept_id.equals("100")){ + //不能划分到所属集团名下 + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + String ParentDept_id = currentUser.getDeptId().toString(); + if(!ParentDept_id.equals(dept_id)){ + if(!ParentDept_id.equals("100")){ + Parammap.put("ParentDept_id",ParentDept_id);//复制 来源 父类 编号 + return MyRetunSuccess(true,cardPackageService.tariffDivision(Parammap)); + }else{ + return Myerr("总集团 不能直接 划分 用户 资费 !!"); + } + }else{ + return Myerr("不能划分所属集团资费 !"); + } + }else{ + return Myerr("无需划分资费到总平台 !"); + } + }else{ + return Myerr("售价 不能小于 成本 !"); + } + }else{ + return Myerr("资费计划系数不能 小于 1 !"); + } + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffGroup:agentTariffDivision
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("集团 资费组 划分 异常!"); + } + + +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardPacketController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardPacketController.java new file mode 100644 index 0000000..fd8c077 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardPacketController.java @@ -0,0 +1,189 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.Arith; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.yunze.IYzCardPacketService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +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.HashMap; + +/** + * 平台资费计划 管理 + * 2021-06-24 + * @author root + */ +@Api("平台资费计划管理") +@RestController +@RequestMapping("/yunze/tariffPlan") +public class YzCardPacketController extends BaseController +{ + + @Autowired + private IYzCardPacketService cardPacketService; + + + + + /** + * 平台资费计划 新增 + */ + @Log(title = "平台资费计划", businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('yunze:tariffPlan:add')") + @PostMapping(value = "/add", produces = { "application/json;charset=UTF-8" }) + public String add(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Double error_so = Double.parseDouble(Parammap.get("error_so").toString()); + Double packet_flow = Double.parseDouble(Parammap.get("packet_flow").toString()); + Double error_flow = Double.parseDouble(Parammap.get("error_flow").toString()); + + if(error_so>=1){ + if(packet_flow>=error_flow) { + + //校验计算 用量 + Parammap.put("error_flow",Arith.div(packet_flow,error_so,0)); + return MyRetunSuccess(cardPacketService.add(Parammap),null); + }else{ + return Myerr("资费计划 流量 不能小于 资费计划 用量 !"); + } + }else{ + return Myerr("资费计划系数不能 小于 1 !"); + } + + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffPlan:add
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("平台资费计划 新增 异常!"); + } + + + + /** + * 平台资费计划 详情 + */ + @PreAuthorize("@ss.hasPermi('yunze:tariffPlan:find')") + @PostMapping(value = "/find", produces = { "application/json;charset=UTF-8" }) + public String find(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + //校验计算 用量 + return MyRetunSuccess(cardPacketService.find(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffPlan:find
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("平台资费计划 详情 异常!"); + } + + + + + + + + + /** + * 平台资费计划 编辑 + */ + @Log(title = "平台资费计划", businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('yunze:tariffPlan:edit')") + @PostMapping(value = "/edit", produces = { "application/json;charset=UTF-8" }) + public String edit(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Double error_so = Double.parseDouble(Parammap.get("error_so").toString()); + Double packet_flow = Double.parseDouble(Parammap.get("packet_flow").toString()); + Double error_flow = Double.parseDouble(Parammap.get("error_flow").toString()); + + Double packet_price = Double.parseDouble(Parammap.get("packet_price").toString()); + Double packet_cost = Double.parseDouble(Parammap.get("packet_cost").toString()); + + if(error_so>=1){ + if(packet_flow>=error_flow) { + //校验计算 用量 + if(packet_price>=packet_cost){ + //售价大等于 成本 + Parammap.put("error_flow",Arith.div(packet_flow,error_so,0)); + return MyRetunSuccess(cardPacketService.update(Parammap),null); + }else{ + return Myerr("售价 不能小于 成本 !"); + } + }else{ + return Myerr("资费计划 流量 不能小于 资费计划 用量 !"); + } + }else{ + return Myerr("资费计划系数不能 小于 1 !"); + } + + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffPlan:edit
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("平台资费计划 编辑 异常!"); + } + + + + /** + * 平台 划分资费计划 查询 + */ + @PreAuthorize("@ss.hasPermi('yunze:tariffPlan:findPacket')") + @PostMapping(value = "/findPacket", produces = { "application/json;charset=UTF-8" }) + public String findPacket(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + Parammap.put("agent_idStr",currentUser.getDeptId()); + return MyRetunSuccess(cardPacketService.findPacket(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:tariffPlan:findPacket
Pstr = " + Pstr + "
ip = " + ip + "
",e.toString()); + } + return Myerr("平台 划分资费计划 查询 异常!"); + } + + + +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardRouteController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardRouteController.java new file mode 100644 index 0000000..ce1157b --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCardRouteController.java @@ -0,0 +1,278 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.yunze.IYzCardRouteService; +import io.swagger.annotations.Api; +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.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 通道 管理 + * 2021-06-19 + * @author root + */ +@Api("上游通道管理") +@RestController +@RequestMapping("/yunze/cardRoute") +public class YzCardRouteController extends BaseController +{ + + @Resource + private IYzCardRouteService iYzCardRouteService; + + + + /** + * 查询简要 通道信息 + */ + @PreAuthorize("@ss.hasPermi('yunze:cardRoute:findSp')") + @PostMapping(value = "/findSp", produces = { "application/json;charset=utf-8" }) + public String findSp() + { + HashMap Parammap = new HashMap(); + try { + return MyRetunSuccess(iYzCardRouteService.find_sp(),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardRoute:findSp " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询简要 通道信息 异常!"); + } + + + /** + * 查询 通道简要信息 状态为 正常 划分通道用 + */ + @PreAuthorize("@ss.hasPermi('yunze:cardRoute:findCr')") + @PostMapping(value = "/findCr", produces = { "application/json;charset=utf-8" }) + public String findCr() + { + HashMap Parammap = new HashMap(); + try { + return MyRetunSuccess(iYzCardRouteService.find_cr(),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardRoute:findSp " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询 通道简要信息 状态为 正常 划分通道用 异常!"); + } + + + /** + * API通道信息列表 + */ + @PreAuthorize("@ss.hasPermi('yunze:cardRoute:list')") + @PostMapping(value = "/list", produces = { "application/json;charset=UTF-8" }) + public String list(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(iYzCardRouteService.sel_Map(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardRoute:list
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取API通道信息列表 异常!"); + } + + + + /** + * 查询API通道详情 + */ + @PreAuthorize("@ss.hasPermi('yunze:cardRoute:find')") + @PostMapping(value = "/find", produces = { "application/json;charset=utf-8" })// + public String find(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(iYzCardRouteService.find(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardRoute:find
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询API通道详情 异常!"); + } + + + + /** + * 新增 API通道信息 + */ + @Log(title = "上游通道", businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('yunze:cardRoute:add')") + @PostMapping(value = "/add", produces = { "application/json;charset=utf-8" }) + public String add(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser User = loginUser.getUser(); + Parammap.put("cd_agent_id",User.getDeptId()); + boolean bool = iYzCardRouteService.add(Parammap); + String msg = bool?"新增 上游通道成功!":"网络异常请稍后重试!!!"; + return MyRetunSuccess(bool,msg); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardRoute:add
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("新增 API通道信息 异常!"); + } + + + /** + * 编辑 API通道信息 + */ + @Log(title = "上游通道", businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('yunze:cardRoute:edit')") + @PostMapping(value = "/edit", produces = { "application/json;charset=utf-8" }) + public String edit(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser User = loginUser.getUser(); + Parammap.put("cd_agent_id",User.getDeptId()); + boolean bool = iYzCardRouteService.update(Parammap); + String msg = bool?"编辑 上游通道成功!":"网络异常请稍后重试!!!"; + return MyRetunSuccess(bool,msg); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardRoute:edit
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("编辑 API通道信息 异常!"); + } + + + /** + * 删除 API通道信息 (改为 删除 状态) + */ + @Log(title = "上游通道", businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('yunze:cardRoute:delRoute')") + @PostMapping(value = "/delRoute", produces = { "application/json;charset=utf-8" }) + public String delRoute(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser User = loginUser.getUser(); + Parammap.put("cd_agent_id",User.getDeptId()); + boolean bool = iYzCardRouteService.update_cd_status(Parammap); + String msg = bool?"删除 上游通道成功!":"网络异常请稍后重试!!!"; + return MyRetunSuccess(bool,msg); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardRoute:delRoute
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("删除 API通道信息 异常!"); + } + + + + /** + * 导出 + * @return + */ + @Log(title = "上游通道", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('yunze:card:exportData')") + @PostMapping(value = "/exportData", produces = { "application/json;charset=utf-8" }) + public String exportData(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + return MyRetunSuccess(iYzCardRouteService.exportData(Parammap,currentUser),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cardRoute:exportData
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("导出上游通道 异常!"); + } + + + + /** + * 通道进度查询 + * */ + + + + +} + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCategoryController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCategoryController.java new file mode 100644 index 0000000..539fc3e --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCategoryController.java @@ -0,0 +1,53 @@ +package com.yunze.web.controller.yunze; +import com.alibaba.fastjson.JSON; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.mapper.yunze.YzCategoryMapper; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.system.service.yunze.YzCategoryService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +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.HashMap; + +/** + * 商品分类 + * 2021-10-21 + */ +@Api("商品分类") +@RestController +@RequestMapping("/yunze/shop") +public class YzCategoryController extends BaseController { + + @Autowired + private YzCategoryService YzCategoryService; + + /** + * 执行商品分类 + */ + @PreAuthorize("@ss.hasPermi('yunze:shop:prdCategory')") + @PostMapping(value = "/prdCategory", produces = {"application/json;charset=UTF-8"}) + public String SynFlow(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(YzCategoryService.CategoryList(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:shop:list
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("商品分类 异常!"); + } + +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCcController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCcController.java new file mode 100644 index 0000000..d03066e --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCcController.java @@ -0,0 +1,157 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.annotation.Log; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.system.domain.SysPost; +import com.yunze.system.service.yunze.IYzLogsService; +import com.yunze.system.service.yunze.YzCcService; +import io.swagger.annotations.Api; +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.HashMap; +/** + * 自动化 + * 2021-10-19 + */ +@Api("自动化") +@RestController +@RequestMapping("/yunze/cc") + +public class YzCcController extends BaseController{ + + @Autowired + private YzCcService YzCcService; + + + /** + * 执行自动化 + */ + @PreAuthorize("@ss.hasPermi('yunze:cc:list')") + @PostMapping(value = "/list", produces = {"application/json;charset=UTF-8"}) + public String SynFlow(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(YzCcService.ListCc(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cc:list
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("自动化 异常!"); + } + + /** + * 自动化新增 + */ + @Log(title = "自动化新增", businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('yunze:cc:add')") + @PostMapping(value = "/add", produces = { "application/json;charset=UTF-8" }) + public String add(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(YzCcService.YzCcAdd(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cc:add
Pstr = " + Pstr + "
ip = " + ip + "
", e.toString()); + } + return Myerr(" 异常!"); + } + + /** + * 查询 对应自动化规则表 名字 对应 自动化管理抄送名字 + */ + @PreAuthorize("@ss.hasPermi('yunze:cc:nameadd')") + @PostMapping(value = "/nameadd", produces = { "application/json;charset=utf-8" }) + public String findCr() + { + HashMap Parammap = new HashMap(); + try { + return MyRetunSuccess(YzCcService.NameAdd(),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cc:nameadd " + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询 对应自动化规则表 名字 正常 自动化管理抄送名字 异常!"); + } + + /** + * 修改自动化 + */ + + @PreAuthorize("@ss.hasPermi('yunze:cc:ccupdate')") + @PostMapping(value = "/ccupdate", produces = {"application/json;charset=UTF-8"}) + public String Update(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(YzCcService.UpdateCc(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cc:update
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("配置自动化 异常!"); + } + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCcHisController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCcHisController.java new file mode 100644 index 0000000..94ac5a7 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCcHisController.java @@ -0,0 +1,52 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.system.service.yunze.YzCcHisService; +import com.yunze.system.service.yunze.YzCcService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +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.HashMap; + +/** + * 自动化配置 + * 2021-10-19 + */ +@Api("自动化配置") +@RestController +@RequestMapping("/yunze/cchis") +public class YzCcHisController extends BaseController { + + @Autowired + private YzCcHisService yzCcHisService; + /** + * 执行 自动化配置 + */ + @PreAuthorize("@ss.hasPermi('yunze:cchis:list')") + @PostMapping(value = "/list", produces = {"application/json;charset=UTF-8"}) + public String SynFlow(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCcHisService.ListCcHis(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:cchis:list
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("自动化配置 异常!"); + } +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCcUrlController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCcUrlController.java new file mode 100644 index 0000000..5a29c06 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzCcUrlController.java @@ -0,0 +1,180 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.system.service.yunze.YzCcService; +import com.yunze.system.service.yunze.YzCcUrlService; +import io.swagger.annotations.Api; +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.HashMap; +import java.util.Map; + +/** + * 自动化 + * 2021-10-19 + */ +@Api("自动化推送") +@RestController +@RequestMapping("/yunze/ccurl") + +public class YzCcUrlController extends BaseController { + + + @Autowired + private YzCcUrlService yzCcUrlService; + + + /** + * 执行配置 + */ + @PreAuthorize("@ss.hasPermi('yunze:ccurl:list')") + @PostMapping(value = "/list", produces = {"application/json;charset=UTF-8"}) + public String SynFlow(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCcUrlService.ListCcUrl(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:ccurl:list
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("自动化配置 异常!"); + } + + /** + * 新增 + */ + @Log(title = "推送", businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('yunze:ccurl:add')") + @PostMapping(value = "/add", produces = {"application/json;charset=UTF-8"}) + public String add(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(yzCcUrlService.insertCcUrl(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:ccurl:add
Pstr = " + Pstr + "
ip = " + ip + "
", e.toString()); + } + return Myerr(" 异常!"); + } + + /** + * 修改配置 + */ + + @PreAuthorize("@ss.hasPermi('yunze:ccurl:update')") + @PostMapping(value = "/update", produces = {"application/json;charset=UTF-8"}) + public String Update(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(yzCcUrlService.updateCcUrl(Parammap), null); + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:ccurl:update
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("配置修改 异常!"); + } + + /** + * 删除 只留最后一位 + */ + + @PreAuthorize("@ss.hasPermi('yunze:ccurl:deleteurl')") + @PostMapping(value = "/deleteurl", produces = {"application/json;charset=UTF-8"}) + public String Delete(@RequestBody String Pstr) { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject(Pstr)); + Map Rmap = yzCcUrlService.DeleteCcUrl(Parammap); + boolean bool = (boolean) Rmap.get("bool"); + String Msg = Rmap.get("Msg").toString(); + if(bool){ + return MyRetunSuccess(Msg,null); + }else{ + return Myerr(Msg); + } + } catch (Exception e) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:ccurl:deleteurl
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + return Myerr("删除配置条数 异常!"); + + + } + + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzExecutionTaskController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzExecutionTaskController.java new file mode 100644 index 0000000..1eff5e7 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzExecutionTaskController.java @@ -0,0 +1,215 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.common.utils.poi.ExcelWrite; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.common.utils.yunze.FileConverter; +import com.yunze.framework.web.service.TokenService; +import com.yunze.quartz.domain.SysJob; +import com.yunze.system.service.yunze.IYzExecutionTaskService; +import org.apache.commons.csv.CSVFormat; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * 执行任务信息 + * 2021-06-21 + * @author root + */ +@RestController +@RequestMapping("/yunze/ExecutionTask") +public class YzExecutionTaskController extends BaseController +{ + + @Resource + private IYzExecutionTaskService iYzExecutionTaskService; + @Resource + private ExcelWrite excelWrite; + @Resource + private FileConverter fileConverter; + + + /** + * 执行任务列表 + */ + @PreAuthorize("@ss.hasPermi('yunze:ExecutionTask:list')") + @PostMapping(value = "/list", produces = { "application/json;charset=UTF-8" }) + public String list(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + Object agent_id = Parammap.get("agent_id"); + if(agent_id==null ){ + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + List agent_idArr = new ArrayList(); + agent_idArr.add(""+currentUser.getDeptId()); + Parammap.put("agent_id",agent_idArr); + } + return MyRetunSuccess(iYzExecutionTaskService.sel_Map(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:ExecutionTask:list
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取API通道信息列表 异常!"); + } + + + /** + * 下载执行任务 + * @param Pstr + * @param response + * @return + */ + @GetMapping(value = "/download" ) + public void download(@RequestParam String Pstr, HttpServletResponse response, HttpServletRequest request) { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + try { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + Pstr = Pstr.replace(" ", "+");//转义 [ ] 》 + + } + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + if(Parammap.get("path")!=null && Parammap.get("token")!=null ){ + String path = Parammap.get("path").toString(); + String token = Parammap.get("token").toString(); + LoginUser loginUser = null; + + try { + loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(token); + }catch (Exception e){ + logger.error("
yunze:ExecutionTask:download token获取用户异常
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + if(loginUser!=null){ + SysUser User = loginUser.getUser(); + logger.info("
"+" 公司 "+User.getDept().getDeptName()+" 用户名 "+User.getUserId()+" "+User.getUserName()+"
Pstr = " + Pstr + "
ip = " + ip + "
"); + //获取当前文件下载 地址 + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + filePath +="/mnt/yunze/download/csv/"; + //切割出下载的地址请求头 + String Prefix = path.split("/")[1]; + path = path.substring(Prefix.length()+2,path.length()); + //拼接下载地址 + path = filePath+path; + excelWrite.download(path,response,"UTF-8",System.currentTimeMillis() + "_csv_"); + } + + }else{ + logger.info("
Pstr = " + Pstr + " ip = " + ip + " 下载文件参数缺失"); + } + + } catch (IOException ex) { + logger.error("
yunze:ExecutionTask:download IOException
Pstr = " + Pstr + "
ip = " + ip + "
",ex.getCause().toString()); + }catch (Exception e){ + logger.error("
yunze:ExecutionTask:download Exception
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + } + + + + /** + * 下载转换 + */ + @GetMapping(value = "/downloadConversion" ) + public void downloadConversion(@RequestParam String Pstr, HttpServletResponse response, HttpServletRequest request) { + { + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + try { + HashMap Parammap = new HashMap(); + if (Pstr != null) { + Pstr = Pstr.replace("%2F", "/");//转义 / + Pstr = Pstr.replace(" ", "+");//转义 [ ] 》 + + } + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + if (Parammap.get("path") != null && Parammap.get("token") != null) { + String path = Parammap.get("path").toString(); + String token = Parammap.get("token").toString(); + LoginUser loginUser = null; + try { + loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(token); + } catch (Exception e) { + logger.error("
yunze:ExecutionTask:download token获取用户异常
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + if (loginUser != null) { + SysUser User = loginUser.getUser(); + logger.info("
" + " 公司 " + User.getDept().getDeptName() + " 用户名 " + User.getUserId() + " " + User.getUserName() + "
Pstr = " + Pstr + "
ip = " + ip + "
"); + + + CsvOrExcle(path,response); + } + } else { + logger.info("
Pstr = " + Pstr + " ip = " + ip + " 下载文件参数缺失"); + } + } catch (Exception e) { + logger.error("
yunze:ExecutionTask:downloadConversion
Pstr = " + Pstr + "
ip = " + ip + "
", e.getCause().toString()); + } + } + } + + + /** + * 下载 Csv Or Excle + * @param path + * @param response + * @throws IOException + */ + private void CsvOrExcle(String path,HttpServletResponse response) throws IOException { + //获取当前文件下载 地址 + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + filePath += "/mnt/yunze/download/csv/"; + + //切割出下载的地址请求头 + String Prefix = path.split("/")[1]; + path = path.substring(Prefix.length() + 2, path.length()); + //拼接下载地址 + path = filePath + path; + + // path是指欲下载的文件的路径。 + String pathArr[] = path.split("\\."); + if(pathArr!=null && pathArr.length>0){ + String downloadUrl = pathArr[0] + ".xls"; + File file = new File(downloadUrl); + if (file!=null && file.exists()) { + // xls 文件 存在直接下载 + excelWrite.download(downloadUrl, response, "UTF-8",System.currentTimeMillis() + "_xls_"); + } else { + //cvs 文件 转换 + fileConverter.generateExcel(fileConverter.CSVexcel(path), downloadUrl, "card",50000); + // 下载 + excelWrite.download(downloadUrl, response, "UTF-8",System.currentTimeMillis() + "_xls_"); + } + } + } + + +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzOrderController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzOrderController.java new file mode 100644 index 0000000..e7b93f6 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzOrderController.java @@ -0,0 +1,213 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.yunze.IYzCardFlowService; +import com.yunze.system.service.yunze.IYzOrderService; +import io.swagger.annotations.Api; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 通道 管理 + * 2021-06-19 + * @author root + */ +@Api("订单管理") +@RestController +@RequestMapping("/yunze/order") +public class YzOrderController extends BaseController +{ + + @Resource + private IYzOrderService iYzOrderService; + @Resource + private IYzCardFlowService iYzCardFlowService; + + + /** + * 订单 列表 + */ + @PreAuthorize("@ss.hasPermi('yunze:order:list')") + @PostMapping(value = "/list", produces = { "application/json;charset=UTF-8" }) + public String list(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + List agent_id = new ArrayList<>(); + if(currentUser.getDeptId()!=100){ + if(Parammap.get("agent_id")!=null){ + List P_agent_id = (List) Parammap.get("agent_id"); + agent_id.addAll(P_agent_id); + }else{ + agent_id.add(Integer.parseInt(currentUser.getDeptId().toString())); + Parammap.put("agent_id",agent_id); + } + } + return MyRetunSuccess(iYzOrderService.selMap(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:order:list
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取订单 列表信息列表 异常!"); + } + + + + /** + * 查询 资费计划 信息 + */ + @PreAuthorize("@ss.hasPermi('yunze:order:list')") + @PostMapping(value = "/queryPacketSimple", produces = { "application/json;charset=UTF-8" }) + public String queryPacketSimple() + { + HashMap Parammap = new HashMap(); + try { + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + List agent_id = new ArrayList<>(); + if(currentUser.getDeptId()!=100){ + agent_id.add(currentUser.getDeptId().toString()); + }else{ + agent_id.add(currentUser.getDeptId().toString()); + } + + Parammap.put("agent_id",agent_id); + return MyRetunSuccess(iYzCardFlowService.queryPacket_simple(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:order:list
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取 【订单】 查询 资费计划 异常!"); + } + + + /** + * 查询 订单详情 + */ + @PreAuthorize("@ss.hasPermi('yunze:order:findOrder')") + @PostMapping(value = "/findOrder", produces = { "application/json;charset=UTF-8" }) + public String findOrder(@RequestBody String Pstr) + { + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + HashMap Parammap = new HashMap(); + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(iYzOrderService.findOrder(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:order:findOrder
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询 【订单详情】 异常!"); + } + + + /** + * 平台导入充值 + * @param file + * @return + */ + @Log(title = "订单管理", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('yunze:order:importRecharge')") + @PostMapping(value = "/importRecharge", produces = { "application/json;charset=utf-8" }) + public AjaxResult importRecharge(MultipartFile file,@RequestParam Map map) + { + + String Pstr = map.get("Pstr").toString(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + HashMap Parammap = new HashMap(); + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser User = loginUser.getUser(); + Parammap.put("User",User); + Parammap.put("agent_id",User.getDeptId()); + return AjaxResult.success(iYzOrderService.importRecharge(file,Parammap)); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:order:importRecharge
ip = " + ip + "
",e.getCause().toString()); + } + return AjaxResult.error("平台导入充值 异常!"); + } + + /** + * 导出 + * @return + */ + @Log(title = "全部订单导出", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('yunze:order:outOrder')") + @PostMapping(value = "/outOrder", produces = { "application/json;charset=utf-8" }) + public String exportData(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + + return MyRetunSuccess(iYzOrderService.exportallorders(Parammap,currentUser),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:order:outOrder
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("全部订单导出 异常!"); + } + + + + + +} + + + + + + + + + + + + + + + + diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzSysLogsController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzSysLogsController.java new file mode 100644 index 0000000..64fae38 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzSysLogsController.java @@ -0,0 +1,170 @@ +package com.yunze.web.controller.yunze; +import com.alibaba.fastjson.JSON; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils;; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.system.service.yunze.IYzLogsService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; + +/** + * 菜单执行任务 + * 2021-8-19 + */ +@Api("菜单执行任务") +@RestController +@RequestMapping("/yunze/sysLog") +public class YzSysLogsController extends BaseController { + + @Autowired + private IYzLogsService iYzLogsService; + + + /** + * 执行日志 + * */ + @PreAuthorize("@ss.hasPermi('yunze:sysLog:list')") + @PostMapping(value = "/list", produces = { "application/json;charset=UTF-8" }) + public String SynFlow(@RequestBody String Pstr){ + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject(Pstr)); + return MyRetunSuccess(iYzLogsService.selMap(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
system:sysLog:list
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取卡板信息列表 异常!"); + } + + /** + * 根据id查询 + * */ + @PreAuthorize("@ss.hasPermi('yunze:sysLog:findSys')") + @PostMapping(value = "/findSys", produces = { "application/json;charset=UTF-8" }) + public String findSys(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(iYzLogsService.getById(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:sysLog:findSys
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询 【订单详情】 异常!"); + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzUserController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzUserController.java new file mode 100644 index 0000000..d4e70d9 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzUserController.java @@ -0,0 +1,228 @@ +package com.yunze.web.controller.yunze; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.annotation.Log; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.ISysPostService; +import com.yunze.system.service.ISysRoleService; +import com.yunze.system.service.ISysUserService; +import com.yunze.system.service.yunze.IYzUserService; +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 org.springframework.web.multipart.MultipartFile; + +import java.util.HashMap; +import java.util.List; + +/** + * 执行任务信息 + * 2021-06-21 + * @author root + */ +@RestController +@RequestMapping("/yunze/agent") +public class YzUserController extends BaseController +{ + + @Autowired + private IYzUserService daoServer; + @Autowired + private ISysUserService userService; + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysPostService postService; + + @Autowired + private TokenService tokenService; + + /** + * 用户 列表 + */ + @PreAuthorize("@ss.hasPermi('yunze:agent:list')") + @PostMapping(value = "/list", produces = { "application/json;charset=UTF-8" }) + public String list(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + Parammap.put("deptId",currentUser.getDeptId()); + return MyRetunSuccess(daoServer.selMap(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:ExecutionTask:list
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取用户信息列表 异常!"); + } + + + /** + * 根据用户编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('yunze:agent:query')") + @GetMapping(value = { "/", "/{userId}" }) + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long 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)) + { + ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); + ajax.put("postIds", postService.selectPostListByUserId(userId)); + ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); + } + + return ajax; + } + + + + + + @Log(title = "用户管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('yunze:agent:export')") + @GetMapping("/export") + public AjaxResult export(SysUser user) + { + List list = userService.selectUserList(user); + ExcelUtil util = new ExcelUtil(SysUser.class); + return util.exportExcel(list, "用户数据"); + } + + @Log(title = "用户管理", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('yunze:agent:import')") + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(SysUser.class); + List userList = util.importExcel(file.getInputStream()); + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + String operName = loginUser.getUsername(); + String message = userService.importUser(userList, updateSupport, operName); + return AjaxResult.success(message); + } + + @GetMapping("/importTemplate") + public AjaxResult importTemplate() + { + ExcelUtil util = new ExcelUtil(SysUser.class); + return util.importTemplateExcel("用户数据"); + } + + + + /** + * 新增用户 + */ + @PreAuthorize("@ss.hasPermi('yunze:agent:add')") + @Log(title = "用户管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysUser user) + { + if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) + { + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); + } + else if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setCreateBy(SecurityUtils.getUsername()); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + return toAjax(userService.insertUser(user)); + } + + /** + * 修改用户 + */ + @PreAuthorize("@ss.hasPermi('yunze:agent:edit')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysUser user) + { + userService.checkUserAllowed(user); + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setUpdateBy(SecurityUtils.getUsername()); + return toAjax(userService.updateUser(user)); + } + + /** + * 删除用户 + */ + @PreAuthorize("@ss.hasPermi('yunze:agent:remove')") + @Log(title = "用户管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{userIds}") + public AjaxResult remove(@PathVariable Long[] userIds) + { + return toAjax(userService.deleteUserByIds(userIds)); + } + + /** + * 重置密码 + */ + @PreAuthorize("@ss.hasPermi('yunze:agent:resetPwd')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/resetPwd") + public AjaxResult resetPwd(@RequestBody SysUser user) + { + userService.checkUserAllowed(user); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + user.setUpdateBy(SecurityUtils.getUsername()); + return toAjax(userService.resetPwd(user)); + } + + /** + * 状态修改 + */ + @PreAuthorize("@ss.hasPermi('yunze:agent:edit')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysUser user) + { + userService.checkUserAllowed(user); + user.setUpdateBy(SecurityUtils.getUsername()); + return toAjax(userService.updateUserStatus(user)); + } + + +} diff --git a/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzYzInfoChangeController.java b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzYzInfoChangeController.java new file mode 100644 index 0000000..73114cd --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/controller/yunze/YzYzInfoChangeController.java @@ -0,0 +1,179 @@ +package com.yunze.web.controller.yunze; + + +import com.alibaba.fastjson.JSON; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.AesEncryptUtil; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.service.yunze.IYzInfoChangeService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +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.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * 卡信息变更 + * 2021-9-22 + */ +@Api("卡信息变更") +@RestController +@RequestMapping("/yunze/change") +public class YzYzInfoChangeController extends BaseController { + + @Autowired + private IYzInfoChangeService iYzInfoChangeService; + + /** + * 获取卡信息变更列表 + * */ + @PreAuthorize("@ss.hasPermi('yunze:change:list')") + @PostMapping(value = "/list", produces = { "application/json;charset=UTF-8" }) + public String list(@RequestBody String Pstr){ + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + // System.out.println(map); + Parammap.putAll(JSON.parseObject((String) Pstr)); + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + SysUser currentUser = loginUser.getUser(); + List agent_id = new ArrayList<>(); + if(currentUser.getDeptId()!=100){ + if(Parammap.get("agent_id")!=null){ + List P_agent_id = (List) Parammap.get("agent_id"); + agent_id.addAll(P_agent_id); + }else{ + agent_id.add(Integer.parseInt(currentUser.getDeptId().toString())); + Parammap.put("agent_id",agent_id); + } + } + return MyRetunSuccess(iYzInfoChangeService.selMap(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
info:change:list
Pstr = " + Pstr + "
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("获取卡信息变更列表 异常!"); + } + + /** + * 时间降序查询 + * */ + @PreAuthorize("@ss.hasPermi('yunze:change:list')") + @PostMapping(value = "/info", produces = { "application/json;charset=UTF-8" }) + public String findSys(@RequestBody String Pstr) + { + HashMap Parammap = new HashMap(); + if(Pstr!=null){ + Pstr = Pstr.replace("%2F", "/");//转义 / + } + try { + Pstr = AesEncryptUtil.desEncrypt(Pstr); + Parammap.putAll(JSON.parseObject((String) Pstr)); + return MyRetunSuccess(iYzInfoChangeService.selTime(Parammap),null); + }catch (Exception e){ + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + logger.error("
yunze:change:info
ip = " + ip + "
",e.getCause().toString()); + } + return Myerr("查询 【时间降序】 异常!"); + } + + + + + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-admin/src/main/java/com/yunze/web/core/config/SwaggerConfig.java b/yunze-admin/src/main/java/com/yunze/web/core/config/SwaggerConfig.java new file mode 100644 index 0000000..a248c42 --- /dev/null +++ b/yunze-admin/src/main/java/com/yunze/web/core/config/SwaggerConfig.java @@ -0,0 +1,125 @@ +package com.yunze.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.yunze.common.config.YunZeConfig; +import io.swagger.annotations.ApiOperation; +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.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * Swagger2的接口配置 + * + * @author yunze + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig +{ + /** 系统基础配置 */ + @Autowired + private YunZeConfig yunzeConfig; + + /** 是否开启swagger */ + @Value("${swagger.enabled}") + private boolean enabled; + + /** 设置请求的统一前缀 */ + @Value("${swagger.pathMapping}") + private String pathMapping; + + /** + * 创建API + */ + @Bean + public Docket createRestApi() + { + return new Docket(DocumentationType.SWAGGER_2) + // 是否启用Swagger + .enable(enabled) + // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) + .apiInfo(apiInfo()) + // 设置哪些接口暴露给Swagger展示 + .select() + // 扫描所有有注解的api,用这种方式更灵活 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + // 扫描指定包中的swagger注解 + // .apis(RequestHandlerSelectors.basePackage("com.yunze.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", "header")); + return apiKeyList; + } + + /** + * 安全上下文 + */ + private List securityContexts() + { + List securityContexts = new ArrayList<>(); + securityContexts.add( + SecurityContext.builder() + .securityReferences(defaultAuth()) + .forPaths(PathSelectors.regex("^(?!auth).*$")) + .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("标题:IOT综合业务支撑平台_接口文档") + // 描述 + .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") + // 作者信息 + .contact(new Contact(yunzeConfig.getName(), null, null)) + // 版本 + .version("版本号:" + yunzeConfig.getVersion()) + .build(); + } +} diff --git a/yunze-admin/src/main/resources/META-INF/spring-devtools.properties b/yunze-admin/src/main/resources/META-INF/spring-devtools.properties new file mode 100644 index 0000000..2b23f85 --- /dev/null +++ b/yunze-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/yunze-admin/src/main/resources/application-druid.yml b/yunze-admin/src/main/resources/application-druid.yml new file mode 100644 index 0000000..d24c164 --- /dev/null +++ b/yunze-admin/src/main/resources/application-druid.yml @@ -0,0 +1,59 @@ +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + druid: + # 主库数据源 + master: + url: jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: iotdb + password: www.5iot.cn + + + #从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: false + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: admin + login-password: 20220107@yzIot + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true \ No newline at end of file diff --git a/yunze-admin/src/main/resources/application.yml b/yunze-admin/src/main/resources/application.yml new file mode 100644 index 0000000..7c3e415 --- /dev/null +++ b/yunze-admin/src/main/resources/application.yml @@ -0,0 +1,150 @@ +# 项目相关配置 +yunze: + # 名称 + name: IoTLink + # 版本 + version: 0.5.0 + # 版权年份 + copyrightYear: 2022v + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/yunze/uploadPath,Linux配置 /home/yunze/uploadPath) + profile: /mnt/yunze/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 开发环境配置 +server: + # 服务器的HTTP端口,默认为8080 + port: 8080 + servlet: + # 应用的访问路径 + context-path: / + tomcat: + # tomcat的URI编码 + uri-encoding: UTF-8 + # tomcat最大线程数,默认为200 + max-threads: 800 + # Tomcat启动初始化的线程数,默认值25 + min-spare-threads: 30 + +# 日志配置 +logging: + level: + org.springframework: warn + com.yunze: debug + +# Spring配置 +spring: + # 资源信息 + messages: + # 国际化资源文件路径 + basename: i18n/messages + profiles: + active: druid + # 文件上传 + servlet: + multipart: + # 单个文件大小 + max-file-size: 30MB + # 设置总上传的文件大小 + max-request-size: 100MB + # 服务模块 + devtools: + restart: + # 热部署开关 + enabled: true + # redis 配置 + redis: + # 地址 + host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: Rdis20220107 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + rabbitmq: + ####连接地址 + host: 127.0.0.1 + ####端口号 + port: 5672 + ####账号 + username: YunZeIotRabbitMq + ## 心跳 请求的心跳超时,以秒为单位; 零表示没有 + requested-heartbeat: 40 + ####密码 + password: 20220107@yzIot + ### 地址 + virtual-host: /VirtualHosts + listener: + simple: + retry: + ####开启消费者(程序出现异常的情况下会)进行重试 + enabled: true + ####最大重试次数 + max-attempts: 1 + ####重试间隔时间 + initial-interval: 3000 + acknowledge-mode: manual + + + +# token配置 +token: + # 令牌自定义标识 + header: Authorization + # 令牌密钥 + secret: abcdefghijklmnopqrstuvwxyz + # 令牌有效期(默认180分钟) + expireTime: 180 + +# MyBatis配置 +mybatis: + # 搜索指定包别名 + typeAliasesPackage: com.yunze.**.domain + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + # 加载全局的配置文件 + configLocation: classpath:mybatis/mybatis-config.xml + +# PageHelper分页插件 +pagehelper: + helperDialect: mysql + reasonable: true + supportMethodsArguments: false + params: count=countSql + +# Swagger配置 +swagger: + # 是否开启swagger + enabled: true + # 请求前缀 + #pathMapping: /dev-api + pathMapping: /prod-api + +# 防止XSS攻击 +xss: + # 过滤开关 + enabled: true + # 排除链接(多个用逗号分隔) + excludes: /system/notice/* + # 匹配链接 + urlPatterns: /system/*,/monitor/*,/tool/*,/yunze/* + + + diff --git a/yunze-admin/src/main/resources/banner.txt b/yunze-admin/src/main/resources/banner.txt new file mode 100644 index 0000000..b742092 --- /dev/null +++ b/yunze-admin/src/main/resources/banner.txt @@ -0,0 +1,27 @@ +Application Version: ${yunze.version} +Spring Boot Version: ${spring-boot.version} + ................... .. + ................... .. + ............,@\... .. + ....../@\`./@@@@\... .. + ...................,@@@@@@@@@@@@@.... ... ......................................................................................................... + ................,/@@@@@@@@@@@@@@/.... .. ....,]]]]]]]]]]]]]]]]]]].....]]]]]]]]]`....`**.=@@@^...]]]@@@@@@@^.....@@@@^......@@@@^......=@@@^....... + ....=`.......]@@@@@@@@@@@@@O[[...... ......[[[[[[[[[[[[[[[[[[`.....@@@/[[[[[@@@\*@@@^=@@@^...[*./@@@*...=@@\.@@@@^......@@@@^.@@@@@@@@@@@@@@^.. + .....,@@@@@@@@@@@@@@@O[.......... . ..............................@@@^=@@@*@@@\*@@@^=@@@^..@@@@@@@@@@@@.\@@\@@@@^...,@@@@@@@/.....=@@@^....... + ........*O@@@@@@@/`....,]]]]]`............ ..............................@@@^=@@@*@@@^*@@@^=@@@^...,]]@@@@]]].]]]*.@@@@^......@@@@^.,]]]]/@@@\]`..... + ......./@@@@@@[...]@@@@@@@@@@@@@\`....... ...=@@@@@@@@@@@@@@@@@@@@@@^...@@@^=@@@*@@@^*@@@^=@@@^.../@@@@@@@@@*,@@@*@@@@^......@@@@^..[[[[[[[[\@@@@`.. + ...../@@@@@/.../@@@@@@@@@@@@@@@@@@^....... ........=@@@@@................@@@^=@@@*@@@^*@@@^=@@@^...@@@@@@@O@@^.=@@@@@@@^......@@@@\^.,@@@@`,@@@@/.... + ..,@@@@@^.../@@@@@@@@[.....\@@@@@@`...... ......,@@@@@....=@@@@........@@@\@@@@*@@@^*@@@^=@@@^...@@@O@@@=@@^*****@@@@^....]/@@@@@^...\@@@@@@@`..... +.........=@@@@@.../@@@@@@@[.........@@@@@@^..................,@@@@@......=@@@@.......[[\@@@@@@@[[`*@@@^=@@@^..=@@^O@@@*@@/[[[[[@@@@[[..=@@@@@@^.....=@@@@\....... +........=@@@@/...@@@@@@@^...........@@@@@@..................,@@@@@........\@@@@.......=@@@/=@@@\...@@@^=@@@^..=@@^@@@@*@@@.....@@@@^......@@@@^....@@@@@@@@\..... +........O@@@@...@@@@@@@`..........,@@@@@@...................[@@@@@]\]]]]]\/@@@@\...../@@@^..=@@@@....**/@@@^..O@@^@@@@*@@@.....@@@@^......@@@@^../@@@@`.,@@@@^.. +.......=@@@@^..@@@@@@@..........]@@@@@@/................]...........................,[[[`....,[[[[...[[[[[[`..\[[.[[[[.,[\.....[[[[`...,[[[[[[`.[[[[[.....,[[[[.. +.......=@@@@..=@@@@@@^......./@@@@@@/`...............,@/........................................................................................................ +.......=@@@@..=@@@@@@............................../@@`.......................................................................................................... +........@@@@..=@@@@@@`........................../@@@^............................................................................................................ +.........\@@^.=@@@@@@@`.....................]@@@@@/........,@*//.=^..=^.@\\,@.......,@`.@^.........=^...@....=@....=@..=@.=@\.@^=@..=\.@....,@..=@.@^.....\^,@*.. +..... ...\^..\@@@@@@@@`..............]@@@@@@@@[............@^..=^..=^.@*\@@......//...@/[[`......=^...@[[[.=@....=@[[\@.=^=@@^=@..=@.@....,@..=@.@^[[@...\@.... + ........\@@@@@@@@@@@@@@@@@@@@@@@@@@@@/...... .....@...,\OO@^.@..,@.....[OOOO.[OOO^......\^...\/OO.,\OOO`=/..,@.=^..\`,@OO@^.[OOO^,@OO@/.,OOO@...=/.... + ..........,@@@@@@@@@@@@@@@@@@@@@@@@/`......... .......................................................................................................... + ............[@@@@@@@@@@@@@@@@@[........... .............................................................................................................. + ......... . ....,[[[[[[......... ... ... . . .. ..................... ...... .... ... .. ... ..... ..... .. .. ............ ... ........... ... .. \ No newline at end of file diff --git a/yunze-admin/src/main/resources/i18n/messages.properties b/yunze-admin/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000..d63aa1f --- /dev/null +++ b/yunze-admin/src/main/resources/i18n/messages.properties @@ -0,0 +1,36 @@ +#错误消息 +not.null=* 必须填写 +user.jcaptcha.error=验证码错误 +user.jcaptcha.expire=验证码已失效 +user.not.exists=用户不存在/密码错误 +user.password.not.match=用户不存在/密码错误 +user.password.retry.limit.count=密码输入错误{0}次 +user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟 +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.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/yunze-admin/src/main/resources/logback.xml b/yunze-admin/src/main/resources/logback.xml new file mode 100644 index 0000000..8395e10 --- /dev/null +++ b/yunze-admin/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + DEBUG + + + ${LOG_PATTERN_CONSOLE} + + + + + + DEBUG + + + ${LOG_PATTERN_FILE} + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}.log + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}-%d{yyyy-MM-dd}.log + + 60 + + + + + + + + + \ No newline at end of file diff --git a/yunze-admin/src/main/resources/mybatis/mybatis-config.xml b/yunze-admin/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e8b52be --- /dev/null +++ b/yunze-admin/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/yunze-admin/yunze-admin.iml b/yunze-admin/yunze-admin.iml new file mode 100644 index 0000000..2d954e2 --- /dev/null +++ b/yunze-admin/yunze-admin.iml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/pom.xml b/yunze-common/pom.xml new file mode 100644 index 0000000..60c1d50 --- /dev/null +++ b/yunze-common/pom.xml @@ -0,0 +1,207 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + yunze-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 + + + + + javax.validation + validation-api + + + + + org.apache.commons + commons-lang3 + + + + + com.fasterxml.jackson.core + jackson-databind + + + + + com.alibaba + fastjson + + + + + commons-io + commons-io + + + + + commons-fileupload + commons-fileupload + + + + + org.apache.poi + poi-ooxml + + + + + org.yaml + snakeyaml + + + + + io.jsonwebtoken + jjwt + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.apache.commons + commons-pool2 + + + + + eu.bitwalker + UserAgentUtils + + + + + javax.servlet + javax.servlet-api + + + + + + org.apache.httpcomponents + httpclient + 4.5.13 + + + + + org.dom4j + dom4j + 2.1.1 + + + + + org.json + json + 20171018 + + + + + + org.springframework.boot + spring-boot-starter-amqp + + + + org.apache.commons + commons-collections4 + 4.4 + + + commons-collections + commons-collections + + + + org.apache.commons + commons-csv + 1.8 + + + + + net.java.dev.jna + jna-platform + + + + + net.sourceforge.javacsv + javacsv + 2.0 + + + + + + org.projectlombok + lombok + + + + + javax.mail + mail + 1.5.0-b01 + + + + com.yunze + yunze-apiCommon + 0.5.0 + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/java/com/yunze/common/annotation/DataScope.java b/yunze-common/src/main/java/com/yunze/common/annotation/DataScope.java new file mode 100644 index 0000000..de203d4 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/annotation/DataScope.java @@ -0,0 +1,36 @@ +package com.yunze.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 yunze + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface DataScope +{ + /** + * 部门表的别名 + */ + public String deptAlias() default ""; + + /** + * 用户表的别名 + */ + public String userAlias() default ""; + + + /** + * 参数是否为Map 类型 + */ + public boolean isMap() default false; + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/annotation/DataSource.java b/yunze-common/src/main/java/com/yunze/common/annotation/DataSource.java new file mode 100644 index 0000000..b44cce0 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/annotation/DataSource.java @@ -0,0 +1,28 @@ +package com.yunze.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.yunze.common.enums.DataSourceType; + +/** + * 自定义多数据源切换注解 + * + * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 + * + * @author yunze + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +public @interface DataSource +{ + /** + * 切换数据源名称 + */ + public DataSourceType value() default DataSourceType.MASTER; +} diff --git a/yunze-common/src/main/java/com/yunze/common/annotation/Excel.java b/yunze-common/src/main/java/com/yunze/common/annotation/Excel.java new file mode 100644 index 0000000..cb54f21 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/annotation/Excel.java @@ -0,0 +1,165 @@ +package com.yunze.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; + +/** + * 自定义导出Excel数据注解 + * + * @author yunze + */ +@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; + + /** + * 导出类型(0数字 1字符串) + */ + public ColumnType cellType() default ColumnType.STRING; + + /** + * 导出时在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 {}; + + /** + * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. + */ + public boolean isExport() default true; + + /** + * 另一个类中的属性名称,支持多级获取,以小数点隔开 + */ + public String targetAttr() default ""; + + /** + * 是否自动统计数据,在最后追加一行统计数据总和 + */ + public boolean isStatistics() default false; + + /** + * 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右) + */ + Align align() default Align.AUTO; + + public enum Align + { + AUTO(0), LEFT(1), CENTER(2), RIGHT(3); + private final int value; + + Align(int value) + { + this.value = value; + } + + public int value() + { + return this.value; + } + } + + /** + * 字段类型(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/yunze-common/src/main/java/com/yunze/common/annotation/Excels.java b/yunze-common/src/main/java/com/yunze/common/annotation/Excels.java new file mode 100644 index 0000000..2ea3754 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/annotation/Excels.java @@ -0,0 +1,18 @@ +package com.yunze.common.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Excel注解集 + * + * @author yunze + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Excels +{ + Excel[] value(); +} diff --git a/yunze-common/src/main/java/com/yunze/common/annotation/Log.java b/yunze-common/src/main/java/com/yunze/common/annotation/Log.java new file mode 100644 index 0000000..a618d51 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/annotation/Log.java @@ -0,0 +1,41 @@ +package com.yunze.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.yunze.common.enums.BusinessType; +import com.yunze.common.enums.OperatorType; + +/** + * 自定义操作日志记录注解 + * + * @author yunze + * + */ +@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; +} diff --git a/yunze-common/src/main/java/com/yunze/common/annotation/RepeatSubmit.java b/yunze-common/src/main/java/com/yunze/common/annotation/RepeatSubmit.java new file mode 100644 index 0000000..6e0c02c --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/annotation/RepeatSubmit.java @@ -0,0 +1,23 @@ +package com.yunze.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 yunze + * + */ +@Inherited +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface RepeatSubmit +{ + +} diff --git a/yunze-common/src/main/java/com/yunze/common/config/MyDictionary.java b/yunze-common/src/main/java/com/yunze/common/config/MyDictionary.java new file mode 100644 index 0000000..d406dc3 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/config/MyDictionary.java @@ -0,0 +1,160 @@ +package com.yunze.common.config; + +import com.yunze.apiCommon.config.RedisUtil; +import com.yunze.common.mapper.yunze.YzCardMapper; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 字典类 + * @Auther: zhang feng + * @Date: 2021/09/14/13:44 + * @Description: + */ +@Component +public class MyDictionary { + @Resource + private RedisUtil redisUtil; + @Resource + private YzCardMapper yzCardMapper; + + + /** + * 获取字典数据 + * + * @param dict_type + * @param dict_value + * @return + */ + public String getdictLabel(String dict_type, String dict_value) { + Map findDict = new HashMap<>(); + findDict.put("dict_type", dict_type); + String dict_label = null; + List> dict_dataArr = getDictDataArr(dict_type); + try { + Map KMap = getKey(dict_dataArr, dict_value); + dict_label = KMap.get("dict_label").toString(); + } catch (Exception e) { + System.out.println("{getdictLabel 异常}" + e.getMessage()); + } + return dict_label; + } + + + + /** + * 获取字典数据 key + * + * @param dict_type + * @param dict_label + * @return + */ + public String getdictValue(String dict_type, String dict_label) { + Map findDict = new HashMap<>(); + findDict.put("dict_type", dict_type); + String dict_value = null; + List> dict_dataArr = getDictDataArr(dict_type); + try { + Map KMap = getVal(dict_dataArr, dict_label); + dict_value = KMap.get("dict_value").toString(); + } catch (Exception e) { + System.out.println("{getdictValue 异常}" + e.getMessage()); + } + return dict_value; + } + + + + + + /** + * 获取字典 数组 + * @param dict_type + * @return + */ + public List> getDictDataArr(String dict_type) { + Map findDict = new HashMap<>(); + findDict.put("dict_type", dict_type); + List> dict_dataArr = null; + try { + Object obj = redisUtil.redisTemplate.opsForValue().get(dict_type); + if (obj != null) { + dict_dataArr = (List>) obj; + if (dict_dataArr != null && dict_dataArr.size() > 0) { + } else { + dict_dataArr = yzCardMapper.findDict(findDict); + } + } else { + dict_dataArr = yzCardMapper.findDict(findDict); + if (dict_dataArr != null && dict_dataArr.size() > 0) { + redisUtil.redisTemplate.opsForValue().set(dict_type, dict_dataArr, 60 * 6 , TimeUnit.MINUTES); + } + } + } catch (Exception e) { + System.out.println("{getDictDataArr 异常}" + e.getMessage()); + } + return dict_dataArr; + } + + + + + + + + + + + /** + * 获取list map 对应数据 + * @param dict_dataArr + * @param dict_value + * @return + */ + public Map getKey(List> dict_dataArr, String dict_value) { + if (dict_dataArr != null && dict_dataArr.size() > 0) { + for (int i = 0; i < dict_dataArr.size(); i++) { + Map obj = dict_dataArr.get(i); + if (obj != null && obj.get("dict_value") != null) { + if (obj.get("dict_value").toString().equals(dict_value)) { + return obj; + } + } + } + } else { + return null; + } + return null; + } + + + + /** + * 获取list map 对应数据 + * @param dict_dataArr + * @param dict_label + * @return + */ + public Map getVal(List> dict_dataArr, String dict_label) { + if (dict_dataArr != null && dict_dataArr.size() > 0) { + for (int i = 0; i < dict_dataArr.size(); i++) { + Map obj = dict_dataArr.get(i); + if (obj != null && obj.get("dict_label") != null) { + if (obj.get("dict_label").toString().equals(dict_label)) { + return obj; + } + } + } + } else { + return null; + } + return null; + } + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/config/RabbitMQConfig.java b/yunze-common/src/main/java/com/yunze/common/config/RabbitMQConfig.java new file mode 100644 index 0000000..6bb876b --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/config/RabbitMQConfig.java @@ -0,0 +1,201 @@ +package com.yunze.common.config; + + +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.BuiltinExchangeType; +import com.rabbitmq.client.Channel; +import org.springframework.amqp.core.BindingBuilder; +import org.springframework.amqp.core.DirectExchange; +import org.springframework.amqp.core.Queue; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.amqp.rabbit.connection.ConnectionFactory; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeoutException; + +@Component +public class RabbitMQConfig { + + public Connection connection ; + + @Resource + private RabbitTemplate rabbitTemplate; + + // org.springframework.amqp.rabbit.connection.CachingConnectionFactory$ChannelCachingConnectionProxy cannot be cast to com.rabbitmq.client.Connection + public Integer getCount(String EXCHANGE_NAME,String queue,String Key,String Type) throws IOException { + Integer queueCount = null; + ConnectionFactory connectionFactory = rabbitTemplate.getConnectionFactory(); + try { + connection = connectionFactory.createConnection(); + Channel channel = connection.createChannel(false); + // 通道关联交换机 + channel.exchangeDeclare(EXCHANGE_NAME, Type); + AMQP.Queue.DeclareOk declareOk = channel.queueDeclarePassive(queue);//直连交换机类型 + //获取队列中的消息个数 + queueCount = declareOk.getMessageCount(); + channel.close(); + }catch (Exception e){ + System.out.println("==================================================================== creatExchangeQueue connection.getCount() [Start] ===================================================================="); + System.out.println(e.getMessage()); + System.out.println("==================================================================== creatExchangeQueue connection.getCount() [End] ===================================================================="); + } + finally { + connection.close(); + connection = null; + } + return queueCount; + } + + + /** + * 创建 队列绑定 路由器 + * @param exchangeName + * @param queueName + * @param routingKey + * @param del_exchangeName + * @param del_queueName + * @param del_routingKey + * @param type 交换机类型 + * @throws IOException + */ + public void creatExchangeQueue(String exchangeName, String queueName, String routingKey, String del_exchangeName, String del_queueName, String del_routingKey, BuiltinExchangeType type) throws IOException { + Channel channel = null; + com.rabbitmq.client.Connection connection = null; + try { + connection = connection!=null ?connection:RabbitMQConnection.getConnection(); + ////connection = RabbitMQConnection.getConnection(); + }catch (Exception e){ + System.out.println("==================================================================== creatExchangeQueue connection.getConnection() [Start] ===================================================================="); + System.out.println(e.getMessage()); + System.out.println("==================================================================== creatExchangeQueue connection.getConnection() [End] ===================================================================="); + connection = RabbitMQConnection.getConnection(); + } + try { + channel = connection.createChannel(); + type = type!=null?type:BuiltinExchangeType.DIRECT; + }catch (Exception e){ + System.out.println("==================================================================== creatExchangeQueue connection.createChannel() [Start] ===================================================================="); + System.out.println(e.getMessage()); + System.out.println("==================================================================== creatExchangeQueue connection.createChannel() [End] ===================================================================="); + connection = RabbitMQConnection.getConnection(); + channel = connection.createChannel(); + } + // 首先声明一个Exchange + // String exchangeName = "JFK airport"; + // String queueName = "New York city"; + try { + AMQP.Exchange.DeclareOk exchangeDeclare = channel.exchangeDeclare(exchangeName,type );//直连交换机类型 + }catch (IOException e){ + System.out.println("以存在交换机"+exchangeName); + channel = connection.createChannel();//操作异常时 会断开本次连接 ,这里进行重连 + } + + if(del_exchangeName!=null){ + try { + AMQP.Exchange.DeclareOk del_exchangeDeclare = channel.exchangeDeclare(del_exchangeName, type);//直连交换机类型 + }catch (IOException e){ + System.out.println("以存在死信交换机"+del_exchangeName); + channel = connection.createChannel(); + } + } + //System.out.println(exchangeDeclare); + // 然后创建一个Queue + + if(del_exchangeName!=null && del_queueName!=null && del_routingKey!=null ){ + //创建死信队列 绑定到 信交换机 + try { + com.rabbitmq.client.AMQP.Queue.DeclareOk del_queueDeclare = channel.queueDeclare(del_queueName, true, false, false,null); + com.rabbitmq.client.AMQP.Queue.BindOk del_queueBind = channel.queueBind(del_queueName, del_exchangeName, del_routingKey); + }catch (IOException e){ + System.out.println("以存在死信 队列"+del_queueName); + channel = connection.createChannel(); + } + } + try { + // 队列绑定 死信交换机 队列 + if(del_exchangeName!=null && del_queueName!=null && del_routingKey!=null ){ + Map arguments = new HashMap<>(2); + arguments.put("x-dead-letter-exchange", del_exchangeName); + arguments.put("x-dead-letter-routing-key", del_routingKey); + com.rabbitmq.client.AMQP.Queue.DeclareOk queueDeclare = channel.queueDeclare(queueName, true, false, false,arguments); + //这个才是将queue绑定到exchange上面,注意这里的routingKey不能为null + com.rabbitmq.client.AMQP.Queue.BindOk queueBind = channel.queueBind(queueName, exchangeName, routingKey); + }else{ + com.rabbitmq.client.AMQP.Queue.DeclareOk queueDeclare = channel.queueDeclare(queueName, true, false, false,null); + com.rabbitmq.client.AMQP.Queue.BindOk queueBind = channel.queueBind(queueName, exchangeName, routingKey); + } + }catch (IOException e){ + System.out.println("以存在 队列"+del_queueName); + channel = connection.createChannel(); + } + //String queue = queueDeclare.getQueue(); + //int messageCount = queueDeclare.getMessageCount(); + //int consumerCount = queueDeclare.getConsumerCount(); + //System.out.println("队列名称=" + queueName + ",当前队列的消息数量=" + messageCount + ",当前队列的消费者数量=" + consumerCount); + // 最后通过Bindings方式将Exchange 绑定到Queue上面 + // 使用Exchange 绑定到Queue上面,destination 目的地,source来源第,routingKey 路由键null + //BindOk exchangeBind = channel.exchangeBind(exchangeName, queue, "");// 绑定一个exchange到另外一个exchange + //System.out.println(queueBind); + finally { + connection.close(); + connection = null; + } + } + + + /** + * 获取连接 对象 + * @return + */ + public Connection getConnection(){ + try { + ConnectionFactory connectionFactory = rabbitTemplate.getConnectionFactory(); + connection = connectionFactory.createConnection(); + }catch (Exception e){ + System.out.println("getConnection Exception "+e.getMessage()); + } + return connection; + } + + + + + /** + * 手动发送消息 + * @param EXCHANGE_NAME 交换机 + * @param queue 队列 + * @param Key 网线 + * @param Type 交换机类型 + * @param msg 发送消息 + * @throws IOException + * @throws TimeoutException + */ + public void send(String EXCHANGE_NAME,String queue,String Key,String Type,String msg) throws IOException, TimeoutException { + // 创建Channel + ConnectionFactory connectionFactory = rabbitTemplate.getConnectionFactory(); + connection = connectionFactory.createConnection(); + try { + BindingBuilder.bind(new Queue(queue)).to(new DirectExchange(EXCHANGE_NAME)).with(Key);// 队列 绑定 交换机 + Channel channel = connection.createChannel(false); + // 通道关联交换机 + channel.exchangeDeclare(EXCHANGE_NAME, Type, true); + channel.basicPublish(EXCHANGE_NAME, Key, null, msg.getBytes("utf-8")); + channel.close(); + } catch (Exception e) { + System.out.println("==================================================================== creatExchangeQueue connection.createChannel() [Start] ===================================================================="); + System.out.println(e.getMessage()); + System.out.println("==================================================================== creatExchangeQueue connection.createChannel() [End] ===================================================================="); + } finally { + connection.close(); + connection = null; + } + } + + + +} \ No newline at end of file diff --git a/yunze-common/src/main/java/com/yunze/common/config/RabbitMQConnection.java b/yunze-common/src/main/java/com/yunze/common/config/RabbitMQConnection.java new file mode 100644 index 0000000..0703bb4 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/config/RabbitMQConnection.java @@ -0,0 +1,80 @@ +package com.yunze.common.config; + +import com.rabbitmq.client.Connection; +import com.rabbitmq.client.ConnectionFactory; + +import java.io.IOException; +import java.util.concurrent.TimeoutException; + +/** + * @ClassName RabbitMQConnection + * @Version V1.0 + **/ +public class RabbitMQConnection { + + /** + * 创建连接 + * + * @return + */ + public static Connection getConnection() { + int Reconnection = 10;//重连次数 + int current = 1;//当前次数 + try { + Connection con = CreateConnection(); + if(con!=null){ + return con; + }else{ + for (int i = 0; i < Reconnection; i++) { + System.out.println("======================= RabbitMQConnection getConnection [重连次数("+current+")] ======================= "); + con = CreateConnection(); + current +=1; + if(con!=null){ + break; + } + } + } + if(con==null){ + System.out.println("重连次数("+current+")con 还是 null "); + } + return con; + }catch (Exception e){ + System.out.println("=============================[Connection getConnection() Exception 【Start】 ]=========================================="); + System.out.println(e.getMessage()); + System.out.println("=============================[Connection getConnection() Exception 【End】 ]=========================================="); + return null; + } + } + + /** + * 创建连接 + * @return + */ + public static Connection CreateConnection() { + try { + //1.创建connectionFactory + ConnectionFactory connectionFactory = new ConnectionFactory(); + //2.配置Host + connectionFactory.setHost("127.0.0.1"); + //3.设置Port + connectionFactory.setPort(5672); + connectionFactory.setRequestedHeartbeat( 40 ); + //4.设置账户和密码 + connectionFactory.setUsername("YunZeIotRabbitMq"); + connectionFactory.setPassword("20220107@yzIot"); + //5.设置VirtualHost + connectionFactory.setVirtualHost("/VirtualHosts"); + return connectionFactory.newConnection(); + }catch (Exception e){ + System.out.println("=============================[Connection CreateConnection() Exception 【Start】 ]=========================================="); + System.out.println(e.getMessage()); + System.out.println("=============================[Connection CreateConnection() Exception 【End】 ]=========================================="); + return null; + } + } + + + + + +} \ No newline at end of file diff --git a/yunze-common/src/main/java/com/yunze/common/config/YunZeConfig.java b/yunze-common/src/main/java/com/yunze/common/config/YunZeConfig.java new file mode 100644 index 0000000..2b51a40 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/config/YunZeConfig.java @@ -0,0 +1,116 @@ +package com.yunze.common.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 读取项目相关配置 + * + * @author yunze + */ +@Component +@ConfigurationProperties(prefix = "yunze") +public class YunZeConfig +{ + /** 项目名称 */ + private String name; + + /** 版本 */ + private String version; + + /** 版权年份 */ + private String copyrightYear; + + /** 实例演示开关 */ + private boolean demoEnabled; + + /** 上传路径 */ + private static String profile; + + /** 获取地址开关 */ + private static boolean addressEnabled; + + 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) + { + YunZeConfig.profile = profile; + } + + public static boolean isAddressEnabled() + { + return addressEnabled; + } + + public void setAddressEnabled(boolean addressEnabled) + { + YunZeConfig.addressEnabled = addressEnabled; + } + + /** + * 获取头像上传路径 + */ + public static String getAvatarPath() + { + return getProfile() + "/avatar"; + } + + /** + * 获取下载路径 + */ + public static String getDownloadPath() + { + return getProfile() + "/download/"; + } + + /** + * 获取上传路径 + */ + public static String getUploadPath() + { + return getProfile() + "/upload"; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/constant/Constants.java b/yunze-common/src/main/java/com/yunze/common/constant/Constants.java new file mode 100644 index 0000000..6d951f4 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/constant/Constants.java @@ -0,0 +1,129 @@ +package com.yunze.common.constant; + +/** + * 通用常量信息 + * + * @author yunze + */ +public class Constants +{ + /** + * UTF-8 字符集 + */ + public static final String UTF8 = "UTF-8"; + + /** + * GBK 字符集 + */ + public static final String GBK = "GBK"; + + /** + * 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 LOGIN_FAIL = "Error"; + + /** + * 验证码 redis key + */ + public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; + + /** + * 登录用户 redis key + */ + public static final String LOGIN_TOKEN_KEY = "login_tokens:"; + + /** + * 防重提交 redis key + */ + public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; + + /** + * 验证码有效期(分钟) + */ + 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 = "sub"; + + /** + * 用户头像 + */ + public static final String JWT_AVATAR = "avatar"; + + /** + * 创建时间 + */ + public static final String JWT_CREATED = "created"; + + /** + * 用户权限 + */ + public static final String JWT_AUTHORITIES = "authorities"; + + /** + * 参数管理 cache key + */ + public static final String SYS_CONFIG_KEY = "sys_config:"; + + /** + * 字典管理 cache key + */ + public static final String SYS_DICT_KEY = "sys_dict:"; + + /** + * 资源映射路径 前缀 + */ + public static final String RESOURCE_PREFIX = "/profile"; +} diff --git a/yunze-common/src/main/java/com/yunze/common/constant/GenConstants.java b/yunze-common/src/main/java/com/yunze/common/constant/GenConstants.java new file mode 100644 index 0000000..a05de2e --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/constant/GenConstants.java @@ -0,0 +1,114 @@ +package com.yunze.common.constant; + +/** + * 代码生成通用常量 + * + * @author yunze + */ +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 REQUIRE = "1"; +} diff --git a/yunze-common/src/main/java/com/yunze/common/constant/HttpStatus.java b/yunze-common/src/main/java/com/yunze/common/constant/HttpStatus.java new file mode 100644 index 0000000..494b4e2 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/constant/HttpStatus.java @@ -0,0 +1,89 @@ +package com.yunze.common.constant; + +/** + * 返回状态码 + * + * @author yunze + */ +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; +} diff --git a/yunze-common/src/main/java/com/yunze/common/constant/ScheduleConstants.java b/yunze-common/src/main/java/com/yunze/common/constant/ScheduleConstants.java new file mode 100644 index 0000000..dbd860f --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/constant/ScheduleConstants.java @@ -0,0 +1,50 @@ +package com.yunze.common.constant; + +/** + * 任务调度通用常量 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/constant/UserConstants.java b/yunze-common/src/main/java/com/yunze/common/constant/UserConstants.java new file mode 100644 index 0000000..59995f2 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/constant/UserConstants.java @@ -0,0 +1,63 @@ +package com.yunze.common.constant; + +/** + * 用户常量信息 + * + * @author yunze + */ +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 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"; + + /** 校验返回结果码 */ + public final static String UNIQUE = "0"; + public final static String NOT_UNIQUE = "1"; +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/card/AddPacket.java b/yunze-common/src/main/java/com/yunze/common/core/card/AddPacket.java new file mode 100644 index 0000000..ae8725e --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/card/AddPacket.java @@ -0,0 +1,300 @@ +package com.yunze.common.core.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.mapper.yunze.YzCardFlowMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YzOrderMapper; +import com.yunze.common.utils.Arith; +import com.yunze.common.utils.yunze.VeDate; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.lang.reflect.Array; +import java.text.ParseException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Auther: zhang feng + * @Date: 2021/08/03/16:22 + * @Description: + */ +@Component +public class AddPacket { + + + @Resource + private YzOrderMapper yzOrderMapper; + @Resource + private YzCardFlowMapper yzCardFlowMapper; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + + + /** + * 直接添加folw 表 不生成订单 + * @param ord_no + * @param iccid + * @param add_parameter + * @return + */ + public Map addFlow(String ord_no,String iccid,Map add_parameter, String validate_type,String create_time,String activate_date){ + //1.查询 需要加包 订单号 与卡号是否已经在数据库中 如果已经在库中 不执行操作 + Map R_Map = new HashMap<>(); + Map findExistence_Map = new HashMap<>(); + findExistence_Map.put("ord_no",ord_no); + findExistence_Map.put("iccid",iccid); + Integer Existence = yzCardFlowMapper.findExistence(findExistence_Map); + Existence =Existence!=null?Existence:0; + String code = "200",message = "批量加包成功"; + //2.加包 + if(Existence==0){ + try { + //加包执行flow + Map SaveFlowExecuteMap = SaveFlowExecute(add_parameter,validate_type,create_time,ord_no,activate_date,iccid); + if(SaveFlowExecuteMap.get("SuccessCount")!=null){ + int SuccessCount = Integer.parseInt(SaveFlowExecuteMap.get("SuccessCount").toString()); + String info = ""; + if(SaveFlowExecuteMap.get("Message")!=null){ + info = SaveFlowExecuteMap.get("Message").toString(); + }else { + info = SuccessCount>0?"执行加包成功 条数【"+SuccessCount+"】":"执行加包失败【】"; + } + info = info.length()>1500?info.substring(0,1500):info;//切割多余的 错误信息 + //3.插入flow成功后 变更 订单状态 + Map updAddPackageInfo_Map = new HashMap<>(); + updAddPackageInfo_Map.put("iccid",iccid); + updAddPackageInfo_Map.put("ord_no",ord_no); + updAddPackageInfo_Map.put("info",info); + int updOrder = yzOrderMapper.updAddPackageInfo(updAddPackageInfo_Map); + System.out.println("变更订单执行加包 执行 状态 "+updOrder); + } + }catch (Exception e){ + System.out.println("加包执行 【SaveFlowExecute】 异常 " +e.getMessage()); + } + }else{ + code = "201"; + message = "资费计划以存在"; + } + R_Map.put("code",code); + R_Map.put("message",message); + return R_Map; + } + + + /** + * 加包执行flow + * @param add_parameter + * @param validate_type + * @param create_time + * @param ord_no + * @param activate_date + * @param iccid + * @return + */ + public Map SaveFlowExecute(Map add_parameter, String validate_type,String create_time,String ord_no,String activate_date,String iccid){ + Map R_Map = new HashMap<>(); + String Message = ""; + List> add_flow = new ArrayList>(); + + String start_time = "",end_time = ""; + int Size = 1; + int SuccessCount = 0; + //sdate = sdate.substring(0, 8) + "01"; + + Integer is_month = Integer.parseInt(add_parameter.get("is_month").toString());//是否拆分 0 否 1 是 + boolean monthBool = is_month==1?true:false; + Integer packet_valid_time = Integer.parseInt(add_parameter.get("packet_valid_time").toString());//加包 时间规格值 + String packet_valid_name = add_parameter.get("packet_valid_name").toString();//加包 时间规格 + //0. 根据 是否拆分 到账 获取加包 条数 + if(monthBool){ + Size = packet_valid_time; + } + List> AddFlow = null; + Map setFlow =null;//加包设置数据 + if(Size>0){ + //1.判断加包类型 1 当月生效 2 次月生效 3 周期延顺 4 激活生效 获取 订单创建时间 + int validate_type_int = Integer.parseInt(validate_type); + Map Pmap = new HashMap(); + Pmap.put("iccid",iccid); + try { + switch (validate_type_int){ + case 1://1 当月生效 + start_time = create_time; + break; + case 2: + start_time = VeDate.getFirstDayOfGivenMonth(VeDate.getMonthDate(create_time,1),"yyyy-MM-dd")+" 00:00:00"; + break; + case 3: + //查询最后一个包的到期时间 +1 + String eTime = yzCardFlowMapper.findEndTime(Pmap); + if(eTime!=null){ + start_time = VeDate.getNextSecond(eTime,1); + }else{ + start_time = create_time; + } + break; + case 4: + //激活时间为空时查询激活时间 + if(activate_date==null){ + String ActivateDate = yzCardMapper.findActivateDate(Pmap); + start_time = ActivateDate; + }else{ + start_time = VeDate.dateToStrLong(VeDate.strToDate(activate_date)); + } + break; + } + }catch (Exception e){ + Message ="加包 设置 开始时间异常 "+e.getMessage(); + System.out.println(Message); + } + + if(start_time!=null && start_time.length()>0){ + try { + setFlow = setFlow(monthBool,add_parameter,packet_valid_time,packet_valid_name,start_time,Size,ord_no,iccid); + if(setFlow.get("Rlist")!=null){ + AddFlow = (List>) setFlow.get("Rlist"); + } + }catch (Exception e){ + Message = "【 获取 加包 flwo setFlow 异常 】"+e.getMessage(); + System.out.println(Message); + } + try { + //同步主表数据 如果开始 时间 和 当前 月 时间 一致 剩余用量 += 包用量 + String Ym = start_time.substring(0,7); + String yearM = VeDate.getStringDateShort().substring(0,7); + if(yearM.equals(Ym)){ + Map addInfoRemaining_Map = new HashMap<>(); + addInfoRemaining_Map.put("flow",add_parameter.get("packet_flow")); + addInfoRemaining_Map.put("iccid",iccid); + //1.创建路由 绑定 生产队列 发送消息 + String card_exchangeName = "admin_card_exchange", card_queueName = "admin_CardUpd_queue", card_routingKey = "admin.CardUpd.queue", + card_del_exchangeName = "dlx_"+card_exchangeName,card_del_queueName = "dlx_"+card_queueName, card_del_routingKey = "dlx_"+card_routingKey; + try { + rabbitMQConfig.creatExchangeQueue(card_exchangeName, card_queueName, card_routingKey, card_del_exchangeName, card_del_queueName, card_del_routingKey,null); + addInfoRemaining_Map.put("queueTypeName","admin_CardAddInfoRemaining_queue"); + rabbitTemplate.convertAndSend(card_exchangeName, card_routingKey, JSON.toJSONString(addInfoRemaining_Map), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + }); + System.out.println("发送 修改剩余 指令成功 !"); + } catch (Exception e) { + System.out.println("发送 修改剩余 创建 失败 " + e.getMessage().toString()); + } + } + }catch (Exception e){ + Message = "加包 同步主表 Remaining 失败 iccid : "+iccid+" , "+e.getMessage(); + System.out.println(Message); + } + }else{ + System.out.println(" 加包取消 start_time = "+start_time); + } + + } + + if(AddFlow!=null){ + Map save_Map = new HashMap<>(); + save_Map.put("flow_arrs",AddFlow); + SuccessCount = yzCardFlowMapper.saveFlow(save_Map); + Message = "加包成功 iccid : "+iccid+" SuccessCount "+SuccessCount; + System.out.println(Message); + }else{ + Message = "未找到加包数据 iccid : "+iccid+" , add_parameter : "+ JSON.toJSONString(add_parameter); + System.out.println(Message); + } + R_Map.put("SuccessCount",SuccessCount); + R_Map.put("Message",Message); + return R_Map; + } + + + /** + * 设置flow + * @param add_parameter + * @param packet_valid_time + * @param packet_valid_name + * @param start_time + * @param Size + * @param ord_no + * @return + * @throws ParseException + */ + public Map setFlow(boolean monthBool,Map add_parameter,Integer packet_valid_time, String packet_valid_name, String start_time,int Size,String ord_no,String iccid ) throws ParseException { + Map R_map = new HashMap<>(); + List> Rlist = new ArrayList<>(); + int valid_time = 0; + Double FlowSize = 0.0; + //判断 时间规格 + String ord_type = ""; + if(packet_valid_name.equals("月")){ + ord_type = "1"; + valid_time = packet_valid_time; + }else if(packet_valid_name.equals("年")){ + ord_type = "2"; + valid_time = packet_valid_time; + } + int month = 1; + if(ord_type.equals("2")){//年包 + if(monthBool){//年包拆分为 1年 单位 + month = 1*12; + }else{ + month = valid_time*12; + } + } + String sTime = start_time,eTime = null; + for (int i = 0; i < Size; i++) { + eTime = VeDate.getMonthDate(sTime,month-1);// 如 周期 1 月 = 当前时间 至 本月月底 所以 -1 + eTime = VeDate.getEndDateOfMonth_yyyy_MM_DD(eTime.split(" ")[0])+" 23:59:59";//获取月底 日 + Map FlowMap = new HashMap<>(); + FlowMap.put("package_id",add_parameter.get("package_id")); + FlowMap.put("packet_id",add_parameter.get("packet_id")); + FlowMap.put("ord_no",ord_no); + FlowMap.put("true_flow",add_parameter.get("packet_flow")); + FlowMap.put("error_flow",add_parameter.get("error_flow")); + FlowMap.put("start_time",sTime); + FlowMap.put("end_time",eTime); + FlowMap.put("ord_type",ord_type); + FlowMap.put("status","1"); + //解决老数据缺少加包参数加包失败问题 + String packet_type = null; + if(add_parameter.get("packet_type")!=null && add_parameter.get("packet_type").toString().length()>0){ + packet_type = add_parameter.get("packet_type").toString() ; + }else{ + Map FindPacketTypeMap = yzCardFlowMapper.findPacketType(add_parameter); + packet_type = FindPacketTypeMap.get("packet_type").toString(); + } + FlowMap.put("packet_type",packet_type); + FlowMap.put("error_time",add_parameter.get("error_so")); + Object validate_type = add_parameter.get("validate_type"); + validate_type = validate_type!=null?validate_type:"1"; + FlowMap.put("validate_type",validate_type); + FlowMap.put("iccid",iccid); + Rlist.add(FlowMap); + //重新赋值 sTime 下个包的开始时间 等于 当前包 往后 推一秒 + sTime = VeDate.getNextSecond(eTime,1); + /* if(add_parameter.get("packet_flow")!=null){ + FlowSize = Arith.add(FlowSize,Double.parseDouble(add_parameter.get("packet_flow").toString())); + }*/ + } + R_map.put("Rlist",Rlist); + //R_map.put("FlowSize",FlowSize); + return R_map; + } + + + + + + } diff --git a/yunze-common/src/main/java/com/yunze/common/core/card/CardChange.java b/yunze-common/src/main/java/com/yunze/common/core/card/CardChange.java new file mode 100644 index 0000000..a652f0a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/card/CardChange.java @@ -0,0 +1,119 @@ +package com.yunze.common.core.card; + +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.MyDictionary; +import com.yunze.common.mapper.yunze.YzCardInfoChangeMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.utils.yunze.GetShowStatIdArr; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Map; + +/** + * 卡信息 变更 操作记录 日志 输出 + * @Auther: zhang feng + * @Date: 2021/09/15/8:21 + * @Description: + */ +@Slf4j +@Component +public class CardChange { + + @Resource + private MyDictionary myDictionary; + @Resource + private YzCardInfoChangeMapper yzCardInfoChangeMapper; + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private GetShowStatIdArr getShowStatIdArr; + /** + * 停 开 机 + * @param Parammap + * @param map + * @param Add_Map 新增变更记录 + * @param Upd_Map 卡状态 变更Map + */ + public void OnOff (Map Parammap, Map map,Map Add_Map,Map Upd_Map){ + boolean bool = false; + String remark = ""; + String execution_status = "2"; + try { + Map Rmap = internalApiRequest.changeCardStatus(Parammap,map); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + String iccid = Upd_Map.get("iccid").toString(); + if(code.equals("200")){ + //更新 card info + Object status_id = Upd_Map.get("status_id"); + String status_ShowId = getShowStatIdArr.GetShowStatId(status_id.toString()); + Upd_Map.put("status_ShowId",status_ShowId); + bool = yzCardMapper.updStatusId(Upd_Map)>0; + if(bool){ + remark = "执行成功!"; + execution_status = "1"; + }else{ + log.error(">>DB - 达量停机轮序消费者 同步达量停机失败:{} | {}<<",iccid,Upd_Map); + } + }else{ + if(Rmap.get("Message")!=null){ + remark = Rmap.get("Message").toString().length()>100?Rmap.get("Message").toString().substring(0,100):Rmap.get("Message").toString(); + } + log.info(">>API - CardChange OnOff 操作失败 :{} | {}<<",iccid,Rmap); + } + }catch (Exception e){ + remark = e.getMessage().length()>100?e.getMessage().substring(0,100):e.getMessage(); + } + Add_Map.put("remark",remark); + Add_Map.put("execution_status",execution_status); + boolean addBool = yzCardInfoChangeMapper.save(Add_Map)>0; + log.info(map.get("iccid")+" yzCardMapper.updStatusId bool : "+bool+" 新增卡信息变更记录 addBool :"+addBool); + } + + + /** + * 断 开 网 + * @param Parammap + * @param map + * @param Add_Map 新增变更记录 + * @param Upd_Map 断开网 变更Map + */ + public void ChangeConnection (Map Parammap, Map map,Map Add_Map,Map Upd_Map){ + boolean bool = false; + String remark = ""; + String execution_status = "2"; + try { + Map Rmap = internalApiRequest.FunctionApnStatus(Parammap,map); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + String iccid = Upd_Map.get("iccid").toString(); + if(code.equals("200")){ + //更新 card info + bool = yzCardMapper.updConnectionStatus(Upd_Map)>0; + if(bool){ + remark = "执行成功!"; + execution_status = "1"; + }else{ + log.error(">>DB - 达量停机轮序消费者 同步达量停机失败:{} | {}<<",iccid,Upd_Map); + } + }else{ + if(Rmap.get("Message")!=null){ + remark = Rmap.get("Message").toString().length()>100?Rmap.get("Message").toString().substring(0,100):Rmap.get("Message").toString(); + } + log.info(">>API - CardChange ChangeConnection 操作失败 :{} | {}<<",iccid,Rmap); + } + }catch (Exception e){ + remark = e.getMessage().length()>100?e.getMessage().substring(0,100):e.getMessage(); + } + Add_Map.put("remark",remark); + Add_Map.put("execution_status",execution_status); + boolean addBool = yzCardInfoChangeMapper.save(Add_Map)>0; + log.info(map.get("iccid")+" yzCardMapper.updConnectionStatus bool : "+bool+" 新增卡信息变更记录 addBool :"+addBool); + } + + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/controller/BaseController.java b/yunze-common/src/main/java/com/yunze/common/core/controller/BaseController.java new file mode 100644 index 0000000..878750e --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/controller/BaseController.java @@ -0,0 +1,190 @@ +package com.yunze.common.core.controller; + +import java.beans.PropertyEditorSupport; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.utils.yunze.AesEncryptUtil; +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.yunze.common.constant.HttpStatus; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.page.PageDomain; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.core.page.TableSupport; +import com.yunze.common.utils.DateUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.sql.SqlUtil; + +/** + * web层通用数据处理 + * + * @author yunze + */ +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() + { + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) + { + String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); + PageHelper.startPage(pageNum, pageSize, orderBy); + } + } + + /** + * my 成功返回函数 + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected String MyRetunSuccess(Object obj,String msg) + { + msg = msg!=null?msg:"操作成功"; + Map Rmap = new HashMap(); + Rmap.put("code",HttpStatus.SUCCESS); + Rmap.put("msg",msg); + Rmap.put("Data",obj); + try { + return AesEncryptUtil.encrypt(JSON.toJSONString(Rmap)); + }catch (Exception e){ + System.err.println(e); + return "数据返回加密失败……"; + } + } + + + protected String Myerr(String Msg) + { + Map map = new HashMap<>(); + map.put("code",HttpStatus.ERROR); + map.put("msg",Msg); + try { + return AesEncryptUtil.encrypt(JSON.toJSONString(map)); + //return JSON.toJSONString(map); + }catch (Exception e){ + System.err.println(e); + return "数据返回加密失败……"; + } + } + + /** + * 设置请求排序数据 + */ + protected void startOrderBy() + { + PageDomain pageDomain = TableSupport.buildPageRequest(); + if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) + { + String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); + PageHelper.orderBy(orderBy); + } + } + + /** + * 响应请求分页数据 + */ + @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; + } + + /** + * 响应返回结果 + * + * @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 AjaxResult success() + { + return AjaxResult.success(); + } + + /** + * 返回失败消息 + */ + public AjaxResult error() + { + return AjaxResult.error(); + } + + /** + * 返回成功消息 + */ + public AjaxResult success(String message) + { + return AjaxResult.success(message); + } + + /** + * 返回失败消息 + */ + public AjaxResult error(String message) + { + return AjaxResult.error(message); + } + + /** + * 页面跳转 + */ + public String redirect(String url) + { + return StringUtils.format("redirect:{}", url); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/domain/AjaxResult.java b/yunze-common/src/main/java/com/yunze/common/core/domain/AjaxResult.java new file mode 100644 index 0000000..d0d7701 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/AjaxResult.java @@ -0,0 +1,148 @@ +package com.yunze.common.core.domain; + +import java.util.HashMap; +import com.yunze.common.constant.HttpStatus; +import com.yunze.common.utils.StringUtils; + +/** + * 操作消息提醒 + * + * @author yunze + */ +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); + } + + /** + * 返回错误消息 + * + * @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); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/domain/BaseEntity.java b/yunze-common/src/main/java/com/yunze/common/core/domain/BaseEntity.java new file mode 100644 index 0000000..bc221a4 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/BaseEntity.java @@ -0,0 +1,114 @@ +package com.yunze.common.core.domain; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * Entity基类 + * + * @author yunze + */ +public class BaseEntity implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 搜索值 */ + private String searchValue; + + /** 创建者 */ + private String createBy; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** 更新者 */ + private String updateBy; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /** 备注 */ + private String remark; + + /** 请求参数 */ + 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/yunze-common/src/main/java/com/yunze/common/core/domain/TreeEntity.java b/yunze-common/src/main/java/com/yunze/common/core/domain/TreeEntity.java new file mode 100644 index 0000000..7951a41 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/TreeEntity.java @@ -0,0 +1,79 @@ +package com.yunze.common.core.domain; + +import java.util.ArrayList; +import java.util.List; + +/** + * Tree基类 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/core/domain/TreeSelect.java b/yunze-common/src/main/java/com/yunze/common/core/domain/TreeSelect.java new file mode 100644 index 0000000..d6c939c --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/TreeSelect.java @@ -0,0 +1,77 @@ +package com.yunze.common.core.domain; + +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.yunze.common.core.domain.entity.SysDept; +import com.yunze.common.core.domain.entity.SysMenu; + +/** + * Treeselect树结构实体类 + * + * @author yunze + */ +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.getDname(); + 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 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/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysDept.java b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysDept.java new file mode 100644 index 0000000..417a593 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysDept.java @@ -0,0 +1,220 @@ +package com.yunze.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.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.yunze.common.core.domain.BaseEntity; + +/** + * 部门表 sys_dept + * + * @author yunze + */ +public class SysDept extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 部门ID */ + private Long deptId; + + /** 父部门ID */ + private Long parentId; + + /** 祖级列表 */ + private String ancestors; + + /** 部门名称 */ + private String deptName; + + /** 显示顺序 */ + private String orderNum; + + /** 负责人 */ + private String leader; + + /** 联系电话 */ + private String phone; + + /** 邮箱 */ + private String email; + + /** 部门状态:0正常,1停用 */ + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 父部门名称 */ + private String parentName; + /** 部门简称 */ + private String dname; + + + + /** 子部门 */ + 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; + } + + @NotBlank(message = "显示顺序不能为空") + public String getOrderNum() + { + return orderNum; + } + + public void setOrderNum(String 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 String getDname() + { + return dname; + } + + public void setDname(String dname) + { + this.dname = dname; + } + + + + 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()) + .append("dname", getDname()) + .toString(); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysDictData.java b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysDictData.java new file mode 100644 index 0000000..7a93016 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysDictData.java @@ -0,0 +1,176 @@ +package com.yunze.common.core.domain.entity; + +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.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.domain.BaseEntity; + +/** + * 字典数据表 sys_dict_data + * + * @author yunze + */ +public class SysDictData extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 字典编码 */ + @Excel(name = "字典编码", cellType = ColumnType.NUMERIC) + private Long dictCode; + + /** 字典排序 */ + @Excel(name = "字典排序", cellType = ColumnType.NUMERIC) + private Long dictSort; + + /** 字典标签 */ + @Excel(name = "字典标签") + private String dictLabel; + + /** 字典键值 */ + @Excel(name = "字典键值") + private String dictValue; + + /** 字典类型 */ + @Excel(name = "字典类型") + private String dictType; + + /** 样式属性(其他样式扩展) */ + private String cssClass; + + /** 表格字典样式 */ + private String listClass; + + /** 是否默认(Y是 N否) */ + @Excel(name = "是否默认", readConverterExp = "Y=是,N=否") + 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) ? true : false; + } + + 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/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysDictType.java b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysDictType.java new file mode 100644 index 0000000..a4bd21f --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysDictType.java @@ -0,0 +1,128 @@ +package com.yunze.common.core.domain.entity; + +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.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.core.domain.BaseEntity; + +/** + * 字典类型表 sys_dict_type + * + * @author yunze + */ +public class SysDictType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 字典主键 */ + @Excel(name = "字典主键", cellType = ColumnType.NUMERIC) + private Long dictId; + + /** 字典名称 */ + @Excel(name = "字典名称") + private String dictName; + + /** 字典类型 */ + @Excel(name = "字典类型") + private String dictType; + + +// /**推送 API*/ +// @Excel(name = "推送 API") +// private String url; +// +// /**推送邮件*/ +// @Excel(name = "推送邮件") +// private String email; + + /** 状态(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个字符") + 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; + } + +// @NotBlank(message = "推送API名称不能为空") +// @Size(min = 0, max = 100, message = "推送API名称长度不能超过100个字符") +// public String getCcUrlName() +// { +// return url; +// } +// public void setCcUrlName(String url) +// { +// this.url = url; +// } +// +// @NotBlank(message = "邮件不能为空") +// @Size(min = 0, max = 100, message = "邮件长度不能超过100个字符") +// public String getCcUrlType() +// { +// return email; +// } +// public void setCcUrlType(String email) +// { +// this.email = email; +// } + +// .append("url", getCcUrlName()) +// .append("email", getCcUrlType()) + @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/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysMenu.java b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysMenu.java new file mode 100644 index 0000000..232782e --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysMenu.java @@ -0,0 +1,245 @@ +package com.yunze.common.core.domain.entity; + +import java.util.ArrayList; +import java.util.List; +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.yunze.common.core.domain.BaseEntity; + +/** + * 菜单权限表 sys_menu + * + * @author yunze + */ +public class SysMenu extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 菜单ID */ + private Long menuId; + + /** 菜单名称 */ + private String menuName; + + /** 父菜单名称 */ + private String parentName; + + /** 父菜单ID */ + private Long parentId; + + /** 显示顺序 */ + private String orderNum; + + /** 路由地址 */ + private String path; + + /** 组件路径 */ + private String component; + + /** 是否为外链(0是 1否) */ + private String isFrame; + + /** 是否缓存(0缓存 1不缓存) */ + private String isCache; + + /** 类型(M目录 C菜单 F按钮) */ + 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; + } + + @NotBlank(message = "显示顺序不能为空") + public String getOrderNum() + { + return orderNum; + } + + public void setOrderNum(String 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 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/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysRole.java b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysRole.java new file mode 100644 index 0000000..3643a0d --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysRole.java @@ -0,0 +1,226 @@ +package com.yunze.common.core.domain.entity; + +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.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.core.domain.BaseEntity; + +/** + * 角色表 sys_role + * + * @author yunze + */ +public class SysRole extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 角色ID */ + @Excel(name = "角色序号", cellType = ColumnType.NUMERIC) + private Long roleId; + + /** 角色名称 */ + @Excel(name = "角色名称") + private String roleName; + + /** 角色权限 */ + @Excel(name = "角色权限") + private String roleKey; + + /** 角色排序 */ + @Excel(name = "角色排序") + private String roleSort; + + /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限) */ + @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限") + private String dataScope; + + /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */ + private boolean menuCheckStrictly; + + /** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */ + private boolean deptCheckStrictly; + + /** 角色状态(0正常 1停用) */ + @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 用户是否存在此角色标识 默认不存在 */ + private boolean flag = false; + + /** 菜单组 */ + private Long[] menuIds; + + /** 部门组(数据权限) */ + private Long[] deptIds; + + 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; + } + + @NotBlank(message = "显示顺序不能为空") + public String getRoleSort() + { + return roleSort; + } + + public void setRoleSort(String 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[] getDeptIds() + { + return deptIds; + } + + public void setDeptIds(Long[] deptIds) + { + this.deptIds = deptIds; + } + + @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/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysUser.java b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysUser.java new file mode 100644 index 0000000..ea53f6f --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/SysUser.java @@ -0,0 +1,328 @@ +package com.yunze.common.core.domain.entity; + +import java.util.Date; +import java.util.List; +import javax.validation.constraints.Email; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.annotation.Excel.Type; +import com.yunze.common.annotation.Excels; +import com.yunze.common.core.domain.BaseEntity; + +/** + * 用户对象 sys_user + * + * @author yunze + */ +public class SysUser extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 用户ID */ + @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") + private Long userId; + + /** 部门ID */ + @Excel(name = "部门编号", type = Type.IMPORT) + private Long deptId; + + /** 用户账号 */ + @Excel(name = "登录名称") + private String userName; + + /** 用户昵称 */ + @Excel(name = "用户名称") + private String nickName; + + /** 用户邮箱 */ + @Excel(name = "用户邮箱") + private String email; + + /** 手机号码 */ + @Excel(name = "手机号码") + private String phonenumber; + + /** 用户性别 */ + @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") + private String sex; + + /** 用户头像 */ + private String avatar; + + /** 密码 */ + private String password; + + /** 盐加密 */ + private String salt; + + /** 帐号状态(0正常 1停用) */ + @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 最后登录IP */ + @Excel(name = "最后登录IP", type = Type.EXPORT) + private String loginIp; + + /** 最后登录时间 */ + @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) + 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; + + 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 Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") + public String getNickName() + { + return nickName; + } + + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + @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; + } + + @JsonIgnore + @JsonProperty + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getSalt() + { + return salt; + } + + public void setSalt(String salt) + { + this.salt = salt; + } + + 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; + } + + @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("email", getEmail()) + .append("phonenumber", getPhonenumber()) + .append("sex", getSex()) + .append("avatar", getAvatar()) + .append("password", getPassword()) + .append("salt", getSalt()) + .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("dept", getDept()) + .toString(); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/domain/entity/YzCard.java b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/YzCard.java new file mode 100644 index 0000000..d73b2ba --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/entity/YzCard.java @@ -0,0 +1,87 @@ +package com.yunze.common.core.domain.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.annotation.Excel.Type; +import com.yunze.common.annotation.Excels; +import com.yunze.common.core.domain.BaseEntity; +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; + +/** + * 用户对象 yz_card_info + * + * @author root + */ +public class YzCard extends BaseEntity +{ + + @Excel(name = "msisdn", cellType = ColumnType.STRING, prompt = "SIM 号码") + private String msisdn ; + + @Excel(name = "iccid", cellType = ColumnType.STRING, prompt = "SIM 卡号") + private String iccid; + + @Excel(name = "imsi", cellType = ColumnType.STRING, prompt = "SIM 识别码") + private String imsi ; + + @Excel(name = "open_date", cellType = ColumnType.STRING, prompt = "开卡日期 yyyy-MM-dd") + private String open_date ; + + @Excel(name = "activate_date", cellType = ColumnType.STRING, prompt = "激活日期 yyyy-MM-dd") + private String activate_date; + + @Excel(name = "agent_id", cellType = ColumnType.STRING, prompt = "代理编号") + private String agent_id ; + + @Excel(name = "channel_id", cellType = ColumnType.STRING, prompt = "通道编号") + private String channel_id ; + + @Excel(name = "is_pool", cellType = ColumnType.STRING, prompt = "是否流量池 0 否 1 是") + private String is_pool; + + @Excel(name = "batch_date", cellType = ColumnType.STRING, prompt = "入库日期 yyyy-MM-dd") + private String batch_date ; + + @Excel(name = "remarks", cellType = ColumnType.STRING, prompt = "备注信息") + private String remarks ; + + + @Excel(name = "status_id", cellType = ColumnType.STRING, prompt = "卡状态") + private String status_id; + + @Excel(name = "package_id", cellType = ColumnType.STRING, prompt = "资费组 编号") + private String package_id ; + + + + @Excel(name = "imei", cellType = ColumnType.STRING, prompt = "IMEI") + private String imei ; + + @Excel(name = "type", cellType = ColumnType.STRING, prompt = "卡类型") + private String type; + + @Excel(name = "network_type", cellType = ColumnType.STRING, prompt = "网络类型 ") + private String network_type; + + @Excel(name = "is_sms", cellType = ColumnType.STRING, prompt = "是否支持短信发送 0 否 1 是") + private String is_sms ; + + @Excel(name = "sms_number", cellType = ColumnType.STRING, prompt = "短信服务号码") + private String sms_number; + + @Excel(name = "gprs", cellType = ColumnType.STRING, prompt = "GPRS是否开启 0 否 1 是") + private String gprs; + + @Excel(name = "user_id", cellType = ColumnType.STRING, prompt = "系统登录账户id ") + private String user_id ; + +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/domain/model/LoginBody.java b/yunze-common/src/main/java/com/yunze/common/core/domain/model/LoginBody.java new file mode 100644 index 0000000..a8f19fc --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/model/LoginBody.java @@ -0,0 +1,69 @@ +package com.yunze.common.core.domain.model; + +/** + * 用户登录对象 + * + * @author yunze + */ +public class LoginBody +{ + /** + * 用户名 + */ + private String username; + + /** + * 用户密码 + */ + private String password; + + /** + * 验证码 + */ + private String code; + + /** + * 唯一标识 + */ + 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 getCode() + { + return code; + } + + public void setCode(String code) + { + this.code = code; + } + + public String getUuid() + { + return uuid; + } + + public void setUuid(String uuid) + { + this.uuid = uuid; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/domain/model/LoginUser.java b/yunze-common/src/main/java/com/yunze/common/core/domain/model/LoginUser.java new file mode 100644 index 0000000..76adcdf --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/domain/model/LoginUser.java @@ -0,0 +1,228 @@ +package com.yunze.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.fasterxml.jackson.annotation.JsonIgnore; +import com.yunze.common.core.domain.entity.SysUser; + +/** + * 登录用户身份权限 + * + * @author yunze + */ +public class LoginUser implements UserDetails +{ + private static final long serialVersionUID = 1L; + + /** + * 用户唯一标识 + */ + private String token; + + /** + * 登录时间 + */ + private Long loginTime; + + /** + * 过期时间 + */ + private Long expireTime; + + /** + * 登录IP地址 + */ + private String ipaddr; + + /** + * 登录地点 + */ + private String loginLocation; + + /** + * 浏览器类型 + */ + private String browser; + + /** + * 操作系统 + */ + private String os; + + /** + * 权限列表 + */ + private Set permissions; + + /** + * 用户信息 + */ + private SysUser user; + + 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; + } + + @JsonIgnore + @Override + public String getPassword() + { + return user.getPassword(); + } + + @Override + public String getUsername() + { + return user.getUserName(); + } + + /** + * 账户是否未过期,过期无法验证 + */ + @JsonIgnore + @Override + public boolean isAccountNonExpired() + { + return true; + } + + /** + * 指定用户是否解锁,锁定的用户无法进行身份验证 + * + * @return + */ + @JsonIgnore + @Override + public boolean isAccountNonLocked() + { + return true; + } + + /** + * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 + * + * @return + */ + @JsonIgnore + @Override + public boolean isCredentialsNonExpired() + { + return true; + } + + /** + * 是否可用 ,禁用的用户不能身份验证 + * + * @return + */ + @JsonIgnore + @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 SysUser getUser() + { + return user; + } + + public void setUser(SysUser user) + { + this.user = user; + } + + @Override + public Collection getAuthorities() + { + return null; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/page/PageDomain.java b/yunze-common/src/main/java/com/yunze/common/core/page/PageDomain.java new file mode 100644 index 0000000..754c0ca --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/page/PageDomain.java @@ -0,0 +1,72 @@ +package com.yunze.common.core.page; + +import com.yunze.common.utils.StringUtils; + +/** + * 分页数据 + * + * @author yunze + */ +public class PageDomain +{ + /** 当前记录起始索引 */ + private Integer pageNum; + + /** 每页显示记录数 */ + private Integer pageSize; + + /** 排序列 */ + private String orderByColumn; + + /** 排序的方向desc或者asc */ + private String isAsc = "asc"; + + 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) + { + this.isAsc = isAsc; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/page/TableDataInfo.java b/yunze-common/src/main/java/com/yunze/common/core/page/TableDataInfo.java new file mode 100644 index 0000000..9785e21 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/page/TableDataInfo.java @@ -0,0 +1,85 @@ +package com.yunze.common.core.page; + +import java.io.Serializable; +import java.util.List; + +/** + * 表格分页数据对象 + * + * @author yunze + */ +public class TableDataInfo implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 总记录数 */ + private long total; + + /** 列表数据 */ + private List rows; + + /** 消息状态码 */ + 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/yunze-common/src/main/java/com/yunze/common/core/page/TableSupport.java b/yunze-common/src/main/java/com/yunze/common/core/page/TableSupport.java new file mode 100644 index 0000000..01935d1 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/page/TableSupport.java @@ -0,0 +1,49 @@ +package com.yunze.common.core.page; + +import com.yunze.common.utils.ServletUtils; + +/** + * 表格数据处理 + * + * @author yunze + */ +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 PageDomain getPageDomain() + { + PageDomain pageDomain = new PageDomain(); + pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM)); + pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE)); + pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); + pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); + return pageDomain; + } + + public static PageDomain buildPageRequest() + { + return getPageDomain(); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/redis/RedisCache.java b/yunze-common/src/main/java/com/yunze/common/core/redis/RedisCache.java new file mode 100644 index 0000000..2b941b5 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/redis/RedisCache.java @@ -0,0 +1,274 @@ +package com.yunze.common.core.redis; + +import java.util.*; +import java.util.concurrent.TimeUnit; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.*; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * spring redis 工具类 + * + * @author yunze + **/ +@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 缓存键值 + * @return 缓存键值对应的数据 + */ + public T getCacheObject(final String key) + { + ValueOperations operation = (ValueOperations) redisTemplate.opsForValue(); + return operation.get(key); + } + + /** + * 删除单个对象 + * + * @param key + */ + public boolean deleteObject(final String key) + { + return redisTemplate.delete(key); + } + + /** + * 删除集合对象 + * + * @param collection 多个对象 + * @return + */ + public long deleteObject(final Collection collection) + { + return redisTemplate.delete(collection); + } + + /** + * 缓存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 (List) redisTemplate.opsForList().range(key, 0, -1); + } + + /** + * 缓存Set + * + * @param key 缓存键值 + * @param dataSet 缓存的数据 + * @return 缓存数据的对象 + */ + public BoundSetOperations setCacheSet(final String key, final Set dataSet) + { + BoundSetOperations setOperation = (BoundSetOperations) 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 (Set) 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 (List) redisTemplate.opsForHash().multiGet(key, hKeys); + } + + /** + * 获得缓存的基本对象列表 + * + * @param pattern 字符串前缀 + * @return 对象列表 + */ + public Collection keys(final String pattern) + { + return redisTemplate.keys(pattern); + } + + + + /** + * 获取指定前缀的一系列key + * 使用scan命令代替keys, Redis是单线程处理,keys命令在KEY数量较多时, + * 操作效率极低【时间复杂度为O(N)】,该命令一旦执行会严重阻塞线上其它命令的正常请求 + * @param keyPrefix + * @return + */ + public Collection scanKeys(String keyPrefix) { + String realKey = "*" + keyPrefix + "*"; + try { + return (Collection) redisTemplate.execute((RedisCallback>) connection -> { + Set binaryKeys = new HashSet<>(); + Cursor cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(realKey).count(Integer.MAX_VALUE).build()); + while (cursor.hasNext()) { + binaryKeys.add(new String(cursor.next())); + } + return binaryKeys; + }); + } catch (Throwable e) { + e.printStackTrace(); + } + return null; + } + + /** + * 删除指定前缀的一系列key + * @param keyPrefix + */ + public void removeAll(String keyPrefix) { + try { + Collection keys = scanKeys(keyPrefix); + redisTemplate.delete(keys); + } catch (Throwable e) { + e.printStackTrace(); + } + } + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/core/text/CharsetKit.java b/yunze-common/src/main/java/com/yunze/common/core/text/CharsetKit.java new file mode 100644 index 0000000..3eca4e8 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/text/CharsetKit.java @@ -0,0 +1,86 @@ +package com.yunze.common.core.text; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import com.yunze.common.utils.StringUtils; + +/** + * 字符集工具类 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/core/text/Convert.java b/yunze-common/src/main/java/com/yunze/common/core/text/Convert.java new file mode 100644 index 0000000..850188f --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/text/Convert.java @@ -0,0 +1,1005 @@ +package com.yunze.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.yunze.common.utils.StringUtils; +import org.apache.commons.lang3.ArrayUtils; + +/** + * 类型转换器 + * + * @author yunze + */ +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": + return true; + case "false": + return false; + case "yes": + return true; + case "ok": + return true; + case "no": + return false; + case "1": + return true; + 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/yunze-common/src/main/java/com/yunze/common/core/text/StrFormatter.java b/yunze-common/src/main/java/com/yunze/common/core/text/StrFormatter.java new file mode 100644 index 0000000..a1a7280 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/core/text/StrFormatter.java @@ -0,0 +1,92 @@ +package com.yunze.common.core.text; + +import com.yunze.common.utils.StringUtils; + +/** + * 字符串格式化 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/enums/BusinessStatus.java b/yunze-common/src/main/java/com/yunze/common/enums/BusinessStatus.java new file mode 100644 index 0000000..1146e3a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/enums/BusinessStatus.java @@ -0,0 +1,20 @@ +package com.yunze.common.enums; + +/** + * 操作状态 + * + * @author yunze + * + */ +public enum BusinessStatus +{ + /** + * 成功 + */ + SUCCESS, + + /** + * 失败 + */ + FAIL, +} diff --git a/yunze-common/src/main/java/com/yunze/common/enums/BusinessType.java b/yunze-common/src/main/java/com/yunze/common/enums/BusinessType.java new file mode 100644 index 0000000..b36246b --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/enums/BusinessType.java @@ -0,0 +1,59 @@ +package com.yunze.common.enums; + +/** + * 业务操作类型 + * + * @author yunze + */ +public enum BusinessType +{ + /** + * 其它 + */ + OTHER, + + /** + * 新增 + */ + INSERT, + + /** + * 修改 + */ + UPDATE, + + /** + * 删除 + */ + DELETE, + + /** + * 授权 + */ + GRANT, + + /** + * 导出 + */ + EXPORT, + + /** + * 导入 + */ + IMPORT, + + /** + * 强退 + */ + FORCE, + + /** + * 生成代码 + */ + GENCODE, + + /** + * 清空数据 + */ + CLEAN, +} diff --git a/yunze-common/src/main/java/com/yunze/common/enums/DataSourceType.java b/yunze-common/src/main/java/com/yunze/common/enums/DataSourceType.java new file mode 100644 index 0000000..3922a5a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/enums/DataSourceType.java @@ -0,0 +1,19 @@ +package com.yunze.common.enums; + +/** + * 数据源 + * + * @author yunze + */ +public enum DataSourceType +{ + /** + * 主库 + */ + MASTER, + + /** + * 从库 + */ + SLAVE +} diff --git a/yunze-common/src/main/java/com/yunze/common/enums/HttpMethod.java b/yunze-common/src/main/java/com/yunze/common/enums/HttpMethod.java new file mode 100644 index 0000000..c1f55e0 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/enums/HttpMethod.java @@ -0,0 +1,36 @@ +package com.yunze.common.enums; + +import java.util.HashMap; +import java.util.Map; +import org.springframework.lang.Nullable; + +/** + * 请求方式 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/enums/OperatorType.java b/yunze-common/src/main/java/com/yunze/common/enums/OperatorType.java new file mode 100644 index 0000000..88a8ed2 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/enums/OperatorType.java @@ -0,0 +1,24 @@ +package com.yunze.common.enums; + +/** + * 操作人类别 + * + * @author yunze + */ +public enum OperatorType +{ + /** + * 其它 + */ + OTHER, + + /** + * 后台用户 + */ + MANAGE, + + /** + * 手机端用户 + */ + MOBILE +} diff --git a/yunze-common/src/main/java/com/yunze/common/enums/UserStatus.java b/yunze-common/src/main/java/com/yunze/common/enums/UserStatus.java new file mode 100644 index 0000000..5ecced1 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/enums/UserStatus.java @@ -0,0 +1,30 @@ +package com.yunze.common.enums; + +/** + * 用户状态 + * + * @author yunze + */ +public enum UserStatus +{ + OK("0", "正常"), DISABLE("1", "停用"), 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/yunze-common/src/main/java/com/yunze/common/exception/BaseException.java b/yunze-common/src/main/java/com/yunze/common/exception/BaseException.java new file mode 100644 index 0000000..40ad754 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/BaseException.java @@ -0,0 +1,97 @@ +package com.yunze.common.exception; + +import com.yunze.common.utils.MessageUtils; +import com.yunze.common.utils.StringUtils; + +/** + * 基础异常 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/exception/CustomException.java b/yunze-common/src/main/java/com/yunze/common/exception/CustomException.java new file mode 100644 index 0000000..9f75aa4 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/CustomException.java @@ -0,0 +1,43 @@ +package com.yunze.common.exception; + +/** + * 自定义异常 + * + * @author yunze + */ +public class CustomException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + private Integer code; + + private String message; + + public CustomException(String message) + { + this.message = message; + } + + public CustomException(String message, Integer code) + { + this.message = message; + this.code = code; + } + + public CustomException(String message, Throwable e) + { + super(message, e); + this.message = message; + } + + @Override + public String getMessage() + { + return message; + } + + public Integer getCode() + { + return code; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/exception/DemoModeException.java b/yunze-common/src/main/java/com/yunze/common/exception/DemoModeException.java new file mode 100644 index 0000000..d2bea9b --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/DemoModeException.java @@ -0,0 +1,15 @@ +package com.yunze.common.exception; + +/** + * 演示模式异常 + * + * @author yunze + */ +public class DemoModeException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + public DemoModeException() + { + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/exception/UtilException.java b/yunze-common/src/main/java/com/yunze/common/exception/UtilException.java new file mode 100644 index 0000000..5b886df --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/UtilException.java @@ -0,0 +1,26 @@ +package com.yunze.common.exception; + +/** + * 工具类异常 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/exception/file/FileException.java b/yunze-common/src/main/java/com/yunze/common/exception/file/FileException.java new file mode 100644 index 0000000..05cc329 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/file/FileException.java @@ -0,0 +1,19 @@ +package com.yunze.common.exception.file; + +import com.yunze.common.exception.BaseException; + +/** + * 文件信息异常类 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/exception/file/FileNameLengthLimitExceededException.java b/yunze-common/src/main/java/com/yunze/common/exception/file/FileNameLengthLimitExceededException.java new file mode 100644 index 0000000..f8bcaab --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/file/FileNameLengthLimitExceededException.java @@ -0,0 +1,16 @@ +package com.yunze.common.exception.file; + +/** + * 文件名称超长限制异常类 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/exception/file/FileSizeLimitExceededException.java b/yunze-common/src/main/java/com/yunze/common/exception/file/FileSizeLimitExceededException.java new file mode 100644 index 0000000..8aeceed --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/file/FileSizeLimitExceededException.java @@ -0,0 +1,16 @@ +package com.yunze.common.exception.file; + +/** + * 文件名大小限制异常类 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/exception/file/InvalidExtensionException.java b/yunze-common/src/main/java/com/yunze/common/exception/file/InvalidExtensionException.java new file mode 100644 index 0000000..d1f5ee8 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/file/InvalidExtensionException.java @@ -0,0 +1,81 @@ +package com.yunze.common.exception.file; + +import java.util.Arrays; +import org.apache.commons.fileupload.FileUploadException; + +/** + * 文件上传 误异常类 + * + * @author yunze + */ +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 : [" + filename + "], extension : [" + extension + "], allowed 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/yunze-common/src/main/java/com/yunze/common/exception/job/TaskException.java b/yunze-common/src/main/java/com/yunze/common/exception/job/TaskException.java new file mode 100644 index 0000000..3ae5eeb --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/job/TaskException.java @@ -0,0 +1,34 @@ +package com.yunze.common.exception.job; + +/** + * 计划策略异常 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/exception/user/CaptchaException.java b/yunze-common/src/main/java/com/yunze/common/exception/user/CaptchaException.java new file mode 100644 index 0000000..a2bdfb6 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/user/CaptchaException.java @@ -0,0 +1,16 @@ +package com.yunze.common.exception.user; + +/** + * 验证码错误异常类 + * + * @author yunze + */ +public class CaptchaException extends UserException +{ + private static final long serialVersionUID = 1L; + + public CaptchaException() + { + super("user.jcaptcha.error", null); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/exception/user/CaptchaExpireException.java b/yunze-common/src/main/java/com/yunze/common/exception/user/CaptchaExpireException.java new file mode 100644 index 0000000..c2a8bcd --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/user/CaptchaExpireException.java @@ -0,0 +1,16 @@ +package com.yunze.common.exception.user; + +/** + * 验证码失效异常类 + * + * @author yunze + */ +public class CaptchaExpireException extends UserException +{ + private static final long serialVersionUID = 1L; + + public CaptchaExpireException() + { + super("user.jcaptcha.expire", null); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/exception/user/UserException.java b/yunze-common/src/main/java/com/yunze/common/exception/user/UserException.java new file mode 100644 index 0000000..aabb696 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/user/UserException.java @@ -0,0 +1,18 @@ +package com.yunze.common.exception.user; + +import com.yunze.common.exception.BaseException; + +/** + * 用户信息异常类 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/exception/user/UserPasswordNotMatchException.java b/yunze-common/src/main/java/com/yunze/common/exception/user/UserPasswordNotMatchException.java new file mode 100644 index 0000000..37b0b78 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/exception/user/UserPasswordNotMatchException.java @@ -0,0 +1,16 @@ +package com.yunze.common.exception.user; + +/** + * 用户密码不正确或不符合规范异常类 + * + * @author yunze + */ +public class UserPasswordNotMatchException extends UserException +{ + private static final long serialVersionUID = 1L; + + public UserPasswordNotMatchException() + { + super("user.password.not.match", null); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/filter/RepeatableFilter.java b/yunze-common/src/main/java/com/yunze/common/filter/RepeatableFilter.java new file mode 100644 index 0000000..3d9a3df --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/filter/RepeatableFilter.java @@ -0,0 +1,52 @@ +package com.yunze.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.yunze.common.utils.StringUtils; + +/** + * Repeatable 过滤器 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/filter/RepeatedlyRequestWrapper.java b/yunze-common/src/main/java/com/yunze/common/filter/RepeatedlyRequestWrapper.java new file mode 100644 index 0000000..56bab30 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/filter/RepeatedlyRequestWrapper.java @@ -0,0 +1,75 @@ +package com.yunze.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.yunze.common.utils.http.HttpHelper; + +/** + * 构建可重复读取inputStream的request + * + * @author yunze + */ +public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper +{ + private final byte[] body; + + public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException + { + super(request); + request.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding("UTF-8"); + + body = HttpHelper.getBodyString(request).getBytes("UTF-8"); + } + + @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/yunze-common/src/main/java/com/yunze/common/filter/XssFilter.java b/yunze-common/src/main/java/com/yunze/common/filter/XssFilter.java new file mode 100644 index 0000000..0fefdf7 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/filter/XssFilter.java @@ -0,0 +1,97 @@ +package com.yunze.common.filter; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +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.yunze.common.utils.StringUtils; + +/** + * 防止XSS攻击的过滤器 + * + * @author yunze + */ +public class XssFilter implements Filter +{ + /** + * 排除链接 + */ + public List excludes = new ArrayList<>(); + + /** + * xss过滤开关 + */ + public boolean enabled = false; + + @Override + public void init(FilterConfig filterConfig) throws ServletException + { + String tempExcludes = filterConfig.getInitParameter("excludes"); + String tempEnabled = filterConfig.getInitParameter("enabled"); + if (StringUtils.isNotEmpty(tempExcludes)) + { + String[] url = tempExcludes.split(","); + for (int i = 0; url != null && i < url.length; i++) + { + excludes.add(url[i]); + } + } + if (StringUtils.isNotEmpty(tempEnabled)) + { + enabled = Boolean.valueOf(tempEnabled); + } + } + + @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) + { + if (!enabled) + { + return true; + } + if (excludes == null || excludes.isEmpty()) + { + return false; + } + String url = request.getServletPath(); + for (String pattern : excludes) + { + Pattern p = Pattern.compile("^" + pattern); + Matcher m = p.matcher(url); + if (m.find()) + { + return true; + } + } + return false; + } + + @Override + public void destroy() + { + + } +} \ No newline at end of file diff --git a/yunze-common/src/main/java/com/yunze/common/filter/XssHttpServletRequestWrapper.java b/yunze-common/src/main/java/com/yunze/common/filter/XssHttpServletRequestWrapper.java new file mode 100644 index 0000000..ca6b327 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/filter/XssHttpServletRequestWrapper.java @@ -0,0 +1,102 @@ +package com.yunze.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.yunze.common.utils.StringUtils; +import com.yunze.common.utils.html.EscapeUtil; + +/** + * XSS过滤处理 + * + * @author yunze + */ +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(); + final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8")); + return new ServletInputStream() + { + @Override + public boolean isFinished() + { + return true; + } + + @Override + public boolean isReady() + { + return true; + } + + @Override + public void setReadListener(ReadListener readListener) + { + } + + @Override + public int read() throws IOException + { + return bis.read(); + } + }; + } + + /** + * 是否是Json请求 + */ + 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/yunze-common/src/main/java/com/yunze/common/mapper/yunze/PollingMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/PollingMapper.java new file mode 100644 index 0000000..4fc3dc0 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/PollingMapper.java @@ -0,0 +1,21 @@ +package com.yunze.common.mapper.yunze; + +import java.util.List; +import java.util.Map; + +public interface PollingMapper { + + /** + * 查询总数 + * @param map + * @return + */ + public int MapCount(Map map); + + /** + *查询 + * @param map + * @return + */ + public List> getList(Map map); +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YrootlowHisMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YrootlowHisMapper.java new file mode 100644 index 0000000..43cfa07 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YrootlowHisMapper.java @@ -0,0 +1,33 @@ +package com.yunze.common.mapper.yunze; + +import java.util.List; +import java.util.Map; + +public interface YrootlowHisMapper { + + /** + * 查询所有 + * */ + public List> ListHis(Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public int selMapHis(Map map); + + public Map getById(Map map); + + /** + * 用量详情导出查询 + * */ + public List> exportFlowHis (Map map); + + + /** + * 用量详情导出 (同步导出 分组 、备注、发货时间)iccid + * */ + public List exportFlowHisIccid(Map map); + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzAgentPackageMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzAgentPackageMapper.java new file mode 100644 index 0000000..1ecbb8a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzAgentPackageMapper.java @@ -0,0 +1,77 @@ +package com.yunze.common.mapper.yunze; + + +import java.util.List; +import java.util.Map; + +/*** + * 资费组 数据层 + */ +public interface YzAgentPackageMapper { + + /** + *查询 + * @param map + * @return + */ + public List> selMap(Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public List selMapCount(Map map); + + + + /** + * 查询 package_id 是否存在 + * @param map + * @return + */ + public int isExist(Map map); + + + /** + * 新增资费组 + * @param map + * @return + */ + public int add(Map map); + + + /** + * 查询单条 资费组 + * @param map + * @return + */ + public List> find(Map map); + + + /** + * 修改 资费组信息 + * @param map + * @return + */ + public int update(Map map); + + + + /** + * 划分更新 + * @param map + * @return + */ + public int updatePackage(Map map); + + + /** + * 从 代理资费组 复制资费组到 代理 + * @param map + * @return + */ + public int addAgent(Map map); + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzAgentPacketMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzAgentPacketMapper.java new file mode 100644 index 0000000..cdd713e --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzAgentPacketMapper.java @@ -0,0 +1,114 @@ +package com.yunze.common.mapper.yunze; + + +import java.util.List; +import java.util.Map; + +/*** + * 资费计划 数据层 + */ +public interface YzAgentPacketMapper { + + + /** + *查询 + * @param map + * @return + */ + public List> selMap(Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public List selMapCount(Map map); + + + /** + * 条件查询获取资费组id + * @param map + * @return + */ + public List getPackage_id(Map map); + + + /** + * 查询 packet_id 是否存在 + * @param map + * @return + */ + public int isExist(Map map); + + + /** + * 新增 资费计划 + * @param map + * @return + */ + public int add(Map map); + + + /** + * 查询单条 资费计划 + * @param map + * @return + */ + public List> find(Map map); + + + /** + * 修改 资费计划 + * @param map + * @return + */ + public int update(Map map); + + + /** + * 查询 资费组简要信息 + * @param map + * @return + */ + public List> find_simple(Map map); + + + + /** + *查询 资费计划 划分信息 + * @param map + * @return + */ + public List> findPacket(Map map); + + + /** + *划卡 资费计划信息 修改 + * @param map + * @return + */ + public int updatePacket(Map map); + + + /** + * 查询 资费计划 设置时 已经设置好的 成本 售价 系数 + * @param map + * @return + */ + public List> findExistence(Map map); + + /** + * 从 集团客户 复制资费计划到 用户 + * @param map + * @return + */ + public int addAgent(Map map); + + /** + *查询资费计划信息 + * @param map + * @return + */ + public List> FindList(Map map); + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardFlowHisMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardFlowHisMapper.java new file mode 100644 index 0000000..4cc93cb --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardFlowHisMapper.java @@ -0,0 +1,51 @@ +package com.yunze.common.mapper.yunze; + + + + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * 资费用量历史记录表 数据层 + * @author root + */ +public interface YzCardFlowHisMapper +{ + + + /** + * 获取资费组简要信息 + * @param map + * @return + */ + public String total_flow(Map map); + + + /** + * 新增 + * @param map + * @return + */ + public int save(Map map); + + /** + * 编辑 + * @param map + * @return + */ + public int edit(Map map); + + /** + * 查询 是否存在 + * @param map + * @return + */ + public Integer isExist(Map map); + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardFlowMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardFlowMapper.java new file mode 100644 index 0000000..9af9a68 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardFlowMapper.java @@ -0,0 +1,219 @@ +package com.yunze.common.mapper.yunze; + + + + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * 资费用量记录表 数据层 + * + * @author root + */ +public interface YzCardFlowMapper +{ + /** + *查询套餐数据 + * @param map + * @return + */ + public List> queryflow(Map map); + + + /** + *查询套餐数据 代理表 + * @param map + * @return + */ + public List> queryflow_agent(Map map); + + + /** + * 查询当前套餐简要信息 + * @param map + * @return + */ + public HashMap queryflow_simple(Map map); + + + /** + * 获取资费组简要信息 + * @param map + * @return + */ + public List> queryPackage_simple(Map map); + + + + /** + * 获取 代理 资费组简要信息 + * @param map + * @return + */ + public List> queryAgentPackage_simple(Map map); + + + /** + * 查询当前套餐简要信息 代理 + * @param map + * @return + */ + public Map queryflowAgent_simple(Map map); + + + /** + * 卡板信息导出需要用到的套餐数据 + * @param map + * @return + */ + public List> outCardFlow(Map map); + + /** + *查询 生效中 未生效 资费计划 + * @param map + * @return + */ + public List> findInEffect(Map map); + + /** + * 查询 已失效 资费计划 + * @param map + * @return + */ + public String findInvalidationSumErrorFlow(Map map); + + /** + * 修改 资费计划用量 + * @param map + * @return + */ + public int updFlow(Map map); + + + /** + * 修改 时间到期资费计划 + * @param map + * @return + */ + public int updStatus(Map map); + + /** + * 查询卡号对应订单号是否已经存在 + * @param map + * @return + */ + public Integer findExistence(Map map); + + + /** + * 查询到期时间 + * @param map + * @return + */ + public String findEndTime(Map map); + + /** + * 插入flow + * @param map + * @return + */ + public int saveFlow(Map map); + + + /** + * 获取资费计划简要信息 + * @param map + * @return + */ + public List> queryPacket_simple(Map map); + + /** + *获取 代理 资费计划简要信息 + * @param map + * @return + */ + public List> queryAgentPacket_simple(Map map); + + + /** + * 获取 资费计划 信息 + * @param map + * @return + */ + public Map FindPacket(Map map); + + /** + * 获取 代理 资费计划 信息 + * @param map + * @return + */ + public Map FindPacketAgent(Map map); + + /** + * 获取 资费计划 简要 信息 + * @param map + * @return + */ + public Map FindPacket_concise(Map map); + + /** + * 获取 代理 资费计划 简要 信息 + * @param map + * @return + */ + public Map FindPacketAgent_concise(Map map); + + + /** + * 查询总数 订购资费查询 + * @param map + * @return + */ + public int MapCount(Map map); + + /** + *查询 订购资费查询 + * @param map + * @return + */ + public List> getList(Map map); + + + /** + * 查询资费计划类型 + * @param map + * @return + */ + public Map findPacketType(Map map); + + /** + * 同步时间查询 + */ + public List> sletume(Map map); + + /** + * 到期时间 + * */ + public List> sleTime(Map map); + + /** + * 订购资费导出查询 + * */ + public List> exportflow (Map map); + + /** + * 查询导出 + */ + public List> exportArr(Map map); + + /** + *查询失效的防超套系数 + * @param map + * @return + */ + public String FindError_time(Map map); +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardInfoChangeMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardInfoChangeMapper.java new file mode 100644 index 0000000..3ac5ad5 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardInfoChangeMapper.java @@ -0,0 +1,48 @@ +package com.yunze.common.mapper.yunze; + + +import java.util.List; +import java.util.Map; + +/** + * 卡状态变更记录表 + */ +public interface YzCardInfoChangeMapper { + + /** + * 查询 + * @param map + * @return + * @throws Exception + */ + public List> selMap(Map map); + + + /** + * 查询总数 + * @param map + * @return + * @throws Exception + */ + public int selMapCount(Map map); + + + + /** + * 新增 + * @param map + * @return + * @throws Exception + */ + public int save(Map map); + + + /** + * 新增 + * @param map + * @return + * @throws Exception + */ + public int addinfo(Map map); + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardIsStopMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardIsStopMapper.java new file mode 100644 index 0000000..a29fa3d --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardIsStopMapper.java @@ -0,0 +1,22 @@ +package com.yunze.common.mapper.yunze; + +import java.util.List; +import java.util.Map; + +public interface YzCardIsStopMapper { + + /** + * 50条查询 + * */ + public List> SleOrcount (Map map); + /** + * 成功的数据 + * */ + public List> SleOrderno (Map map); + + /** + * 新增 + * */ + public int AddStop(Map map); + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardMapper.java new file mode 100644 index 0000000..85ff87f --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardMapper.java @@ -0,0 +1,429 @@ +package com.yunze.common.mapper.yunze; + + +import java.util.List; +import java.util.Map; + + +/** + * 卡板信息 数据层 + * + * @author root + */ +public interface YzCardMapper +{ + /** + *查询 + * @param map + * @return + */ + public List> selMap(Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public Integer selMapCount(Map map); + + + /** + *查询 [切割iccid 19 位] + * @param map + * @return + */ + public List> selMapLianTong(Map map); + + /** + * 查询总数 [切割iccid 19 位] + * @param map + * @return + */ + public Integer selMapLianTongCount(Map map); + + + /** + * 查询单卡信息 + * @param map + * @return + */ + public Map find(Map map); + + /** + * 查询单条 卡板数据 数据 不关联 Route + * @param map + * @return + */ + public Map findNotRoute(Map map); + + + /** + * 导入卡板数据 + */ + public int importCard(Map map); + + + /** + * 查询单卡信息 + * @param map + * @return + */ + public List isExistence(Map map); + + + /** + * 查询目前最大自定义号码 + * @return + */ + public String findMaxVid(); + + + /** + * 查询 卡号 分配 通道 状态 + * @param map + * @return + */ + public Map findRoute(Map map); + + + + /** + *按当前赛选条件获取导出数据 + * @param map + * @return + */ + public List> outCard(Map map); + + + /** + *按当前赛选条件获取导出数据 [切割iccid 19 位] + * @param map + * @return + */ + public List> outCardLianTong(Map map); + + + /** + *按当前赛选条件获取导出数据 iccid + * @param map + * @return + */ + public List outCardIccid(Map map); + + + + /** + *按当前赛选条件获取导出数据 iccid [切割iccid 19 位] + * @param map + * @return + */ + public List outCardIccidLianTong(Map map); + + + /** + * 获取匹配筛选条件下的卡板id + * @param map + * @return + */ + public List selId(Map map); + + + + /** + * 获取匹配筛选条件下的卡板id iccid [切割iccid 19 位] + * @param map + * @return + */ + public List selIdLianTong(Map map); + + /** + * 卡所属划分 + * @param map + * @return + */ + public int dividCard(Map map); + + + /** + * 通道下 已有使用量的卡 且 剩余 用量>0 + * @param map + * @return + */ + public List> channelCardCommonly(Map map); + + /** + * 通道下 超出用量 和 暂未使用用量查询 Serious 超出用量的 , Slight 没用量的 + * @param map + * @return + */ + public List> channelCardSeriousAndSlight(Map map); + + + /** + * 获取某通道下大于百分之多少的 卡信息 percentage 0.8 = 80% + * @param map + * @return + */ + public List> findPercentage(Map map); + + + /** + * 修改 激活时间 + * @param map + * @return + */ + public int updActivate(Map map); + + + /** + * 激活时间为空得的 iccid + * @param map + * @return + */ + public List> activate_dateNull(Map map); + + + /** + * 修改卡状态 + * @param map + * @return + */ + public int updStatusId(Map map); + + /** + * 修改 批量 卡状态 + * @param map + * @return + */ + public int updStatusIdArr(Map map); + + + public int updction(Map map); + + /** + * 查询通道下 所属卡 + * @param map + * @return + */ + public List> findChannelIdCar(Map map); + + + /** + * 修改 卡用量 + * @param map + * @return + */ + public int updUsed(Map map); + + + /** + * 通道下 所属卡 设置达量停机的卡 + * @param map + * @return + */ + public List> findChannelIdCarStop(Map map); + + + /** + * 备份 卡所属关联 + * @return + */ + public List> BackupAssociate(); + + + /** + * 查询单卡激活时间 + * @param map + * @return + */ + public String findActivateDate(Map map); + + + /** + * yz_card_info 新增 剩余 + * @param map + * @return + */ + public int addInfoRemaining(Map map); + + /** + * 连接管理 设置时 备份 卡所属关联 + * @param map + * @return + */ + public List> SetBackupAssociate(Map map); + + + /** + * 连接管理设置 修改 + * @param map + * @return + */ + public int SetCard(Map map); + + + /** + * 修改 imei + * @param map + * @return + */ + public int updimei(Map map); + + + + + /** + * 查询 卡号 分配 通道 + * @param map + * @return + */ + public List> findRouteArr(Map map); + + /** + *月初有订购期内流量卡 进行 复机 + * */ + public List> StatusChange(Map map); + + + + /** + * 通道下 所属卡 设置 未订购资费断网 的卡 + * @param map + * @return + */ + public List> findChannelIdDisconnected(Map map); + + + /** + * 查询字典信息 + * @param map + * @return + */ + public List> findDict(Map map); + + /** + * 连接管理设置 修改 + * @param map + * @return + */ + public int updConnectionStatus(Map map); + + /** + * 查询使用降序查询时间 + * */ + public Map selTime(Map map); + + /** + * 新增 + * @param map + * @return + * @throws Exception + */ + public List> addsel(Map map); + + + + /** + * 查询 代理 所属卡 + * @param map + * @return + */ + public List findBelongingCard(Map map); + + + /** + * 修改 分组 备注 + * @param map + * @return + */ + public List> findGroupingAndRemarks(Map map); + + + /** + * 修改分组 备注 + * @param map + * @return + */ + public int updGroupingAndRemarks(Map map); + + + /** + * 查询 代理下 卡号 + * @param map + * @return + */ + public List findAgentIccid(Map map); + + + + + /** + * 查询下级代理商 返回 格式 1,2 + * @param map + * @return + */ + public String queryChildrenAreaInfo(Map map); + + + /** + * 获取 所属代理下 卡分组 + * @param map + * @return + */ + public List getCardGrouping(Map map); + + + /** + * 查询 销售 合伙人 + * @param map + * @return + */ + public List> findSalesPartner(Map map); + + /** + * C端充值 轮询 卡状态变更失败的 进行再次 复机;(前提是没用完用量) + * */ + public List> SleMulti (Map map); + + /** + * 划卡回滚 + * @param map + * @return + */ + public int dividCardBk(Map map); + + + + /** + * 修改 备注 分组 + */ + public int UpdateFill(Map map); + + /** + * 同步时间 + */ + public int updDueExpireTime(Map map); + + + /** + * 用量详情导出 (同步导出 分组 、备注、发货时间) + * */ + public List> hisList (Map map); + + + + +} + + + + + + + + + + + + + diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardPackageMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardPackageMapper.java new file mode 100644 index 0000000..940365a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardPackageMapper.java @@ -0,0 +1,63 @@ +package com.yunze.common.mapper.yunze; + + +import java.util.List; +import java.util.Map; + +/*** + * 资费组 数据层 + */ +public interface YzCardPackageMapper { + + /** + *查询 + * @param map + * @return + */ + public List> selMap(Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public List selMapCount(Map map); + + + + /** + * 查询 package_id 是否存在 + * @param map + * @return + */ + public int isExist(Map map); + + + /** + * 新增资费组 + * @param map + * @return + */ + public int add(Map map); + + + /** + * 查询 资费组 + * @param map + * @return + */ + public List> find(Map map); + + + + + + + /** + * 修改 资费组信息 + * @param map + * @return + */ + public int update(Map map); + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardPacketMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardPacketMapper.java new file mode 100644 index 0000000..2653918 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCardPacketMapper.java @@ -0,0 +1,83 @@ +package com.yunze.common.mapper.yunze; + + +import java.util.List; +import java.util.Map; + +/*** + * 资费计划 数据层 + */ +public interface YzCardPacketMapper { + + + /** + *查询 + * @param map + * @return + */ + public List> selMap(Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public List selMapCount(Map map); + + + /** + * 条件查询获取资费组id + * @param map + * @return + */ + public List getPackage_id(Map map); + + + /** + * 查询 packet_id 是否存在 + * @param map + * @return + */ + public int isExist(Map map); + + + /** + * 新增 资费计划 + * @param map + * @return + */ + public int add(Map map); + + + /** + * 查询单条 资费计划 + * @param map + * @return + */ + public List> find(Map map); + + + /** + * 修改 资费计划 + * @param map + * @return + */ + public int update(Map map); + + + /** + *查询 平台资费计划 划分信息 + * @param map + * @return + */ + public List> findPacket(Map map); + + + + /** + *查询资费计划信息 + * @param map + * @return + */ + public List> FindList(Map map); +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCategoryMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCategoryMapper.java new file mode 100644 index 0000000..226a5c6 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCategoryMapper.java @@ -0,0 +1,20 @@ +package com.yunze.common.mapper.yunze; + +import java.util.List; +import java.util.Map; + +public interface YzCategoryMapper { + + /** + * 查询所有 + * */ + public List> CategoryList(Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public int selMapCount(Map map); + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCcHisMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCcHisMapper.java new file mode 100644 index 0000000..5c0fa42 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCcHisMapper.java @@ -0,0 +1,18 @@ +package com.yunze.common.mapper.yunze; + +import java.util.List; +import java.util.Map; + +public interface YzCcHisMapper { + /** + * 查询所有 + * */ + public List> ListCcHis(Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public int selMapCount(Map map); +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCcMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCcMapper.java new file mode 100644 index 0000000..c00a5e4 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCcMapper.java @@ -0,0 +1,32 @@ +package com.yunze.common.mapper.yunze; + +import java.util.List; +import java.util.Map; + +public interface YzCcMapper { + + + /** + * 查询所有 + * */ + public List> ListCc(Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public int selMapCount(Map map); + + public int CcAdd(Map map); + + /** + * 查询 对应自动化规则表 名字 自动化管理抄送名字 + */ + public List> NameAdd(); + /** + * 修改 + * */ + public int UpdateCc(Map map); + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCcUrlMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCcUrlMapper.java new file mode 100644 index 0000000..91b68fe --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzCcUrlMapper.java @@ -0,0 +1,32 @@ +package com.yunze.common.mapper.yunze; + +import com.yunze.common.core.domain.entity.SysDictData; + +import java.util.List; +import java.util.Map; + +public interface YzCcUrlMapper { + + /** + * 查询所有 + * */ + public List> ListCcUrl (Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public int selMapCount(Map map); + + + public int insertCcUrl(Map map); + + public int updateCcUrl(Map map); + + public int DeleteCcUrl(Map map); + + public Integer CountId(Map map); + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzExecutionTaskMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzExecutionTaskMapper.java new file mode 100644 index 0000000..c0d756f --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzExecutionTaskMapper.java @@ -0,0 +1,59 @@ +package com.yunze.common.mapper.yunze; + + +import java.util.List; +import java.util.Map; + +/** + * 执行 任务 表格 + */ +public interface YzExecutionTaskMapper { + + + /** + * 查询 + * + * @param map + * @return + * @throws Exception + */ + List> sel_Map(Map map); + + + /** + * 查询总数 + * + * @param map + * @return + * @throws Exception + */ + public int sel_Map_Count(Map map); + + + /** + * 新增任务 + * + * @param map + * @return + */ + public int add(Map map); + + /** + * 修改任务结束时间 + * + * @param map + * @return + */ + public int set_end_time(Map map); + + + /** + * 修改 地址 + * + * @param map + * @return + */ + public int upd(Map map); + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzInfoChangeMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzInfoChangeMapper.java new file mode 100644 index 0000000..3bedc93 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzInfoChangeMapper.java @@ -0,0 +1,23 @@ +package com.yunze.common.mapper.yunze; + +import java.util.List; +import java.util.Map; + +public interface YzInfoChangeMapper { + + /** + * 查询所有 + * */ + public List> ListInfo(Map map); + /** + * 查询总数 + * @param map + * @return + */ + public int selMapCount(Map map); + + /** + * 时间降序查询 + * */ + public List> selTime(Map map); +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzOrderMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzOrderMapper.java new file mode 100644 index 0000000..7a33ee2 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzOrderMapper.java @@ -0,0 +1,111 @@ +package com.yunze.common.mapper.yunze; + +import java.util.List; +import java.util.Map; + +/** + * 订单 数据层 + * + * @author yunze + */ +public interface YzOrderMapper { + + /** + * 获取执行的加包订单 去生产任务 + * + * @return + */ + public List> findAddPackage(Map map); + + + /** + * 查询 + * + * @param map + * @return + */ + public List> selMap(Map map); + + /** + * 查询总数 + * + * @param map + * @return + */ + public Integer selMapCount(Map map); + + + /** + * 修改已经加包的订单 加包状态 + * + * @param map + * @return + */ + public int updAddPackage(Map map); + + + /** + * 自动 修改已经加包的订单加包状态 + * + * @return + */ + public int updAutomatic(); + + public int updActivate(Map map); + + + /** + * 修改 加包执行状态 + * + * @param map + * @return + */ + public int updAddPackageInfo(Map map); + + + /** + * 查询订单加包参数 + * + * @param map + * @return + */ + public Map findOrder(Map map); + + + /** + * 批量插入订单 + * + * @param map + * @return + */ + public int importOrder(Map map); + + + /** + * 新增单条订单 + * + * @param map + * @return + */ + public int save(Map map); + + + /** + * 购物插入订单 + * + * @param map + * @return + */ + public int ShoppingSave(Map map); + + + /** + * 导出 + */ + public List> exportallorders(Map map); + + public List> arrorders(Map map); + + +} + diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzPassagewayPollingMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzPassagewayPollingMapper.java new file mode 100644 index 0000000..7ab066b --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzPassagewayPollingMapper.java @@ -0,0 +1,53 @@ +package com.yunze.common.mapper.yunze; + + +import java.util.List; +import java.util.Map; + +/** + * 通道轮序详情表 + */ +public interface YzPassagewayPollingMapper { + + /** + * 查询 + * @param map + * @return + * @throws Exception + */ + List> selMap(Map map); + + + /** + * 查询总数 + * @param map + * @return + * @throws Exception + */ + public int selMapCount(Map map); + + + /** + * 新增 轮序详情 + * @param map + * @return + */ + public int add(Map map); + + /** + * 修改当前轮序 数量 + * @param map + * @return + */ + public int update_cd_current(Map map); + + + /** + *查询 近三天 正在执行的轮序任务 + * @return + */ + public List> find_execute(); + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzSysLogsMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzSysLogsMapper.java new file mode 100644 index 0000000..5b1a659 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzSysLogsMapper.java @@ -0,0 +1,63 @@ +package com.yunze.common.mapper.yunze; + +import org.yaml.snakeyaml.events.Event; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public interface YzSysLogsMapper { + + /** + * 查询所有 + * */ + public List> Listwhole(); + + /** + * 备份删除 + * */ + public int deleteById(Map map); + + /** + *查询 + * @param map + * @return + */ + public List> selMap(Map map); + + /** + * 查询总数 + * @param map + * @return + */ + public int selMapCount(Map map); + + /** + * 通过id查询 + * request_args + * response_args + * + * @param map*/ + public Map getById(Map map); + + + + + +} + + + + + + + + + + + + + + + + diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzUserMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzUserMapper.java new file mode 100644 index 0000000..e2d18ec --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/YzUserMapper.java @@ -0,0 +1,46 @@ +package com.yunze.common.mapper.yunze; + + +import java.util.List; +import java.util.Map; + +/** + * 系统用户 集团用户用 + */ +public interface YzUserMapper { + + /** + * 查询 + * @param map + * @return + * @throws Exception + */ + public List> selMap(Map map); + + + /** + * 查询总数 + * @param map + * @return + * @throws Exception + */ + public int selMapCount(Map map); + + + /** + * 获取用户 权限过滤 + * @param map + * @return + */ + public List getUserID(Map map); + + + /** + * 获取部门id + * @param map 权限过滤 + * @return + */ + public List getDeptID(Map map); + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/automationCC/YzAutomationCcHisMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/automationCC/YzAutomationCcHisMapper.java new file mode 100644 index 0000000..9048c27 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/automationCC/YzAutomationCcHisMapper.java @@ -0,0 +1,38 @@ +package com.yunze.common.mapper.yunze.automationCC; + + +import java.util.List; +import java.util.Map; + +/** + * 自动化 推送记录 + */ +public interface YzAutomationCcHisMapper { + + + + /** + * 新增 + * @return + */ + public int save(Map map); + + + /** + * 修改抄送记录 + * @param map + * @return + */ + public int updCcCount(Map map); + + + /** + * 获取未抄送成功的数据进行抄送 + * @param map + * @return + */ + public List> findNotPerformed(Map map); + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/automationCC/YzAutomationCcMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/automationCC/YzAutomationCcMapper.java new file mode 100644 index 0000000..e878aad --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/automationCC/YzAutomationCcMapper.java @@ -0,0 +1,22 @@ +package com.yunze.common.mapper.yunze.automationCC; + + +import java.util.List; +import java.util.Map; + +/** + * 自动化 推送记录 + */ +public interface YzAutomationCcMapper { + + + + /** + * 查询 自动化抄送 + * @return + */ + public List> findConcise(Map map); + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/automationCC/YzAutomationCcUrlMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/automationCC/YzAutomationCcUrlMapper.java new file mode 100644 index 0000000..cb9758a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/automationCC/YzAutomationCcUrlMapper.java @@ -0,0 +1,22 @@ +package com.yunze.common.mapper.yunze.automationCC; + + +import java.util.List; +import java.util.Map; + +/** + * 自动化 触发任务推送地址邮箱配置 + */ +public interface YzAutomationCcUrlMapper { + + + + /** + * 查询 触发任务推送地址邮箱配置 + * @return + */ + public List> findConcise(Map map); + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/mapper/yunze/commodity/YzWxByProductAgentMapper.java b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/commodity/YzWxByProductAgentMapper.java new file mode 100644 index 0000000..b0d401b --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/mapper/yunze/commodity/YzWxByProductAgentMapper.java @@ -0,0 +1,58 @@ +package com.yunze.common.mapper.yunze.commodity; + + +import java.util.List; +import java.util.Map; + +/** + * 商品购买代理关联表 信息 + */ +public interface YzWxByProductAgentMapper { + + + /** + * 获取 商品购买代理关联 + * @return + */ + public List> findConcise(Map map); + + + /** + * 查询运费配置 + * @return + */ + public String findByCardFare(); + + + /** + * 查询系统配置 + * @param map + * @return + */ + public String findConfig(Map map); + + + /** + * 查询 商品代理 + * @param map + * @return + */ + public List> getDepIDArr(Map map); + + + + + /** + * 新增商品代理 + * @param map + * @return + */ + public int save(Map map); + + /** + * 删除商品代理表 + * @param map + * @return + */ + public int delPAgent(); +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/Arith.java b/yunze-common/src/main/java/com/yunze/common/utils/Arith.java new file mode 100644 index 0000000..f8fbbcf --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/Arith.java @@ -0,0 +1,114 @@ +package com.yunze.common.utils; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * 精确的浮点数运算 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/utils/DateUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/DateUtils.java new file mode 100644 index 0000000..18fa7bb --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/DateUtils.java @@ -0,0 +1,155 @@ +package com.yunze.common.utils; + +import java.lang.management.ManagementFactory; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import org.apache.commons.lang3.time.DateFormatUtils; + +/** + * 时间工具类 + * + * @author yunze + */ +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 dateTime() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyyMMdd"); + } + + /** + * 日期型字符串转化为日期 格式 + */ + 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 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 + "分钟"; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/DictUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/DictUtils.java new file mode 100644 index 0000000..d79408d --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/DictUtils.java @@ -0,0 +1,183 @@ +package com.yunze.common.utils; + +import java.util.Collection; +import java.util.List; +import com.yunze.common.constant.Constants; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.utils.spring.SpringUtils; + +/** + * 字典工具类 + * + * @author yunze + */ +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) + { + Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); + if (StringUtils.isNotNull(cacheObj)) + { + List dictDatas = StringUtils.cast(cacheObj); + return dictDatas; + } + 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.containsAny(separator, dictValue) && StringUtils.isNotEmpty(datas)) + { + for (SysDictData dict : datas) + { + for (String value : dictValue.split(separator)) + { + if (value.equals(dict.getDictValue())) + { + propertyString.append(dict.getDictLabel() + separator); + break; + } + } + } + } + else + { + for (SysDictData dict : datas) + { + if (dictValue.equals(dict.getDictValue())) + { + return dict.getDictLabel(); + } + } + } + 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() + separator); + break; + } + } + } + } + else + { + for (SysDictData dict : datas) + { + if (dictLabel.equals(dict.getDictLabel())) + { + return dict.getDictValue(); + } + } + } + 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(Constants.SYS_DICT_KEY + "*"); + SpringUtils.getBean(RedisCache.class).deleteObject(keys); + } + + /** + * 设置cache key + * + * @param configKey 参数键 + * @return 缓存键key + */ + public static String getCacheKey(String configKey) + { + return Constants.SYS_DICT_KEY + configKey; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/Email/EmailCc.java b/yunze-common/src/main/java/com/yunze/common/utils/Email/EmailCc.java new file mode 100644 index 0000000..c91fddd --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/Email/EmailCc.java @@ -0,0 +1,78 @@ +package com.yunze.common.utils.Email; + +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.automationCC.YzAutomationCcMapper; +import com.yunze.common.mapper.yunze.commodity.YzWxByProductAgentMapper; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 邮件抄送 + * @Auther: zhang feng + * @Date: 2021/09/26/14:16 + * @Description: + */ +@Component +public class EmailCc { + @Resource + private YzWxByProductAgentMapper yzWxByProductAgentMapper; + @Resource + private RedisCache redisCache; + //findConfig + + + + /** + * 下单发货通知 抄送 默认模板 + * @param CCMap + * @return + */ + public Map ShoppingDelivery_default(Map CCMap,String SendEmail) { + String userName = "",password = ""; + Map userNameMap = new HashMap<>(); + Map passwordMap = new HashMap<>(userNameMap); + Object Email = redisCache.getCacheObject("ccConfig.Email"); + Object EmailPwd = redisCache.getCacheObject("ccConfig.EmailPwd"); + if(Email!=null && Email.toString().length()>0){ + userName = Email.toString(); + }else{ + userNameMap.put("config_key","yunze.ccConfig.Email"); + userName = yzWxByProductAgentMapper.findConfig(userNameMap); + redisCache.setCacheObject("ccConfig.Email",userName,6,TimeUnit.HOURS);//6 小时 缓存 + } + if(EmailPwd!=null && EmailPwd.toString().length()>0){ + password = EmailPwd.toString(); + }else{ + passwordMap.put("config_key","yunze.ccConfig.EmailPwd"); + password = yzWxByProductAgentMapper.findConfig(passwordMap); + redisCache.setCacheObject("ccConfig.EmailPwd",password,6,TimeUnit.HOURS);//6 小时 缓存 + } + Map rmap = new HashMap(); + boolean bool = true; + String info = CCMap.get("info")!=null?CCMap.get("info").toString():""; + Map Text = EmailSend.Shopping_text(CCMap.get("ord_no").toString(),CCMap.get("create_time").toString(),CCMap.get("shipping_Phone").toString(), + CCMap.get("shipping_user").toString(),CCMap.get("province").toString(),CCMap.get("city").toString(),CCMap.get("district").toString(), + CCMap.get("address").toString(),CCMap.get("by_count").toString(),CCMap.get("product_name").toString(),info); + + try { + MimeMessageDTO mimeDTO = new MimeMessageDTO(); + mimeDTO.setSentDate(new Date()); + mimeDTO.setSubject("您有新的发货订单"); + mimeDTO.setText(Text.get("template").toString()); + bool = MailUtil.sendEmail(userName, password, SendEmail, mimeDTO); + }catch(Exception e) { + System.out.println("ShoppingDelivery_default 异常 "+e.getMessage()); + bool=false; + } + rmap.put("bool", bool); + return rmap; + } + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/Email/EmailSend.java b/yunze-common/src/main/java/com/yunze/common/utils/Email/EmailSend.java new file mode 100644 index 0000000..26c6436 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/Email/EmailSend.java @@ -0,0 +1,176 @@ +package com.yunze.common.utils.Email; + +import java.text.MessageFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + + +/** + * + * @ClassName: EmailSend + * @Description: TODO(邮件抄送类) + * @author zhangfeng + * @date 2018年8月28日 + */ +public class EmailSend { + + private static String userName = "zhangfeng@5iot.cn"; // 用户邮箱地址 + private static String password = "root@_123321"; // 密码或者授权码 + /** + * 发送注册邮件验证码 + * @param USER_NAME + * @param Email + * @return + */ + public static Map EmailVerification(String USER_NAME,String Email) { + Map rmap = new HashMap(); + boolean bool=true; + Map Text =GetEmailVFText(USER_NAME, Email); + try { + MimeMessageDTO mimeDTO = new MimeMessageDTO(); + mimeDTO.setSentDate(new Date()); + mimeDTO.setSubject("验证您的电子邮箱地址"); + mimeDTO.setText(Text.get("template").toString()); + bool=MailUtil.sendEmail(userName, password, Email, mimeDTO); + }catch(Exception e) { + bool=false; + } + rmap.put("bool", bool); + rmap.put("random", Text.get("random")); + return rmap; + } + + + + + + + + /** + * 获取注册时的邮件内容 + * @param USER_NAME 收件人姓名 + * @param Email 收件人邮箱 + * @return + */ + public static Map GetEmailVFText(String USER_NAME,String Email) { + Map rmap = new HashMap(); + String random=(int)((Math.random()*9+1)*100000)+""; + rmap.put("random", random); + String template="" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + "
" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + "
Billie"+USER_NAME+"
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "

验证您是该电子邮件地址的所有者

" + + "

" + + " "+Email+"" + + "

" + + "
" + + "
" + + "
" + + "

验证该邮箱的目的是为了更好的为您服务。

" + + "

您可以使用此验证码来验证您是该电子邮件地址的所有者。

" + + "
"+random+"
" + + "

如果这不是您本人所为,则可能是有人误输了您的电子邮件地址。请勿将此验证码泄露给他人,并且您目前无需执行任何其它操作。

" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
我们向您发送这封电子邮件,目的是让您了激活您的报名 帐号。
" + + "
" + + "
" + + "
"; + rmap.put("template", template); + return rmap; + + } + + + + + + + public static Map Shopping_text(String ord_no,String createTime,String shipping_Phone,String shipping_user,String province,String city,String district,String address,String by_count,String product_name,String info) { + Map rmap = new HashMap(); + String template = ""; + String text ="

您有新的待发货订单

[{0}]

下单时间:[{1}]

商品名:[{2}]

下单数量:[{3}]

收件人姓名:[{4}]

收件人联系电话:[{5}]

收件人地址:[{6}]-[{7}]-[{8}]({9})

订单备注:[{10}]

如果这不是您本人所为,则可能是有人误输了您的电子邮件地址。请勿将此订单信息泄露给他人,并且您目前无需执行任何其它操作。

"; + template = MessageFormat.format(text,ord_no,createTime,product_name,by_count,shipping_user,shipping_Phone,province,city,district,address,info); + rmap.put("template", template); + return rmap; + + } + + + public static void main(String[] args) { + Map rmap = new HashMap(); + boolean bool=true; + Map Text =Shopping_text("2021092401474568010317", "2021-09-24 13:48:04", "Mifi", "1", + "张锋", "18660430320", "山东省", "济南市", "历下区", "山钢新天地九号楼513", "尽快发货!"); + try { + MimeMessageDTO mimeDTO = new MimeMessageDTO(); + mimeDTO.setSentDate(new Date()); + mimeDTO.setSubject("您有新的发货订单"); + mimeDTO.setText(Text.get("template").toString()); + bool=MailUtil.sendEmail(userName, password, "546558392@qq.com", mimeDTO); + }catch(Exception e) { + bool=false; + } + rmap.put("bool", bool); + System.out.println(rmap); + } + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/Email/MailUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/Email/MailUtil.java new file mode 100644 index 0000000..e51e4fb --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/Email/MailUtil.java @@ -0,0 +1,257 @@ +package com.yunze.common.utils.Email; + +import java.util.List; +import java.util.Properties; + +import javax.activation.DataHandler; +import javax.activation.FileDataSource; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Multipart; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; + +import com.yunze.common.utils.Email.MimeMessageDTO; + +/** + * + * @ClassName: MailUtil + * @Description: TODO 邮件发送例子 + * @author zhangfeng + * @date 2018年8月28日 + */ +public class MailUtil { + + /** + * 变量名 userName: TODO 邮箱用户名 + */ + private String userName; + + /** + * 变量名 password: TODO 邮箱地址 + */ + private String password; + + /** + * 变量名 smtpHost: TODO 邮箱smtp地址,发送地址 + */ + private String smtpHost; + + /** + * 变量名 targetAddress: TODO 目标邮箱地址 + */ + private String targetAddress; + + /** + * 发送单邮件 + * @param userName + * @param password + * @param targetAddress + * @param mimeDTO + * @return + */ + public static boolean sendEmail(String userName,String password,String targetAddress, + MimeMessageDTO mimeDTO){ + return publicsendEmail(userName,password,targetAddress,mimeDTO,false,null); + } + /** + * 发送单邮件(附件) + * @param userName + * @param password + * @param targetAddress + * @param mimeDTO + * @param filepath 文件本地绝对路径 + * @return + */ + public static boolean sendEmailByFile(String userName,String password,String targetAddress, + MimeMessageDTO mimeDTO,List filepath){ + return publicsendEmail(userName,password,targetAddress,mimeDTO,true,filepath); + } + /** + * 群发邮件 + * @param userName + * @param password + * @param targetAddress 多个邮件发送地址,以,分隔 + * @param mimeDTO + * @return + */ + public static boolean sendGroupEmail(String userName,String password,String targetAddress, + MimeMessageDTO mimeDTO){ + return publicsendEmail(userName,password,targetAddress,mimeDTO,true,null); + } + /** + * 群发邮件 (附件) + * @param userName + * @param password + * @param targetAddress 多个邮件发送地址,以,分隔 + * @param mimeDTO + * @param filepath 文件本地绝对路径 + * @return + */ + public static boolean sendGroupEmailByFile(String userName,String password,String targetAddress, + MimeMessageDTO mimeDTO,List filepath){ + return publicsendEmail(userName,password,targetAddress,mimeDTO,true,filepath); + } + + + + /** + * 邮件发送基础方法 + * @param userName + * @param password + * @param targetAddress + * @param mimeDTO + * @param isGroup + * @param filepath + * @return + */ + private static boolean publicsendEmail(String userName,String password,String targetAddress, + MimeMessageDTO mimeDTO,boolean isGroup,List filepath){ + Properties props = makeMailProperties(userName); + String hostname=SMTPUtil.SimpleMailSender(userName); + Session session = Session.getInstance(props, new PopupAuthenticator(userName, password)); + session.setDebug(true); + try { + Transport ts = session.getTransport(); + ts.connect(hostname,userName,password); + Message message =!isGroup?createEmail(session,userName,targetAddress,mimeDTO) + :createEmailByGroupAndFile(session,userName, + targetAddress,mimeDTO,filepath==null?null:filepath); + ts.sendMessage(message,message.getAllRecipients()); + ts.close(); + } catch (Exception mex) { + mex.printStackTrace(); + return false; + } + return true; + } + + + + + + /** + * 创建邮件信息 + * @param userName + * @return + */ + private static Properties makeMailProperties(String userName){ + Properties props = new Properties(); + String hostname=SMTPUtil.SimpleMailSender(userName); + props.put("mail.smtp.host", hostname); + props.setProperty("mail.smtp.auth", "true"); + props.setProperty("mail.transport.protocol", "smtp"); + if(hostname.indexOf(".qq.com")!=-1){ + props.setProperty("mail.smtp.socketFactory.port", "465"); + props.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + } + return props; + } + + + + /** + * 创建邮件 + * @Author Casper + * Create_time:2015年10月17日 下午7:45:57 + * description: + */ + private static Message createEmail(Session session,String userName,String regMail,MimeMessageDTO mimeDTO){ + MimeMessage message = new MimeMessage(session); + try { + message.setFrom(new InternetAddress(userName)); + message.setRecipient(Message.RecipientType.TO, new InternetAddress(regMail)); + message.setSubject(mimeDTO.getSubject()); + message.setContent(mimeDTO.getText(),"text/html;charset=UTF-8"); + message.saveChanges(); + } catch (MessagingException e) { + e.printStackTrace(); + } + return message; + } + /** + * 创建群发带附件 + * @return + */ + private static Message createEmailByGroupAndFile(Session session,String userName, + String regMail,MimeMessageDTO mimeDTO,List filepath){ + MimeMessage message = new MimeMessage(session); + try { + message.setFrom(new InternetAddress(userName)); + // 创建收件人列表 + if (regMail != null && regMail.trim().length() > 0) { + String[] arr = regMail.split(","); + int receiverCount = arr.length; + if (receiverCount > 0) { + InternetAddress[] address = new InternetAddress[receiverCount]; + for (int i = 0; i < receiverCount; i++) { + address[i] = new InternetAddress(arr[i]); + } + message.setRecipients(Message.RecipientType.TO, address); + } + } + // 后面的BodyPart将加入到此处创建的Multipart中 + Multipart mp = new MimeMultipart(); + // 附件操作 + if (filepath != null && filepath.size() > 0) { + for (String filename : filepath) { + MimeBodyPart mbp = new MimeBodyPart(); + // 得到数据源 + FileDataSource fds = new FileDataSource(filename); + // 得到附件本身并至入BodyPart + mbp.setDataHandler(new DataHandler(fds)); + // 得到文件名同样至入BodyPart + mbp.setFileName(fds.getName()); + mp.addBodyPart(mbp); + } + MimeBodyPart mbp = new MimeBodyPart(); + mbp.setText(mimeDTO.getText()); + mp.addBodyPart(mbp); + // 移走集合中的所有元素 + filepath.clear(); + // Multipart加入到信件 + message.setContent(mp); + } else { + // 设置邮件正文 +// message.setText(mimeDTO.getText()); + message.setContent(mimeDTO.getText(),"text/html;charset=UTF-8"); + } + message.setSubject(mimeDTO.getSubject()); + message.saveChanges(); + } catch (MessagingException e) { + e.printStackTrace(); + } + return message; + } + + + + 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 getSmtpHost() { + return smtpHost; + } + public void setSmtpHost(String smtpHost) { + this.smtpHost = smtpHost; + } + public String getTargetAddress() { + return targetAddress; + } + public void setTargetAddress(String targetAddress) { + this.targetAddress = targetAddress; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/Email/MimeMessageDTO.java b/yunze-common/src/main/java/com/yunze/common/utils/Email/MimeMessageDTO.java new file mode 100644 index 0000000..43d9127 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/Email/MimeMessageDTO.java @@ -0,0 +1,77 @@ +package com.yunze.common.utils.Email; + +import java.util.Date; + + +/** + * + * @ClassName: MimeMessageDTO + * @Description: TODO(这里用一句话描述这个类的作用) + * @author zhangfeng + * @date 2018年8月28日 + */ +public class MimeMessageDTO { + /** + * 变量名 subject: TODO 邮件标题 + */ + private String subject; + + /** + * 变量名 sentDate: TODO 邮件日期 + */ + private Date sentDate; + + /** + * 变量名 text: TODO 邮件内容 + */ + private String text; + + /** + * 方法名: initMimeMessage + * 功能描述: TODO 初始化 + * @param: @param subject + * @param: @param date + * @param: @param text + * @param: @return + * @return: MimeMessageDTO + */ + public MimeMessageDTO initMimeMessage(String subject, Date date, String text) { + return new MimeMessageDTO(subject, date, text); + } + + public MimeMessageDTO() { + super(); + } + + public MimeMessageDTO(String subject, Date sentDate, String text) { + super(); + this.subject = subject; + this.sentDate = sentDate; + this.text = text; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public Date getSentDate() { + return sentDate; + } + + public void setSentDate(Date sentDate) { + this.sentDate = sentDate; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/Email/PopupAuthenticator.java b/yunze-common/src/main/java/com/yunze/common/utils/Email/PopupAuthenticator.java new file mode 100644 index 0000000..3693020 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/Email/PopupAuthenticator.java @@ -0,0 +1,24 @@ +package com.yunze.common.utils.Email; + +import javax.mail.Authenticator; +import javax.mail.PasswordAuthentication; + +/** + * 类名称: PopupAuthenticator + * 功能描述: TODO + * 创建人: GavinNie 邮件 账号 密码 + * 创建时间: 2014-12-4 上午11:07:10 + * @version V1.0 + */ +public class PopupAuthenticator extends Authenticator { + private String username = null; + private String password = null; + + public PopupAuthenticator(String user, String pass) { + this.username = user; + this.password = pass; + } + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/Email/SMTPUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/Email/SMTPUtil.java new file mode 100644 index 0000000..8c75893 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/Email/SMTPUtil.java @@ -0,0 +1,72 @@ +package com.yunze.common.utils.Email; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +/** + * + * @ClassName: SMTPUtil + * @Description: TODO 得到smtp + * @author zhangfeng + * @date 2018年8月28日 + */ +public class SMTPUtil { + /** + * 方法名: SimpleMailSender + * 功能描述: TODO 简单的smtp生成,大部分是有用的,建议自己建立smtp库.... + * @param: @param userName + * @param: @return + * @return: String + */ + public static String SimpleMailSender(String userName) { + return "smtp.exmail.qq.com"; + //return "smtp." + getHost(userName); + } + + + /** + * @Title: getSMTPAddress + * @Description: TODO (这里用一句话描述这个方法的作用) + * @param @param userName + * @param @return 设定文件 + * @return String 返回类型 + * @throws + */ + public static String getSMTPAddress(String userName){ + String smtpAddress = null; + Properties props = new Properties(); + try { + InputStream in = SMTPUtil.class.getResourceAsStream("/smtp.properties"); + props.load(in); + //读取properties的内容 + smtpAddress = props.getProperty(getHost(userName).trim()); + //没有获取到 + if(smtpAddress == null){ + //生成简单得 + smtpAddress = SimpleMailSender(userName); + } + } catch (IOException e) { + e.printStackTrace(); + } + return smtpAddress; + } + + + /** + * @Title: getHost + * @Description: TODO 得到 邮箱@后面得字符 + * @param @param userName + * @param @return 设定文件 + * @return String 返回类型 + * @throws + */ + public static String getHost(String userName){ + return userName.split("@")[1]; + } + +// public static void main(String[] args) { +// String s = getSMTPAddress("nie_zw@qq.com"); +// System.out.println(s); +// } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/ExceptionUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/ExceptionUtil.java new file mode 100644 index 0000000..5b5f73a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/ExceptionUtil.java @@ -0,0 +1,40 @@ +package com.yunze.common.utils; + +import java.io.PrintWriter; +import java.io.StringWriter; +import org.apache.commons.lang3.exception.ExceptionUtils; + +/** + * 错误信息处理类。 + * + * @author yunze + */ +public class ExceptionUtil +{ + /** + * 获取exception的详细错误信息。 + */ + public static String getExceptionMessage(Throwable e) + { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + return str; + } + + 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/yunze-common/src/main/java/com/yunze/common/utils/LogUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/LogUtils.java new file mode 100644 index 0000000..3b55de9 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/LogUtils.java @@ -0,0 +1,18 @@ +package com.yunze.common.utils; + +/** + * 处理并记录日志文件 + * + * @author yunze + */ +public class LogUtils +{ + public static String getBlock(Object msg) + { + if (msg == null) + { + msg = ""; + } + return "[" + msg.toString() + "]"; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/MessageUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/MessageUtils.java new file mode 100644 index 0000000..ce59afd --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/MessageUtils.java @@ -0,0 +1,26 @@ +package com.yunze.common.utils; + +import org.springframework.context.MessageSource; +import org.springframework.context.i18n.LocaleContextHolder; +import com.yunze.common.utils.spring.SpringUtils; + +/** + * 获取i18n资源文件 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/utils/SecurityUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/SecurityUtils.java new file mode 100644 index 0000000..b91e92a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/SecurityUtils.java @@ -0,0 +1,90 @@ +package com.yunze.common.utils; + +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import com.yunze.common.constant.HttpStatus; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.exception.CustomException; + +/** + * 安全服务工具类 + * + * @author yunze + */ +public class SecurityUtils +{ + /** + * 获取用户账户 + **/ + public static String getUsername() + { + try + { + return getLoginUser().getUsername(); + } + catch (Exception e) + { + throw new CustomException("获取用户账户异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户 + **/ + public static LoginUser getLoginUser() + { + try + { + return (LoginUser) getAuthentication().getPrincipal(); + } + catch (Exception e) + { + throw new CustomException("获取用户信息异常", 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/yunze-common/src/main/java/com/yunze/common/utils/ServletUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/ServletUtils.java new file mode 100644 index 0000000..d0ff910 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/ServletUtils.java @@ -0,0 +1,136 @@ +package com.yunze.common.utils; + +import java.io.IOException; +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.yunze.common.core.text.Convert; + +/** + * 客户端工具类 + * + * @author yunze + */ +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); + } + + /** + * 获取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 待渲染的字符串 + * @return null + */ + public static String 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(); + } + return null; + } + + /** + * 是否是Ajax异步请求 + * + * @param request + */ + public static boolean isAjaxRequest(HttpServletRequest request) + { + String accept = request.getHeader("accept"); + if (accept != null && accept.indexOf("application/json") != -1) + { + return true; + } + + String xRequestedWith = request.getHeader("X-Requested-With"); + if (xRequestedWith != null && xRequestedWith.indexOf("XMlhttpRequest") != -1) + { + return true; + } + + String uri = request.getRequestURI(); + if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) + { + return true; + } + + String ajax = request.getParameter("__ajax"); + if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) + { + return true; + } + return false; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/StringUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/StringUtils.java new file mode 100644 index 0000000..89f99f2 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/StringUtils.java @@ -0,0 +1,459 @@ +package com.yunze.common.utils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import com.yunze.common.core.text.StrFormatter; + +/** + * 字符串工具类 + * + * @author yunze + */ +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); + } + + /** + * 字符串转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; + } + + /** + * 驼峰转下划线命名 + */ + 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(); + } + + @SuppressWarnings("unchecked") + public static T cast(Object obj) + { + return (T) obj; + } +} \ No newline at end of file diff --git a/yunze-common/src/main/java/com/yunze/common/utils/Threads.java b/yunze-common/src/main/java/com/yunze/common/utils/Threads.java new file mode 100644 index 0000000..76f2c6d --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/Threads.java @@ -0,0 +1,99 @@ +package com.yunze.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 yunze + */ +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/yunze-common/src/main/java/com/yunze/common/utils/VerifyCodeUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/VerifyCodeUtils.java new file mode 100644 index 0000000..bfc2ef7 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/VerifyCodeUtils.java @@ -0,0 +1,228 @@ +package com.yunze.common.utils; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.OutputStream; +import java.security.SecureRandom; +import java.util.Arrays; +import java.util.Random; +import javax.imageio.ImageIO; + +/** + * 验证码工具类 + * + * @author yunze + */ +public class VerifyCodeUtils +{ + // 使用到Algerian字体,系统里没有的话需要安装字体,字体只显示大写,去掉了1,0,i,o几个容易混淆的字符 + public static final String VERIFY_CODES = "789ABCDEFGHJKLMNPQRSTUVWXYZ"; + + private static Random random = new SecureRandom(); + + /** + * 使用系统默认字符源生成验证码 + * + * @param verifySize 验证码长度 + * @return + */ + public static String generateVerifyCode(int verifySize) + { + return generateVerifyCode(verifySize, VERIFY_CODES); + } + + /** + * 使用指定源生成验证码 + * + * @param verifySize 验证码长度 + * @param sources 验证码字符源 + * @return + */ + public static String generateVerifyCode(int verifySize, String sources) + { + if (sources == null || sources.length() == 0) + { + sources = VERIFY_CODES; + } + int codesLen = sources.length(); + Random rand = new Random(System.currentTimeMillis()); + StringBuilder verifyCode = new StringBuilder(verifySize); + for (int i = 0; i < verifySize; i++) + { + verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1))); + } + return verifyCode.toString(); + } + + /** + * 输出指定验证码图片流 + * + * @param w + * @param h + * @param os + * @param code + * @throws IOException + */ + public static void outputImage(int w, int h, OutputStream os, String code) throws IOException + { + int verifySize = code.length(); + BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); + Random rand = new Random(); + Graphics2D g2 = image.createGraphics(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + Color[] colors = new Color[5]; + Color[] colorSpaces = new Color[] { Color.WHITE, Color.CYAN, Color.GRAY, Color.LIGHT_GRAY, Color.MAGENTA, + Color.ORANGE, Color.PINK, Color.YELLOW }; + float[] fractions = new float[colors.length]; + for (int i = 0; i < colors.length; i++) + { + colors[i] = colorSpaces[rand.nextInt(colorSpaces.length)]; + fractions[i] = rand.nextFloat(); + } + Arrays.sort(fractions); + + g2.setColor(Color.GRAY);// 设置边框色 + g2.fillRect(0, 0, w, h); + + Color c = getRandColor(200, 250); + g2.setColor(c);// 设置背景色 + g2.fillRect(0, 2, w, h - 4); + + // 绘制干扰线 + Random random = new Random(); + g2.setColor(getRandColor(160, 200));// 设置线条的颜色 + for (int i = 0; i < 20; i++) + { + int x = random.nextInt(w - 1); + int y = random.nextInt(h - 1); + int xl = random.nextInt(6) + 1; + int yl = random.nextInt(12) + 1; + g2.drawLine(x, y, x + xl + 40, y + yl + 20); + } + + // 添加噪点 + float yawpRate = 0.05f;// 噪声率 + int area = (int) (yawpRate * w * h); + for (int i = 0; i < area; i++) + { + int x = random.nextInt(w); + int y = random.nextInt(h); + int rgb = getRandomIntColor(); + image.setRGB(x, y, rgb); + } + + shear(g2, w, h, c);// 使图片扭曲 + + g2.setColor(getRandColor(100, 160)); + int fontSize = h - 4; + Font font = new Font("Algerian", Font.ITALIC, fontSize); + g2.setFont(font); + char[] chars = code.toCharArray(); + for (int i = 0; i < verifySize; i++) + { + AffineTransform affine = new AffineTransform(); + affine.setToRotation(Math.PI / 4 * rand.nextDouble() * (rand.nextBoolean() ? 1 : -1), + (w / verifySize) * i + fontSize / 2, h / 2); + g2.setTransform(affine); + g2.drawChars(chars, i, 1, ((w - 10) / verifySize) * i + 5, h / 2 + fontSize / 2 - 10); + } + + g2.dispose(); + ImageIO.write(image, "jpg", os); + } + + private static Color getRandColor(int fc, int bc) + { + if (fc > 255) { + fc = 255; + } + if (bc > 255) { + bc = 255; + } + int r = fc + random.nextInt(bc - fc); + int g = fc + random.nextInt(bc - fc); + int b = fc + random.nextInt(bc - fc); + return new Color(r, g, b); + } + + private static int getRandomIntColor() + { + int[] rgb = getRandomRgb(); + int color = 0; + for (int c : rgb) + { + color = color << 8; + color = color | c; + } + return color; + } + + private static int[] getRandomRgb() + { + int[] rgb = new int[3]; + for (int i = 0; i < 3; i++) + { + rgb[i] = random.nextInt(255); + } + return rgb; + } + + private static void shear(Graphics g, int w1, int h1, Color color) + { + shearX(g, w1, h1, color); + shearY(g, w1, h1, color); + } + + private static void shearX(Graphics g, int w1, int h1, Color color) + { + + int period = random.nextInt(2); + + boolean borderGap = true; + int frames = 1; + int phase = random.nextInt(2); + + for (int i = 0; i < h1; i++) + { + double d = (double) (period >> 1) + * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames); + g.copyArea(0, i, w1, 1, (int) d, 0); + if (borderGap) + { + g.setColor(color); + g.drawLine((int) d, i, 0, i); + g.drawLine((int) d + w1, i, w1, i); + } + } + + } + + private static void shearY(Graphics g, int w1, int h1, Color color) + { + + int period = random.nextInt(40) + 10; // 50; + + boolean borderGap = true; + int frames = 20; + int phase = 7; + for (int i = 0; i < w1; i++) + { + double d = (double) (period >> 1) + * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames); + g.copyArea(i, 0, 1, h1, 0, (int) d); + if (borderGap) + { + g.setColor(color); + g.drawLine(i, (int) d, i, 0); + g.drawLine(i, (int) d + h1, i, h1); + } + + } + } +} \ No newline at end of file diff --git a/yunze-common/src/main/java/com/yunze/common/utils/bean/BeanUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/bean/BeanUtils.java new file mode 100644 index 0000000..a59572a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/bean/BeanUtils.java @@ -0,0 +1,110 @@ +package com.yunze.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 yunze + */ +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/yunze-common/src/main/java/com/yunze/common/utils/file/FileTypeUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/file/FileTypeUtils.java new file mode 100644 index 0000000..a308e8c --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/file/FileTypeUtils.java @@ -0,0 +1,76 @@ +package com.yunze.common.utils.file; + +import java.io.File; +import org.apache.commons.lang3.StringUtils; + +/** + * 文件类型工具类 + * + * @author yunze + */ +public class FileTypeUtils +{ + /** + * 获取文件类型 + *

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

+ * 例如: yunze.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/yunze-common/src/main/java/com/yunze/common/utils/file/FileUploadUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/file/FileUploadUtils.java new file mode 100644 index 0000000..0ac602e --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/file/FileUploadUtils.java @@ -0,0 +1,235 @@ +package com.yunze.common.utils.file; + +import java.io.File; +import java.io.IOException; +import org.apache.commons.io.FilenameUtils; +import org.springframework.web.multipart.MultipartFile; +import com.yunze.common.config.YunZeConfig; +import com.yunze.common.constant.Constants; +import com.yunze.common.exception.file.FileNameLengthLimitExceededException; +import com.yunze.common.exception.file.FileSizeLimitExceededException; +import com.yunze.common.exception.file.InvalidExtensionException; +import com.yunze.common.utils.DateUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.uuid.IdUtils; + +/** + * 文件上传工具类 + * + * @author yunze + */ +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 = YunZeConfig.getProfile(); + + public static void setDefaultBaseDir(String defaultBaseDir) + { + FileUploadUtils.defaultBaseDir = defaultBaseDir; + } + + public static String getDefaultBaseDir() + { + return defaultBaseDir; + } + + /** + * 以默认配置进行文件上传 + * + * @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 = 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); + + File desc = getAbsoluteFile(baseDir, fileName); + file.transferTo(desc); + String pathFileName = getPathFileName(baseDir, fileName); + return pathFileName; + } + + /** + * 编码文件名 + */ + public static final String extractFilename(MultipartFile file) + { + String fileName = file.getOriginalFilename(); + String extension = getExtension(file); + fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension; + return fileName; + } + + private 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; + } + + private static final String getPathFileName(String uploadDir, String fileName) throws IOException + { + int dirLastIndex = YunZeConfig.getProfile().length() + 1; + String currentDir = StringUtils.substring(uploadDir, dirLastIndex); + String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName; + return pathFileName; + } + + /** + * 文件大小校验 + * + * @param file 上传的文件 + * @return + * @throws FileSizeLimitExceededException 如果超出最大大小 + * @throws InvalidExtensionException + */ + public static final void assertAllowed(MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, InvalidExtensionException + { + long size = file.getSize(); + if (DEFAULT_MAX_SIZE != -1 && 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(file.getContentType()); + } + return extension; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/file/FileUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/file/FileUtils.java new file mode 100644 index 0000000..39a332c --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/file/FileUtils.java @@ -0,0 +1,203 @@ +package com.yunze.common.utils.file; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +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.lang3.ArrayUtils; +import com.yunze.common.utils.StringUtils; + +/** + * 文件处理工具类 + * + * @author yunze + */ +public class FileUtils extends org.apache.commons.io.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 + { + if (os != null) + { + try + { + os.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + if (fis != null) + { + try + { + fis.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + } + } + + /** + * 删除文件 + * + * @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 真实文件名 + * @return + */ + 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.setHeader("Content-disposition", contentDispositionValue.toString()); + } + + /** + * 百分号编码工具方法 + * + * @param s 需要百分号编码的字符串 + * @return 百分号编码后的字符串 + */ + public static String percentEncode(String s) throws UnsupportedEncodingException + { + String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString()); + return encode.replaceAll("\\+", "%20"); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/file/ImageUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/file/ImageUtils.java new file mode 100644 index 0000000..cbfb9d6 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/file/ImageUtils.java @@ -0,0 +1,101 @@ +package com.yunze.common.utils.file; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +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.yunze.common.config.YunZeConfig; +import com.yunze.common.constant.Constants; +import com.yunze.common.utils.StringUtils; + +/** + * 图片处理工具类 + * + * @author yunze + */ +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 key 地址 + * @return 字节数据 + */ + public static byte[] readFile(String url) + { + InputStream in = null; + ByteArrayOutputStream baos = 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 = YunZeConfig.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); + IOUtils.closeQuietly(baos); + } + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/file/MimeTypeUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/file/MimeTypeUtils.java new file mode 100644 index 0000000..206eef9 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/file/MimeTypeUtils.java @@ -0,0 +1,59 @@ +package com.yunze.common.utils.file; + +/** + * 媒体类型工具类 + * + * @author yunze + */ +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", + // 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/yunze-common/src/main/java/com/yunze/common/utils/html/EscapeUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/html/EscapeUtil.java new file mode 100644 index 0000000..b600b1e --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/html/EscapeUtil.java @@ -0,0 +1,155 @@ +package com.yunze.common.utils.html; + +import com.yunze.common.utils.StringUtils; + +/** + * 转义和反转义工具类 + * + * @author yunze + */ +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) + { + int len; + if ((text == null) || ((len = text.length()) == 0)) + { + return StringUtils.EMPTY; + } + StringBuilder buffer = new StringBuilder(len + (len >> 2)); + char c; + for (int i = 0; i < len; i++) + { + c = text.charAt(i); + if (c < 64) + { + buffer.append(TEXT[c]); + } + else + { + buffer.append(c); + } + } + return buffer.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 html = "ipt>alert(\"XSS\")ipt>"; + // String html = "<123"; + // String html = "123>"; + System.out.println(EscapeUtil.clean(html)); + System.out.println(EscapeUtil.escape(html)); + System.out.println(EscapeUtil.unescape(html)); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/html/HTMLFilter.java b/yunze-common/src/main/java/com/yunze/common/utils/html/HTMLFilter.java new file mode 100644 index 0000000..f152377 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/html/HTMLFilter.java @@ -0,0 +1,570 @@ +package com.yunze.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 yunze + */ +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 (false == 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/yunze-common/src/main/java/com/yunze/common/utils/http/HttpHelper.java b/yunze-common/src/main/java/com/yunze/common/utils/http/HttpHelper.java new file mode 100644 index 0000000..0c3d348 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/http/HttpHelper.java @@ -0,0 +1,55 @@ +package com.yunze.common.utils.http; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import javax.servlet.ServletRequest; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 通用http工具封装 + * + * @author yunze + */ +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, Charset.forName("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/yunze-common/src/main/java/com/yunze/common/utils/http/HttpUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/http/HttpUtils.java new file mode 100644 index 0000000..1ab0c7d --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/http/HttpUtils.java @@ -0,0 +1,262 @@ +package com.yunze.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.security.cert.X509Certificate; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.yunze.common.constant.Constants; + +/** + * 通用http发送方法 + * + * @author yunze + */ +public class HttpUtils +{ + private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); + + /** + * 向指定 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 = url + "?" + param; + 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 + { + String urlNameString = url; + log.info("sendPost - {}", urlNameString); + URL realUrl = new URL(urlNameString); + 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(), "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("ISO-8859-1"), "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(); + } + + 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/yunze-common/src/main/java/com/yunze/common/utils/ip/AddressUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/ip/AddressUtils.java new file mode 100644 index 0000000..00dcfcb --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/ip/AddressUtils.java @@ -0,0 +1,56 @@ +package com.yunze.common.utils.ip; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.alibaba.fastjson.JSONObject; +import com.yunze.common.config.YunZeConfig; +import com.yunze.common.constant.Constants; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.http.HttpUtils; + +/** + * 获取地址类 + * + * @author yunze + */ +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) + { + String address = UNKNOWN; + // 内网不查询 + if (IpUtils.internalIp(ip)) + { + return "内网IP"; + } + if (YunZeConfig.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 = JSONObject.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 address; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/ip/IpUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/ip/IpUtils.java new file mode 100644 index 0000000..0b77685 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/ip/IpUtils.java @@ -0,0 +1,195 @@ +package com.yunze.common.utils.ip; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import javax.servlet.http.HttpServletRequest; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.html.EscapeUtil; + +/** + * 获取IP方法 + * + * @author yunze + */ +public class IpUtils +{ + 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" : EscapeUtil.clean(ip); + } + + public static boolean internalIp(String ip) + { + byte[] addr = textToNumericFormatV4(ip); + return internalIp(addr) || "127.0.0.1".equals(ip); + } + + 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; + } + + public static String getHostIp() + { + try + { + return InetAddress.getLocalHost().getHostAddress(); + } + catch (UnknownHostException e) + { + } + return "127.0.0.1"; + } + + public static String getHostName() + { + try + { + return InetAddress.getLocalHost().getHostName(); + } + catch (UnknownHostException e) + { + } + return "未知"; + } +} \ No newline at end of file diff --git a/yunze-common/src/main/java/com/yunze/common/utils/poi/ExcelUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/poi/ExcelUtil.java new file mode 100644 index 0000000..1ef095f --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/poi/ExcelUtil.java @@ -0,0 +1,1100 @@ +package com.yunze.common.utils.poi; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; +import org.apache.poi.ss.usermodel.BorderStyle; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.ClientAnchor; +import org.apache.poi.ss.usermodel.DataValidation; +import org.apache.poi.ss.usermodel.DataValidationConstraint; +import org.apache.poi.ss.usermodel.DataValidationHelper; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.Drawing; +import org.apache.poi.ss.usermodel.FillPatternType; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.apache.poi.ss.util.CellRangeAddressList; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFClientAnchor; +import org.apache.poi.xssf.usermodel.XSSFDataValidation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.annotation.Excel.Type; +import com.yunze.common.annotation.Excels; +import com.yunze.common.config.YunZeConfig; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.text.Convert; +import com.yunze.common.exception.CustomException; +import com.yunze.common.utils.DateUtils; +import com.yunze.common.utils.DictUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.file.FileTypeUtils; +import com.yunze.common.utils.file.ImageUtils; +import com.yunze.common.utils.reflect.ReflectUtils; + +/** + * Excel相关处理 + * + * @author yunze + */ +public class ExcelUtil +{ + private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class); + + /** + * 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 short maxHeight; + + /** + * 统计列表 + */ + private Map statistics = new HashMap(); + + /** + * 数字格式 + */ + private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00"); + + /** + * 实体对象 + */ + public Class clazz; + + public ExcelUtil(Class clazz) + { + this.clazz = clazz; + } + + public void init(List list, String sheetName, Type type) + { + if (list == null) + { + list = new ArrayList(); + } + this.list = list; + this.sheetName = sheetName; + this.type = type; + createExcelField(); + createWorkbook(); + } + + /** + * 对excel表单默认第一个索引名转换成list + * + * @param is 输入流 + * @return 转换后集合 + */ + public List importExcel(InputStream is) throws Exception + { + return importExcel(StringUtils.EMPTY, is); + } + + /** + * 对excel表单指定表格索引名转换成list + * + * @param sheetName 表格索引名 + * @param is 输入流 + * @return 转换后集合 + */ + public List importExcel(String sheetName, InputStream is) throws Exception + { + this.type = Type.IMPORT; + this.wb = WorkbookFactory.create(is); + List list = new ArrayList(); + Sheet sheet = null; + if (StringUtils.isNotEmpty(sheetName)) + { + // 如果指定sheet名,则取指定sheet中的内容. + sheet = wb.getSheet(sheetName); + } + else + { + // 如果传入的sheet名不存在则默认指向第1个sheet. + sheet = wb.getSheetAt(0); + } + + if (sheet == null) + { + throw new IOException("文件sheet不存在"); + } + + int rows = sheet.getPhysicalNumberOfRows(); + + if (rows > 0) + { + // 定义一个map用于存放excel列的序号和field. + Map cellMap = new HashMap(); + // 获取表头 + Row heard = sheet.getRow(0); + for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) + { + Cell cell = heard.getCell(i); + if (StringUtils.isNotNull(cell)) + { + String value = this.getCellValue(heard, i).toString(); + cellMap.put(value, i); + } + else + { + cellMap.put(null, i); + } + } + // 有数据时才处理 得到类的所有field. + Field[] allFields = clazz.getDeclaredFields(); + // 定义一个map用于存放列的序号和field. + Map fieldsMap = new HashMap(); + for (int col = 0; col < allFields.length; col++) + { + Field field = allFields[col]; + Excel attr = field.getAnnotation(Excel.class); + if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) + { + // 设置类的私有字段属性可访问. + field.setAccessible(true); + Integer column = cellMap.get(attr.name()); + if (column != null) + { + fieldsMap.put(column, field); + } + } + } + for (int i = 1; i < rows; i++) + { + // 从第2行开始取数据,默认第一行是表头. + Row row = sheet.getRow(i); + if(row == null) + { + 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 = fieldsMap.get(entry.getKey()); + // 取得类型,并根据对象类型设置值. + 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 = DateUtils.parseDateToStr(dateFormat, (Date) 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) + { + 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)) + { + Excel attr = field.getAnnotation(Excel.class); + 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()); + } + ReflectUtils.invokeSetter(entity, propertyName, val); + } + } + list.add(entity); + } + } + return list; + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param list 导出数据集合 + * @param sheetName 工作表的名称 + * @return 结果 + */ + public AjaxResult exportExcel(List list, String sheetName) + { + this.init(list, sheetName, Type.EXPORT); + return exportExcel(); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param sheetName 工作表的名称 + * @return 结果 + */ + public AjaxResult importTemplateExcel(String sheetName) + { + this.init(null, sheetName, Type.IMPORT); + return exportExcel(); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @return 结果 + */ + public AjaxResult exportExcel() + { + OutputStream out = null; + try + { + // 取出一共有多少个sheet. + double sheetNo = Math.ceil(list.size() / sheetSize); + for (int index = 0; index <= sheetNo; index++) + { + createSheet(sheetNo, index); + + // 产生一行 + Row row = sheet.createRow(0); + int column = 0; + // 写入各个字段的列头名称 + for (Object[] os : fields) + { + Excel excel = (Excel) os[1]; + this.createCell(excel, row, column++); + } + if (Type.EXPORT.equals(type)) + { + fillExcelData(index, row); + addStatisticsRow(); + } + } + 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 CustomException("导出Excel失败,请联系网站管理员!"); + } + finally + { + if (wb != null) + { + try + { + wb.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + if (out != null) + { + try + { + out.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + } + } + + /** + * 填充excel数据 + * + * @param index 序号 + * @param row 单元格行 + */ + public void fillExcelData(int index, Row row) + { + int startNo = index * sheetSize; + int endNo = Math.min(startNo + sheetSize, list.size()); + for (int i = startNo; i < endNo; i++) + { + row = sheet.createRow(i + 1 - startNo); + // 得到导出对象. + T vo = (T) list.get(i); + int column = 0; + for (Object[] os : fields) + { + Field field = (Field) os[0]; + Excel excel = (Excel) os[1]; + // 设置实体类私有属性可访问 + field.setAccessible(true); + 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); + 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.cloneStyleFrom(styles.get("data")); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + Font headerFont = wb.createFont(); + headerFont.setFontName("Arial"); + headerFont.setFontHeightInPoints((short) 10); + headerFont.setBold(true); + headerFont.setColor(IndexedColors.WHITE.getIndex()); + style.setFont(headerFont); + styles.put("header", 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); + + style = wb.createCellStyle(); + style.cloneStyleFrom(styles.get("data")); + style.setAlignment(HorizontalAlignment.LEFT); + styles.put("data1", style); + + style = wb.createCellStyle(); + style.cloneStyleFrom(styles.get("data")); + style.setAlignment(HorizontalAlignment.CENTER); + styles.put("data2", style); + + style = wb.createCellStyle(); + style.cloneStyleFrom(styles.get("data")); + style.setAlignment(HorizontalAlignment.RIGHT); + styles.put("data3", style); + + return styles; + } + + /** + * 创建单元格 + */ + public Cell createCell(Excel attr, Row row, int column) + { + // 创建列 + Cell cell = row.createCell(column); + // 写入列信息 + cell.setCellValue(attr.name()); + setDataValidation(attr, row, column); + cell.setCellStyle(styles.get("header")); + return cell; + } + + /** + * 设置单元格信息 + * + * @param value 单元格值 + * @param attr 注解相关 + * @param cell 单元格信息 + */ + public void setCellVo(Object value, Excel attr, Cell cell) + { + if (ColumnType.STRING == attr.cellType()) + { + cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix()); + } + else if (ColumnType.NUMERIC == attr.cellType()) + { + if (StringUtils.isNotNull(value)) + { + cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value)); + } + } + 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())) + { + // 这里默认设了2-101列提示. + setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column); + } + // 如果设置了combo属性则本列只能选择不能输入 + if (attr.combo().length > 0) + { + // 这里默认设了2-101列只能选择不能输入. + setXSSFValidation(sheet, attr.combo(), 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); + int align = attr.align().value(); + cell.setCellStyle(styles.get("data" + (align >= 1 && align <= 3 ? align : ""))); + + // 用于读取对象中的属性 + 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(DateUtils.parseDateToStr(dateFormat, (Date) 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())).toString()); + } + else + { + // 设置列类型 + setCellVo(value, attr, cell); + } + addStatisticsData(column, Convert.toStr(value), attr); + } + } + catch (Exception e) + { + log.error("导出Excel失败{}", e); + } + return cell; + } + + /** + * 设置 POI XSSFSheet 单元格提示 + * + * @param sheet 表单 + * @param promptTitle 提示标题 + * @param promptContent 提示内容 + * @param firstRow 开始行 + * @param endRow 结束行 + * @param firstCol 开始列 + * @param endCol 结束列 + */ + public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow, + int firstCol, int endCol) + { + DataValidationHelper helper = sheet.getDataValidationHelper(); + DataValidationConstraint constraint = helper.createCustomConstraint("DD1"); + CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); + DataValidation dataValidation = helper.createValidation(constraint, regions); + dataValidation.createPromptBox(promptTitle, promptContent); + dataValidation.setShowPromptBox(true); + sheet.addValidationData(dataValidation); + } + + /** + * 设置某些列的值只能输入预制的数据,显示下拉框. + * + * @param sheet 要设置的sheet. + * @param textlist 下拉框显示的内容 + * @param firstRow 开始行 + * @param endRow 结束行 + * @param firstCol 开始列 + * @param endCol 结束列 + * @return 设置好的sheet. + */ + public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) + { + DataValidationHelper helper = sheet.getDataValidationHelper(); + // 加载下拉列表内容 + DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist); + // 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列 + CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); + // 数据有效性对象 + DataValidation dataValidation = helper.createValidation(constraint, regions); + // 处理Excel兼容性问题 + if (dataValidation instanceof XSSFDataValidation) + { + dataValidation.setSuppressDropDownArrow(true); + dataValidation.setShowErrorBox(true); + } + else + { + dataValidation.setSuppressDropDownArrow(false); + } + + sheet.addValidationData(dataValidation); + } + + /** + * 解析导出值 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(separator, propertyValue)) + { + 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(separator, propertyValue)) + { + 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); + } + + /** + * 合计统计信息 + */ + 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) + { + Cell cell = null; + Row row = sheet.createRow(sheet.getLastRowNum() + 1); + Set keys = statistics.keySet(); + 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 = YunZeConfig.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.indexOf(".") > -1) + { + 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 = new ArrayList(); + List tempFields = new ArrayList<>(); + tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields())); + tempFields.addAll(Arrays.asList(clazz.getDeclaredFields())); + for (Field field : tempFields) + { + // 单注解 + if (field.isAnnotationPresent(Excel.class)) + { + putToField(field, field.getAnnotation(Excel.class)); + } + + // 多注解 + if (field.isAnnotationPresent(Excels.class)) + { + Excels attrs = field.getAnnotation(Excels.class); + Excel[] excels = attrs.value(); + for (Excel excel : excels) + { + putToField(field, excel); + } + } + } + this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList()); + this.maxHeight = getRowHeight(); + } + + /** + * 根据注解获取最大行高 + */ + public short getRowHeight() + { + double maxHeight = 0; + for (Object[] os : this.fields) + { + Excel excel = (Excel) os[1]; + maxHeight = maxHeight > excel.height() ? maxHeight : excel.height(); + } + return (short) (maxHeight * 20); + } + + /** + * 放到字段集合中 + */ + private void putToField(Field field, Excel attr) + { + if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) + { + this.fields.add(new Object[] { field, attr }); + } + } + + /** + * 创建一个工作簿 + */ + public void createWorkbook() + { + this.wb = new SXSSFWorkbook(500); + } + + /** + * 创建工作表 + * + * @param sheetNo sheet数量 + * @param index 序号 + */ + public void createSheet(double sheetNo, int index) + { + this.sheet = wb.createSheet(); + this.styles = createStyles(wb); + // 设置工作表的名称. + if (sheetNo == 0) + { + wb.setSheetName(index, sheetName); + } + else + { + 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; + } +} \ No newline at end of file diff --git a/yunze-common/src/main/java/com/yunze/common/utils/poi/ExcelWrite.java b/yunze-common/src/main/java/com/yunze/common/utils/poi/ExcelWrite.java new file mode 100644 index 0000000..09dee2d --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/poi/ExcelWrite.java @@ -0,0 +1,190 @@ +package com.yunze.common.utils.poi; + +import java.io.*; +import java.lang.reflect.Field; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletResponse; + +import com.yunze.common.utils.yunze.ExcelColumnAnnotation; +import org.apache.commons.collections.CollectionUtils; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.stereotype.Component; + +/** + * 用于处理Excel写操作 + */ +@Component +public class ExcelWrite{ + +/* *//** + * 下载文件 + * @param path + * @param response + * @param charsetName + *//* + public void download(String path, HttpServletResponse response,String charsetName) { + charsetName = charsetName!=null?charsetName:"GBK";//ISO-8859-1 UTF-8 GBK + try { + // path是指欲下载的文件的路径。 + File file = new File(path); + // 取得文件名。 + String filename = file.getName(); + // 以流的形式下载文件。 + InputStream fis = new BufferedInputStream(new FileInputStream(path)); + byte[] buffer = new byte[fis.available()]; + fis.read(buffer); + fis.close(); + // 清空response + response.reset(); + // 设置response的Header + response.addHeader("Content-Disposition", "attachment;filename=" + + new String(filename.getBytes(),charsetName)); + response.addHeader("Content-Length", "" + file.length()); + OutputStream toClient = new BufferedOutputStream( + response.getOutputStream()); + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + toClient.write(buffer); + toClient.flush(); + toClient.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } + }*/ + + /** + * 下载文件 + * @param path + * @param response + * @param charsetName + * @param newName + * @throws IOException + */ + public void download(String path, HttpServletResponse response,String charsetName,String newName) throws IOException { + charsetName = charsetName!=null?charsetName:"GBK";//ISO-8859-1 UTF-8 GBK + // path是指欲下载的文件的路径。 + File file = new File(path); + // 取得文件名。 + //String filename = file.getName(); + // 取得文件的后缀名。 + //String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase(); + // 以流的形式下载文件。 + InputStream fis = new BufferedInputStream(new FileInputStream(path)); + byte[] buffer = new byte[fis.available()]; + fis.read(buffer); + fis.close(); + // 清空response + response.reset(); + // 设置response的Header + response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(newName+file.getName(),charsetName)); + + response.addHeader("Content-Length", "" + file.length()); + OutputStream toClient = new BufferedOutputStream(response.getOutputStream()); + response.setContentType("application/octet-stream"); + toClient.write(buffer); + toClient.flush(); + toClient.close(); + } + + + /** + * 输出 写入excel + * @param response + * @param dataList + * @param cls + * @param + */ + public static void writeExcel(HttpServletResponse response, List dataList, Class cls){ + Field[] fields = cls.getDeclaredFields(); + List fieldList = Arrays.stream(fields) + .filter(field -> { + ExcelColumnAnnotation annotation = field.getAnnotation(ExcelColumnAnnotation.class); + if (annotation != null && annotation.col() > 0) { + field.setAccessible(true); + return true; + } + return false; + }).sorted(Comparator.comparing(field -> { + int col = 0; + ExcelColumnAnnotation annotation = field.getAnnotation(ExcelColumnAnnotation.class); + if (annotation != null) { + col = annotation.col(); + } + return col; + })).collect(Collectors.toList()); + + Workbook wb = new XSSFWorkbook(); + Sheet sheet = wb.createSheet("转换数据"); + AtomicInteger ai = new AtomicInteger(); + { + Row row = sheet.createRow(ai.getAndIncrement()); + AtomicInteger aj = new AtomicInteger(); + //写入头部 + fieldList.forEach(field -> { + ExcelColumnAnnotation annotation = field.getAnnotation(ExcelColumnAnnotation.class); + String columnName = ""; + if (annotation != null) { + columnName = annotation.value(); + } + Cell cell = row.createCell(aj.getAndIncrement()); + + CellStyle cellStyle = wb.createCellStyle(); + cellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); + + Font font = wb.createFont(); + cellStyle.setFont(font); + cell.setCellStyle(cellStyle); + cell.setCellValue(columnName); + }); + } + if (CollectionUtils.isNotEmpty(dataList)) { + dataList.forEach(t -> { + Row row1 = sheet.createRow(ai.getAndIncrement()); + AtomicInteger aj = new AtomicInteger(); + fieldList.forEach(field -> { + Class type = field.getType(); + Object value = ""; + try { + value = field.get(t); + } catch (Exception e) { + e.printStackTrace(); + } + Cell cell = row1.createCell(aj.getAndIncrement()); + if (value != null) { + if (type == Date.class) { + cell.setCellValue(value.toString()); + } else { + cell.setCellValue(value.toString()); + } + cell.setCellValue(value.toString()); + } + }); + }); + } + //冻结窗格 + wb.getSheet("转换数据").createFreezePane(0, 1, 0, 1); + //生成excel文件 + String now=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); + String exc ="Conversion-"+now+".xlsx"; + OutputStream os=null; + try { + response.setContentType("application/vnd.ms-excel"); + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("Content-disposition", "attachment;filename="+ URLEncoder.encode(exc,"utf-8")); + os=response.getOutputStream(); + response.flushBuffer(); + wb.write(os); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/reflect/ReflectUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/reflect/ReflectUtils.java new file mode 100644 index 0000000..1a8c235 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/reflect/ReflectUtils.java @@ -0,0 +1,410 @@ +package com.yunze.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.util.Date; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; +import org.apache.poi.ss.usermodel.DateUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.yunze.common.core.text.Convert; +import com.yunze.common.utils.DateUtils; + +/** + * 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数. + * + * @author yunze + */ +@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] == 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; + + } + + /** + * 将反射时的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/yunze-common/src/main/java/com/yunze/common/utils/sign/Base64.java b/yunze-common/src/main/java/com/yunze/common/utils/sign/Base64.java new file mode 100644 index 0000000..04e909b --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/sign/Base64.java @@ -0,0 +1,291 @@ +package com.yunze.common.utils.sign; + +/** + * Base64工具类 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/utils/sign/Md5Utils.java b/yunze-common/src/main/java/com/yunze/common/utils/sign/Md5Utils.java new file mode 100644 index 0000000..7f96a4a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/sign/Md5Utils.java @@ -0,0 +1,66 @@ +package com.yunze.common.utils.sign; + +import java.security.MessageDigest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Md5加密方法 + * + * @author yunze + */ +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("UTF-8"), "UTF-8"); + } + catch (Exception e) + { + log.error("not supported charset...{}", e); + return s; + } + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/spring/SpringUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/spring/SpringUtils.java new file mode 100644 index 0000000..3c8c068 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/spring/SpringUtils.java @@ -0,0 +1,146 @@ +package com.yunze.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.yunze.common.utils.StringUtils; + +/** + * spring工具类 方便在非spring管理环境中获取bean + * + * @author yunze + */ +@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; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/sql/SqlUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/sql/SqlUtil.java new file mode 100644 index 0000000..91b71d5 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/sql/SqlUtil.java @@ -0,0 +1,37 @@ +package com.yunze.common.utils.sql; + +import com.yunze.common.exception.BaseException; +import com.yunze.common.utils.StringUtils; + +/** + * sql操作工具类 + * + * @author yunze + */ +public class SqlUtil +{ + /** + * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) + */ + public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; + + /** + * 检查字符,防止注入绕过 + */ + public static String escapeOrderBySql(String value) + { + if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) + { + throw new BaseException("参数不符合规范,不能进行查询"); + } + return value; + } + + /** + * 验证 order by 语法是否符合规范 + */ + public static boolean isValidOrderBySql(String value) + { + return value.matches(SQL_PATTERN); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/uuid/IdUtils.java b/yunze-common/src/main/java/com/yunze/common/utils/uuid/IdUtils.java new file mode 100644 index 0000000..42a75e9 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/uuid/IdUtils.java @@ -0,0 +1,49 @@ +package com.yunze.common.utils.uuid; + +/** + * ID生成器工具类 + * + * @author yunze + */ +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/yunze-common/src/main/java/com/yunze/common/utils/uuid/UUID.java b/yunze-common/src/main/java/com/yunze/common/utils/uuid/UUID.java new file mode 100644 index 0000000..606267a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/uuid/UUID.java @@ -0,0 +1,484 @@ +package com.yunze.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.yunze.common.exception.UtilException; + +/** + * 提供通用唯一识别码(universally unique identifier)(UUID)实现 + * + * @author yunze + */ +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 (false == isSimple) + { + builder.append('-'); + } + // time_mid + builder.append(digits(mostSigBits >> 16, 4)); + if (false == isSimple) + { + builder.append('-'); + } + // time_high_and_version + builder.append(digits(mostSigBits, 4)); + if (false == isSimple) + { + builder.append('-'); + } + // variant_and_sequence + builder.append(digits(leastSigBits >> 48, 4)); + if (false == 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/yunze-common/src/main/java/com/yunze/common/utils/yunze/AesEncryptUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/AesEncryptUtil.java new file mode 100644 index 0000000..6369382 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/AesEncryptUtil.java @@ -0,0 +1,123 @@ +package com.yunze.common.utils.yunze; +/** + * AES 128bit 加密解密工具类 + * + */ + +import com.alibaba.fastjson.JSON; +import org.apache.commons.codec.binary.Base64; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Map; + + +public class AesEncryptUtil { + + //使用AES-128-CBC加密模式,key需要为16位,key和iv可以相同! + private static String KEY = "YunZeIot@5iot.cn"; + + private static String IV = "www_5iot_cn@2022"; + + + /** + * 加密方法 + * @param data 要加密的数据 + * @param key 加密key + * @param iv 加密iv + * @return 加密的结果 + * @throws Exception + */ + public static String encrypt(String data, String key, String iv) throws Exception { + try { + + Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");//"算法/模式/补码方式" + int blockSize = cipher.getBlockSize(); + byte[] dataBytes = data.getBytes("utf-8"); + int plaintextLength = dataBytes.length; + if (plaintextLength % blockSize != 0) { + plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize)); + } + + byte[] plaintext = new byte[plaintextLength]; + + System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length); + + SecretKeySpec keyspec = new SecretKeySpec(key.getBytes("utf-8"), "AES"); + IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes("utf-8")); + + cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec); + byte[] encrypted = cipher.doFinal(plaintext); + //System.out.println("加密后:"+byteToHexString(encrypted)); + + return new Base64().encodeToString(encrypted); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 解密方法 + * @param data 要解密的数据 + * @param key 解密key + * @param iv 解密iv + * @return 解密的结果 + * @throws Exception + */ + public static String desEncrypt(String data, String key, String iv) throws Exception { + try { + byte[] encrypted1 = new Base64().decode(data); + Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); + SecretKeySpec keyspec = new SecretKeySpec(key.getBytes("utf-8"), "AES"); + IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes("utf-8")); + + cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec); + + byte[] original = cipher.doFinal(encrypted1); + String originalString = new String(original,"utf-8"); + return originalString.trim(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 使用默认的key和iv加密 + * @param data + * @return + * @throws Exception + */ + public static String encrypt(String data) throws Exception { + return encrypt(data, KEY, IV); + } + + /** + * 使用默认的key和iv解密 + * @param data + * @return + * @throws Exception + */ + public static String desEncrypt(String data) throws Exception { + return desEncrypt(data, KEY, IV); + } + + public static String byteToHexString(byte[] bytes) { + StringBuffer sb = new StringBuffer(bytes.length); + String sTemp; + for (int i = 0; i < bytes.length; i++) { + sTemp = Integer.toHexString(0xFF & bytes[i]); + if (sTemp.length() < 2) + sb.append(0); + sb.append(sTemp.toUpperCase()); + } + return sb.toString(); + } + + + + } \ No newline at end of file diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/ApiParamMap.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/ApiParamMap.java new file mode 100644 index 0000000..7a3384e --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/ApiParamMap.java @@ -0,0 +1,64 @@ +package com.yunze.common.utils.yunze; + +import org.springframework.stereotype.Component; + +import java.util.*; + +@Component +public class ApiParamMap { + + /** + * 描述: 封装查询api的必要参数 + */ + public Map getApiParams(Map pMap){ + Map map = new HashMap(); + Map Yzmap = new HashMap(); + Map Parmap = new HashMap(); + + String appId = "adminOption"; + String password = "aaaaaaSXCV"; + String access_key = "GGBBBSSXXX"; + String timeStamp = System.currentTimeMillis() + ""; + + Yzmap.put("password", password); + Yzmap.put("appId", appId); + Yzmap.put("timeStamp", timeStamp); + String sign = getSign(Yzmap, access_key); + Yzmap.put("sign", sign); + + if(!pMap.isEmpty()){ + for(String key:pMap.keySet()){ + Parmap.put(key, pMap.get(key).toString()); + } + } + map.put("verify", Yzmap); + map.put("Param", Parmap); + return map; + } + + public static String getSign(Map map, String key) {//入参为:appid,password,version,iccid,timestamp,sign + Iterator iterator = map.keySet().iterator(); + while (iterator.hasNext()) {// 循环取键值进行判断 + String m = iterator.next();// 键 + if (m.startsWith("sign")) { + iterator.remove();// 移除map中sign字符的键对应的键值对 + } + if (m.startsWith("iccids")) { + iterator.remove(); + } + } + List list = new ArrayList<>(map.keySet()); + Collections.sort(list); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < list.size(); i++) { + String k = list.get(i); + String v = (String) map.get(k); + sb.append(k).append("=").append(v).append("&"); + } + String signstr = sb.append("key=").append(key).toString(); + //System.out.println(signstr); + String sign = MD5Util.MD5Encode(signstr).toUpperCase(); + //System.out.println(sign); + return sign; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/CardFlowSyn.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/CardFlowSyn.java new file mode 100644 index 0000000..2d83eb9 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/CardFlowSyn.java @@ -0,0 +1,240 @@ +package com.yunze.common.utils.yunze; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.mapper.yunze.YzCardFlowHisMapper; +import com.yunze.common.mapper.yunze.YzCardFlowMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.utils.Arith; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 卡用量同步 + * @Auther: zhang feng + * @Date: 2021/07/20/15:19 + * @Description: + */ +@Component +public class CardFlowSyn { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private YzCardFlowMapper yzCardFlowMapper; + @Resource + private YzCardFlowHisMapper yzCardFlowHisMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + + + /** + * 用量计算 [直接同步 yzCardMapper ] + * @param iccid + * @param ApiUsed + * @return + */ + public Map CalculationFlow(String iccid,Double ApiUsed){ + Map Rmap = CalculationFlowCommon(iccid, ApiUsed); + Double SumFlow = Double.parseDouble(Rmap.get("SumFlow").toString()); + Double total_show_flow = Double.parseDouble(Rmap.get("total_show_flow").toString()); + boolean bool_info = false; + Double remaining = Arith.sub(SumFlow,total_show_flow); + Map updUsedMap = new HashMap<>(); + updUsedMap.put("iccid",iccid); + updUsedMap.put("used",total_show_flow); + updUsedMap.put("remaining",remaining); + bool_info = yzCardMapper.updUsed(updUsedMap)>0; + //返回数据 + Rmap.put("used",total_show_flow); + Rmap.put("remaining",remaining); + Rmap.put("bool_info",bool_info); + return Rmap; + } + + + + /** + * 用量计算 [queue 队列同步 yzCardMapper ] + * @param iccid + * @param ApiUsed + * @return + */ + public Map CalculationFlowQueue(String iccid,Double ApiUsed,boolean bool){ + Map Rmap = CalculationFlowCommon(iccid, ApiUsed); + Double SumFlow = Double.parseDouble(Rmap.get("SumFlow").toString()); + Double total_show_flow = Double.parseDouble(Rmap.get("total_show_flow").toString()); + String bool_info = ""; + Double remaining = Arith.sub(SumFlow,total_show_flow); + Map updUsedMap = new HashMap<>(); + updUsedMap.put("iccid",iccid); + updUsedMap.put("used",total_show_flow); + updUsedMap.put("remaining",remaining); + //1.创建路由 绑定 生产队列 发送消息 + String card_exchangeName = "admin_card_exchange", card_queueName = "admin_CardUpd_queue", card_routingKey = "admin.CardUpd.queue", + card_del_exchangeName = "dlx_"+card_exchangeName,card_del_queueName = "dlx_"+card_queueName, card_del_routingKey = "dlx_"+card_routingKey; + try { + if(bool){ + try { + rabbitMQConfig.creatExchangeQueue(card_exchangeName, card_queueName, card_routingKey, card_del_exchangeName, card_del_queueName, card_del_routingKey,null); + }catch (Exception e){ + System.out.println("CalculationFlowQueue 》creatExchangeQueue "+e.getMessage()); + } + } + updUsedMap.put("queueTypeName","admin_CardUpdUsed_queue"); + rabbitTemplate.convertAndSend(card_exchangeName, card_routingKey, JSON.toJSONString(updUsedMap), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + }); + bool_info = "发送 主表修改 指令成功 !"; + } catch (Exception e) { + System.out.println("用量计算 队列同步 创建 失败 " + e.getMessage().toString()); + bool_info = e.getMessage().toString(); + bool_info = bool_info.length()>500?bool_info.substring(0,500):bool_info; + } + + + + //返回数据 + Rmap.put("used",total_show_flow); + Rmap.put("remaining",remaining); + Rmap.put("bool_info",bool_info); + return Rmap; + } + + + /** + * 用量计算 + * @param iccid + * @param ApiUsed + * @return + */ + public Map CalculationFlowCommon(String iccid,Double ApiUsed){ + Map Rmap = new HashMap<>(); + boolean bool_info=false,bool_flow=false,bool_flowHis=false; + Map findMap = new HashMap<>(); + findMap.put("iccid",iccid); + + String []YyyyAndMm = VeDate.getYyyyAndMm(); + String nowMonthSta = YyyyAndMm[0]+"-"+YyyyAndMm[1]+"-01"; + String nowMonthEnd = VeDate.getLastDayOfMonth(Integer.parseInt(YyyyAndMm[0]),Integer.parseInt(YyyyAndMm[1])); + findMap.put("nowMonthSta",nowMonthSta); + findMap.put("nowMonthEnd",nowMonthEnd); + //0.修改 时间到期资费计划 + yzCardFlowMapper.updStatus(findMap); + //1.查询过期用量 + String SumErrorFlow = yzCardFlowMapper.findInvalidationSumErrorFlow(findMap); + Double SumErrorFlow_D = SumErrorFlow!=null && SumErrorFlow.length()>0?Double.parseDouble(SumErrorFlow):0.0; + + Double DseFlow = SumErrorFlow!=null && SumErrorFlow.length()>0?Double.parseDouble(SumErrorFlow):0.0; + Double used = DseFlow;//主表 账期 已用 + //当前计算 = 接口用量 - 已到期 用量 + Double cl_Used = Arith.sub(ApiUsed,DseFlow); + //2.获取 有效资费计划 计算 + Double xiShu = 1.0;//默认 + List> InEffectArr = yzCardFlowMapper.findInEffect(findMap); + if(InEffectArr!=null && InEffectArr.size()>0){ + Double UdF = cl_Used+0; + for (int i = 0; i < InEffectArr.size(); i++) { + Map Pobj = InEffectArr.get(i); + Double true_flow = Double.parseDouble(Pobj.get("true_flow").toString()); + Double error_flow = Double.parseDouble(Pobj.get("error_flow").toString()); + Double error_time = Double.parseDouble(Pobj.get("error_time").toString()); + String id = Pobj.get("id").toString(); + xiShu = error_time;//同步包系数 + // 当前计算 用量 - 资费计划 用量 作比较 小等 0 用完了 否则未用完继续 作比较 + UdF = Arith.sub(cl_Used,error_flow); + if(UdF<0){ + Double use_so_flow = Arith.mul(cl_Used,error_time); + DseFlow = Arith.add(DseFlow,use_so_flow);//累加 主表用量 = 已用 * 系数 + Map UpdMap = new HashMap<>(); + UpdMap.put("use_true_flow",cl_Used); + UpdMap.put("use_so_flow",use_so_flow); + UpdMap.put("status","1");// 生效中 + UpdMap.put("id",id); + bool_flow = yzCardFlowMapper.updFlow(UpdMap)>0; + break; + }else{ + cl_Used = Arith.sub(cl_Used,error_flow); + DseFlow = Arith.add(Arith.add(DseFlow,error_flow),Math.abs(cl_Used));//累加 主表用量 = 包容量 + 超出部分绝对值 + Map UpdMap = new HashMap<>(); + UpdMap.put("use_true_flow",error_flow); + UpdMap.put("use_so_flow",true_flow); + UpdMap.put("status","0");// 已失效 + UpdMap.put("id",id); + //bool_flow = true; + bool_flow = yzCardFlowMapper.updFlow(UpdMap)>0; + } + } + }else{ + //获取最近过期的资费计划 系数 + String Error_time = yzCardFlowMapper.FindError_time(findMap); + xiShu = Error_time!=null && Error_time.length()>0 && Double.parseDouble(Error_time)>=1?Double.parseDouble(Error_time):xiShu; + } + + //3.同步用量历史表 + String now[] = VeDate.getStringDateShort().split("-"); + findMap.put("year",now[0]); + findMap.put("month",now[1]); + findMap.put("day",now[2]); + + String total_flow = yzCardFlowHisMapper.total_flow(findMap);//历史用量 月用量记录 + Double DtFlow = total_flow!=null&&total_flow.length()>0?Double.parseDouble(total_flow):0.0; + //同步 + Double total_flow_now = Arith.sub(ApiUsed,DtFlow); + Double total_show_flow = Arith.mul(ApiUsed,xiShu); + Double total_show_flow_now = Arith.mul(total_flow_now,xiShu); + Integer isExist = yzCardFlowHisMapper.isExist(findMap);//历史用量 月用量记录 + if(isExist!=null && isExist>0){ + Map editMap = new HashMap<>(); + editMap.putAll(findMap); + editMap.put("total_flow",ApiUsed); + editMap.put("total_flow_now",total_flow_now); + editMap.put("total_show_flow",total_show_flow); + editMap.put("total_show_flow_now",total_show_flow_now); + bool_flowHis = yzCardFlowHisMapper.edit(editMap)>0; + }else{ + Map saveMap = new HashMap<>(); + saveMap.putAll(findMap); + saveMap.put("total_flow",ApiUsed); + saveMap.put("total_flow_now",total_flow_now); + saveMap.put("total_show_flow",total_show_flow); + saveMap.put("total_show_flow_now",total_show_flow_now); + bool_flowHis = yzCardFlowHisMapper.save(saveMap)>0; + } + + //同步主表用量 + Double SumFlow = 0.0; + SumFlow = Arith.add(SumFlow,SumErrorFlow_D); + if(InEffectArr!=null && InEffectArr.size()>0){ + for (int i = 0; i < InEffectArr.size(); i++) { + Map Pobj = InEffectArr.get(i); + Double true_flow = Double.parseDouble(Pobj.get("true_flow").toString()); + SumFlow = Arith.add(SumFlow,true_flow); + } + } + //总量 * 系数 + SumFlow = Arith.mul(SumFlow,xiShu); + //返回数据 + Rmap.put("SumFlow",SumFlow); + Rmap.put("total_show_flow",total_show_flow); + Rmap.put("used",total_show_flow); + Rmap.put("bool_info",bool_info); + Rmap.put("bool_flowHis",bool_flowHis); + Rmap.put("bool_flow",bool_flow); + return Rmap; + } + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/CommonlyUsed.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/CommonlyUsed.java new file mode 100644 index 0000000..658d65b --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/CommonlyUsed.java @@ -0,0 +1,28 @@ +package com.yunze.common.utils.yunze; + +import java.util.List; + +/** + * 常用工具类 + * 20201218 ~ 至今 + */ +public class CommonlyUsed { + + /** + * 判断 val 是否在 StrArr + * @param StrArr + * @param val + * @return + */ + public static boolean Val_Is_Arr (List StrArr,String val){ + boolean bool = false; + for (int i = 0; i < StrArr.size(); i++) { + if (val.equals(StrArr.get(i))){ + bool = true; + break; + } + } + return bool; + } + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/Different.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/Different.java new file mode 100644 index 0000000..17a175b --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/Different.java @@ -0,0 +1,468 @@ +package com.yunze.common.utils.yunze; + +import java.util.*; + +/** + * 比较两个 list + */ +public class Different { + + /** + * 获取不同数据 + * @param list1 + * @param list2 + * @return + */ + public static List getDiffrent(List list1, List list2) { + Map map = new HashMap(list1.size() + list2.size()); + List diff = new ArrayList(); + List maxList = list1; + List minList = list2; + if (list2.size() > list1.size()) { + maxList = list2; + minList = list1; + } + + for (String string : maxList) { + map.put(string, 1); + } + + for (String string : minList) { + Integer cc = map.get(string); + if (cc != null) { + map.put(string, ++cc); + continue; + } + map.put(string, 1); + } + + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue() == 1) { + diff.add(entry.getKey()); + } + } + return diff; + } + + + /** + * 获取相同值 + * @param list1 + * @param list2 + * @param lie + * @return + */ + public static List> getIdentical(List list1, List list2,String lie) { + Map map = new HashMap(list1.size() + list2.size()); + List> diff = new ArrayList>(); + List maxList = list1; + List minList = list2; + if (list2.size() > list1.size()) { + maxList = list2; + minList = list1; + } + + for (String string : maxList) { + map.put(string, 1); + } + + for (String string : minList) { + Integer cc = map.get(string); + if (cc != null) { + map.put(string, ++cc); + continue; + } + map.put(string, 1); + } + + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue() == 1) { + + }else{ + Map Obj = new HashMap(); + Obj.put(lie,entry.getKey()); + diff.add(Obj); + } + } + return diff; + } + + /** + * 获取相同数据 + * @param list1 + * @param list2 + * @return + */ + public static List getIdentical(List list1, List list2) { + Map map = new HashMap(list1.size() + list2.size()); + List diff = new ArrayList(); + List maxList = list1; + List minList = list2; + if (list2.size() > list1.size()) { + maxList = list2; + minList = list1; + } + + for (String string : maxList) { + map.put(string, 1); + } + + for (String string : minList) { + Integer cc = map.get(string); + if (cc != null) { + map.put(string, ++cc); + continue; + } + map.put(string, 1); + } + + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue() == 1) { + + }else{ + diff.add(entry.getKey()); + } + } + return diff; + } + + + /** + * 获取不同数据 + * @param list1 + * @param list2 + * @param lie + * @return + */ + public static List> getDiffrent(List list1, List list2,String lie) { + Map map = new HashMap(list1.size() + list2.size()); + List> diff = new ArrayList>(); + List maxList = list1; + List minList = list2; + if (list2.size() > list1.size()) { + maxList = list2; + minList = list1; + } + + for (String string : maxList) { + map.put(string, 1); + } + + for (String string : minList) { + Integer cc = map.get(string); + if (cc != null) { + map.put(string, ++cc); + continue; + } + map.put(string, 1); + } + + for (Map.Entry entry : map.entrySet()) { + if (entry.getValue() == 1) { + Map Obj = new HashMap(); + Obj.put(lie,entry.getKey()); + diff.add(Obj); + } + } + return diff; + } + + + /** + * 删除 字段 相同数据 + * @param listmap + * @param list2 + * @param lie + * @return + */ + public static List> delIdentical(List> listmap, List list2,String lie) { + List> Rmap = new ArrayList>(); + + for (int i = 0; i < listmap.size(); i++) { + Map map = listmap.get(i); + String val = map.get(lie); + boolean bool = false; + for (int j = 0; j < list2.size(); j++) { + if(val.equals(list2.get(j))){ + bool = true; + break; + } + } + if(!bool){ + Rmap.add(map); + } + } + return Rmap; + } + + /** + * 删除 字段 相同数据 + * @param listmap + * @param list2 + * @param lie + * @return + */ + public static List> delIdenticalObj(List> listmap, List list2,String lie) { + List> Rmap = new ArrayList>(); + for (int i = 0; i < listmap.size(); i++) { + Map map = listmap.get(i); + String val = map.get(lie)+""; + boolean bool = false; + for (int j = 0; j < list2.size(); j++) { + if(val.equals(list2.get(j))){ + bool = true; + break; + } + } + if(!bool){ + Rmap.add(map); + } + } + return Rmap; + } + + + + /** + * 判断 val 是否在 list1 中 + * @param list1 + * @param val + * @return + */ + public static boolean Is_existence(List list1, String val) { + boolean bool = false; + for (int i = 0; i > list1,String lie, String val) { + boolean bool = false; + for (int i = 0; i obj = list1.get(i); + if(obj.get(lie).equals(val)){ + bool = true; + break; + } + } + return bool; + } + + + + /** + * 判断 val 是否在 arr 中 + * @param arr + * @param val + * @return + */ + public static boolean Is_existence(String arr[], String val) { + boolean bool = false; + for (int i = 0; i list1, String val) { + boolean bool = false; + for (int i = 0; i list1, Integer val) { + boolean bool = false; + for (int i = 0; i list1 =new ArrayList(); + for(int i=1;i<10;i++) { + list1.add(i+""); + + } + + List list2 =new ArrayList(); + for(int i=5;i<11;i++) { + list2.add(i+""); + } + List list3 =getIdentical(list1,list2); + List> list4 =getIdentical(list2,list1,"iccid"); + + System.out.println(list1); + System.out.println(list2); + System.out.println("不同的值:"+list3); + System.out.println("不同的值:"+list4);*/ + + + /*Objects Wtarr[] = {}; + for (int i = 1; i < 10; i++) { + Wtarr = StringArrAdd(Wtarr, ); + } + for (int i = 1; i < Wtarr.length; i++) { + System.out.println(Wtarr[i]); + }*/ + + } + + public static Object[] StringArrAdd(Object[] custom,Object name) { + //添加姓名 + + if(custom==null) { //若数组为空,定义数组的长度为1 + + custom=new Objects[1]; + + custom[0]=name; + + } else { + //若数组不为空,把数组复制出一个新的,在原数组的基础上加1 + + Object[] copy= Arrays.copyOf(custom, custom.length+1); + + //把原先数组制空 + custom=null; + //把新数组给原先这个数组 + custom=copy; + custom[custom.length-1]=name; + } + return custom; + } + + + + /** + * 获取 数组去重数据 和 重复值 + * List list = new LinkedList (); + * list.add ("电视"); + * list.add ("电视"); + * list.add ("手机"); + * list.add ("冰箱"); + * list.add ("电视"); + * list.add ("空调"); + * list.add ("手机"); + * @param list + * @return + */ + public static Map getListDifference(List list){ + Map Rmap = new HashMap<>(); + Set set = new HashSet (); + List arr = new ArrayList<> (); + String result = ""; + for ( String string : list ) + { + // 表示存在就加不进去了 + if (!set.add (string)) + { + if (!result.contains (string)) + { + result += string + "|"; + arr.add(string); + } + } + } + List resultArr = new ArrayList<>(set); + Rmap.put("only",resultArr);//[手机, 空调, 冰箱, 电视] + Rmap.put("Repeat",arr);//[电视, 手机] + return Rmap; + } + + + /** + * 获取 筛选不重复的某列值 和 重复的 + * @param list + * @param lie + * @return + */ + public static Map getNotRepeating(List> list,String lie) { + Map map = new HashMap(); + List> Rlist = new ArrayList>(); + List> Repeatlist = new ArrayList>(); + + for (int i = 0; i obj = list.get(i); + if(Rlist.size()>0){ + if(Is_existence(Rlist,lie,obj.get(lie).toString())){ + Repeatlist.add(obj); + }else{ + Rlist.add(obj); + } + }else{ + Rlist.add(obj); + } + + } + map.put("Rlist",Rlist); + map.put("Repeatlist",Repeatlist); + return map; + } + + + + + /** + * 获取 筛选不重复的某列值 和 重复的 + * @param list + * @param lie + * @return + */ + public static Map getNotRepeating(List> list,List DB_list,String lie) { + Map map = new HashMap(); + List> Rlist = new ArrayList>();//存在 + List> Repeatlist = new ArrayList>();//不存在 + + for (int i = 0; i obj = list.get(i); + if(Is_existenceStr(DB_list,obj.get(lie).toString())){ + Rlist.add(obj); + }else{ + Repeatlist.add(obj); + } + } + map.put("Rlist",Rlist); + map.put("Repeatlist",Repeatlist); + return map; + } + + + + + + + + + + + + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/EncodingUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/EncodingUtil.java new file mode 100644 index 0000000..1ce9b46 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/EncodingUtil.java @@ -0,0 +1,133 @@ +package com.yunze.common.utils.yunze; + +import java.io.UnsupportedEncodingException; + +/** + * @Auther: zhang feng + * @Date: 2021/06/17/15:57 + * @Description: + */ +public class EncodingUtil { + + + /** + * 将原正确编码的字符串src,转化为编码为srcCharset的字符串 + *

+ * 前提是:确保原字符串的编码是无损(完整的). 无需知道原字符串的具体编码, + * 转化为目标编码的字符串由java库自动实现,无需自己手动实现。 + *

+ * 如果原编码字符串不能转化为目标编码,将会抛出UnsupportedEncodingException + * + * @param src + * @param srcCharset + * @param destCharet + * @return 转换后的字符串 + * @throws UnsupportedEncodingException + */ + public static String convertEncoding_Str(String src, String srcCharset, String destCharet) + throws UnsupportedEncodingException { + byte[] bts = src.getBytes(srcCharset); + return new String(bts, destCharet); + } + + + /** + * 将编码为srcCharset的字节数组src转化为编码为destCharet的字节数组 + * + * @param src + * @param srcCharset + * @param destCharet + * @return + * @throws UnsupportedEncodingException + */ + public static byte[] convertEncoding_ByteArr(byte[] src, String srcCharset, String destCharet) + throws UnsupportedEncodingException { + String s = new String(src, srcCharset); + return s.getBytes(destCharet); + } + + + /** + * 将字节数组byteArr转化为2位16进制字符串,每个16进制之间用空格分割 + * + * @param byteArr + * @return + */ + public static String byteToHex(byte... byteArr) { + if (null == byteArr || byteArr.length == 0) + return ""; + StringBuffer sb = new StringBuffer(); + String tmp = null; + + for (byte b : byteArr) { + + tmp = Integer.toHexString(b); + // 切记:byte进行运算时,会自动转化为int,否则可能会出错 + if (b >>> 31 == 1) { // 最高位为1,负数 + sb.append(tmp.substring(6)); + } else { // 最高位为0,正数 + if (tmp.length() < 2) + sb.append('0'); + sb.append(tmp); + } + sb.append(' '); + } + sb.deleteCharAt(sb.length() - 1); // delete last space + return sb.toString(); + } + + + public static String getEncoding(String str) + { + String encode; + + encode = "UTF-16"; + try { + if (str.equals(new String(str.getBytes(), encode))){ + return encode; + } + } catch (Exception ex) { + } + + encode = "ASCII"; + try { + if (str.equals(new String(str.getBytes(), encode))){ + return "字符串<< " + str + " >>中仅由数字和英文字母组成,无法识别其编码格式"; + } + } catch (Exception ex) { + } + + encode = "ISO-8859-1"; + try { + if (str.equals(new String(str.getBytes(), encode))){ + return encode; + } + } catch (Exception ex) { + } + + encode = "GB2312"; + try { + if (str.equals(new String(str.getBytes(), encode))){ + return encode; + } + } catch (Exception ex) { + } + + encode = "UTF-8"; + try { + if (str.equals(new String(str.getBytes(), encode))){ + return encode; + } + } catch (Exception ex) { + } + + /* + *......待完善 + */ + + return "未识别编码格式"; + } + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/ExcelColumnAnnotation.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/ExcelColumnAnnotation.java new file mode 100644 index 0000000..92ff27b --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/ExcelColumnAnnotation.java @@ -0,0 +1,27 @@ +package com.yunze.common.utils.yunze; + +import java.lang.annotation.*; + +/** + * 自定义实体类所需要的bean 属性 + */ +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ExcelColumnAnnotation { + /** + * Excel标题 + * + * @return + * @author Lynch + */ + String value() default ""; + + /** + * Excel从左往右排列位置 + * + * @return + * @author Lynch + */ + int col() default 0; +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/ExcelConfig.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/ExcelConfig.java new file mode 100644 index 0000000..19141ab --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/ExcelConfig.java @@ -0,0 +1,722 @@ +package com.yunze.common.utils.yunze; + +import com.alibaba.fastjson.JSON; +import org.apache.commons.collections.CollectionUtils; +import org.apache.poi.hssf.usermodel.HSSFDateUtil; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.lang.reflect.Field; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + + + +@Component +public class ExcelConfig { + + + /** + * 导出excel + */ + public static void writeExcel(HttpServletResponse response, List dataList, Class cls){ + Field[] fields = cls.getDeclaredFields(); + List fieldList = Arrays.stream(fields) + .filter(field -> { + ExcelColumnAnnotation annotation = field.getAnnotation(ExcelColumnAnnotation.class); + if (annotation != null && annotation.col() > 0) { + field.setAccessible(true); + return true; + } + return false; + }).sorted(Comparator.comparing(field -> { + int col = 0; + ExcelColumnAnnotation annotation = field.getAnnotation(ExcelColumnAnnotation.class); + if (annotation != null) { + col = annotation.col(); + } + return col; + })).collect(Collectors.toList()); + + Workbook wb = new XSSFWorkbook(); + Sheet sheet = wb.createSheet("Sheet1"); + AtomicInteger ai = new AtomicInteger(); + { + Row row = sheet.createRow(ai.getAndIncrement()); + AtomicInteger aj = new AtomicInteger(); + //写入头部 + fieldList.forEach(field -> { + ExcelColumnAnnotation annotation = field.getAnnotation(ExcelColumnAnnotation.class); + String columnName = ""; + if (annotation != null) { + columnName = annotation.value(); + } + Cell cell = row.createCell(aj.getAndIncrement()); + + CellStyle cellStyle = wb.createCellStyle(); + cellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); + + Font font = wb.createFont(); + cellStyle.setFont(font); + cell.setCellStyle(cellStyle); + cell.setCellValue(columnName); + }); + } + if (CollectionUtils.isNotEmpty(dataList)) { + dataList.forEach(t -> { + Row row1 = sheet.createRow(ai.getAndIncrement()); + AtomicInteger aj = new AtomicInteger(); + fieldList.forEach(field -> { + Class type = field.getType(); + Object value = ""; + try { + value = field.get(t); + } catch (Exception e) { + e.printStackTrace(); + } + Cell cell = row1.createCell(aj.getAndIncrement()); + if (value != null) { + if (type == Date.class) { + cell.setCellValue(value.toString()); + } else { + cell.setCellValue(value.toString()); + } + cell.setCellValue(value.toString()); + } + }); + }); + } + //冻结窗格 + wb.getSheet("Sheet1").createFreezePane(0, 1, 0, 1); + //生成excel文件 + String now=new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); + String exc ="exc-"+now+".xlsx"; + + OutputStream os=null; + try { + response.setContentType("application/vnd.ms-excel"); + response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("Content-disposition", "attachment;filename="+URLEncoder.encode(exc,"utf-8")); + os=response.getOutputStream(); + response.flushBuffer(); + wb.write(os); + } catch (Exception e) { + e.printStackTrace(); + } + } + + //**************************************************************************// + + public List> getExcelListMap(String file) { + Workbook wb =null; + Sheet sheet = null; + Row row = null; + List> list = null; + String cellData = null; + // String filePath = "C:/Users/Administrator/Desktop/1.xlsx"; + String columns[] = {"iccid","card_no","card_define_no","card_type","package_id"}; + wb = readExcel(file); + if(wb != null){ + //用来存放表中数据 + list = new ArrayList>(); + //获取第一个sheet + sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + int colnum = row.getPhysicalNumberOfCells(); + for (int i = 1; i map = new LinkedHashMap(); + row = sheet.getRow(i); + if (row== null) { + System.out.println("this row is null ----------------------"); + continue; + + } + for (int j=0;j map : list) { + for (Map.Entry entry : map.entrySet()) { + System.out.print(entry.getKey()+":"+entry.getValue()+","); + } + System.out.println(); + }*/ + return list; + } + + + public List> getExcelListMap(String file,String[] columns) { + Workbook wb =null; + Sheet sheet = null; + Row row = null; + List> list = null; + String cellData = null; + // String filePath = "C:/Users/Administrator/Desktop/1.xlsx"; + wb = readExcel(file); + if(wb != null){ + //用来存放表中数据 + list = new ArrayList>(); + //获取第一个sheet + sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + int colnum = row.getPhysicalNumberOfCells(); + for (int i = 1; i map = new LinkedHashMap(); + row = sheet.getRow(i); + if (row== null) { + //System.out.println("this row is null ----------------------"); + continue; + + } + for (int j=0;j map : list) { + for (Map.Entry entry : map.entrySet()) { + System.out.print(entry.getKey()+":"+entry.getValue()+","); + } + System.out.println(); + }*/ + return list; + } + + /** + * 追加 生成 Vid + * @param file + * @param columns + * @param maxVid + * @return + */ + public List> getExcelListMap(String file,String[] columns,Long maxVid) { + Workbook wb =null; + Sheet sheet = null; + Row row = null; + List> list = null; + String cellData = null; + // String filePath = "C:/Users/Administrator/Desktop/1.xlsx"; + wb = readExcel(file); + if(wb != null){ + //用来存放表中数据 + list = new ArrayList>(); + //获取第一个sheet + sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + int colnum = row.getPhysicalNumberOfCells(); + for (int i = 1; i map = new LinkedHashMap(); + row = sheet.getRow(i); + if (row== null) { + //System.out.println("this row is null ----------------------"); + continue; + } + for (int j=0;j map : list) { + for (Map.Entry entry : map.entrySet()) { + System.out.print(entry.getKey()+":"+entry.getValue()+","); + } + System.out.println(); + }*/ + return list; + } + + + + /** + * 读取客户信息 + * @param file + * @return + */ + public Map getExcelCustomer(String file,String[] sheet1_columns,String[] sheet2_columns,String[] sheet3_columns) { + Workbook wb =null; + Sheet sheet = null; + Sheet sheet2 = null; + Sheet sheet3 = null; + Row row = null; + Row row2 = null; + Row row3 = null; + List> CMaplist = new ArrayList>();//主表信息 + List> CatArrslist = new ArrayList>();//账号 + List> CpeopleArrslist = new ArrayList>();//人员 + String cellData = null; + // String filePath = "C:/Users/Administrator/Desktop/1.xlsx"; + wb = readExcel(file); + Map AddMap = null; + if(wb != null){ + //用来存放表中数据 + AddMap = new HashMap<>(); + + + //=============[主表信息获取]======================== + //获取sheet + sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + int colnum = row.getPhysicalNumberOfCells(); + for (int i = 1; i map = new LinkedHashMap(); + row = sheet.getRow(i); + if (row== null) { + //System.out.println("this row is null ----------------------"); + continue; + } + for (int j=0;j map = new LinkedHashMap(); + row2 = sheet2.getRow(i); + if (row2== null) { + //System.out.println("this row is null ----------------------"); + continue; + } + for (int j=0;j map = new LinkedHashMap(); + row3 = sheet3.getRow(i); + if (row3== null) { + continue; + } + for (int j=0;j> getReplaceExcel(String file) { + Workbook wb =null; + Sheet sheet = null; + Row row = null; + List> list = null; + String cellData = null; + String columns[] = {"iccid","card_no","card_define_no","package_id","replace_price","express_price","is_system","agent_id"}; + wb = readExcel(file); + if(wb != null){ + //用来存放表中数据 + list = new ArrayList>(); + //获取第一个sheet + sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + int colnum = row.getPhysicalNumberOfCells(); + for (int i = 1; i map = new LinkedHashMap(); + row = sheet.getRow(i); + if (row == null) { + //System.out.println("this row is null ----------------------"); + continue; + } + for (int j=0;j> getPlReplaceExcel(String file) { + Workbook wb =null; + Sheet sheet = null; + Row row = null; + List> list = null; + String cellData = null; + String columns[] = {"iccid","ordNo","newNumber","packageName","consignee","tel","address","expressNumber","express","createTime","info"}; + wb = readExcel(file); + if(wb != null){ + //用来存放表中数据 + list = new ArrayList>(); + //获取第一个sheet + sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + int colnum = row.getPhysicalNumberOfCells(); + for (int i = 1; i map = new LinkedHashMap(); + row = sheet.getRow(i); + if (row == null) { + System.out.println("this row is null ----------------------"); + continue; + + } + for (int j=0;j> getInitFlowExcel(String file) { + Workbook wb =null; + Sheet sheet = null; + Row row = null; + List> list = null; + String cellData = null; + String columns[] = {"new_iccid","old_iccid","reFlow","reMoney"}; + wb = readExcel(file); + if(wb != null){ + //用来存放表中数据 + list = new ArrayList>(); + //获取第一个sheet + sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + int colnum = row.getPhysicalNumberOfCells(); + for (int i = 1; i map = new LinkedHashMap(); + row = sheet.getRow(i); + if (row == null) { + System.out.println("this row is null ----------------------"); + continue; + + } + for (int j=0;j> listMap=excelConfig.getExcelListMap("D:\\钉钉存档\\down.xlsx"); + System.out.println(listMap);*/ + + /* String path="D:\\钉钉存档\\down.xlsx"; + EasyExcel.read(path, ExcelImportCard.class,new ExcelListener()).sheet().doRead(); +*/ + ExcelConfig excelConfig=new ExcelConfig(); + + String[] sheet1_columns = {"dept_name","dname","grade_id","province","city","district","sort_id","credit_code","id_card","address","remarks","affiliation_id","tax_number","sales_id"}; + String[] sheet2_columns ={"dept_name","Cat_Name","Cat_Bank_Name","Cat_Number","Cat_atId","Cat_Address","Cat_User_Name","Cat_Zip_Code"}; + String[] sheet3_columns ={"dept_name","name","is_maste","gender_id","telephone","qq","nailed","email","job_title"}; + Map Rmap = excelConfig.getExcelCustomer("C:\\Users\\54655\\Desktop\\ImportCustomer.xlsx",sheet1_columns,sheet2_columns,sheet3_columns); + System.out.println(JSON.toJSON(Rmap)); + + } + + /** + * 读取 Excel 并赋值 传入 Pmap 属性 + * @param file + * @param columns + * @param Pmap + * @return + */ + public List> getExcelListMap(String file,String[] columns,Map Pmap,String type) { + Workbook wb =null; + Sheet sheet = null; + Row row = null; + List> list = null; + String cellData = null; + // String filePath = "C:/Users/Administrator/Desktop/1.xlsx"; + wb = readExcel(file); + + List Exlist = new ArrayList(); + + if(wb != null){ + //用来存放表中数据 + list = new ArrayList>(); + //获取第一个sheet + sheet = wb.getSheetAt(0); + //获取最大行数 + int rownum = sheet.getPhysicalNumberOfRows(); + //获取第一行 + row = sheet.getRow(0); + //获取最大列数 + int colnum = row.getPhysicalNumberOfCells(); + String ID_type = ""; + if(type!=null && type.length()>0){ + ID_type = type ; + } + + for (int i = 1; i map = new HashMap<>(); + map.putAll(Pmap); + row = sheet.getRow(i); + if (row== null) { + System.out.println("this row is null ----------------------"); + continue; + + } + for (int j=0;j> CSVexcel(String csvFilePath){ + List> rlist = new ArrayList<>(); + try { + //String csvFilePath = "F:\\谷歌下载\\a4f3b472050746ea8f4035648ded7bc7_CardOut.csv"; + // 创建CSV读对象 + CsvReader csvReader = new CsvReader(csvFilePath,',',Charset.forName("GBK")); + // 读表头 csvReader.readHeaders() 读行 csvReader.readRecord() + List headList = new ArrayList<>(); + int i = 0 ; + while (csvReader.readHeaders()){ + // 读一整行 + Map obj = new HashMap<>(); + String row = csvReader.getRawRecord(); + String rows[] = row.split(","); + List list = Arrays.asList(rows); + if(i==0){ + headList = list; + } + i++; + for (int j = 0; j < headList.size() ; j++) { + obj.put(headList.get(j),list.get(j)); + } + rlist.add(obj); + + // + // System.out.println(csvReader.get("Link")); // 读这行的某一列 + } + + }catch (Exception e){ + + } + return rlist; + } + + /** + * 写入文件 + * @param list + * @param savePath + * @param PageName + * @param Pagesize 65536 + */ + public void generateExcel(List> list, String savePath,String PageName,int Pagesize) { + // 创建HSSFWorkbook对象(excel的文档对象) + HSSFWorkbook workbook = new HSSFWorkbook(); + // 建立新的sheet对象(excel的表单) + Map heard = null; + Pagesize = Pagesize>65536?65536:Pagesize;//不能超过poi 最大限制 + + try { + int index = 0; + String PName = PageName +"-"+ (Pagesize*index)+"-"+(Pagesize*(index+1)); + HSSFSheet sheet = workbook.createSheet(PName); + //sheet.setDefaultRowHeightInPoints(12);// 设置列高 + //sheet.setDefaultColumnWidth(40);// 设置列宽 + + for (int i = 0, len = list.size(); i < len; i++) { + HSSFRow row = sheet.createRow((i) - (index * Pagesize)); + if ((i + 1) % Pagesize == 0) { + index+=1; + PName = PageName +"-"+ (Pagesize*index)+"-"+(Pagesize*(index+1)); + sheet = workbook.createSheet(PName); + row = sheet.createRow(0); + int j = 0; + for(String key:heard.keySet()){ + if(key!=null){ + Object value = heard.get(key); + value = value!=null?value:""; + row.createCell(j).setCellValue(value.toString()); + j++; + } + } + } + if(i==0){ + heard = list.get(i);//获取表头 + } + //row = sheet.createRow(i); + + Map obj = list.get(i); + if(obj!=null){ + int j = 0; + for(String key:obj.keySet()){ + if(key!=null){ + Object value = obj.get(key); + value = value!=null?value:""; + row.createCell(j).setCellValue(value.toString()); + j++; + } + } + } + } + }catch (Exception e){ + System.out.println("写入数据错误!"+e.getMessage().toString()); + } + + // 输出Excel文件 + try { + FileOutputStream fos = new FileOutputStream(new File(savePath)); + workbook.write(fos); + workbook.close(); + fos.close(); + } catch (Exception e) { + System.out.println("生成excel文档失败"+e.getMessage().toString()); + } + } + + + public String export(List> list, String f) { + String name = ""; + HSSFWorkbook book = new HSSFWorkbook(); + HSSFSheet sheet = book.createSheet("stud"); +// 声明一行 + HSSFRow row = sheet.createRow(0); + row = sheet.createRow(0); + row.createCell(0).setCellValue("身份"); + row.createCell(1).setCellValue("信用"); + int index = 0;//记录额外创建的sheet数量 + for (int i = 0; i < list.size(); i++) { + if ((i + 1) % 65535 == 0) { + sheet = book.createSheet("stud" + index); + row = sheet.createRow(0); + row.createCell(0).setCellValue("身份"); + row.createCell(1).setCellValue("信用"); + index++; + } + row = sheet.createRow((i + 1) - (index * 65535)); +// 第四步,创建单元格,并设置值 + row.createCell((short) 0).setCellValue(list.get(i).get("info").toString()); + row.createCell((short) 1).setCellValue(list.get(i).get("score").toString()); + } +// 第六步,将文件存到指定位置 + String fileName = ""; + try { + fileName = f + "/download/导出.xls"; + name = "导出.xls"; + File file = new File(fileName); + if (file.exists()) { + file.delete(); + } + FileOutputStream fout = new FileOutputStream(fileName); + book.write(fout); + fout.close(); + } catch (Exception e) { + e.printStackTrace(); + } + return name; + + } + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/GetShowStatIdArr.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/GetShowStatIdArr.java new file mode 100644 index 0000000..aa6e56a --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/GetShowStatIdArr.java @@ -0,0 +1,38 @@ +package com.yunze.common.utils.yunze; + +import org.springframework.stereotype.Component; + +@Component +public class GetShowStatIdArr { + + + public String GetShowStatId (String status_id){ + //卡状态对应的卡状态描述 + String status_ShowId = "8"; + if(status_id.equals("13") || status_id.equals("14") || status_id.equals("22") || status_id.equals("19")){ + status_ShowId = "1"; + }if(status_id.equals("17") ){ + status_ShowId = "2"; + }if(status_id.equals("9") || status_id.equals("7") || status_id.equals("15")){ + status_ShowId = "3"; + }if(status_id.equals("1")){ + status_ShowId = "4"; + }if(status_id.equals("3") || status_id.equals("2") || status_id.equals("10") || status_id.equals("11") || + status_id.equals("20")|| status_id.equals("30")|| status_id.equals("31") || status_id.equals("32") || + status_id.equals("21")|| status_id.equals("27")|| status_id.equals("33") || status_id.equals("12")){ + status_ShowId = "5"; + }if(status_id.equals("4")){ + status_ShowId = "6"; + }if(status_id.equals("16")|| status_id.equals("23")|| status_id.equals("24") || status_id.equals("5") || + status_id.equals("6") || status_id.equals("28")|| status_id.equals("26") || status_id.equals("18")|| + status_id.equals("25")){ + status_ShowId = "7"; + }if(status_id.equals("8") || status_id.equals("29")){ + status_ShowId = "8"; + } + + + return status_ShowId; + } + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/HttpClientUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/HttpClientUtil.java new file mode 100644 index 0000000..9e328d3 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/HttpClientUtil.java @@ -0,0 +1,115 @@ +package com.yunze.common.utils.yunze; + +import com.alibaba.fastjson.JSONObject; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; + +import java.io.IOException; +import java.nio.charset.Charset; + +public class HttpClientUtil { + + /** + * 传递string参数 + */ + public static String doPostStr(String url, String json){ + String result = null; + + HttpPost post = null; + try { + CloseableHttpClient httpClient = HttpClients.createDefault(); + post = new HttpPost(url); + // 构造消息头 + post.setHeader("Content-type", "application/json; charset=utf-8"); + // 构建消息实体 + StringEntity entity = new StringEntity(json, Charset.forName("UTF-8")); + post.setEntity(entity); + CloseableHttpResponse response = httpClient.execute(post); + + // 检验返回码 + int statusCode = response.getStatusLine().getStatusCode(); + if(statusCode == HttpStatus.SC_OK){ + result= EntityUtils.toString(response.getEntity(),"utf-8"); + + } + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(post != null){ + try { + post.releaseConnection(); + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + System.out.println(result); + return result; + } + + /** + * post 请求 + */ + public static String doPostJson(String url, JSONObject json){ + String result = null; + + HttpPost post = null; + try { + CloseableHttpClient httpClient = HttpClients.createDefault(); + post = new HttpPost(url); + // 构造消息头 + post.setHeader("Content-type", "application/json; charset=utf-8"); + // 构建消息实体 + StringEntity entity = new StringEntity(json.toString(), Charset.forName("UTF-8")); + post.setEntity(entity); + CloseableHttpResponse response = httpClient.execute(post); + + // 检验返回码 + int statusCode = response.getStatusLine().getStatusCode(); + if(statusCode == HttpStatus.SC_OK){ + result= EntityUtils.toString(response.getEntity(),"utf-8"); + + } + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(post != null){ + try { + post.releaseConnection(); + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + System.out.println(result); + return result; + } + + /** + *get 请求 + */ + public static String doGet(String url) throws ClientProtocolException, IOException { + String result = null; + DefaultHttpClient client = new DefaultHttpClient(); + org.apache.http.client.methods.HttpGet getHttp = new org.apache.http.client.methods.HttpGet(url); + HttpResponse res =client.execute(getHttp); + HttpEntity entity =res.getEntity(); + if(null!=entity){ + result = EntityUtils.toString(entity,"utf-8"); + //System.out.println(result); + } + System.out.println(result); + return result; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/HttpUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/HttpUtil.java new file mode 100644 index 0000000..514a252 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/HttpUtil.java @@ -0,0 +1,276 @@ +package com.yunze.common.utils.yunze; + + +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class HttpUtil { + private static CloseableHttpClient httpClient; + + static { + PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); + cm.setMaxTotal(100); + cm.setDefaultMaxPerRoute(20); + cm.setDefaultMaxPerRoute(50); + httpClient = HttpClients.custom().setConnectionManager(cm).build(); + } + + public static String get(String url) { + CloseableHttpResponse response = null; + BufferedReader in = null; + String result = ""; + try { + HttpGet httpGet = new HttpGet(url); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000).setSocketTimeout(30000).build(); + httpGet.setConfig(requestConfig); + httpGet.setConfig(requestConfig); + httpGet.addHeader("Content-type", "application/json; charset=utf-8"); + httpGet.setHeader("Accept", "application/json"); + response = httpClient.execute(httpGet); + in = new BufferedReader(new InputStreamReader(response.getEntity().getContent(),"utf-8")); + StringBuffer sb = new StringBuffer(""); + String line = ""; + String NL = System.getProperty("line.separator"); + while ((line = in.readLine()) != null) { + sb.append(line + NL); + } + in.close(); + result = sb.toString(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (null != response) { + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + } + + public static String post(String url, String jsonString) { + CloseableHttpResponse response = null; + BufferedReader in = null; + String result = ""; + try { + HttpPost httpPost = new HttpPost(url); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000).setSocketTimeout(30000).build(); + httpPost.setConfig(requestConfig); + httpPost.setConfig(requestConfig); + httpPost.addHeader("Content-type", "application/json; charset=utf-8"); + httpPost.setHeader("Accept", "application/json"); + httpPost.setEntity(new StringEntity(jsonString, Charset.forName("UTF-8"))); + response = httpClient.execute(httpPost); + in = new BufferedReader(new InputStreamReader(response.getEntity().getContent(),"utf-8")); + StringBuffer sb = new StringBuffer(""); + String line = ""; + String NL = System.getProperty("line.separator"); + while ((line = in.readLine()) != null) { + sb.append(line + NL); + } + in.close(); + result = sb.toString(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (null != response) { + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + } + + + + + public static String post(String url, String jsonString, Map headers) { + CloseableHttpResponse response = null; + BufferedReader in = null; + String result = ""; + try { + HttpPost httpPost = new HttpPost(url); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000).setSocketTimeout(30000).build(); + httpPost.setConfig(requestConfig); + httpPost.setConfig(requestConfig); + httpPost.addHeader("Content-type", "application/json; charset=utf-8"); + httpPost.setHeader("Accept", "application/json"); + + if (headers!=null){ + for(String key:headers.keySet()){ + //System.out.println("key="+key+" value=" +headers.get(key)); + httpPost.setHeader(key, headers.get(key)); + } + } + httpPost.setEntity(new StringEntity(jsonString, Charset.forName("UTF-8"))); + response = httpClient.execute(httpPost); + in = new BufferedReader(new InputStreamReader(response.getEntity().getContent(),"utf-8")); + StringBuffer sb = new StringBuffer(""); + String line = ""; + String NL = System.getProperty("line.separator"); + while ((line = in.readLine()) != null) { + sb.append(line + NL); + } + in.close(); + result = sb.toString(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (null != response) { + response.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + } + + + + + + + + + + /** + * 获取Json数据 + * + * @param request + * @return + */ + public static String getJsonParam(HttpServletRequest request) { + + String jsonParam = ""; + ServletInputStream inputStream = null; + try { + int contentLength = request.getContentLength(); + if (!(contentLength < 0)) { + byte[] buffer = new byte[contentLength]; + inputStream = request.getInputStream(); + for (int i = 0; i < contentLength; ) { + int len = inputStream.read(buffer, i, contentLength); + if (len == -1) { + break; + } + i += len; + } + jsonParam = new String(buffer, "utf-8"); + } + } catch (IOException e) { + //System.out.println("参数转换成json异常 {\"+e+\"}"); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + //System.out.println("参数转换成json异常 {" + e + "}"); + } + } + } + return jsonParam; + } + + + /** + * json的数据格式 请求体 请求 + * @param url + * @param body + * @return + * @throws Exception + */ + public static String sendPostJson(String url, String body) throws Exception { + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(url); + httpPost.addHeader("Content-Type", "application/json"); + httpPost.setEntity(new StringEntity(body)); + CloseableHttpResponse response = httpClient.execute(httpPost); + //System.out.println(response.getStatusLine().getStatusCode() + "\n"); + HttpEntity entity = response.getEntity(); + String responseContent = EntityUtils.toString(entity, "UTF-8"); + //System.out.println(responseContent); + response.close(); + httpClient.close(); + return responseContent; + } + + /** + * form-data post + * @param url + * @param map + * @return + * @throws Exception + */ + public static String doPost(String url, Map map) throws Exception { + String result = ""; + CloseableHttpClient client = null; + CloseableHttpResponse response = null; + RequestConfig defaultRequestConfig = RequestConfig.custom().setSocketTimeout(550000).setConnectTimeout(550000) + .setConnectionRequestTimeout(550000).setStaleConnectionCheckEnabled(true).build(); + client = HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build(); + // client = HttpClients.createDefault(); + URIBuilder uriBuilder = new URIBuilder(url); + + HttpPost httpPost = new HttpPost(uriBuilder.build()); + httpPost.setHeader("Connection", "Keep-Alive"); + httpPost.setHeader("Charset", "utf-8"); + httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); + Iterator> it = map.entrySet().iterator(); + List params = new ArrayList(); + + while (it.hasNext()) { + Map.Entry entry = it.next(); + NameValuePair pair = new BasicNameValuePair(entry.getKey(), entry.getValue().toString()); + params.add(pair); + } + httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); + try { + response = client.execute(httpPost); + if (response != null) { + HttpEntity resEntity = response.getEntity(); + if (resEntity != null) { + result = EntityUtils.toString(resEntity, "utf-8"); + } + } + } catch (ClientProtocolException e) { + throw new RuntimeException("创建连接失败" + e); + } catch (IOException e) { + throw new RuntimeException("创建连接失败" + e); + } + + return result; + } + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/ID_Generate.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/ID_Generate.java new file mode 100644 index 0000000..a5fee62 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/ID_Generate.java @@ -0,0 +1,67 @@ +package com.yunze.common.utils.yunze; + +import java.util.ArrayList; +import java.util.List; + + +/** + * +* @ClassName: ID_Generate +* @Description: ID生成器(这里用一句话描述这个类的作用) +* @author zhangfeng +* @date 2018年12月14日 上午9:59:42 +* + */ +public class ID_Generate { + + /** + * 生成单个id编号 + * @param t_name 表名 + * @param ct 当天数据数量 + * @param leng 生成编号位数 + * @return + */ + public static String G_id(String t_name,Integer ct,int leng) { + String Times[]=VeDate.getYyyyAndMm();//获取当前日期YYYYMMDD + String TIme_p=Times[0]+Times[1]+Times[2];//日期部分 + ct=ct+1; + String ID=""; + for (int i = 0; i < (leng-(ct.toString()).length()); i++) { + ID+="0"; + } + ID=ID+ct;//编号 + return t_name+TIme_p+ID; + } + + /** + * 生成单个id编号 + * @param t_name 表名 + * @param ct 当天数据数量 + * @param leng 生成编号位数 + * @param ID_COUNT 生成多少个编号 + * @return + */ + public static List G_id(String t_name,Integer ct,int leng,int ID_COUNT) { + List olist=new ArrayList(); + String Times[]=VeDate.getYyyyAndMm();//获取当前日期YYYYMMDD + String TIme_p=Times[0]+Times[1]+Times[2];//日期部分 + for (int j = 0; j < ID_COUNT; j++) { + ct=ct+1; + String ID=""; + for (int i = 0; i < (leng-(ct.toString()).length()); i++) { + ID+="0"; + } + ID=ID+ct;//编号 + olist.add(t_name+TIme_p+ID); + } + + return olist; + } + + public static void main(String[] args) { + List olist=ID_Generate.G_id("GSCN", 0, 4, 101); + for (int i = 0; i < olist.size(); i++) { + System.out.println(olist.get(i)); + } + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/MD5Util.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/MD5Util.java new file mode 100644 index 0000000..c71bb18 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/MD5Util.java @@ -0,0 +1,63 @@ +package com.yunze.common.utils.yunze; + +import java.security.MessageDigest; + +/** + * 1.MD5加密字符串(32位大写) + * 2.MD5加密字符串(32位小写) + *

+ * MD5在线加密:https://md5jiami.51240.com/ + * 3.将二进制字节数组转换为十六进制字符串 + * 4.Unicode中文编码转换成字符串 + */ +public class MD5Util { + + private final static String[] hexDigits = {"0", "1", "2", "3", "4", "5", "6", "7", + "8", "9", "a", "b", "c", "d", "e", "f"}; + + /** + * 转换字节数组为16进制字串 + * @param b 字节数组 + * @return 16进制字串 + */ + public static String byteArrayToHexString(byte[] b) { + StringBuilder resultSb = new StringBuilder(); + for (byte aB : b) { + resultSb.append(byteToHexString(aB)); + } + return resultSb.toString(); + } + + /** + * 转换byte到16进制 + * @param b 要转换的byte + * @return 16进制格式 + */ + private static String byteToHexString(byte b) { + int n = b; + if (n < 0) { + n = 256 + n; + } + int d1 = n / 16; + int d2 = n % 16; + return hexDigits[d1] + hexDigits[d2]; + } + + /** + * MD5编码 + * @param origin 原始字符串 + * @return 经过MD5加密之后的结果 + */ + public static String MD5Encode(String origin) { + String resultString = null; + try { + resultString = origin; + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(resultString.getBytes("UTF-8")); + resultString = byteArrayToHexString(md.digest()); + } catch (Exception e) { + e.printStackTrace(); + } + return resultString; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/OutECImei.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/OutECImei.java new file mode 100644 index 0000000..bc7421d --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/OutECImei.java @@ -0,0 +1,43 @@ +package com.yunze.common.utils.yunze; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; + +import java.util.*; + +/** + * @Auther: zhang feng + * @Date: 2021/08/20/12:24 + * @Description: + */ +public class OutECImei { + + + public String getSign(Map map,String key){//入参为:appid,password,version,iccid,timestamp,sign + Iterator iterator = map.keySet().iterator(); + while (iterator.hasNext()){// 循环取键值进行判断 + String m = iterator.next();// 键 + if(m.startsWith("sign")){ + iterator.remove();// 移除map中以a字符开头的键对应的键值对 + } + if(m.startsWith("iccids")){ + iterator.remove(); + } + } + List list=new ArrayList<>(map.keySet()); + Collections.sort(list); + StringBuffer sb=new StringBuffer(); + for(int i=0;i1 && currenPage<=pageCount){ + //点击上一页时 新的当前页面=当前页面-1 + prePage=currenPage-1; + }else{ + //否则点击第一页时还是第一页 + prePage=firstPage; + } + // 赋值总页数 + lastPage=pageCount; + //(给下一页赋值) 如果当前页大于0并且小于总页数 则下一页可以加1 + if(curren>0 && currenPage { + + private String code; + private String msg; + private T data; + + public Result(String code, String msg, T data) { + this.code = code; + this.msg = msg; + this.data = data; + } + + public Result(){ + super(); + } + + public String getCode() { + return code; + } + + public void setCode(String 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; + } + + @Override + public String toString() { + return "Response{" + + "code='" + code + '\'' + + ", msg='" + msg + '\'' + + ", data=" + data + + '}'; + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/SHA256Util.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/SHA256Util.java new file mode 100644 index 0000000..b83b28f --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/SHA256Util.java @@ -0,0 +1,48 @@ +package com.yunze.common.utils.yunze; + +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * @Auther: zhang feng + * @Date: 2021/07/21/17:19 + * @Description: + */ +public class SHA256Util { + + public static void main(String[] args) { + System.out.println(getSHA256StrJava("sdchinacmsdydwlwpt017")); + } + + public static String getSHA256StrJava(String str) { + + MessageDigest messageDigest; + String encodeStr = ""; + try { + messageDigest = MessageDigest.getInstance("SHA-256"); + messageDigest.update(str.getBytes("UTF-8")); + encodeStr = byte2Hex(messageDigest.digest()); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return encodeStr; + } + + private static String byte2Hex(byte[] bytes) { + StringBuffer stringBuffer = new StringBuffer(); + String temp = null; + for (int i = 0; i < bytes.length; i++) { + temp = Integer.toHexString(bytes[i] & 0xFF); + if (temp.length() == 1) { +//1得到一位的进行补0操作 + stringBuffer.append("0"); + } + stringBuffer.append(temp); + } + return stringBuffer.toString(); + } + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/Upload.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/Upload.java new file mode 100644 index 0000000..cc7f82f --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/Upload.java @@ -0,0 +1,33 @@ +package com.yunze.common.utils.yunze; + +import java.io.File; +import java.io.IOException; + +/** + * 上传文件帮助类 + * @Auther: zhang feng + * @Date: 2021/03/05/14:48 + * @Description: + */ +public class Upload { + + /** + * 判断路径是否存在,否:创建此路径 + * @param file + * @return + * @throws IOException + */ + public static File mkdirsmy(File file) throws IOException{ + if (!file.exists()) { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + file.createNewFile(); + } + return file; + } + + + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/UrlUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/UrlUtil.java new file mode 100644 index 0000000..20c7a98 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/UrlUtil.java @@ -0,0 +1,89 @@ +package com.yunze.common.utils.yunze; + +import java.util.Iterator; +import java.util.Map; + +public class UrlUtil { + + /** + * 将参数集合转换为get请求地址 + * + * @param url + * @param params + * @return + */ + public static String getUrl(String url, Map params) { + // 添加url参数 + if (params != null) { + Iterator it = params.keySet().iterator(); + StringBuffer sb = null; + while (it.hasNext()) { + String key = it.next(); + Object value = ""; + if (params.get(key) != null) { + value = params.get(key); + } + + if (sb == null) { + sb = new StringBuffer(); + sb.append("?"); + } else { + sb.append("&"); + } + sb.append(key); + sb.append("="); + sb.append(value); + } + url += sb.toString(); + } + //System.out.println(url); + return url; + } + + /** + * 中文转Unicode + * + * @param gbString + * 待转换的字符串 + * @return 字符串 + */ + public static String gbEncoding(String gbString) { + char[] utfBytes = gbString.toCharArray(); + String unicodeBytes = ""; + for (int byteIndex = 0; byteIndex < utfBytes.length; byteIndex++) { + String hexB = Integer.toHexString(utfBytes[byteIndex]); // 转换为16进制整型字符串 + if (hexB.length() <= 2) { + hexB = "00" + hexB; + } + unicodeBytes = unicodeBytes + "\\u" + hexB; + } + //System.out.println("unicodeBytes is: " + unicodeBytes); + return unicodeBytes; + } + + /** + * Unicode转中文 + * + * @param dataStr + * 待转换的字符串 + * @return 字符串 + */ + public static String decodeUnicode(String dataStr) { + int start = 0; + int end = 0; + final StringBuffer buffer = new StringBuffer(); + while (start > -1) { + end = dataStr.indexOf("\\u", start + 2); + String charStr = ""; + if (end == -1) { + charStr = dataStr.substring(start + 2, dataStr.length()); + } else { + charStr = dataStr.substring(start + 2, end); + } + char letter = (char) Integer.parseInt(charStr, 16); // 16进制parse整形字符串。 + buffer.append(new Character(letter).toString()); + start = end; + } + return buffer.toString(); + } +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/VeDate.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/VeDate.java new file mode 100644 index 0000000..d630ef1 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/VeDate.java @@ -0,0 +1,884 @@ +package com.yunze.common.utils.yunze; + + +import java.text.ParseException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.*; + +/*** + * + * @ClassName: VeDate + * @Description: 格式化时间帮助类(这里用一句话描述这个类的作用) + * @author zhangfeng + * @date 2018年8月15日 + */ +public class VeDate { + /** + * 获取现在时间 + * + * @return 返回时间类型 yyyy-MM-dd HH:mm:ss + */ + public static Date getNowDate() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + ParsePosition pos = new ParsePosition(8); + Date currentTime_2 = formatter.parse(dateString, pos); + return currentTime_2; + } + + /** + * 获取现在时间 + * + * @return返回短时间格式 yyyy-MM-dd + */ + public static Date getNowDateShort() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(currentTime); + ParsePosition pos = new ParsePosition(8); + Date currentTime_2 = formatter.parse(dateString, pos); + return currentTime_2; + } + + /** + * 获取现在时间 + * + * @return返回短时间格式 yyyyMMdd + */ + public static String getNowDateShortNuber() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(currentTime); + System.out.println(dateString); + String times[]=dateString.toString().split("-"); + return times[0]+times[1]+times[2]; + } + + + + + /** + * 获取现在时间 + * + * @return返回字符串格式 yyyy-MM-dd HH:mm:ss + */ + public static String getStringDate() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 获取一个月的最后一天 + * @param yyyy_MM_dd + * @return + */ + public static String getEndDateOfMonth_yyyy_MM_DD(String yyyy_MM_dd) {// yyyy-MM-dd + String[] Strs = yyyy_MM_dd.split("-"); + String str = Strs[0]+"-"+Strs[1]+"-"; + String month = Strs[1]; + // System.out.println("month "+month); + //String yyyy_MM_dd = str.substring(0, 4)+"-"+month+"-01"; + int mon = Integer.parseInt(month); + if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) { + str += "31"; + } else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) { + str += "30"; + } else { + if (isLeapYear(yyyy_MM_dd)) { + str += "29"; + } else { + str += "28"; + } + } + return str; + } + + /** + * 获取现在时间 + * + * @return返回字符串格式 yyyy-MM-dd HH:mm:ss.SSS + */ + public static String getStringDateSSS() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + String dateString = formatter.format(currentTime); + return dateString; + } + + + + /** + * 获取现在时间 + * + * @return 返回短时间字符串格式yyyy-MM-dd + */ + public static String getStringDateShort() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(currentTime); + return dateString; + } + /** + * 获取当前年月集合 + * @return + */ + public static String[] getYyyyAndMm(){ + String data=getStringDateShort(); + return data.split("-"); + } + + /** + * 获取时间 小时:分;秒 HH:mm:ss + * + * @return + */ + public static String getTimeShort() { + SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); + Date currentTime = new Date(); + String dateString = formatter.format(currentTime); + return dateString; + } + /** + * 字符串转换成时间格式 + * @param date + * @return + */ + public static String GetHH_MM_SS(String strDate){ + String str=strDate.split(" ")[1]; + return str; + } + + + /** + * 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss + * + * @param strDate + * @return + */ + public static Date strToDateLong(String strDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(strDate, pos); + return strtodate; + } + + /** + * 格式化 日期 + * @param strDate + * @return + */ + public static Date strToDateLong(String strDate,String Format) { + SimpleDateFormat formatter = new SimpleDateFormat(Format); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(strDate, pos); + return strtodate; + } + + + /** + * 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss + * + * @param dateDate + * @return + */ + public static String dateToStrLong(Date dateDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(dateDate); + return dateString; + } + + /** + * 将短时间格式时间转换为字符串 yyyy-MM-dd + * + * @param dateDate + * @param + * @return + */ + public static String dateToStr(Date dateDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(dateDate); + return dateString; + } + + /** + * 将短时间格式字符串转换为时间 yyyy-MM-dd + * + * @param strDate + * @return + */ + public static Date strToDate(String strDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(strDate, pos); + return strtodate; + } + + /** + * 得到现在时间 + * + * @return + */ + public static Date getNow() { + Date currentTime = new Date(); + return currentTime; + } + + /** + * 提取一个月中的最后一天 + * + * @param day + * @return + */ + public static Date getLastDate(long day) { + Date date = new Date(); + long date_3_hm = date.getTime() - 3600000 * 34 * day; + Date date_3_hm_date = new Date(date_3_hm); + return date_3_hm_date; + } + + /** + * 得到现在时间 + * + * @return 字符串 yyyyMMdd HHmmss + */ + public static String getStringToday() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd HHmmss"); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 得到现在小时 + */ + public static String getHour() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + String hour; + hour = dateString.substring(11, 13); + return hour; + } + + /** + * 得到现在分钟 + * + * @return + */ + public static String getTime() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + String min; + min = dateString.substring(14, 16); + return min; + } + + /** + * 根据用户传入的时间表示格式,返回当前时间的格式 如果是yyyyMMdd,注意字母y不能大写。 + * + * @param sformat + * yyyyMMddhhmmss + * @return + */ + public static String getUserDate(String sformat) { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat(sformat); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 二个小时时间间的差值,必须保证二个时间都是"HH:MM"的格式,返回字符型的分钟 + */ + public static String getTwoHour(String st1, String st2) { + String[] kk = null; + String[] jj = null; + kk = st1.split(":"); + jj = st2.split(":"); + if (Integer.parseInt(kk[0]) < Integer.parseInt(jj[0])) + return "0"; + else { + double y = Double.parseDouble(kk[0]) + Double.parseDouble(kk[1]) / 60; + double u = Double.parseDouble(jj[0]) + Double.parseDouble(jj[1]) / 60; + if ((y - u) > 0) + return y - u + ""; + else + return "0"; + } + } + + /** + * 得到二个日期间的间隔天数 + */ + public static String getTwoDay(String sj1, String sj2) { + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + long day = 0; + try { + Date date = myFormatter.parse(sj1); + Date mydate = myFormatter.parse(sj2); + day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000); + } catch (Exception e) { + return ""; + } + return day + ""; + } + + /** + * 时间前推或后推分钟,其中JJ表示分钟. + */ + public static String getPreTime(String sj1, String jj) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String mydate1 = ""; + try { + Date date1 = format.parse(sj1); + long Time = (date1.getTime() / 1000) + Integer.parseInt(jj) * 60; + date1.setTime(Time * 1000); + mydate1 = format.format(date1); + } catch (Exception e) { + } + return mydate1; + } + + /** + * 得到一个时间延后或前移几天的时间,nowdate为时间,delay为前移或后延的天数 + */ + public static String getNextDay(String nowdate, String delay) { + try{ + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + String mdate = ""; + Date d = strToDate(nowdate); + long myTime = (d.getTime() / 1000) + Integer.parseInt(delay) * 24 * 60 * 60; + d.setTime(myTime * 1000); + mdate = format.format(d); + return mdate; + }catch(Exception e){ + return ""; + } + } + + /** + * 判断是否润年 + * + * @param ddate + * @return + */ + public static boolean isLeapYear(String ddate) { + + /** + * 详细设计: 1.被400整除是闰年,否则: 2.不能被4整除则不是闰年 3.能被4整除同时不能被100整除则是闰年 + * 3.能被4整除同时能被100整除则不是闰年 + */ + Date d = strToDate(ddate); + GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance(); + gc.setTime(d); + int year = gc.get(Calendar.YEAR); + if ((year % 400) == 0) + return true; + else if ((year % 4) == 0) { + if ((year % 100) == 0) + return false; + else + return true; + } else + return false; + } + + /** + * 返回美国时间格式 26 Apr 2006 + * + * @param str + * @return + */ + public static String getEDate(String str) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(str, pos); + String j = strtodate.toString(); + String[] k = j.split(" "); + return k[2] + k[1].toUpperCase() + k[5].substring(2, 4); + } + + /** + * 获取一个月的最后一天 + * + * @param dat + * @return + */ + public static String getEndDateOfMonth(String dat) {// yyyyMM + String str = dat.substring(0, 6); + String month = dat.substring(4, 6); + // System.out.println("month "+month); + String yyyy_MM_dd = str.substring(0, 4)+"-"+month+"-01"; + int mon = Integer.parseInt(month); + if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) { + str += "31"; + } else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) { + str += "30"; + } else { + if (isLeapYear(yyyy_MM_dd)) { + str += "29"; + } else { + str += "28"; + } + } + return str; + } + + + + /** + * 获取一个月的最后一天 + * + * @param dat + * @return + */ + public static String getEndDateOfMonthTime(String dat) {// yyyyMM + String str = dat.substring(0, 6); + String month = dat.substring(4, 6); + // System.out.println("month "+month); + String yyyy_MM_dd = str.substring(0, 4)+"-"+month+"-01"; + int mon = Integer.parseInt(month); + if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) { + str += "31"; + } else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) { + str += "30"; + } else { + if (isLeapYear(yyyy_MM_dd)) { + str += "29"; + } else { + str += "28"; + } + } + return str; + } + + + + /** + * 判断二个时间是否在同一个周 + * + * @param date1 + * @param date2 + * @return + */ + public static boolean isSameWeekDates(Date date1, Date date2) { + Calendar cal1 = Calendar.getInstance(); + Calendar cal2 = Calendar.getInstance(); + cal1.setTime(date1); + cal2.setTime(date2); + int subYear = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR); + if (0 == subYear) { + if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) + return true; + } else if (1 == subYear && 11 == cal2.get(Calendar.MONTH)) { + // 如果12月的最后一周横跨来年第一周的话则最后一周即算做来年的第一周 + if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) + return true; + } else if (-1 == subYear && 11 == cal1.get(Calendar.MONTH)) { + if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) + return true; + } + return false; + } + + /** + * 产生周序列,即得到当前时间所在的年度是第几周 + * + * @return + */ + public static String getSeqWeek() { + Calendar c = Calendar.getInstance(Locale.CHINA); + String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR)); + if (week.length() == 1) + week = "0" + week; + String year = Integer.toString(c.get(Calendar.YEAR)); + return year + week; + } + + /** + * 获得一个日期所在的周的星期几的日期,如要找出2002年2月3日所在周的星期一是几号 + * + * @param sdate + * @param num + * @return + */ + public static String getWeek(String sdate, String num) { + // 再转换为时间 + Date dd = VeDate.strToDate(sdate); + Calendar c = Calendar.getInstance(); + c.setTime(dd); + if (num.equals("1")) // 返回星期一所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); + else if (num.equals("2")) // 返回星期二所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); + else if (num.equals("3")) // 返回星期三所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); + else if (num.equals("4")) // 返回星期四所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY); + else if (num.equals("5")) // 返回星期五所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); + else if (num.equals("6")) // 返回星期六所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); + else if (num.equals("0")) // 返回星期日所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); + return new SimpleDateFormat("6").format(c.getTime()); + } + + /** + * 根据一个日期,返回是星期几的字符串 + * + * @param sdate + * @return + */ + public static String getWeek(String sdate) { + // 再转换为时间 + Date date = VeDate.strToDate(sdate); + Calendar c = Calendar.getInstance(); + c.setTime(date); + // int hour=c.get(Calendar.DAY_OF_WEEK); + // hour中存的就是星期几了,其范围 1~7 + // 1=星期日 7=星期六,其他类推 + return new SimpleDateFormat("EEEE").format(c.getTime()); + } + public static String getWeekStr(String sdate){ + String str = ""; + str = VeDate.getWeek(sdate); + if("1".equals(str)){ + str = "星期日"; + }else if("2".equals(str)){ + str = "星期一"; + }else if("3".equals(str)){ + str = "星期二"; + }else if("4".equals(str)){ + str = "星期三"; + }else if("5".equals(str)){ + str = "星期四"; + }else if("6".equals(str)){ + str = "星期五"; + }else if("7".equals(str)){ + str = "星期六"; + } + return str; + } + + /** + * 两个时间之间的天数 + * + * @param date1 + * @param date2 + * @return + */ + public static long getDays(String date1, String date2) { + if (date1 == null || date1.equals("")) + return 0; + if (date2 == null || date2.equals("")) + return 0; + // 转换为标准时间 + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + Date date = null; + Date mydate = null; + try { + date = myFormatter.parse(date1); + mydate = myFormatter.parse(date2); + } catch (Exception e) { + } + long day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000); + return day; + } + + /** + * 形成如下的日历 , 根据传入的一个时间返回一个结构 星期日 星期一 星期二 星期三 星期四 星期五 星期六 下面是当月的各个时间 + * 此函数返回该日历第一行星期日所在的日期 + * + * @param sdate + * @return + */ + public static String getNowMonth(String sdate) { + // 取该时间所在月的一号 + sdate = sdate.substring(0, 8) + "01"; + + // 得到这个月的1号是星期几 + Date date = VeDate.strToDate(sdate); + Calendar c = Calendar.getInstance(); + c.setTime(date); + int u = c.get(Calendar.DAY_OF_WEEK); + String newday = VeDate.getNextDay(sdate, (1 - u) + ""); + return newday; + } + + /** + * 取得数据库主键 生成格式为yyyymmddhhmmss+k位随机数 + * + * @param k + * 表示是取几位随机数,可以自己定 + */ + + public static String getNo(int k) { + + return getUserDate("yyyyMMddhhmmss") + getRandom(k); + } + + /** + * 返回一个随机数 + * + * @param i + * @return + */ + public static String getRandom(int i) { + Random jjj = new Random(); + // int suiJiShu = jjj.nextInt(9); + if (i == 0) + return ""; + String jj = ""; + for (int k = 0; k < i; k++) { + jj = jj + jjj.nextInt(9); + } + return jj; + } + + /** + * + * @param + */ + public static boolean RightDate(String date) { + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + ; + if (date == null) + return false; + if (date.length() > 10) { + sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + } else { + sdf = new SimpleDateFormat("yyyy-MM-dd"); + } + try { + sdf.parse(date); + } catch (ParseException pe) { + return false; + } + return true; + } + + + + + /** + * 时间前推或后推分钟,其中SS表示秒. + */ + public static String getSTime(String sj1, String SS) { + SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss"); + String mydate1 = ""; + try { + Date date1 = format.parse(sj1); + long Time = (date1.getTime() / 1000) + Integer.parseInt(SS) ; + date1.setTime(Time * 1000); + mydate1 = format.format(date1); + } catch (Exception e) { + } + return mydate1; + } + +/** + * 时间比较 + * @param date_1 + * @param date_standard 比较标准 + * @return + */ + public static boolean TimeComparison(String date_1, String date_standard) { + boolean bool = false; + SimpleDateFormat myFormatter = new SimpleDateFormat("HH:mm:ss"); + try { + Date d1 = myFormatter.parse(date_1); + Date d2 = myFormatter.parse(date_standard); + bool =d1.compareTo(d2)>=0?true:false; + } catch (Exception e) { + } + return bool; + } + + + + + /** + * 日期比较 + * @param date_1 + * @param date_standard 比较标准 + * @return + */ + public static boolean TimeComparison_yyyy_MM_dd(String date_1, String date_standard) { + boolean bool = false; + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date d1 = myFormatter.parse(date_1); + Date d2 = myFormatter.parse(date_standard); + bool =d1.compareTo(d2)>0?true:false; + } catch (Exception e) { + } + return bool; + } + + + + /** + * 获取某月的最后一天 + * @Title:getLastDayOfMonth + * @Description: + * @param:@param year + * @param:@param month + * @param:@return + * @return:String + * @throws + */ +public static String getLastDayOfMonth(int year,int month) +{ + Calendar cal = Calendar.getInstance(); + //设置年份 + cal.set(Calendar.YEAR,year); + //设置月份 + cal.set(Calendar.MONTH, month-1); + //获取某月最大天数 + int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH); + //设置日历中月份的最大天数 + cal.set(Calendar.DAY_OF_MONTH, lastDay); + //格式化日期 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String lastDayOfMonth = sdf.format(cal.getTime()); + + return lastDayOfMonth; +} + + /** + * 获取指定日期当月的第一天 + * @param dateStr + * @param format + * @return + */ + public static String getFirstDayOfGivenMonth(String dateStr,String format){ + SimpleDateFormat sdf = new SimpleDateFormat(format); + try { + Date date = sdf.parse(dateStr); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.DAY_OF_MONTH,1); + calendar.add(Calendar.MONTH, 0); + return sdf.format(calendar.getTime()); + } catch (ParseException e) { + e.printStackTrace(); + } + return null; + } + + /** + + * 获取指定日期下个月的第一天 + * @param dateStr + * @param format + * @return + */ + public static String getFirstDayOfNextMonth(String dateStr,String format){ + SimpleDateFormat sdf = new SimpleDateFormat(format); + try { + Date date = sdf.parse(dateStr); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.DAY_OF_MONTH,1); + calendar.add(Calendar.MONTH, 1); + return sdf.format(calendar.getTime()); + } catch (ParseException e) { + e.printStackTrace(); + } + return null; + } + + + + + /** + * 获取startDate日期后month月的日期 + * @param yyyy_MM_dd_HH_mm_ss 开始日期 yyyy-MM-dd HH:mm:ss + * @param month 几个月后 + * @return + */ + public static String getMonthDate(String yyyy_MM_dd_HH_mm_ss,int month) throws ParseException { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date1 = formatter.parse(yyyy_MM_dd_HH_mm_ss); + LocalDateTime localDateTime = date1.toInstant() + .atZone(ZoneId.systemDefault() ) + .toLocalDateTime().plusMonths(month); + Date date = Date.from(localDateTime.atZone( ZoneId.systemDefault()).toInstant()); + + String dateString = formatter.format(date); + return dateString; + } + + + /** + *获取 多少秒后的时间 + * @param yyyy_MM_dd_HH_mm_ss + * @param second + * @return + * @throws ParseException + */ + public static String getNextSecond(String yyyy_MM_dd_HH_mm_ss,int second) throws ParseException { + LocalDateTime parse = LocalDateTime.parse(yyyy_MM_dd_HH_mm_ss, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + LocalDateTime plusSeconds = parse.plusSeconds(second);// X 秒后 + //System.out.println(plusSeconds); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + Date date = Date.from(plusSeconds.atZone( ZoneId.systemDefault()).toInstant()); + String dateString = formatter.format(date); + return dateString; + } + + + + public static void main(String[] args) throws Exception { + VeDate v=new VeDate(); +/* + System.out.println(v.GetHH_MM_SS("2006-11-03 12:22:10"));*/ + /* String str[]=getYyyyAndMm(); + System.out.println(str[0]+str[1]+str[2]);*/ + // System.out.println(TimeComparison("08:30:00","08:30:01")); +/* String yyyy_MM_dd= getFirstDayOfNextMonth("2021-04-30","yyyy-MM-dd"); + System.out.println(yyyy_MM_dd); + + System.out.println(TimeComparison_yyyy_MM_dd("2021-04-30",yyyy_MM_dd)); + System.out.println(TimeComparison_yyyy_MM_dd("2021-05-31",yyyy_MM_dd));*/ + + System.out.println(getStringDateShort().substring(0,7)); + /*System.out.println(getFirstDayOfGivenMonth(getMonthDate(getStringDateSSS(),1),"yyyy-MM-dd"));*/ + + //System.out.println(getNo(4)); + + String package_id = "YZ202106230408082666"; + package_id = package_id.substring(package_id.length()-4,package_id.length()); + System.out.println(package_id); + + //System.out.println(getStringDateShort());// new Date()为获取当前系统时间 + + //System.out.println(getEndDateOfMonth("202102")); + //System.out.println(getEndDateOfMonth("202102")); + //System.out.println(getNowDateShortNuber()); + + //String yyyy_MM_dd_HH_mm_ss = VeDate.getStringDate(); + //System.out.println(yyyy_MM_dd_HH_mm_ss); + //System.out.println(VeDate.getNextDay(yyyy_MM_dd_HH_mm_ss.split(" ")[0],"7")); + //System.out.println(getEndDateOfMonth_yyyy_MM_DD(getStringDateShort())); + //System.out.println(Integer.parseInt(getHour())); + System.out.println(getNextSecond("2021-08-31 11:02:51",1)); + + System.out.println(dateToStrLong(strToDate("2019-6-12"))); + //System.out.println(getTwoHour("18:41:00","16:41:00")); + // System.out.println(getLastDayOfMonth(2019,4).split("-")[2]); + //System.out.println(v.GetHH_MM_SS(); + //System.out.print(Integer.valueOf(getTwoDay("2006-11-03 12:22:10", "2006-11-02 11:22:09"))); + } +} \ No newline at end of file diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/WriteCSV.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/WriteCSV.java new file mode 100644 index 0000000..cfd125b --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/WriteCSV.java @@ -0,0 +1,525 @@ +package com.yunze.common.utils.yunze; + +import com.alibaba.fastjson.JSON; +import org.apache.commons.csv.CSVFormat; +import org.apache.commons.csv.CSVPrinter; +import org.springframework.stereotype.Component; + +import java.io.*; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 写入CSV文件 + * @Auther: zhang feng + * @Date: 2021/03/06/13:39 + * @Description: + */ +@Component +public class WriteCSV { + + /** + * 输出CSV 文件 重名 文件 追加写入 + * @param fileName 文件名 + * @param mapList 写入数据 + * @param withHeader 表头 + * @param OutUrl 写入地址 /a/ 默认 /mnt/yunze/download/ + */ + public void Write (String fileName , List> mapList,String[] withHeader,String OutUrl,String[] keys){ + + try { + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + if(OutUrl!=null){ + filePath +=OutUrl; + } + filePath +="/mnt/yunze/download/csv/"; + //System.out.println(filePath); + String agent_rul = fileName.split("/")[0]; + + File Url=new File(filePath+"/1.txt");//tomcat 路径 + Upload.mkdirsmy(Url);//创建文件夹 + File file = new File(filePath+"/"+fileName+".csv"); + FileOutputStream fos = null; + CSVFormat csvFormat = null ; + if (file.exists()) { + csvFormat = CSVFormat.DEFAULT.withIgnoreHeaderCase(); + fos = new FileOutputStream(filePath+"/"+fileName+".csv",true); + }else { + //设置表头 + csvFormat = CSVFormat.DEFAULT.withHeader(withHeader); + fos = new FileOutputStream(filePath+"/"+fileName+".csv"); + } + if(fos!=null){ + OutputStreamWriter osw = new OutputStreamWriter(fos, "GBK");// GBK UTF-8 + + CSVPrinter csvPrinter = new CSVPrinter(osw, csvFormat); +// csvPrinter = CSVFormat.DEFAULT.withHeader("姓名", "年龄", "家乡").print(osw); + + //循环输出表格数据 + for (int j = 0; j < mapList.size(); j++) { + Map objectMap = mapList.get(j); + Object oarr[] = objectMap.values().toArray(); + //int index = 0; + Object[] Wtarr = {}; + for (int i = 0; i < keys.length; i++) { + /* String value = ""+; + value = value != null && value !="null"?value:"";*/ + Wtarr = Different.StringArrAdd(Wtarr, objectMap.get(keys[i]));//数组添加 + } + csvPrinter.printRecord(Wtarr);//最后一个写入 + /**for(String key:objectMap.keySet()){ + //System.out.println("key="+key+"and value=" +objectMap.get(key)); + Wtarr = Different.StringArrAdd(Wtarr,objectMap.get(key).toString());//数组添加 + index++; + if(oarr.length==index){ + csvPrinter.printRecord(Wtarr);//最后一个写入 + } + }*/ + } + csvPrinter.flush(); + csvPrinter.close(); + }else{ + System.err.println("============== [FileOutputStream = null !!!] =============="); + } + + } catch (Exception e) { + System.err.println("==============WriteCSV导出CVS数据异常!=============="); + System.out.println(e); + } + + } + + + /** + * 输出CSV 文件 重名 文件 追加写入 + * @param fileName 文件名 + * @param mapList 写入数据 + * @param withHeader 表头 + * @param OutUrl 写入地址 /a/ 默认 /mnt/yunze/download/ + * @param Flieurl + */ + public void Write (String fileName , List> mapList,String[] withHeader,String OutUrl,String[] keys,String Flieurl){ + + try { + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + if(OutUrl!=null){ + filePath +=OutUrl; + } + filePath +="/mnt/yunze/backup/csv/"+Flieurl; + //System.out.println(filePath); + String agent_rul = fileName.split("/")[0]; + + File Url=new File(filePath+"/1.txt");//tomcat 路径 + Upload.mkdirsmy(Url);//创建文件夹 + File file = new File(filePath+"/"+fileName+".csv"); + FileOutputStream fos = null; + CSVFormat csvFormat = null ; + if (file.exists()) { + csvFormat = CSVFormat.DEFAULT.withIgnoreHeaderCase(); + fos = new FileOutputStream(filePath+"/"+fileName+".csv",true); + }else { + //设置表头 + csvFormat = CSVFormat.DEFAULT.withHeader(withHeader); + fos = new FileOutputStream(filePath+"/"+fileName+".csv"); + } + if(fos!=null){ + OutputStreamWriter osw = new OutputStreamWriter(fos, "GBK");// GBK UTF-8 + + CSVPrinter csvPrinter = new CSVPrinter(osw, csvFormat); +// csvPrinter = CSVFormat.DEFAULT.withHeader("姓名", "年龄", "家乡").print(osw); + + //循环输出表格数据 + for (int j = 0; j < mapList.size(); j++) { + Map objectMap = mapList.get(j); + Object oarr[] = objectMap.values().toArray(); + //int index = 0; + Object[] Wtarr = {}; + for (int i = 0; i < keys.length; i++) { + /* String value = ""+; + value = value != null && value !="null"?value:"";*/ + Wtarr = Different.StringArrAdd(Wtarr, objectMap.get(keys[i]));//数组添加 + } + csvPrinter.printRecord(Wtarr);//最后一个写入 + /**for(String key:objectMap.keySet()){ + //System.out.println("key="+key+"and value=" +objectMap.get(key)); + Wtarr = Different.StringArrAdd(Wtarr,objectMap.get(key).toString());//数组添加 + index++; + if(oarr.length==index){ + csvPrinter.printRecord(Wtarr);//最后一个写入 + } + }*/ + } + csvPrinter.flush(); + csvPrinter.close(); + }else{ + System.err.println("============== [FileOutputStream = null !!!] =============="); + } + + } catch (Exception e) { + System.err.println("==============WriteCSV导出CVS数据异常!=============="); + System.out.println(e); + } + + } + + + + /** + * 输出 操作数据 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param description 操作描述 + * @param agentName 执行人 + * @param result 执行结果 + * @param Outcolumns 输出表头 + * @param keys 输出列 + */ + public void OutCSV(List> list , String fileName_flow, String description, String agentName, String result,String Outcolumns[],String keys[],String IdKey){ + + List> out_list = new ArrayList<>(); + + for (int i = 0; i < list.size(); i++) { + Map out_map= new HashMap(); + + Map cardIndex=list.get(i); + String iccid =cardIndex.get(IdKey).toString(); + + String Time= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + out_map.put(IdKey,iccid); + out_map.put("description",description); + out_map.put("time",Time); + out_map.put("result",result); + out_map.put("agentName",agentName); + + out_list.add(out_map); + if ((i+1)%50==0 || (i+1)==list.size()){ + //执行导出 + if(out_list.size()>0){ + Write(fileName_flow,out_list,Outcolumns,null,keys); + out_list = new ArrayList<>(); + } + + } + } + + } + + + + + + + /** + * 输出 操作数据 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param description 操作描述 + * @param agentName 执行人 + * @param result 执行结果 + * @param Outcolumns 输出表头 + * @param keys 输出列 + */ + public void OutCSV(List> list , String fileName_flow, String description, String agentName, String result,String Outcolumns[],String keys[]){ + OutCSV(list,fileName_flow,description,agentName,result,Outcolumns,keys,"iccid"); + } + + + + /** + * 输出 操作数据 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param description 操作描述 + * @param agentName 执行人 + * @param result 执行结果 + * @param Outcolumns 输出表头 + * @param keys 输出列 + */ + public void OutCSVObj(List> list , String fileName_flow, String description, String agentName, String result,String Outcolumns[],String keys[]){ + OutCSVObj(list,fileName_flow,description,agentName,result,Outcolumns,keys,"iccid"); + } + + + /** + * 输出 操作数据 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param description 操作描述 + * @param agentName 执行人 + * @param result 执行结果 + * @param Outcolumns 输出表头 + * @param keys 输出列 + */ + public void OutCSVObj(List> list , String fileName_flow, String description, String agentName, String result,String Outcolumns[],String keys[],String IdKey){ + + List> out_list = new ArrayList<>(); + + for (int i = 0; i < list.size(); i++) { + Map out_map= new HashMap(); + + Map cardIndex=list.get(i); + String iccid =cardIndex.get(IdKey).toString(); + + String Time= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + out_map.put(IdKey,iccid); + out_map.put("description",description); + out_map.put("time",Time); + out_map.put("result",result); + out_map.put("agentName",agentName); + + out_list.add(out_map); + if ((i+1)%50==0 || (i+1)==list.size()){ + //执行导出 + if(out_list.size()>0){ + Write(fileName_flow,out_list,Outcolumns,null,keys); + out_list = new ArrayList<>(); + } + + } + } + + } + + + + + /** + * 输出 操作数据 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param description 操作描述 + * @param agentName 执行人 + * @param result 执行结果 + * @param Outcolumns 输出表头 + * @param keys 输出列 + * @param OutSize 多少条数据进行一次输出 + */ + public void OutCSVObj(List> list , String fileName_flow, String description, String agentName, String result,String Outcolumns[],String keys[],int OutSize){ + + List> out_list = new ArrayList<>(); + + for (int i = 0; i < list.size(); i++) { + Map out_map= new HashMap(); + Map cardIndex=list.get(i); + String iccid =cardIndex.get("iccid").toString(); + String Time= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + out_map.put("iccid",iccid); + out_map.put("description",description); + out_map.put("result",result); + out_map.put("agentName",agentName); + out_map.put("OptionTime",Time);//加上操作时间 + out_list.add(out_map); + if ((i+1)%OutSize==0 || (i+1)==list.size()){ + //执行导出 + if(out_list.size()>0){ + Write(fileName_flow,out_list,Outcolumns,null,keys); + out_list = new ArrayList<>(); + } + + } + } + } + + /** + * 输出 操作数据 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param Outcolumns 输出表头 + * @param keys 输出列 + * @param OutSize 多少条数据进行一次输出 + */ + public void OutCSVObj(List> list , String fileName_flow,String Outcolumns[],String keys[],int OutSize){ + List> out_list = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + Map out_map= new HashMap(); + Map cardIndex=list.get(i); + String Time= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + for (int j = 0; j 0){ + Write(fileName_flow,out_list,Outcolumns,null,keys); + out_list = new ArrayList<>(); + } + + } + } + + } + + + + /** + * 输出 操作数据 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param Outcolumns 输出表头 + * @param keys 输出列 + * @param defOutcolumns 默认输出 【默认】该批次都会写入的数据 + * @param OutSize 多少条数据进行一次输出 + */ + public void OutCSVObj(List> list , String fileName_flow,String Outcolumns[],String keys[],Map defOutcolumns,int OutSize){ + List> out_list = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + Map out_map= new HashMap(); + Map cardIndex=list.get(i); + String Time= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + for (int j = 0; j 0){ + Write(fileName_flow,out_list,Outcolumns,null,keys); + out_list = new ArrayList<>(); + } + } + } + + } + + + + + /** + * 输出 操作数据 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param Outcolumns 输出表头 + * @param keys 输出列 + * @param defOutcolumns 默认输出 【默认】该批次都会写入的数据 + * @param OutSize 多少条数据进行一次输出 + */ + public void OutCSVStr(List> list , String fileName_flow,String Outcolumns[],String keys[],Map defOutcolumns,int OutSize){ + List> out_list = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + Map out_map= new HashMap(); + Map cardIndex=list.get(i); + String Time= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + for (int j = 0; j 0){ + Write(fileName_flow,out_list,Outcolumns,null,keys); + out_list = new ArrayList<>(); + } + } + } + + } + + + + + /** + * 读取 + * @param readpath 读取路径 + * @param Redcolumns 列名 + * @return + * @throws Exception + */ + public static List> readCSV(String readpath,List Redcolumns) { + List> Rlist = new ArrayList<>(); + File inFile = new File(readpath); + try + { + boolean sign = Redcolumns!=null&&Redcolumns.size()>0?true:false; + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(inFile),"GB2312")); + while(reader.ready()) + { + String line = reader.readLine(); + StringTokenizer st = new StringTokenizer(line, ","); + + if (st.hasMoreTokens() && sign) + { + Map obj = new HashMap<>(); + + for (int i = 0; i < Redcolumns.size(); i++) { + obj.put(""+Redcolumns.get(i),st.nextToken()); + } + System.out.println(obj); + Rlist.add(obj); + } + else + { + Redcolumns = new ArrayList<>(); + while (st.hasMoreTokens()){ // 判断是否已经到结尾 + Redcolumns.add(st.nextToken()); // 打印下一个字段 + } + sign = true; + } + } + reader.close(); + } + catch (FileNotFoundException e) + { + e.printStackTrace(); + } + catch (IOException e) + { + e.printStackTrace(); + } + return Rlist; + } + + + + + + + + + + + public static void main(String[] args) { + /* String path = "/getcsv/2a8984d344e04b878956521960d03fa5_CardOut.csv"; + String Prefix = path.split("/")[1]; + path = path.substring(Prefix.length()+2,path.length()); + System.out.println(path);*/ + List> dataList = WriteCSV.readCSV("F:\\谷歌下载\\新建文本文档 (3).csv",null); + System.out.println(dataList); + + + + Map>> collect = dataList.stream().collect(Collectors.groupingBy(scope->scope.get("dept_id").toString()+'-'+scope.get("user_id").toString())); + + + System.out.println(JSON.toJSONString(collect)); + + + } + + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/XmlUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/XmlUtil.java new file mode 100644 index 0000000..41716e7 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/XmlUtil.java @@ -0,0 +1,64 @@ +package com.yunze.common.utils.yunze; + +import org.dom4j.Attribute; +import org.dom4j.Document; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.xml.sax.InputSource; + +import java.io.StringReader; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * + * + */ +public class XmlUtil { + + static Map xmlMap = new HashMap(); + + /** + * xml字符串转换成Map 获取标签内属性值和text值 + * + * @param xml + * @return + * @throws Exception + */ + public static Map xmlToMap(String xml) throws Exception { + StringReader reader = new StringReader(xml); + InputSource source = new InputSource(reader); + SAXReader sax = new SAXReader(); // 创建一个SAXReader对象 + Document document = sax.read(source); // 获取document对象,如果文档无节点,则会抛出Exception提前结束 + Element root = document.getRootElement(); // 获取根节点 + Map map = XmlUtil.getNodes(root); // 从根节点开始遍历所有节点 + return map; + } + + /** + * 从指定节点开始,递归遍历所有子节点 + * + * @author chenleixing + * @return + */ + @SuppressWarnings("unchecked") + public static Map getNodes(Element node) { + xmlMap.put(node.getName().toLowerCase(), node.getTextTrim()); + List listAttr = node.attributes(); // 当前节点的所有属性的list + for (Attribute attr : listAttr) { // 遍历当前节点的所有属性 + String name = attr.getName(); // 属性名称 + String value = attr.getValue(); // 属性的值 + xmlMap.put(name, value.trim()); + } + +// 递归遍历当前节点所有的子节点 + List listElement = node.elements(); // 所有一级子节点的list + for (Element e : listElement) { // 遍历所有一级子节点 + XmlUtil.getNodes(e); // 递归 + } + return xmlMap; + + } + +} diff --git a/yunze-common/src/main/java/com/yunze/common/utils/yunze/YzPollingUtil.java b/yunze-common/src/main/java/com/yunze/common/utils/yunze/YzPollingUtil.java new file mode 100644 index 0000000..8944be5 --- /dev/null +++ b/yunze-common/src/main/java/com/yunze/common/utils/yunze/YzPollingUtil.java @@ -0,0 +1,49 @@ +package com.yunze.common.utils.yunze; + +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 轮询 公共代码部分 + * @Auther: zhang feng + * @Date: 2021/11/24/16:51 + * @Description: + */ +@Component +public class YzPollingUtil { + + + /** + * 过滤不需要循环的 通道 id + * @param Ex_ChannelArr + * @param ChannelArr + * @param bool + * @return + */ + public List> filterNoPollin(List Ex_ChannelArr, List> ChannelArr, boolean bool){ + if(bool){ + List> Run_ChannelArr = new ArrayList<>(); + //过滤 没有划卡的通道不需要监听 + for (int i = 0; i < ChannelArr.size(); i++) { + Map ChannelObj = ChannelArr.get(i); + String cd_id = ChannelObj.get("cd_id").toString(); + for (int j = 0; j < Ex_ChannelArr.size(); j++) { + if(cd_id.equals(Ex_ChannelArr.get(j))){ + Run_ChannelArr.add(ChannelObj); + } + } + } + ChannelArr = Run_ChannelArr;//刷新赋值 + } + return ChannelArr; + } + + + + + + +} diff --git a/yunze-common/src/main/resources/mapper/quartz/backup/BackupMapper.xml b/yunze-common/src/main/resources/mapper/quartz/backup/BackupMapper.xml new file mode 100644 index 0000000..14c7c9e --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/backup/BackupMapper.xml @@ -0,0 +1,253 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/PollingMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/PollingMapper.xml new file mode 100644 index 0000000..b3b89c3 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/PollingMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + + and polling_id LIKE CONCAT(#{value},'%') + + + + AND + + DATE_FORMAT( create_date , '%Y-%m-%d %H:%i:%S' ) + + + DATE_FORMAT( upd_date , '%Y-%m-%d %H:%i:%S' ) + + + DATE_FORMAT( syn_date , '%Y-%m-%d %H:%i:%S' ) + + BETWEEN #{staTime} AND #{endTime} + + + AND cd_id = #{channel_id} + + + AND polling_type = #{polling_type} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzAgentPackagetMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzAgentPackagetMapper.xml new file mode 100644 index 0000000..4667907 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzAgentPackagetMapper.xml @@ -0,0 +1,175 @@ + + + + + + + + + + and a.package_agentname LIKE CONCAT(#{value},'%') + + + and a.package_name LIKE CONCAT(#{value},'%') + + + + and a.package_id in + + #{package_idArr} + + + + and a.dept_id in + + #{agent_id} + + + + and a.id = #{id} + + + ${dataScope} + + + + + + + + + + + + + + + + + INSERT INTO yz_agent_package + ( package_id, package_agentname, package_name, create_time, error_so, dept_id, user_id ) + SELECT + package_id, + package_agentname, + package_name, + now(), + error_so, + #{dept_id}, + #{user_id} + FROM + yz_card_package a + + a.package_id = #{package_id} + + + + + + + + + + + + UPDATE + yz_agent_package + + package_agentname = #{package_agentname}, + package_name = #{package_name} + + + id = #{id} + + + + + + UPDATE + yz_agent_package + + package_agentname = #{package_agentname}, + package_name = #{package_name} + + + package_id = #{package_id} + AND dept_id = #{dept_id} + + + + + + + INSERT INTO yz_agent_package + ( package_id, package_agentname, package_name, create_time, error_so, dept_id, user_id ) + SELECT + package_id, + package_agentname, + package_name, + now(), + error_so, + #{dept_id}, + #{user_id} + FROM + yz_agent_package a + + a.package_id = #{package_id} + AND a.dept_id = #{ParentDept_id} + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzAgentPacketMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzAgentPacketMapper.xml new file mode 100644 index 0000000..d7bcdf1 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzAgentPacketMapper.xml @@ -0,0 +1,483 @@ + + + + + + + + 1=1 + + + and a.packet_wx_name LIKE CONCAT(#{packetValue},'%') + + + and a.packet_name LIKE CONCAT(#{packetValue},'%') + + + + and a.wechat_pay in + + #{wechat_pay} + + + + and a.balance_pay in + + #{balance_pay} + + + + and a.is_month in + + #{is_month} + + + + and a.in_stock in + + #{in_stock} + + + + and a.packet_valid_type in + + #{packet_valid_type} + + + + and a.dept_id in + + #{dept_id} + + + + and a.package_id in + + #{package_id} + + + + and a.dept_id in + + #{agent_id} + + + + and a.id = #{id} + + + ${dataScope} + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO yz_agent_packet ( + package_id, + packet_id, + packet_name, + packet_wx_name, + packet_price, + packet_flow, + base_packet_type, + packet_type, + is_profit, + show_profit, + wechat_pay, + balance_pay, + create_time, + error_flow, + error_so, + packet_valid_time, + packet_cost, + is_month, + date_limit, + deduction, + in_stock, + packet_valid_type, + dept_id, + user_id, + packet_valid_name + ) SELECT + package_id, + packet_id, + packet_name, + packet_wx_name, + #{set_packet_price}, + packet_flow, + base_packet_type, + packet_type, + is_profit, + show_profit, + wechat_pay, + balance_pay, + now(), + packet_flow/#{set_error_so}, + #{set_error_so}, + packet_valid_time, + #{set_packet_cost}, + is_month, + date_limit, + deduction, + in_stock, + packet_valid_type, + #{dept_id}, + #{user_id}, + packet_valid_name + FROM + yz_card_packet a + + a.id = #{id} + + + + + + + + + + + + UPDATE + yz_agent_packet + + package_id = #{package_id}, + packet_id = #{packet_id}, + packet_name = #{packet_name}, + packet_wx_name = #{packet_wx_name}, + packet_price = #{packet_price}, + packet_flow = #{packet_flow}, + base_packet_type = #{base_packet_type}, + packet_type = #{packet_type}, + is_profit = #{is_profit}, + show_profit = #{show_profit}, + wechat_pay = #{wechat_pay}, + balance_pay = #{balance_pay}, + error_flow = #{error_flow}, + error_so = #{error_so}, + packet_valid_time = #{packet_valid_time}, + packet_cost = #{packet_cost}, + is_month = #{is_month}, + date_limit = #{date_limit}, + deduction = #{deduction}, + in_stock = #{in_stock}, + packet_valid_type = #{packet_valid_type}, + packet_valid_name = #{packet_valid_name} + + + id = #{id} + + + + + + + + + + + + + + + + + UPDATE + yz_agent_packet + + packet_name = #{packet_name}, + packet_wx_name = #{packet_wx_name}, + packet_price = #{set_packet_price}, + packet_flow = #{packet_flow}, + base_packet_type = #{base_packet_type}, + packet_type = #{packet_type}, + is_profit = #{is_profit}, + show_profit = #{show_profit}, + wechat_pay = #{wechat_pay}, + balance_pay = #{balance_pay}, + error_flow = packet_flow/#{set_error_so}, + error_so = #{set_error_so}, + packet_valid_time = #{packet_valid_time}, + packet_cost = #{set_packet_cost}, + is_month = #{is_month}, + date_limit = #{date_limit}, + deduction = #{deduction}, + in_stock = #{in_stock}, + packet_valid_type = #{packet_valid_type}, + packet_valid_name = #{packet_valid_name} + + + package_id = #{package_id} + AND packet_id = #{packet_id} + AND dept_id = #{dept_id} + AND user_id = #{user_id} + + + + + + + + + + + + + INSERT INTO yz_agent_packet ( + package_id, + packet_id, + packet_name, + packet_wx_name, + packet_price, + packet_flow, + base_packet_type, + packet_type, + is_profit, + show_profit, + wechat_pay, + balance_pay, + create_time, + error_flow, + error_so, + packet_valid_time, + packet_cost, + is_month, + date_limit, + deduction, + in_stock, + packet_valid_type, + dept_id, + user_id, + packet_valid_name + ) SELECT + package_id, + packet_id, + packet_name, + packet_wx_name, + #{set_packet_price}, + packet_flow, + base_packet_type, + packet_type, + is_profit, + show_profit, + wechat_pay, + balance_pay, + now(), + packet_flow/#{set_error_so}, + #{set_error_so}, + packet_valid_time, + #{set_packet_cost}, + is_month, + date_limit, + deduction, + in_stock, + packet_valid_type, + #{dept_id}, + #{user_id}, + packet_valid_name + FROM + yz_agent_packet a + + a.id = #{id} + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardFlowHisMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardFlowHisMapper.xml new file mode 100644 index 0000000..6f5a2ba --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardFlowHisMapper.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + insert into + yz_card_flow_his + ( + total_flow, + total_flow_now, + month, + year, + day, + iccid, + create_time, + total_show_flow, + total_show_flow_now + )value + ( + #{total_flow}, + #{total_flow_now}, + #{month}, + #{year}, + #{day}, + #{iccid}, + now(), + #{total_show_flow}, + #{total_show_flow_now} + ) + + + + + update + yz_card_flow_his + + total_flow = #{total_flow}, + total_flow_now = #{total_flow_now}, + update_time = now(), + total_show_flow = #{total_show_flow}, + total_show_flow_now = #{total_show_flow_now} + + + iccid = #{iccid} + AND `year` = #{year} + AND `month` = #{month} + AND `day` = #{day} + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardFlowMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardFlowMapper.xml new file mode 100644 index 0000000..7513905 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardFlowMapper.xml @@ -0,0 +1,634 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update yz_card_flow + + use_true_flow = #{use_true_flow}, + use_so_flow = #{use_so_flow}, + + status = #{status} + + + + id =#{id} + + + + + + + + + + + + update yz_card_flow + + status = 0 + + + iccid =#{iccid} + and end_time now() + + + + + + + + + + + + + + + insert into + yz_card_flow + ( + package_id, + packet_id, + ord_no, + true_flow, + error_flow, + start_time, + end_time, + create_time, + ord_type, + status, + packet_type, + use_flow, + iccid, + error_time, + validate_type + )value + + (#{flow_arrs.package_id}, + #{flow_arrs.packet_id}, + #{flow_arrs.ord_no}, + #{flow_arrs.true_flow}, + #{flow_arrs.error_flow}, + #{flow_arrs.start_time}, + #{flow_arrs.end_time}, + now(), + #{flow_arrs.ord_type}, + #{flow_arrs.status}, + #{flow_arrs.packet_type}, + #{flow_arrs.use_flow}, + #{flow_arrs.iccid}, + #{flow_arrs.error_time}, + #{flow_arrs.validate_type}) + + + + + + + + + + + + + + + + + + + + + + + + + + + + AND ord_no LIKE CONCAT(#{value},'%') + + + AND iccid LIKE CONCAT(#{value},'%') + + + AND status = #{status} + + + AND iccid = #{iccid} + + + AND packet_type =#{packet} + + + AND validate_type =#{effect} + + + AND + + DATE_FORMAT( create_time , '%Y-%m-%d' ) + + + DATE_FORMAT( start_time , '%Y-%m-%d' ) + + + DATE_FORMAT( end_time , '%Y-%m-%d' ) + + + DATE_FORMAT( validate_time , '%Y-%m-%d' ) + + BETWEEN #{staTime} AND #{endTime} + + + and iccid in + + #{IccidArr} + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardInfoChangeMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardInfoChangeMapper.xml new file mode 100644 index 0000000..5570090 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardInfoChangeMapper.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + INSERT INTO yz_card_info_change + ( + iccid, + ctype, + cbefore, + cafterward, + createTime, + remark, + source_type, + execution_status + ) + value ( + #{iccid}, + #{ctype}, + #{cbefore}, + #{cafterward}, + now(), + #{remark}, + #{source_type}, + #{execution_status} + ) + + + + + INSERT INTO yz_card_info_change + ( + iccid, + ctype, + cbefore, + cafterward, + createTime, + remark, + source_type, + execution_status + ) + value + + ( + #{CardInfoMapList.iccid}, + #{CardInfoMapList.ctype}, + #{CardInfoMapList.cbefore}, + #{CardInfoMapList.cafterward}, + now(), + #{CardInfoMapList.remark}, + #{CardInfoMapList.source_type}, + #{CardInfoMapList.execution_status} + ) + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardIsStopMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardIsStopMapper.xml new file mode 100644 index 0000000..0dcc224 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardIsStopMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + INSERT INTO yz_card_isstop + ( + iccid, + order_no, + status, + create_time, + update_time + ) + VALUE + + ( + #{Stoploop.iccid}, + #{Stoploop.order_no}, + #{Stoploop.status}, + now(), + now() + ) + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardMapper.xml new file mode 100644 index 0000000..ed804ce --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardMapper.xml @@ -0,0 +1,1350 @@ + + + + + + + + + and related_cd_id = #{related_cd_id} + + + and status_id = #{status_id} + + + and status_ShowId =#{status_ShowId} + + + and customize_grouping = #{customize_grouping} + + + and package_id = #{package_id} + + + and + + DATE_FORMAT( open_date, '%Y-%m-%d' ) + + + DATE_FORMAT( activate_date, '%Y-%m-%d' ) + + + DATE_FORMAT( batch_date, '%Y-%m-%d' ) + + + DATE_FORMAT( deliver_date, '%Y-%m-%d' ) + + + DATE_FORMAT( due_expire_time, '%Y-%m-%d' ) + + BETWEEN #{staTime} AND #{endTime} + + + and agent_id in + + #{agent_id} + + + + and channel_id IN + + #{channel_id} + + + + and is_pool = #{is_pool} + + + and pool_id = #{pool_id} + + + and del_flag = #{del_flag} + + + + and + + vid + + + msisdn + + + iccid + + + imsi + + IN + + + #{UpArr.cardNumber} + + + + + + + + + + + + + + and ( vid = #{value} or + msisdn = #{value} or + SUBSTRING(iccid,1,19) = #{value} or + imsi = #{value}) + + + and remarks LIKE CONCAT(#{value},'%') + + + and imei LIKE CONCAT(#{value},'%') + + + + and + + vid + + + msisdn + + + SUBSTRING(iccid,1,19) + + + imsi + + + imei + + BETWEEN #{StartValue} AND #{EndValue} + + + + + + + + + + + + and ( vid = #{value} or + msisdn = #{value} or + iccid = #{value} or + imsi = #{value}) + + + and remarks LIKE CONCAT(#{value},'%') + + + and imei LIKE CONCAT(#{value},'%') + + + + and + + vid + + + msisdn + + + iccid + + + imsi + + + imei + + BETWEEN #{StartValue} AND #{EndValue} + + + + + + + + SELECT + id, + vid, + msisdn, + iccid, + imsi, + open_date, + activate_date, + agent_id, + channel_id, + DATE_FORMAT( batch_date, "%Y-%m-%d" ) AS batch_date, + DATE_FORMAT( syn_Time, "%Y-%m-%d %H:%i:%S" ) AS syn_Time, + remarks, + status_id, + status_ShowId, + package_id, + used, + customize_grouping, + DATE_FORMAT( deliver_date, "%Y-%m-%d" ) AS deliver_date, + DATE_FORMAT( due_expire_time, "%Y-%m-%d" ) AS due_expire_time + + ,remind_ratio, + virtual_ratio, + del_flag, + connection_status, + is_Disconnected + + FROM + yz_card_info + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert + into + yz_card_info + ( + vid, + msisdn, + iccid, + imsi, + open_date, + activate_date, + agent_id, + channel_id, + is_pool, + batch_date, + remarks, + status_id, + package_id, + imei, + type, + network_type, + is_sms, + sms_number, + gprs, + dept_id, + user_id, + create_date, + status_ShowId, + create_by + ) + value + + (#{card_arrs.vid},#{card_arrs.msisdn},#{card_arrs.iccid},#{card_arrs.imsi},#{card_arrs.open_date},#{card_arrs.activate_date}, + + #{card_arrs.agent_id}, + + + '100', + + #{card_arrs.channel_id}, + + + #{card_arrs.is_pool}, + + + '0', + + #{card_arrs.batch_date},#{card_arrs.remarks}, + + #{card_arrs.status_id}, + + + '8', + + #{card_arrs.package_id},#{card_arrs.imei},#{card_arrs.type},#{card_arrs.network_type}, + + #{card_arrs.is_sms}, + + + '0', + + #{card_arrs.sms_number}, + + #{card_arrs.gprs}, + + + '0', + + + #{card_arrs.agent_id}, + + + '100', + + + #{card_arrs.user_id}, + + + '1', + + now(),'8',#{create_by}) + + + + + + + + + + + + + + + + + + + + + + + update yz_card_info + + agent_id = #{set_dept_id}, + dept_id = #{set_dept_id}, + user_id = #{set_user_id} + + + id in + + #{idArr} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update yz_card_info + + activate_date = #{activate_date}, + syn_Time =now() + + ,open_date = #{open_date} + + + + iccid =#{iccid} + + + + + + update yz_card_info + + status_id = #{status_id}, + status_ShowId = #{status_ShowId}, + syn_Time =now() + + + iccid =#{iccid} + + + + + + + update yz_card_info + + status_id = #{status_id}, + status_ShowId = #{status_ShowId}, + syn_Time =now() + + + iccid in + + #{iccidArr} + + + + + + + update yz_card_info + + connection_status = #{connection_status}, + syn_Time =now() + + + iccid in + + #{iccidArr} + + + + + + + + + update yz_card_info + + connection_status = #{connection_status}, + syn_Time =now() + + + iccid =#{iccid} + + + + + + + update yz_card_info + + used = #{used}, + remaining = #{remaining}, + syn_Time =now() + + + iccid =#{iccid} + + + + + + + + + + + + + + + + UPDATE + yz_card_info + + remaining = remaining+#{flow} + + + iccid =#{iccid} + + + + + + + update yz_card_info + + + package_id = #{package_id}, + + + channel_id = #{channel_id}, + + + remind_ratio = #{remind_ratio}, + + + is_Disconnected =#{is_Disconnected}, + + + + iccid in + + #{card_arrs.iccid} + + + + + + + update yz_card_info + + imei = #{used}, + syn_Time =now() + + + iccid =#{iccid} + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE + yz_card_info + + customize_grouping = + #{card_arrs.customize_grouping} + "", + remarks = + #{card_arrs.remarks} + "", + deliver_date = + #{card_arrs.deliver_date} + "", + + + iccid = #{card_arrs.iccid} + + ; + + + + + + + + + + + + + + + + + + + + + + + + + + + update yz_card_info + + agent_id = #{dept_id}, + dept_id = #{dept_id}, + user_id = #{user_id} + + + id in + + #{idArr.id} + + + and agent_id = #{error_agent_id} + + + and user_id = #{error_user_id} + + + + + + update yz_card_info + + + customize_grouping =#{customize_grouping}, + + + remarks =#{remarks}, + + + deliver_date =#{deliver_date} + + + + iccid in + + #{iccids} + + + + + + + update yz_card_info + + due_expire_time =#{due_expire_time} + + + iccid in + + #{iccids.iccid} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardPackagetMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardPackagetMapper.xml new file mode 100644 index 0000000..2826862 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardPackagetMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + and a.package_agentname LIKE CONCAT(#{value},'%') + + + and a.package_name LIKE CONCAT(#{value},'%') + + + + and a.package_id in + + #{package_idArr} + + + + and a.dept_id in + + #{agent_id} + + + + and a.id = #{id} + + + ${dataScope} + + + + + + + + + + + INSERT INTO + yz_card_package + ( + package_id, + package_agentname, + package_name, + create_time, + error_so, + dept_id, + user_id + )value ( + #{package_id}, + #{package_agentname}, + #{package_name}, + now(), + + #{error_so}, + + + 1.0, + + 100, + 1 + ) + + + + + + + + + + + UPDATE + yz_card_package + + package_agentname = #{package_agentname}, + package_name = #{package_name} + + + id = #{id} + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardPacketMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardPacketMapper.xml new file mode 100644 index 0000000..66d75ff --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCardPacketMapper.xml @@ -0,0 +1,383 @@ + + + + + + + + 1=1 + + + and a.packet_wx_name LIKE CONCAT(#{packetValue},'%') + + + and a.packet_name LIKE CONCAT(#{packetValue},'%') + + + + and a.wechat_pay in + + #{wechat_pay} + + + + and a.balance_pay in + + #{balance_pay} + + + + and a.is_month in + + #{is_month} + + + + and a.in_stock in + + #{in_stock} + + + + and a.packet_valid_type in + + #{packet_valid_type} + + + + and a.dept_id in + + #{dept_id} + + + + and a.package_id in + + #{package_id} + + + + and a.dept_id in + + #{agent_id} + + + + and a.id = #{id} + + + ${dataScope} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO + yz_card_packet + ( + package_id, + packet_id, + packet_name, + packet_wx_name, + packet_price, + packet_flow, + base_packet_type, + packet_type, + is_profit, + show_profit, + wechat_pay, + balance_pay, + create_time, + error_flow, + error_so, + packet_valid_time, + packet_cost, + is_month, + date_limit, + deduction, + in_stock, + packet_valid_type, + dept_id, + user_id, + packet_valid_name + )value ( + #{package_id}, + #{packet_id}, + #{packet_name}, + #{packet_wx_name}, + #{packet_price}, + #{packet_flow}, + + #{base_packet_type}, + + + 0, + + + #{packet_type}, + + + 0, + + + #{is_profit}, + + + 0, + + + #{show_profit}, + + + 0, + + #{wechat_pay}, + #{balance_pay}, + now(), + #{error_flow}, + #{error_so}, + #{packet_valid_time}, + #{packet_cost}, + #{is_month}, + + #{date_limit}, + + + '', + + #{deduction}, + #{in_stock}, + #{packet_valid_type}, + '100', + '1', + #{packet_valid_name} + ) + + + + + + + + + + + UPDATE + yz_card_packet + + package_id = #{package_id}, + packet_id = #{packet_id}, + packet_name = #{packet_name}, + packet_wx_name = #{packet_wx_name}, + packet_price = #{packet_price}, + packet_flow = #{packet_flow}, + base_packet_type = #{base_packet_type}, + packet_type = #{packet_type}, + is_profit = #{is_profit}, + show_profit = #{show_profit}, + wechat_pay = #{wechat_pay}, + balance_pay = #{balance_pay}, + error_flow = #{error_flow}, + error_so = #{error_so}, + packet_valid_time = #{packet_valid_time}, + packet_cost = #{packet_cost}, + is_month = #{is_month}, + date_limit = #{date_limit}, + deduction = #{deduction}, + in_stock = #{in_stock}, + packet_valid_type = #{packet_valid_type}, + packet_valid_name = #{packet_valid_name} + + + id = #{id} + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCategoryMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCategoryMapper.xml new file mode 100644 index 0000000..9538eae --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCategoryMapper.xml @@ -0,0 +1,51 @@ + + + + + + + + + and category_name LIKE CONCAT(#{value},'%') + + + and category_code LIKE CONCAT(#{value},'%') + + + + category_status =#{category_status} + + + AND + + DATE_FORMAT( modified_time , '%Y-%m-%d' ) + + BETWEEN #{staTime} AND #{endTime} + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCcHisMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCcHisMapper.xml new file mode 100644 index 0000000..afe4dfa --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCcHisMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCcMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCcMapper.xml new file mode 100644 index 0000000..b4aa974 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCcMapper.xml @@ -0,0 +1,134 @@ + + + + + + + + + and cc_name LIKE CONCAT(#{value},'%') + + + + and trigger_type =#{trigger_type} + + + and operation_type =#{operation_type} + + + and execution_type =#{execution_type} + + + and conditions_type =#{conditions_type} + + + and execution_template =#{execution_template} + + + and status =#{status} + + + and conditions_type =#{conditions_type} + + + and execution_template =#{execution_template} + + + AND + + DATE_FORMAT( create_time , '%Y-%m-%d' ) + + BETWEEN #{staTime} AND #{endTime} + + + + + + + + + + + insert into yz_automation_cc ( + trigger_type,channel_id,operation_type,conditions_type,dep_id, + execution_type,status,remark,execution_template,cc_name + )values( + #{trigger_type},#{channel_id},#{operation_type},#{conditions_type},#{dep_id}, + #{execution_type},#{status},#{remark},#{execution_template},#{cc_name} + ) + + + + update + yz_automation_cc + + trigger_type = #{trigger_type}, + channel_id = #{channel_id}, + operation_type = #{operation_type}, + conditions_type =#{conditions_type}, + dep_id =#{dep_id}, + execution_type =#{execution_type}, + status =#{status}, + remark =#{remark}, + execution_template =#{execution_template}, + cc_name =#{cc_name} + + + id =#{id} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzCcUrlMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCcUrlMapper.xml new file mode 100644 index 0000000..e1717ed --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzCcUrlMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + and url LIKE CONCAT(#{PushAPI},'%') + + + and email LIKE CONCAT(#{mail},'%') + + + AND + + DATE_FORMAT( create_time , '%Y-%m-%d' ) + + BETWEEN #{staTime} AND #{endTime} + + + + + + + + + + insert into yz_automation_cc_url( + cc_id,url,email + )values( + #{cc_id},#{url},#{email} + ) + + + + update + yz_automation_cc_url + + url=#{url},email=#{email} + + + id =#{id} + + + + + + + delete from yz_automation_cc_url + + id = #{id} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzExecutionTaskMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzExecutionTaskMapper.xml new file mode 100644 index 0000000..b27d0f1 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzExecutionTaskMapper.xml @@ -0,0 +1,157 @@ + + + + + + + + + AND task_name LIKE CONCAT(#{value},'%') + + + AND auth LIKE CONCAT(#{value},'%') + + + AND url LIKE CONCAT(#{value},'%') + + + + AND agent_id IN + + #{agent_id} + + + + AND type = #{taskType} + + + AND + + DATE_FORMAT( create_time , '%Y-%m-%d' ) + + + DATE_FORMAT( start_time , '%Y-%m-%d' ) + + + DATE_FORMAT( end_time, '%Y-%m-%d' ) + + BETWEEN #{staTime} AND #{endTime} + + + + + + + + + + + + + + + INSERT INTO + yz_execution_task + ( + create_time, + update_time, + start_time, + task_name, + url, + auth, + agent_id, + type + ) + VALUES + ( + now(), + now(), + now(), + #{task_name}, + #{url}, + #{auth}, + #{agent_id}, + #{type} + ) + + + + + + update + yz_execution_task + + end_time = now(), + update_time = now() + + + id = #{id} + + + + + + update + yz_execution_task + + url = #{url}, + update_time = now() + + + id = #{id} + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzFlowHisMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzFlowHisMapper.xml new file mode 100644 index 0000000..c4cfe84 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzFlowHisMapper.xml @@ -0,0 +1,96 @@ + + + + + + + + + and iccid LIKE CONCAT(#{value},'%') + + + + AND + + DATE_FORMAT( create_time , '%Y-%m-%d' ) + + + DATE_FORMAT( update_time , '%Y-%m-%d' ) + + BETWEEN #{staTime} AND #{endTime} + + + and iccid in + + #{IccidArr} + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzInfoChangeMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzInfoChangeMapper.xml new file mode 100644 index 0000000..c6f59b2 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzInfoChangeMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + and iccid LIKE CONCAT(#{value},'%') + + + + AND ctype =#{taskType} + + + AND source_type =#{source} + + + AND execution_status =#{state} + + + AND + + DATE_FORMAT( createTime , '%Y-%m-%d' ) + + BETWEEN #{staTime} AND #{endTime} + + + and iccid in + + #{IccidArr} + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzOrderMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzOrderMapper.xml new file mode 100644 index 0000000..6ae2ac8 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzOrderMapper.xml @@ -0,0 +1,362 @@ + + + + + + + + + + + + and a.iccid = #{value} + + + and a.ord_no = #{value} + + + and a.ord_name LIKE CONCAT('%',#{value},'%') + + + and a.wx_ord_no = #{value} + + + and a.info LIKE CONCAT('%',#{value},'%') + + + + and a.pay_type = #{payment} + + + and a.add_package = #{Addpackage} + + + and a.status = #{status} + + + and ord_type = #{ord_type} + + + and a.packet_id = #{packet_id} + + + and a.pay_type = #{pay_type} + + + and a.cre_type = #{cre_type} + + + and a.is_profit = #{is_profit} + + + and a.add_package = #{add_package} + + + and a.show_status = #{show_status} + + + and a.open_id = #{open_id} + + + and a.agent_id in + + #{agent_id} + + + + and + + a.iccid + + BETWEEN #{StartValue} AND #{EndValue} + + + and + + DATE_FORMAT( a.create_time, "%Y-%m-%d %H:%i:%S" ) + + + DATE_FORMAT( a.add_package_time, "%Y-%m-%d %H:%i:%S" ) + + BETWEEN #{staTime} AND #{endTime} + + + and del_flag =#{del_flag} + + + + + + + + + + + + + + + + + + + + + update + yz_order + + add_package = 1 + + + id = #{id} + + + + + + + + update yz_order + + add_package = 1 + + + + id in ( + SELECT + b.id + FROM + yz_card_flow a, + yz_order b + where + a.ord_no = b.ord_no + and a.iccid = b.iccid + and b.add_package = 0 + ) + + + + + + + + update yz_card_info + + activate_date = #{activate_date} + + ,open_date = #{open_date} + + + + iccid =#{iccid} + + + + + + + update yz_order + + add_package = '1', + add_package_time = now() + + ,info = #{info} + + + + iccid =#{iccid} + and ord_no = #{ord_no} + + + + + + + + + + + + + insert into + yz_order + ( + ord_no,ord_type,ord_name,iccid,wx_ord_no, + status,price,account,packet_id,pay_type, + cre_type,is_profit,add_package,show_status,open_id,agent_id, + profit_type,create_time,validate_type,info,add_parameter,del_flag,is_profit_sharing + ) + value + + (#{order_arrs.ord_no},#{order_arrs.ord_type},#{order_arrs.ord_name},#{order_arrs.iccid},#{order_arrs.wx_ord_no}, + #{order_arrs.status},#{order_arrs.price},#{order_arrs.account},#{order_arrs.packet_id},#{order_arrs.pay_type}, + #{order_arrs.cre_type},#{order_arrs.is_profit},#{order_arrs.add_package},#{order_arrs.show_status},#{order_arrs.open_id},#{order_arrs.agent_id}, + #{order_arrs.profit_type},now(),#{order_arrs.validate_type},#{order_arrs.info}, #{order_arrs.add_parameter} ,0,0 + ) + + + + + + + insert into + yz_order + ( + ord_no,ord_type,ord_name,iccid,wx_ord_no, + status,price,account,packet_id,pay_type, + cre_type,is_profit,add_package,show_status,open_id,agent_id, + profit_type,create_time,validate_type,info,add_parameter,del_flag,is_profit_sharing + ) + value + (#{ord_no},#{ord_type},#{ord_name},#{iccid},#{wx_ord_no}, + #{status},#{price},#{account},#{packet_id},#{pay_type}, + #{cre_type},#{is_profit},#{add_package},#{show_status},#{open_id},#{agent_id}, + #{profit_type},now(),#{validate_type},#{info}, #{add_parameter},0,0 + ) + + + + + + insert into + yz_order + ( + ord_no,ord_type,ord_name,iccid,wx_ord_no, + status,price,account,pay_type, + cre_type,is_profit,add_package,show_status,open_id,agent_id, + create_time,del_flag,info + ) + value + (#{ord_no},#{ord_type},#{ord_name},#{iccid},#{wx_ord_no}, + #{status},#{price},#{account},#{pay_type}, + #{cre_type},#{is_profit},#{add_package},#{show_status},#{open_id},#{agent_id}, + now(),0, + ) + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzPassagewayMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzPassagewayMapper.xml new file mode 100644 index 0000000..6e3a0b1 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzPassagewayMapper.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzPassagewayPollingMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzPassagewayPollingMapper.xml new file mode 100644 index 0000000..1572573 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzPassagewayPollingMapper.xml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + INSERT INTO + yz_passageway_polling + ( + cd_id, + create_date, + cd_count, + cd_current, + polling_id, + upd_date, + polling_type + )value ( + #{cd_id}, + now(), + #{cd_count}, + #{cd_current}, + #{polling_id}, + now(), + #{polling_type} + ) + + + + + + + + + + + + + + + + UPDATE + yz_passageway_polling + + syn_date = now(), + upd_date = now(), + cd_current = #{cd_current} + + + polling_id = #{polling_id} + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzSysLogsMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzSysLogsMapper.xml new file mode 100644 index 0000000..f121ee6 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzSysLogsMapper.xml @@ -0,0 +1,217 @@ + + + + + + delete from yz_sys_logs + + + + and id in + + #{idAll.id} + + + + + + + + + + + + and res_url LIKE CONCAT(#{value},'%') + + + and class_method LIKE CONCAT(#{value},'%') + + + and ip LIKE CONCAT(#{value},'%') + + + and request_args LIKE CONCAT(#{value},'%') + + + and response_args LIKE CONCAT(#{value},'%') + + + and user_name LIKE CONCAT(#{value},'%') + + + + AND project = #{taskType} + + + AND + + DATE_FORMAT( create_time , '%Y-%m-%d' ) + + BETWEEN #{staTime} AND #{endTime} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/YzUserMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/YzUserMapper.xml new file mode 100644 index 0000000..90535c5 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/YzUserMapper.xml @@ -0,0 +1,112 @@ + + + + + + + + + + select u.user_id, u.dept_id, u.user_name, u.nick_name, 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, + d.dept_id, d.parent_id, 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 + 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 + + + + + + u.del_flag = '0' + + AND u.user_name like CONCAT( #{user_name}, '%') + + + AND u.nick_name like CONCAT( #{nick_name}, '%') + + + AND u.status = #{status} + + + AND u.phonenumber like CONCAT( #{phonenumber}, '%') + + + AND DATE_FORMAT( u.create_time, '%Y-%m-%d' ) BETWEEN #{staTime} AND #{endTime} + + AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) + + ${dataScope} + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/automationCC/YzAutomationCcHisMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/automationCC/YzAutomationCcHisMapper.xml new file mode 100644 index 0000000..6615f9c --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/automationCC/YzAutomationCcHisMapper.xml @@ -0,0 +1,77 @@ + + + + + + + + INSERT INTO + yz_automation_cc_his + ( + cc_id, + cc_url, + cc_email, + cc_state, + cc_result, + remark, + cc_parameter, + create_time, + cc_count, + cc_time + )VALUE + ( + #{cc_id}, + #{cc_url}, + #{cc_email}, + #{cc_state}, + #{cc_result}, + #{remark}, + #{cc_parameter}, + now(), + 0, + now() + ) + + + + + UPDATE yz_automation_cc_his + + cc_count = cc_count+1, + cc_time = now(), + cc_state = '1', + cc_result = #{cc_result}, + remark = #{remark} + + + id = #{id} + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/automationCC/YzAutomationCcMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/automationCC/YzAutomationCcMapper.xml new file mode 100644 index 0000000..9286745 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/automationCC/YzAutomationCcMapper.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/automationCC/YzAutomationCcUrlMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/automationCC/YzAutomationCcUrlMapper.xml new file mode 100644 index 0000000..998a2a0 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/automationCC/YzAutomationCcUrlMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-common/src/main/resources/mapper/quartz/yunze/commodity/YzWxByProductAgentMapper.xml b/yunze-common/src/main/resources/mapper/quartz/yunze/commodity/YzWxByProductAgentMapper.xml new file mode 100644 index 0000000..90df0e2 --- /dev/null +++ b/yunze-common/src/main/resources/mapper/quartz/yunze/commodity/YzWxByProductAgentMapper.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO yz_wx_by_product_agent ( + dept_id + )values + + ( + #{IdArr} + ) + + + + + delete from yz_wx_by_product_agent + + + + \ No newline at end of file diff --git a/yunze-common/yunze-common.iml b/yunze-common/yunze-common.iml new file mode 100644 index 0000000..243ab66 --- /dev/null +++ b/yunze-common/yunze-common.iml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-admin/cAdmin.iml b/yunze-consumption-admin/cAdmin.iml new file mode 100644 index 0000000..f22522b --- /dev/null +++ b/yunze-consumption-admin/cAdmin.iml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-admin/pom.xml b/yunze-consumption-admin/pom.xml new file mode 100644 index 0000000..0b47307 --- /dev/null +++ b/yunze-consumption-admin/pom.xml @@ -0,0 +1,109 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + cAdmin + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.apache.commons + commons-lang3 + + + + com.alibaba + fastjson + 1.2.49 + + + + org.projectlombok + lombok + + + com.yunze + yunze-common + + + com.alibaba + druid + 1.2.6 + compile + + + + + mysql + mysql-connector-java + + + + + + + + + + + cAdmin + + + src/main/resources + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + src/main/java + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-admin/src/main/java/com/yunze/CAdminApplication.java b/yunze-consumption-admin/src/main/java/com/yunze/CAdminApplication.java new file mode 100644 index 0000000..5514785 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/CAdminApplication.java @@ -0,0 +1,15 @@ +package com.yunze; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +@SpringBootApplication +@MapperScan("com.yunze.common.mapper") +@MapperScan("com.yunze.apiCommon.mapper") +class CAdminApplication { + public static void main(String[] args) { + SpringApplication.run(CAdminApplication.class); + } +} diff --git a/yunze-consumption-admin/src/main/java/com/yunze/config/DisposableBean.java b/yunze-consumption-admin/src/main/java/com/yunze/config/DisposableBean.java new file mode 100644 index 0000000..b98b722 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/config/DisposableBean.java @@ -0,0 +1,44 @@ +package com.yunze.config; + +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @Auther: zhang feng + * @Date: 2021/07/10/14:24 + * @Description: + */ +@Component +public class DisposableBean { + + + @Autowired + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RedisCache redisCache; + + + + @PreDestroy + public void exit(){ + /*//防止程序意外终止后 redis 还有记录正在监听 记录 下次程序启动不在创建 消费者 + System.out.println("cardStop 程序结束 执行删除redis Listener 记录key "); + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + List IDArr = yzCardRouteMapper.findIDArr(); + if(IDArr!=null && IDArr.size()>0) { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < IDArr.size(); i++) { + String cd_id = IDArr.get(i); + redisCache.redisTemplate.delete("polling_cardCardStop_queue_"+cd_id); + } + }*/ + + } +} diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/ArrOrders.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/ArrOrders.java new file mode 100644 index 0000000..f21c7bf --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/ArrOrders.java @@ -0,0 +1,374 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardFlowMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 全部订单导出 + * */ + +@Slf4j +@Component +public class ArrOrders { + + + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private YzCardFlowMapper yzCardFlowMapper; + + + + @RabbitHandler + @RabbitListener(queues = "admin_Exportallorders_queue") + public void DbCard(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map Pmap = JSON.parseObject(msg); + //System.out.println(Pmap); + Map map = (Map) Pmap.get("map"); + Map User = (Map) Pmap.get("User"); + List> outCardIccidArr = (List>) Pmap.get("outCardIccidArr"); + List> userArr = (List>) Pmap.get("userArr"); + List> arrorders = (List>) Pmap.get("arrorders"); + List> stateOptions = (List>) Pmap.get("stateOptions"); + List> pay_type = (List>) Pmap.get("pay_type"); + List> customize_whether = (List>) Pmap.get("customize_whether"); + List> cardConnection_type = (List>) Pmap.get("cardConnection_type"); + + + String newName = (String) Pmap.get("newName"); + Map task_map = (Map) Pmap.get("task_map"); + + String prefix = "admin_Exportallorders_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + OutDataCard( map,User,outCardIccidArr,userArr,arrorders,stateOptions,pay_type,customize_whether, newName,task_map,cardConnection_type); + + }catch (Exception e){ + log.error(">>错误 - 全部的订单导出 消费者:{}<<", e.getMessage().toString()); + } + + } + + private void OutDataCard(Map map, Map user, List> outCardIccidArr, List> userArr, List> arrorders, List> stateOptions, + List> pay_type, List> customize_whether, String newName, Map task_map, List> cardConnection_type) { + + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + Map Dept = (Map) user.get("dept"); + String agent_id = Dept.get("deptId").toString(); + if(agent_id.equals("100")){ + yzCardFlowMapper.queryPackage_simple(map); + }else{ + Map PackageMap = new HashMap(); + PackageMap.put("agent_id",agent_id); + yzCardFlowMapper.queryAgentPackage_simple(PackageMap); + } + map.put("iccid_arrs",outCardIccidArr); + + try { + WriteOutCard(outCardIccidArr,stateOptions,pay_type,userArr,arrorders,customize_whether,newName,task_map,cardConnection_type); + }catch (Exception e){ + log.error("导出卡信息异常 [导出数据 Exception] "+e.getCause().toString() ); + } + + + + } + + /** + * 字典获取 + * @param CarMap 写入Map + * @param DictDataArr 字典 list + * @param basis 获取依据 字段 与 dictValue 判断 + * @param fieldName 返回字段名称 + * @return + */ + public Map WriteDic (Map CarMap,List> DictDataArr,String basis,String fieldName){ + + Map Rmap = new HashMap(); + String status_id = CarMap.get(basis)!=null?CarMap.get(basis).toString():null; + boolean bool = false; + if(status_id!=null){ + for (int i = 0; i < DictDataArr.size(); i++) { + Map dictData = DictDataArr.get(i); + String dictValue = dictData.get("dictValue").toString(); + if(dictValue.equals(status_id)){ + CarMap.put(fieldName,dictData.get("dictLabel")); + bool = true; + break; + } + } + } + //字段 默认值 + if(!bool){ + CarMap.put(fieldName,""); + } + return CarMap; + } + + /** + * 写入 所属集团信息 + * @param CarMap + * @param deptArr + * @return + */ + protected Map WriteCarUser (Map CarMap,List> deptArr){ + + Map Rmap = new HashMap(); + String user_id = CarMap.get("agent_id")!=null?CarMap.get("agent_id").toString():null; + boolean bool = false; + if(deptArr!=null && user_id !=null){ + for (int i = 0; i < deptArr.size(); i++) { + Map UserMap = deptArr.get(i); + String Fuser_id = UserMap.get("dept_id").toString(); + if(Fuser_id.equals(user_id)){ + CarMap.put("dept_name",UserMap.get("dept_name")); + bool = true; + break; + } + } + } + if(!bool){ + CarMap.put("dept_name",""); + } + return CarMap; + } + + + + /** + * 写入 年月日 + * @param CarMap + * @param deptArr + * @return + */ + protected Map WriteFlow (Map CarMap,List> deptArr){ + + String user_id = CarMap.get("packet_id")!=null?CarMap.get("packet_id").toString():null; + boolean bool = false; + if(deptArr!=null && user_id !=null){ + for (int i = 0; i < deptArr.size(); i++) { + Map UserMap = deptArr.get(i); + String packet_id = UserMap.get("packet_id").toString(); + if(packet_id.equals(user_id)){ + CarMap.put("packet_name_value",UserMap.get("packet_wx_name")); + CarMap.put("packet_valid_name_value",UserMap.get("packet_valid_name")); + CarMap.put("packet_valid__value",UserMap.get("packet_valid_time")); + CarMap.put("packet_flow_value",UserMap.get("packet_flow")); + + bool = true; + break; + } + } + } + if(!bool){ + CarMap.put("packet_name_value",""); + CarMap.put("packet_valid_name_value",""); + CarMap.put("packet_valid__value",""); + CarMap.put("packet_flow_value",""); + } + return CarMap; + } + + + + private String WriteOutCard(List> outCardArr, + List> stateOptions, List> pay_type, + List> deptArr, List> arrorders, List> customize_whether, + String newName, Map task_map, List> cardConnection_type) { + boolean outFlowInfo = false; + outFlowInfo = arrorders!=null && arrorders.size()>0?true:false; + + List> out_list = new ArrayList>(); + //循环添加单卡数据信息 + for (int i = 0; i < outCardArr.size(); i++) { + Map CarMap = outCardArr.get(i); + + //写入 支付方式 pay_type_value + CarMap = WriteDic(CarMap,pay_type,"pay_type","pay_type_value"); + //写入 支付状态 status_value + CarMap = WriteDic(CarMap,stateOptions,"status","status_value"); + //写入 自定义是否 pay_type_value + CarMap = WriteDic(CarMap,customize_whether,"add_package","add_package_value"); + //写入 生效类型 pay_type_value + CarMap = WriteDic(CarMap,cardConnection_type,"validate_type","validate_type_value"); + + //写入 所属集团信息 + CarMap = WriteCarUser(CarMap,deptArr); + + //写入 资费计划 信息 + if(outFlowInfo){ + CarMap = WriteFlow(CarMap,arrorders); + } + + + out_list.add(CarMap); + } + + String Outcolumns[] = {"订单号","交易名称","串号","微信订单号","支付状态","交易金额","支付方式","是否已加包","创建时间","生效类型","备注","加包执行时间"}; + String keys[] = {"ord_no","ord_name","iccid","wx_ord_no","status_value","price","pay_type_value","add_package_value","create_time","validate_type_value","info","add_package_time"}; + + if(outFlowInfo){ + Outcolumns = new String[]{"订单号", "交易名称", "串号", "微信订单号", "支付状态", "交易金额", "支付方式", "是否已加包", "创建时间", "生效类型", "备注", "加包执行时间","资费计划名称","资费计划规则 月 年","资费计划规格","套餐包流量","所属公司"}; + keys = new String[]{"ord_no", "ord_name", "iccid", "wx_ord_no", "status_value", "price", "pay_type_value", "add_package_value", "create_time", "validate_type_value", "info", "add_package_time","packet_name_value","packet_valid_name_value","packet_valid__value","packet_flow_value","dept_name"}; + } + + + writeCSV.Write(newName,out_list,Outcolumns,null,keys); + + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + return "已下发执行任务可在【设备管理】》【执行任务管理】查看"; + + + } + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardCEndValue.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardCEndValue.java new file mode 100644 index 0000000..6021f7c --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardCEndValue.java @@ -0,0 +1,295 @@ +package com.yunze.system.card; +import com.yunze.common.config.MyDictionary; +import com.yunze.common.mapper.yunze.YzCardInfoChangeMapper; +import com.yunze.common.mapper.yunze.YzCardIsStopMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.mapper.yunze.commodity.YzWxByProductAgentMapper; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.utils.yunze.GetShowStatIdArr; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Component; +import javax.annotation.Resource; +import java.io.IOException; +import java.util.*; + +@Slf4j +@Component +public class CardCEndValue { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private YzCardIsStopMapper yzCardIsStopMapper; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private YzCardInfoChangeMapper yzCardInfoChangeMapper; + @Resource + private MyDictionary myDictionary; + @Resource + private YzWxByProductAgentMapper yzWxByProductAgentMapper; + @Resource + private GetShowStatIdArr getShowStatIdArr; + + private String Outcolumns[] = {"iccid", "返回消息", "执行描述", "执行人", "执行结果"}; + private String keys[] = {"iccid", "Message", "describe", "agentName", "result"}; + private int OutSize = 50;//每 50条数据输出一次 + + /** + * C端充值 轮询 卡状态变更失败的 进行再次 复机;(前提是没用完用量) + */ + @RabbitHandler + @RabbitListener(queues = "admin_CEndValue_queue") + public void CardMonth(String msg) throws IOException { + try { + execution();//C端充值 轮询 卡状态变更失败的 进行再次 复机 + } catch (Exception e) { + log.error(">>错误 - C端充值 轮询 卡状态变更失败的 进行再次 复机 消费者:{}<<", e.getMessage()); + } + } + + private void execution() { + String Message = ""; + HashMap map = new HashMap<>(); + + List> card_arrs = new ArrayList>(); + map.put("config_key", "yunze.card.IsStop");//参数键名 config_key + String MaixCount = yzWxByProductAgentMapper.findConfig(map);//查询系统配置 + MaixCount = MaixCount != null ? MaixCount : "10"; + map.put("MaixCount", MaixCount); + + List> SleOrcount = yzCardIsStopMapper.SleOrcount(map);//数据库 查询 + List> SleOrderno = yzCardIsStopMapper.SleOrderno(map);//数据库 查询 + card_arrs.addAll(0, SleOrcount); + int index = card_arrs.size() - 1; + index = index>=0?index:0; + card_arrs.addAll(index, SleOrderno);//添加到一个List + map.put("cardArrs", card_arrs); + + List> SleMulti = yzCardMapper.SleMulti(map);//数据库 查询 + + + + String create_by = " [总平台] - " + " [管理员] "; + //1.读取 上传文件 + String newName = UUID.randomUUID().toString().replace("-", "") + "_CardAgain";//这里 + String task_name = create_by + "-C端充值 [变更失败再次 复机] "; + String SaveUrl = "/getcsv/" + newName + ".csv"; + SaveUrl = "/getcsv/" + newName + ".csv"; + Map task_map = new HashMap(); + task_map.put("auth", create_by); + task_map.put("task_name", task_name); + task_map.put("url", SaveUrl); + task_map.put("agent_id", "100"); + task_map.put("type", "10"); //对应的任务类别 + if(SleMulti!=null && SleMulti.size()>0){ + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + }else{ + System.out.println("C端充值 失败再次 未找到需要,需要操作的数据! "); + } + + map.put("card_arrs", SleMulti);//更新 list + + try { + + List> SuccessArr = new ArrayList<>(); + String describe = ""; + List> failArr = new ArrayList<>(); + String cafterward = "正常";//变更后状太 + String OPtionType = "";//操作类型 + for (int i = 0; i < SleMulti.size(); i++) { + + Map Obj = new HashMap<>(); + String iccid = SleMulti.get(i).get("iccid").toString(); + String ord_no = SleMulti.get(i).get("ord_no").toString(); + Obj.put("iccid", iccid); + Obj.put("Is_Stop", "on"); + Obj.put("ord_no", ord_no); + + Map Rmap = internalApiRequest.changeCardStatus(Obj, SleMulti.get(i)); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //复机操作 + Object status = Rmap.get("status"); + if (status != null && status != "" && status.toString().trim().length() > 0) { + Obj.put("status", status.toString().trim()); + String RMessage = Rmap.get("Message") != null ? Rmap.get("Message").toString() : "操作成功!"; + Obj.put("Message", RMessage); + Obj.put("describe", describe); + Obj.put("agentName", create_by); + Obj.put("result", "操作成功"); + SuccessArr.add(Obj); + log.info(">>API - 变更操作 成功 = 0 :{} | {}<<", iccid, Rmap); + } + } else { + Obj.put("agentName", create_by); + Obj.put("result", "操作失败"); + Message = Rmap.get("Message") != null ? Rmap.get("Message").toString() : "API异常!"; + Obj.put("Message", Message); + failArr.add(Obj); + } + String ctype = ""; + String dict_type = ""; + String key = ""; + key = "status_id"; + dict_type = "yunze_card_status_ShowId"; + ctype = "1"; + + List> lmArr = yzCardMapper.addsel(map);//这里是 查询 出 数据库 操作 前 卡状态 + + List> AddArr = new ArrayList<>(); + List> AddStop = new ArrayList<>(); + //2. 卡信息 变更表 插入数据 + if (SuccessArr.size() > 0) { + writeCSV.OutCSVObj(SuccessArr, newName, Outcolumns, keys, null, OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + //变更主表信息 + try { + updStatus(SuccessArr, "1");//下发变更 卡状态 队列 + } catch (Exception e) { + log.info(">>错误 - 变更主表信息 :{} | {}<<", e.getMessage()); + } + String cbefore = "正常";//变更后 + for (int j = 0; j < lmArr.size(); j++) { + Map ObjMap = lmArr.get(j); + Map Add_Map = new HashMap<>(); + String value = ObjMap.get(key) != null && ObjMap.get(key).toString().length() > 0 ? ObjMap.get(key).toString() : "未知"; + + if (!value.equals("未知")) { + cbefore = myDictionary.getdictLabel(dict_type, value); + } else { + cbefore = value; + } + Add_Map.put("iccid", ObjMap.get("iccid")); + Add_Map.put("ctype", ctype);//生命周期 + Add_Map.put("cbefore", cbefore); + Add_Map.put("cafterward", cafterward); + Add_Map.put("remark", "执行成功!"); + Add_Map.put("source_type", "7");// 来源 类型 + Add_Map.put("execution_status", "1"); + AddArr.add(Add_Map); + } + Map map1 = new HashMap<>(); + map1.put("CardInfoMapList", AddArr); + map1.put("ctype", lmArr); + int addBool = yzCardInfoChangeMapper.addinfo(map1); + log.info("插入成功"); + log.info("Dlx - " + map.get("iccid") + " 卡信息变更表 插入 : " + OPtionType + " 新增卡信息变更记录 addBool :" + addBool); + + + for (int j = 0; j < SuccessArr.size(); j++) { + Map ObjMap = SuccessArr.get(j); + Map Add_Map = new HashMap<>(); + Add_Map.put("iccid", ObjMap.get("iccid")); + Add_Map.put("status", "1"); + Add_Map.put("order_no", ObjMap.get("ord_no")); + AddStop.add(Add_Map); + } + Map map3 = new HashMap<>(); + map3.put("Stoploop", AddStop); + int AddStopBool = yzCardIsStopMapper.AddStop(map3); + log.info("Dlx - " + map.get("iccid") + " 卡信息 插入 : " + SuccessArr + " 新增月初复机有用量的卡 addBool :" + AddStopBool); + SuccessArr = new ArrayList<>(); + + } + if (failArr.size() > 0) { + + writeCSV.OutCSVObj(failArr, newName, Outcolumns, keys, null, OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + for (int j = 0; j < lmArr.size(); j++) { + Map ObjMap = lmArr.get(j); + Map Add_Map = new HashMap<>(); + String value = ObjMap.get(key) != null && ObjMap.get(key).toString().length() > 0 ? ObjMap.get(key).toString() : "未知"; + String cbefore = "";//变更后 + if (!value.equals("未知")) { + cbefore = myDictionary.getdictLabel(dict_type, value); + } else { + cbefore = value; + } + Add_Map.put("iccid", ObjMap.get("iccid")); + Add_Map.put("ctype", ctype);//生命周期 + Add_Map.put("cbefore", cbefore); + Add_Map.put("cafterward", cafterward); + Add_Map.put("describe", describe); + Add_Map.put("agentName", create_by); + Add_Map.put("remark", "执行失败!"); + Add_Map.put("source_type", "7");// 来源 类型 + Add_Map.put("execution_status", "2"); + AddArr.add(Add_Map); + } + Map map2 = new HashMap<>(); + map2.put("CardInfoMapList", AddArr); + int addBool = yzCardInfoChangeMapper.addinfo(map2); + log.info("Dlx - " + map.get("iccid") + " 卡信息变更表 插入 : " + SuccessArr + " 新增卡信息变更记录 addBool :" + addBool); + + + for (int j = 0; j < failArr.size(); j++) { + Map ObjMap = failArr.get(j); + Map Add_Map = new HashMap<>(); + Add_Map.put("iccid", ObjMap.get("iccid")); + Add_Map.put("status", "2"); + Add_Map.put("order_no", ObjMap.get("ord_no")); + AddStop.add(Add_Map); + } + Map map3 = new HashMap<>(); + map3.put("Stoploop", AddStop); + int AddStopBool = yzCardIsStopMapper.AddStop(map3); + log.info("Dlx - " + map.get("iccid") + " 卡信息 插入 : " + SuccessArr + " 新增月初复机有用量的卡 addBool :" + AddStopBool); + failArr = new ArrayList<>(); + } + + } + + } catch (DuplicateKeyException e) { + String[] solit = e.getCause().toString().split("'"); + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", e.getCause().toString()); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(SleMulti, newName, Outcolumns, keys, defOutcolumns, OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">> cardSet-消费者- 上传excel异常 [插入数据 DuplicateKeyException ] :{}<<", e.getMessage().toString()); + } catch (Exception e) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", e.getCause().toString()); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(SleMulti, newName, Outcolumns, keys, defOutcolumns, OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">>cardSet-消费者- 批量查询消费者:{}<<", e.getMessage()); + } + } + /** + * 修改卡状态 + * @param SuccessArr + */ + public void updStatus(List> SuccessArr, String statusCode) { + //1. 修改卡状态 || 修改停机状态 + List iccidArr = new ArrayList(); + Map Upd_Map = new HashMap<>(); + for (int i = 0; i < SuccessArr.size(); i++) { + iccidArr.add(SuccessArr.get(i).get("iccid").toString()); + } + Upd_Map.put("iccidArr", iccidArr); + Upd_Map.put("status_id", statusCode); + Upd_Map.put("status_ShowId",getShowStatIdArr.GetShowStatId(statusCode)); + + yzCardMapper.updStatusIdArr(Upd_Map); + } +} + + + + + + + diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardImportBatchApiUpd.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardImportBatchApiUpd.java new file mode 100644 index 0000000..fcfd3fc --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardImportBatchApiUpd.java @@ -0,0 +1,465 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.MyDictionary; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardInfoChangeMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 特殊操作 批量变更停复机操作 + */ +@Slf4j +@Component +public class CardImportBatchApiUpd { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private YzCardInfoChangeMapper yzCardInfoChangeMapper; + @Resource + private MyDictionary myDictionary; + @Resource + private GetShowStatIdArr getShowStatIdArr; + + private String Outcolumns[] = {"iccid", "返回消息", "执行描述", "执行人", "执行结果"}; + private String keys[] = {"iccid", "Message", "describe", "agentName", "result"}; + private int OutSize = 50;//每 50条数据输出一次 + + /** + * 批量停复机 断开网 操作 + */ + @RabbitHandler + @RabbitListener(queues = "admin_CardImportBatch_queue") + public void CardSelImie(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String filePath = map.get("filePath").toString();//项目根目录 + String ReadName = map.get("ReadName").toString();//上传新文件名 + Map Pmap = (Map) map.get("map");//参数 + Map User = (Map) Pmap.get("User");//登录用户信息 + + String prefix = "admin_CardImportBatch_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix + ":" + ReadName); + if (isExecute == null) { + redisCache.setCacheObject(prefix + ":" + ReadName, msg, 3, TimeUnit.SECONDS);//3 秒缓存 避免 重复消费 + execution(filePath, ReadName, Pmap, User);//执行特殊操作 查询imie + } + } catch (Exception e) { + log.error(">>错误 - 特殊操作 批量停复机 断开网 消费者:{}<<", e.getMessage().toString()); + } + } + + /** + * 查询执行 + */ + public void execution(String filePath, String ReadName, Map Pmap, Map User) { + String Message = ""; + String cbefore = "";//变更前 + String cafterward = "";//变更后 + String OPtionType = "";//操作类型 + String describe = ""; + + //1.读取 上传文件 + String path = filePath + "/upload/importSelImei/" + ReadName; + ExcelConfig excelConfig = new ExcelConfig(); + String columns[] = {"iccid"}; + List> list = excelConfig.getExcelListMap(path, columns); + Map Dept = (Map) User.get("dept"); + String create_by = " [ " + Dept.get("deptName") + " ] - " + " [ " + User.get("userName") + " ] "; + + String newName = UUID.randomUUID().toString().replace("-", "") + "_CardChangeInfo"; + String task_name = create_by + "-批量变更 [批量变更 输出] "; + String SaveUrl = "/getcsv/" + newName + ".csv"; + SaveUrl = "/getcsv/" + newName + ".csv"; + Map task_map = new HashMap(); + task_map.put("auth", create_by); + task_map.put("task_name", task_name); + task_map.put("url", SaveUrl); + task_map.put("agent_id", User.get("deptId")); + task_map.put("type", "8"); + + if (list != null && list.size() > 0) { + //筛选出 iccid 卡号 重复项 + Map getNotRepeatingMap = Different.getNotRepeating(list, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap.get("Rlist");//更新 查询数据 + List> Repeatlist = (List>) getNotRepeatingMap.get("Repeatlist"); + if (Repeatlist.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "ICCID重复查询失败!同一ICCID同批次,无需多次查询!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(Repeatlist, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + //查询数据库中 匹对iccid 是否存在 + HashMap map = new HashMap<>(); + //添加修改数据 + map.put("card_arrs", list); + map.put("type", "3"); + List iccidarr = yzCardMapper.isExistence(map); + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + if (iccidarr != null && iccidarr.size() > 0) { + //1.判断 查询卡号是否都在库里 + //库中查询出卡号与上传卡号数量 不一致 说明有卡号不在数据库中 + if (!(iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "iccid 不在数据库中!请核对iccid卡号!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(Out_list_Different, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } + map.put("card_arrs", list);//更新 list + try { + if (list != null && list.size() > 0) { + //筛选出未划分通道的 + map.put("channel_idType", "notNull"); + List Channel_iccidarr = yzCardMapper.isExistence(map); + if (Channel_iccidarr != null && Channel_iccidarr.size() > 0) { + if (!(Channel_iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, Channel_iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "未划分通道,取消操作!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(Out_list_Different, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } + map.put("card_arrs", list);//更新 list + List> find_crArr = yzCardRouteMapper.find_cr();//查询 通道简要信息 状态为 正常 + List channel_idArr = new ArrayList<>(); + if (find_crArr != null && find_crArr.size() > 0) { + for (int i = 0; i < find_crArr.size(); i++) { + channel_idArr.add(find_crArr.get(i).get("dictValue")); + } + } else { + channel_idArr.add("0"); + } + //筛选出通道正常的进行 查询 + map.put("channel_idArr", channel_idArr); + List normalChannel_iccidarr = yzCardMapper.isExistence(map); + if (normalChannel_iccidarr != null && normalChannel_iccidarr.size() > 0) { + if (!(normalChannel_iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, normalChannel_iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "通道状态 为停用或已删除 取消操作"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(Out_list_Different, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } + map.put("card_arrs", list);//更新 list + + List> SuccessArr = new ArrayList<>(); + List> failArr = new ArrayList<>(); + + String Is_remind_ratio = Pmap.get("Is_remind_ratio").toString(); + System.out.println(Is_remind_ratio.toString()); + String Switch_network = Pmap.get("Switch_network").toString(); + List> findRouteArr = yzCardMapper.findRouteArr(map);//查询 卡号 分配 通道 及变更前 卡状态 断开网状态 + //判断 取值 key 字典key ctype + String ctype = ""; + String dict_type = ""; + String key = ""; + if (Is_remind_ratio.equals("3") || Is_remind_ratio.equals("2")) {//停复机 + key = "Sel_status_ShowId"; + dict_type = "yunze_card_status_ShowId"; + ctype = "1"; + }else if (Switch_network.equals("3") || Switch_network.equals("2")) {//断开网 + key = "Sel_connection_status"; + dict_type = "yz_cardConnection_type"; + ctype = "2"; + } + + + for (int i = 0; i < findRouteArr.size(); i++) { + Map Obj = findRouteArr.get(i); + String iccid = Obj.get("iccid").toString(); + Obj.put("iccid", iccid); + + //设置 变更前后 数据 + Obj.put("ctype", ctype);//变更 类型 + String value = Obj.get(key) != null && Obj.get(key).toString().length() > 0 ? Obj.get(key).toString() : "未知"; + if (!value.equals("未知")) { + cbefore = myDictionary.getdictLabel(dict_type, value); + } else { + cbefore = value; + } + Obj.put("cbefore", cbefore);//变更前 + + + //【是否停复机】 on 开机 off 停机 + System.out.println(Switch_network.toString()); + if (Is_remind_ratio.equals("1") && Switch_network.equals("1")) { + System.out.println("不操作"); + } else if (!Is_remind_ratio.equals("1") && !Switch_network.equals("1")) { + System.out.println("多项操作不允许"); + } else if (!Is_remind_ratio.equals("1")) { + System.out.println("批量停复机操作"); + describe = "批量停复机操作-"; + OPtionType = "changeCardStatus"; + if (Is_remind_ratio.equals("3")) { + describe += "【复机】"; + cafterward = "已激活"; + Obj.put("Is_Stop", "on"); + } else if (Is_remind_ratio.equals("2")) { + describe += "【停机】"; + cafterward = "已停机"; + Obj.put("Is_Stop", "off"); + } + Obj.put("cafterward", cafterward);//变更后 + Map Rmap = internalApiRequest.changeCardStatus(Obj, findRouteArr.get(i)); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + + if (code.equals("200")) { + //停复机操作 + Object status = Rmap.get("status"); + if (status != null && status != "" && status.toString().trim().length() > 0) { + Obj.put("status", status.toString().trim()); + String RMessage = Rmap.get("Message") != null ? Rmap.get("Message").toString() : "操作成功!"; + Obj.put("Message", RMessage); + Obj.put("agentName", create_by); + Obj.put("result", "操作成功"); + SuccessArr.add(Obj);//输出 csv 文间 + log.info(">>API - 变更操作 statusCode = 0 :{} | {}<<", iccid, Rmap); + } + } else { + Obj.put("result", "操作失败"); + Message = Rmap.get("Message") != null ? Rmap.get("Message").toString() : "API异常!"; + Obj.put("Message", Message); + failArr.add(Obj); + } + } else if (!Switch_network.equals("1")) { + System.out.println("允许操作"); + describe = "断开网操作"; + OPtionType = "FunctionApnStatus"; + if (Switch_network.equals("3")) { + describe += "【开网】"; + cafterward = "开网"; + Obj.put("Is_Break", "0"); + } else if (Switch_network.equals("2")) { + describe += "【断网】"; + cafterward = "断网"; + Obj.put("Is_Break", "1"); + } + Obj.put("cafterward", cafterward);//变更后 + Map Rmap = internalApiRequest.FunctionApnStatus(Obj, findRouteArr.get(i)); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //断开网操作 + String RMessage = Rmap.get("Message") != null ? Rmap.get("Message").toString() : "操作成功!"; + Obj.put("Message", RMessage); + Obj.put("describe", describe); + Obj.put("agentName", create_by); + Obj.put("result", "操作成功"); + SuccessArr.add(Obj);//输出 csv 文间 + log.info(">>API - 变更操作 statusCode = 0 :{} | {}<<", iccid, Rmap); + } else { + Obj.put("result", "操作失败"); + Message = Rmap.get("Message") != null ? Rmap.get("Message").toString() : "API异常!"; + Obj.put("Message", Message); + failArr.add(Obj); + } + } + } + + //2. 卡信息 变更表 插入数据 + if (SuccessArr.size() > 0) { + writeCSV.OutCSVObj(SuccessArr, newName, Outcolumns, keys, null, OutSize); + //变更主表信息 + try { + if (!Is_remind_ratio.equals("1")) {//停复机 + String statusCode = Is_remind_ratio.equals("2") ? "2" : Is_remind_ratio.equals("3") ? "1" : ""; + if (statusCode != "") { + updStatus(SuccessArr, statusCode);//下发变更 卡状态 队列 + } else { + log.info(">>错误 - updStatus :{}<<", "变更状态不在规定数据内"); + } + } else if (!Switch_network.equals("1")) {//断开网 + String Connection = Switch_network.equals("2") ? "2" : Switch_network.equals("3") ? "1" : ""; + if (Connection != "") { + updConnectionStatus(SuccessArr, Connection);//下发变更 断开网 队列 + } else { + log.info(">>错误 - updConnectionStatus :{}<<", "变更状态不在规定数据内"); + } + } + } catch (Exception e) { + log.info(">>错误 - 变更主表信息 :{} | {}<<", e.getMessage()); + } + + List> AddArr = new ArrayList<>(); + for (int i = 0; i < SuccessArr.size(); i++) { + Map Add_Map = SuccessArr.get(i); + + Add_Map.put("cafterward", cafterward); + Add_Map.put("remark", "执行成功!"); + Add_Map.put("source_type", "5");// 来源 类型 :5 批量操作 + Add_Map.put("execution_status", "1"); + AddArr.add(Add_Map); + } + Map map1 = new HashMap<>(); + map1.put("CardInfoMapList", AddArr); + int addBool = yzCardInfoChangeMapper.addinfo(map1); + log.info("插入成功"); + log.info("Dlx - " + map.get("iccid") + " 卡信息变更表 插入 : " + OPtionType + " 新增卡信息变更记录 addBool :" + addBool); + + } + if (failArr.size() > 0) { + writeCSV.OutCSVObj(failArr, newName, Outcolumns, keys, null, OutSize); + List> AddArr = new ArrayList<>(); + for (int j = 0; j < failArr.size(); j++) { + Map Add_Map = failArr.get(j); + Add_Map.put("remark", "执行失败!"); + Add_Map.put("source_type", "5");// 来源 类型 :5 批量操作 + Add_Map.put("execution_status", "2"); + AddArr.add(Add_Map); + } + Map map2 = new HashMap<>(); + map2.put("CardInfoMapList", AddArr); + int addBool = yzCardInfoChangeMapper.addinfo(map2); + log.info("Dlx - " + map.get("iccid") + " 卡信息变更表 插入 : " + SuccessArr + " 新增卡信息变更记录 addBool :" + addBool); + } + + + } else { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "通道状态 为停用或已删除 取消操作!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(list, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } else { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "未划分通道,取消操作!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(list, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } + } catch (DuplicateKeyException e) { + String[] solit = e.getCause().toString().split("'"); + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", e.getCause().toString()); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(list, newName, Outcolumns, keys, defOutcolumns, OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">> cardSet-消费者- 上传excel异常 [插入数据 DuplicateKeyException ] :{}<<", e.getMessage().toString()); + } catch (Exception e) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", e.getCause().toString()); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(list, newName, Outcolumns, keys, defOutcolumns, OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">>cardSet-消费者- 批量查询消费者:{}<<", e.getMessage()); + } + } else { + log.info("上传ICCID卡号不在数据库中!请核对后重试!"); + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "查询iccid卡号平台中未找到!查询取消!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(list, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } else { + log.error("admin_CardImportBatch_queue`-消费者 上传表格无数据!无需执行"); + } + yzExecutionTaskMapper.set_end_time(task_map);//需改任务 结束 时间 + } + + + /** + * 修改卡状态 + * + * @param SuccessArr + */ + public void updStatus(List> SuccessArr, String statusCode) { + //1. 修改卡状态 || 修改停复机状态 + List iccidArr = new ArrayList(); + Map Upd_Map = new HashMap<>(); + for (int i = 0; i < SuccessArr.size(); i++) { + iccidArr.add(SuccessArr.get(i).get("iccid").toString()); + } + Upd_Map.put("iccidArr", iccidArr); + Upd_Map.put("status_id", statusCode); + Upd_Map.put("status_ShowId", getShowStatIdArr.GetShowStatId(statusCode)); + + yzCardMapper.updStatusIdArr(Upd_Map); + } + + public void updConnectionStatus(List> SuccessArr, String Connection) { + //1. 修改卡状态 || 修改断开网状态 + List iccidArr = new ArrayList(); + Map Upd_Map = new HashMap<>(); + for (int i = 0; i < SuccessArr.size(); i++) { + iccidArr.add(SuccessArr.get(i).get("iccid").toString()); + } + Upd_Map.put("iccidArr", iccidArr); + Upd_Map.put("connection_status", Connection); + yzCardMapper.updction(Upd_Map); + } + + +} \ No newline at end of file diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardImportSelImei.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardImportSelImei.java new file mode 100644 index 0000000..a651de0 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardImportSelImei.java @@ -0,0 +1,335 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 特殊操作 查询imie 消费 者 + */ +@Slf4j +@Component +public class CardImportSelImei { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + + + private String Outcolumns[] = {"iccid","imei","执行描述","执行人","执行结果"}; + private String keys[] = {"iccid","imei","message","agentName","result"}; + private int OutSize = 50;//每 50条数据输出一次 + + /** + * 特殊操作 查询imie + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "admin_CardImportSelImei_queue") + public void CardSelImie(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String filePath = map.get("filePath").toString();//项目根目录 + String ReadName = map.get("ReadName").toString();//上传新文件名 + Map Pmap = ( Map)map.get("map");//参数 + Map User = ( Map)Pmap.get("User");//登录用户信息 + + String prefix = "admin_CardImportSelImei_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ ReadName); + if(isExecute==null){ + redisCache.setCacheObject(prefix+":"+ ReadName, msg, 3, TimeUnit.SECONDS);//3 秒缓存 避免 重复消费 + execution(filePath,ReadName,Pmap,User);//执行特殊操作 查询imie + } + } catch (Exception e) { + log.error(">>错误 - 特殊操作 查询imie 消费者:{}<<", e.getMessage().toString()); + } + } + + /** + * 查询执行 + */ + public void execution(String filePath,String ReadName,Map Pmap,Map User){ + String Message = ""; + //1.读取 上传文件 + String path = filePath + "/upload/importSelImei/" + ReadName; + ExcelConfig excelConfig = new ExcelConfig(); + String columns[] = {"iccid"}; + List> list = excelConfig.getExcelListMap(path,columns); + Map Dept = (Map)User.get("dept"); + String create_by = " [ "+Dept.get("deptName")+" ] - "+" [ "+User.get("userName")+" ] "; + + String newName = UUID.randomUUID().toString().replace("-","")+"_CardImportSelImei"; + String task_name = create_by+"-特殊操作 [特殊操作 查询imie] "; + String SaveUrl = "/getcsv/"+newName+".csv"; + SaveUrl = "/getcsv/"+newName+".csv"; + Map task_map = new HashMap(); + task_map.put("auth",create_by); + task_map.put("task_name",task_name); + task_map.put("url",SaveUrl); + task_map.put("agent_id",User.get("deptId") ); + task_map.put("type", "7"); + + if(list!=null && list.size()>0) { + //筛选出 iccid 卡号 重复项 + Map getNotRepeatingMap = Different.getNotRepeating(list,"iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap.get("Rlist");//更新 查询数据 + List> Repeatlist = (List>) getNotRepeatingMap.get("Repeatlist"); + if(Repeatlist.size()>0){ + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","ICCID重复查询失败!同一ICCID同批次,无需多次查询!"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(Repeatlist, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + //查询数据库中 匹对iccid 是否存在 + HashMap map = new HashMap<>(); + //添加修改数据 + map.put("card_arrs",list); + map.put("type","3"); + List iccidarr = yzCardMapper.isExistence(map); + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + if (iccidarr != null && iccidarr.size() > 0) { + //1.判断 查询卡号是否都在库里 + //库中查询出卡号与上传卡号数量 不一致 说明有卡号不在数据库中 + if (!(iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","iccid 不在数据库中!请核对iccid卡号!"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(Out_list_Different, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + } + map.put("card_arrs", list);//更新 list + try { + if(list!=null && list.size()>0) { + //筛选出未划分通道的 + map.put("channel_idType","notNull"); + List Channel_iccidarr = yzCardMapper.isExistence(map); + if (Channel_iccidarr != null && Channel_iccidarr.size() > 0) { + if (!(Channel_iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, Channel_iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","未划分通道,取消操作!"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(Out_list_Different, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + } + map.put("card_arrs", list);//更新 list + List> find_crArr = yzCardRouteMapper.find_cr();//查询 通道简要信息 状态为 正常 + List channel_idArr = new ArrayList<>(); + if(find_crArr!=null && find_crArr.size()>0){ + for (int i = 0; i < find_crArr.size(); i++) { + channel_idArr.add(find_crArr.get(i).get("dictValue")); + } + }else{ + channel_idArr.add("0"); + } + //筛选出通道正常的进行 查询 + map.put("channel_idArr",channel_idArr); + List normalChannel_iccidarr = yzCardMapper.isExistence(map); + if(normalChannel_iccidarr!=null && normalChannel_iccidarr.size()>0){ + if (!(normalChannel_iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, normalChannel_iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","通道状态 为停用或已删除 取消操作"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(Out_list_Different, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + } + map.put("card_arrs", list);//更新 list + //查询imei 并同步修改 imei + List> SuccessArr = new ArrayList<>(); + List> failArr = new ArrayList<>(); + List> findRouteArr = yzCardMapper.findRouteArr(map);//查询需要轮序的卡 + for (int i = 0; i Obj = new HashMap<>(); + String iccid = findRouteArr.get(i).get("iccid").toString(); + Obj.put("iccid", iccid); + //Obj.put("Is_Stop", "on"); + Map Rmap = internalApiRequest.queryCardImei(Obj, findRouteArr.get(i)); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //获取 imei 更新 card info + Object imei = Rmap.get("imei"); + if (imei != null && imei != "" && imei.toString().trim().length() > 0) { + Obj.put("imei", imei.toString().trim()); + SuccessArr.add(Obj); + log.info(">>API - 获取imei statusCode = 0 :{} | {}<<", iccid, Rmap); + } + }else{ + Obj.put("message", Message); + failArr.add(Obj); + } + if(SuccessArr.size()>0){ + try { + updimei(SuccessArr);//下发变更 imei 队列 + }catch (Exception e){ + log.info(">>错误 - updimei :{} | {}<<", e.getMessage()); + } + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","操作成功"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询成功"); + writeCSV.OutCSVObj(SuccessArr, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + if(failArr.size()>0){ + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + + // + } + }else{ + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","通道状态 为停用或已删除 取消操作!"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + }else{ + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","未划分通道,取消操作!"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + } + } catch (DuplicateKeyException e) { + String[] solit = e.getCause().toString().split("'"); + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message",e.getCause().toString()); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">> cardSet-消费者- 上传excel异常 [插入数据 DuplicateKeyException ] :{}<<", e.getMessage().toString()); + } catch (Exception e) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message",e.getCause().toString()); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">>cardSet-消费者- 批量查询消费者:{}<<", e.getMessage()); + } + } else { + log.info("上传ICCID卡号不在数据库中!请核对后重试!"); + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","查询iccid卡号平台中未找到!查询取消!"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + }else{ + log.error( "admin_CardImportSelImei_queue-消费者 上传表格无数据!无需执行"); + } + } + + + /** + * 创建队列 变更 imei + * @param SuccessArr + */ + public void updimei(List> SuccessArr){ + //同步主表数据 如果开始 时间 和 当前 月 时间 一致 剩余用量 += 包用量 + Map UpdMap = new HashMap<>(); + //1.创建路由 绑定 生产队列 发送消息 + String card_exchangeName = "admin_card_exchange", card_queueName = "admin_CardUpd_queue", card_routingKey = "admin.CardUpd.queue", + card_del_exchangeName = "dlx_"+card_exchangeName,card_del_queueName = "dlx_"+card_queueName, card_del_routingKey = "dlx_"+card_routingKey; + try { + rabbitMQConfig.creatExchangeQueue(card_exchangeName, card_queueName, card_routingKey, card_del_exchangeName, card_del_queueName, card_del_routingKey,null); + for (int i = 0; i < SuccessArr.size(); i++) { + Map Obj = SuccessArr.get(i); + UpdMap.putAll(Obj); + UpdMap.put("queueTypeName","admin_CardUpdimei_queue"); + rabbitTemplate.convertAndSend(card_exchangeName, card_routingKey, JSON.toJSONString(UpdMap), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + }); + } + System.out.println("发送 修改剩余 指令成功 !"); + } catch (Exception e) { + System.out.println("发送 修改剩余 创建 失败 " + e.getMessage().toString()); + } + } + + + + + + + +} diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardImportSet.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardImportSet.java new file mode 100644 index 0000000..3af2d52 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardImportSet.java @@ -0,0 +1,193 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.Different; +import com.yunze.common.utils.yunze.ExcelConfig; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 连接设置 【资费组设置、通道设置 、超量停机阈值设定】 消费 者 + */ +@Slf4j +@Component +public class CardImportSet { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + + private String Outcolumns[] = {"id","set_dept_id","set_user_id","执行时间","执行人"}; + private String keys[] = {"id","set_dept_id","set_user_id","time","agentName"}; + private int OutSize = 50;//每 50条数据输出一次 + + /** + * 连接设置 + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "admin_CardImportSet_queue") + public void CardSet(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String filePath = map.get("filePath").toString();//项目根目录 + String ReadName = map.get("ReadName").toString();//上传新文件名 + Map Pmap = ( Map)map.get("map");//参数 + Map User = ( Map)Pmap.get("User");//登录用户信息 + + String prefix = "admin_CardImportSet_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ ReadName); + if(isExecute==null){ + redisCache.setCacheObject(prefix+":"+ ReadName, msg, 3, TimeUnit.SECONDS);//3 秒缓存 避免 重复消费 + execution(filePath,ReadName,Pmap,User);//执行连接设置 + } + } catch (Exception e) { + log.error(">>错误 - 连接设置 消费者:{}<<", e.getMessage().toString()); + } + } + + /** + * 设置执行 + */ + public void execution(String filePath,String ReadName,Map Pmap,Map User){ + String Message = ""; + //1.读取 上传文件 + String path = filePath + "/upload/importSet/" + ReadName; + ExcelConfig excelConfig = new ExcelConfig(); + String columns[] = {"iccid"}; + + + + List> list = excelConfig.getExcelListMap(path,columns); + Map Dept = (Map)User.get("dept"); + String create_by = " [ "+Dept.get("deptName")+" ] - "+" [ "+User.get("userName")+" ] "; + String Outcolumns[] = {"iccid","操作描述","执行结果","执行人","执行时间"}; + String keys[] = {"iccid","description","result","agentName","OptionTime"}; + + String newName = UUID.randomUUID().toString().replace("-","")+"_CardImportSet"; + String DistributeBackupName = UUID.randomUUID().toString().replace("-","")+"_CardImportSetBackup"; + String task_name = create_by+"-设备管理 [连接设置] "; + String SaveUrl = "/getcsv/"+newName+".csv"; + SaveUrl = "/getcsv/"+newName+".csv"; + SaveUrl += ",/getcsv/"+DistributeBackupName+".csv"; + Map task_map = new HashMap(); + task_map.put("auth",create_by); + task_map.put("task_name",task_name); + task_map.put("url",SaveUrl); + task_map.put("agent_id",User.get("deptId") ); + task_map.put("type", "6"); + + if(list!=null && list.size()>0) { + //筛选出 iccid 卡号 重复项 + Map getNotRepeatingMap = Different.getNotRepeating(list,"iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap.get("Rlist");//更新 设置数据 + List> Repeatlist = (List>) getNotRepeatingMap.get("Repeatlist"); + if(Repeatlist.size()>0){ + writeCSV.OutCSVObj(Repeatlist,newName,"ICCID重复设置失败!同一ICCID同批次,无需多次设置!",create_by,"设置失败",Outcolumns,keys,OutSize); + } + //查询数据库中 匹对iccid 是否存在 + HashMap map = new HashMap<>(); + //添加修改数据 + map.put("package_id",Pmap.get("package_id")); + map.put("channel_id",Pmap.get("channel_id")); + map.put("Is_remind_ratio",Pmap.get("Is_remind_ratio")); + map.put("remind_ratio",Pmap.get("remind_ratio")); + map.put("is_Disconnected",Pmap.get("is_Disconnected")); + map.put("card_arrs",list); + map.put("type","3"); + List iccidarr = yzCardMapper.isExistence(map); + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + if (iccidarr != null && iccidarr.size() > 0) { + //1.判断 设置卡号是否都在库里 + //库中查询出卡号与上传卡号数量 不一致 说明有卡号不在数据库中 + if (!(iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 设置数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 设置数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + writeCSV.OutCSVObj(Out_list_Different, newName, "iccid 不在数据库中!请核对iccid卡号!", create_by, "设置失败", Outcolumns, keys,OutSize); + } + } + map.put("card_arrs", list);//更新 list + try { + if (list.size() > 0) { + //备份设置前属性 + try { + List> Bklist = yzCardMapper.SetBackupAssociate(map); + if(Bklist!=null && Bklist.size()>0){ + String BK_keys[] = {"id","iccid","remind_ratio","channel_id","package_id","OptionTime"}; + writeCSV.OutCSVObj(Bklist, DistributeBackupName, BK_keys, BK_keys,OutSize); + } + }catch (Exception e){ + log.error(">> cardSet-消费者- 备份 异常 :{}<<", e.getMessage()); + } + int sInt = yzCardMapper.SetCard(map); + if (sInt > 0) { + writeCSV.OutCSVObj(list, newName, "批量 设置 成功 数据 [" + sInt + "] 条", create_by, "设置成功", Outcolumns, keys,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + } + } + } catch (DuplicateKeyException e) { + String[] solit = e.getCause().toString().split("'"); + writeCSV.OutCSVObj(list, newName, e.getCause().toString(), create_by, "设置失败", Outcolumns, keys,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">> cardSet-消费者- 上传excel异常 [插入数据 DuplicateKeyException ] :{}<<", e.getMessage().toString()); + } catch (Exception e) { + writeCSV.OutCSVObj(list, newName, e.getCause().toString(), create_by, "设置失败", Outcolumns, keys,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">>cardSet-消费者- 批量设置消费者:{}<<", e.getMessage()); + } + + } else { + log.info("上传ICCID卡号不在数据库中!请核对后重试!"); + writeCSV.OutCSVObj(list, newName, "设置iccid卡号平台中未找到!设置取消!", create_by, "设置失败", Outcolumns, keys,OutSize); + } + }else{ + log.error( "admin-消费者 上传表格无数据!无需执行设置"); + } + } + + + + + + + + + + +} diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardSetCardInfo.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardSetCardInfo.java new file mode 100644 index 0000000..7f29255 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/CardSetCardInfo.java @@ -0,0 +1,226 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 特殊操作 变更卡分组、备注 消费 者 + */ +@Slf4j +@Component +public class CardSetCardInfo { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + + + private String Outcolumns[] = {"iccid","分组","发货日期","备注","执行描述","执行人","执行结果"}; + private String keys[] = {"iccid","customize_grouping","deliver_date","remarks","message","agentName","result"}; + private int OutSize = 50;//每 50条数据输出一次 + + /** + * 特殊操作 变更卡分组、备注 + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "admin_importSetCardInfo_queue") + public void CardSelImie(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String filePath = map.get("filePath").toString();//项目根目录 + String ReadName = map.get("ReadName").toString();//上传新文件名 + Map Pmap = ( Map)map.get("map");//参数 + Map User = ( Map)Pmap.get("User");//登录用户信息 + + String prefix = "admin_importSetCardInfo_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ ReadName); + if(isExecute==null){ + redisCache.setCacheObject(prefix+":"+ ReadName, msg, 3, TimeUnit.SECONDS);//3 秒缓存 避免 重复消费 + execution(filePath,ReadName,Pmap,User);//执行特殊操作 变更卡分组、备注 + } + } catch (Exception e) { + log.error(">>错误 - 特殊操作 变更卡分组、备注 消费者:{}<<", e.getMessage().toString()); + } + } + + /** + * 变更 执行 + */ + public void execution(String filePath,String ReadName,Map Pmap,Map User){ + String Message = ""; + //1.读取 上传文件 + String path = filePath + "/upload/importSetCardInfo/" + ReadName; + ExcelConfig excelConfig = new ExcelConfig(); + String columns[] = {"iccid","customize_grouping","remarks","deliver_date"}; + List> list = excelConfig.getExcelListMap(path,columns); + Map Dept = (Map)User.get("dept"); + String create_by = " [ "+Dept.get("deptName")+" ] - "+" [ "+User.get("userName")+" ] "; + + String newName = UUID.randomUUID().toString().replace("-","")+"_CardSetCardInfo"; + String UpdBackupName = UUID.randomUUID().toString().replace("-","")+"_CardSetCardInfoBackup";//设置分组备注前信息备份名称 + String deptId = User.get("deptId").toString(); + String task_name = create_by+"-特殊操作 [特殊操作 变更卡分组、备注] "; + String SaveUrl = "/getcsv/"+newName+".csv"; + SaveUrl += ",/getcsv/"+UpdBackupName+".csv"; + + Map task_map = new HashMap(); + task_map.put("auth",create_by); + task_map.put("task_name",task_name); + task_map.put("url",SaveUrl); + task_map.put("agent_id",User.get("deptId") ); + task_map.put("type", "8"); + + if(list!=null && list.size()>0) { + //筛选出 iccid 卡号 重复项 + Map getNotRepeatingMap = Different.getNotRepeating(list,"iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap.get("Rlist");//更新 查询数据 + List> Repeatlist = (List>) getNotRepeatingMap.get("Repeatlist"); + if(Repeatlist.size()>0){ + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","ICCID重复操作失败!同一ICCID同批次,无需多次修改!"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","操作失败"); + writeCSV.OutCSVObj(Repeatlist, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + //查询数据库中 匹对iccid 是否存在 + HashMap map = new HashMap<>(); + //添加修改数据 + map.put("card_arrs",list); + map.put("type","3"); + List iccidarr = yzCardMapper.isExistence(map); + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + if (iccidarr != null && iccidarr.size() > 0) { + //1.判断 查询卡号是否都在库里 + //库中查询出卡号与上传卡号数量 不一致 说明有卡号不在数据库中 + if (!(iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","iccid 不在数据库中!请核对iccid卡号!"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","操作失败"); + writeCSV.OutCSVObj(Out_list_Different, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + } + map.put("card_arrs", list);//更新 list + try { + if(list!=null && list.size()>0) { + //判断当前 操作用户所属集团 过滤不属于自己集团的卡 + if(!deptId.equals("100")){ + Map CountMap = new HashMap<>(); + CountMap.putAll(map); + CountMap.put("agent_id",deptId); + CountMap.put("FindAgent_id",yzCardMapper.queryChildrenAreaInfo(CountMap));//查询代理所属下级代理 + List AgentIccidArr = yzCardMapper.findAgentIccid(CountMap); + //库中查询出【该代理旗下】卡号 与上传卡号数量 不一致 说明有卡号不在 其名下 + if (!(AgentIccidArr.size() == list.size())) { + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, AgentIccidArr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","越权操作! iccid 不在操作人名下!请核对iccid卡号!"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","操作失败"); + writeCSV.OutCSVObj(Out_list_Different, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + } + } + map.put("card_arrs", list);//更新 list + //1.备份 修改前数据 + List> BakUpArr = yzCardMapper.findGroupingAndRemarks(map); + if(BakUpArr!=null && BakUpArr.size()>0){ + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","操作前数据备份 操作时间:"+ VeDate.getStringDateSSS()); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","操作成功"); + writeCSV.OutCSVObj(BakUpArr, UpdBackupName,Outcolumns, keys,defOutcolumns,OutSize); + } + int updCount = 0; + try { + updCount = yzCardMapper.updGroupingAndRemarks(map);//变更 分组、备注 队列 + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","操作成功 修改数量 "+updCount); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","操作成功"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + }catch (DuplicateKeyException e){ + log.info(">>错误 - yzCardMapper.updGroupingAndRemarks :{} | {}<<", e.getMessage()); + String Msg = e.getMessage(); + Msg = Msg.length()>100?Msg.substring(0,100):Msg; + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message",Msg); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","操作失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + } + } catch (Exception e) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message",e.getCause().toString()); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","操作失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">> cardSet-消费者- 上传excel异常 [ Exception ] :{}<<", e.getMessage()); + } + } else { + log.info("上传ICCID卡号不在数据库中!请核对后重试!"); + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("message","操作iccid卡号平台中未找到!查询取消!"); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","操作失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + } + }else{ + log.error( "admin_importSetCardInfo_queue-消费者 上传表格无数据!无需执行"); + } + } + + + + + + + + + +} diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/DistributeCard.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/DistributeCard.java new file mode 100644 index 0000000..05e88ca --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/DistributeCard.java @@ -0,0 +1,220 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.*; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 划卡 消费 者 + */ +@Slf4j +@Component +public class DistributeCard { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + + + + /** + * 卡划分 + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "admin_DistributeCard_queue") + public void DbCard(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String set_dept_name = map.get("set_dept_name").toString();//上传新文件名 + List dividIdArr = (List) map.get("dividIdArr");//输出文件名 + + String prefix = "admin_DistributeCard_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ set_dept_name); + if(isExecute==null){ + redisCache.setCacheObject(prefix+":"+ set_dept_name, msg, 10, TimeUnit.SECONDS);//10 秒缓存 避免 重复消费 + execution(map,dividIdArr);//执行卡划分 + } + } catch (Exception e) { + log.error(">>错误 - 卡划分 消费者:{}<<", e.getMessage().toString()); + } + } + + /** + * 划卡执行 + * @param map + */ + public void execution(Map map,List dividIdArr){ + String Message = ""; + if(dividIdArr!=null && dividIdArr.size()>0){ + + //1.备份现有卡所属信息 + String set_dept_name = map.get("set_dept_name").toString(); + String set_user_name = map.get("set_user_name").toString(); + String create_by = " [ "+set_dept_name+" ] - "+" [ "+set_user_name+" ] "; + String newName = UUID.randomUUID().toString().replace("-","")+"_CardDistribute"; + String DistributeBackupName = UUID.randomUUID().toString().replace("-","")+"_CardDistributeBackup"; + String agent_id = map.get("TaskAgent_id").toString(); + + String task_name = create_by+"-连接管理 [划卡] "; + String SaveUrl = "/getcsv/"+newName+".csv"; + SaveUrl += ",/getcsv/"+DistributeBackupName+".csv"; + Map task_map = new HashMap(); + task_map.put("auth",create_by); + task_map.put("task_name",task_name); + task_map.put("url",SaveUrl); + task_map.put("agent_id", agent_id); + task_map.put("type", "2"); + + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + List> list = yzCardMapper.BackupAssociate(); + OutCSV(list,DistributeBackupName,create_by); + + //2.开始划卡 + Map Pmap = new HashMap<>(); + Pmap.put("set_dept_id",map.get("set_dept_id")); + Pmap.put("set_user_id",map.get("set_user_id")); + Pmap.put("idArr",dividIdArr); + + int updCount = yzCardMapper.dividCard(Pmap); + if(updCount>0){ + Message = "当前筛选条件下需要划分的数据 [ "+dividIdArr.size()+" ] 条,成功划分 [ "+updCount+" ] 条,至 [ "+set_dept_name+" ] [ "+set_user_name+" ] !"; + log.info(Message); + }else{ + Message = "当前筛选条件下需要划分的数据 [ "+dividIdArr.size()+" ] 条 至 [ "+set_dept_name+" ] [ "+set_user_name+" ] 划分失败 !"; + log.error(Message); + } + OutCSVUpd(dividIdArr,set_dept_name,set_user_name,newName,create_by,Message); + yzExecutionTaskMapper.set_end_time(task_map); + }else{ + log.info("当前筛选条件下未找到需要划分的数据!请核对后重试!"); + } + } + + + + /** + * 输出 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param agentName 执行人 + */ + public void OutCSV(List> list , String fileName_flow, String agentName){ + + List> out_list = new ArrayList<>(); + + for (int i = 0; i < list.size(); i++) { + Map out_map= new HashMap(); + + Map cardIndex=list.get(i); + String iccid =cardIndex.get("iccid").toString(); + String id =cardIndex.get("id").toString(); + String dept_id =cardIndex.get("dept_id").toString(); + String user_id =cardIndex.get("user_id").toString(); + //String tableName ="zy_"+cardType; + + String Outcolumns[] = {"id","iccid","dept_id","user_id","执行时间","执行人"}; + String keys[] = {"id","iccid","dept_id","user_id","time","agentName"}; + String Time= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + out_map.put("id",id); + out_map.put("iccid",iccid); + out_map.put("dept_id",dept_id); + out_map.put("user_id",user_id); + out_map.put("time",Time); + out_map.put("agentName",agentName); + + out_list.add(out_map); + if ((i+1)%50==0 || (i+1)==list.size()){ + //执行导出 + if(out_list.size()>0){ + writeCSV.Write(fileName_flow,out_list,Outcolumns,null,keys); + out_list = new ArrayList<>(); + } + } + } + + } + + + + + + /** + * 输出 划卡数据 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param agentName 执行人 + */ + public void OutCSVUpd(List list , String set_dept_id, String set_user_id, String fileName_flow, String agentName,String Msg){ + + List> out_list = new ArrayList<>(); + List> outLast_list = new ArrayList<>(); + + String Outcolumns[] = {"id","set_dept_id","set_user_id","执行时间","执行人"}; + String keys[] = {"id","set_dept_id","set_user_id","time","agentName"}; + for (int i = 0; i < list.size(); i++) { + Map out_map= new HashMap(); + String id =list.get(i); + + String Time= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + out_map.put("id",id); + out_map.put("set_dept_id",set_dept_id); + out_map.put("set_user_id",set_user_id); + out_map.put("time",Time); + out_map.put("agentName",agentName); + + out_list.add(out_map); + if ((i+1)%50==0 || (i+1)==list.size()){ + //执行导出 + if(out_list.size()>0){ + writeCSV.Write(fileName_flow,out_list,Outcolumns,null,keys); + out_list = new ArrayList<>(); + } + } + } + + Map out_map= new HashMap(); + out_map.put("id",Msg); + out_map.put("set_dept_id",set_dept_id); + out_map.put("set_user_id",set_user_id); + out_map.put("time",LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + out_map.put("agentName",agentName); + + outLast_list.add(out_map); + writeCSV.Write(fileName_flow,outLast_list,Outcolumns,null,keys); + + } + + + + + + +} diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/DueExpireTime.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/DueExpireTime.java new file mode 100644 index 0000000..8dd13f2 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/DueExpireTime.java @@ -0,0 +1,82 @@ +package com.yunze.system.card; +import com.yunze.common.mapper.yunze.YzCardFlowMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.utils.yunze.VeDate; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *同步主表到期日期 消费者 + * */ +@Slf4j +@Component +public class DueExpireTime { + + @Resource + private YzCardFlowMapper yzCardFlowMapper; + @Resource + private YzCardMapper yzCardMapper; + + @RabbitHandler + @RabbitListener(queues = "admin_DueExpireTime_queue") + private void DueExpireTime(){ + + Map map = new HashMap<>(); + List> FindArr = yzCardFlowMapper.sletume(map); + Map>> UpdMap = FindArr.stream(). + collect(Collectors.groupingBy((Map m) -> m.get("end_time").toString())); + + for(String key:UpdMap.keySet()){ + //System.out.println("key="+key); + String due_expire_time = key ; + due_expire_time = due_expire_time.indexOf(".0")!=-1?due_expire_time.replace(".0", ""):due_expire_time ; + Map updInfo = new HashMap<>(); + updInfo.put("due_expire_time", due_expire_time); + updInfo.put("iccids",UpdMap.get(key)); + //System.out.println(updInfo); + yzCardMapper.updDueExpireTime(updInfo); + + } + + + + } + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/ExportFlowArr.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/ExportFlowArr.java new file mode 100644 index 0000000..46b1651 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/ExportFlowArr.java @@ -0,0 +1,414 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.mapper.yunze.YzCardFlowMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 订购资费导出 + * */ + +@Slf4j +@Component +public class ExportFlowArr { + + + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private YzCardFlowMapper yzCardFlowMapper; + + + + @RabbitHandler + @RabbitListener(queues = "admin_ExportFlow_queue") + public void DbCard(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map Pmap = JSON.parseObject(msg); + //System.out.println(Pmap); + Map map = (Map) Pmap.get("map"); + Map User = (Map) Pmap.get("User"); + + List> outCardIccidArr = (List>) Pmap.get("outCardIccidArr"); + List> deptArr = (List>) Pmap.get("deptArr"); + List> arrorders = (List>) Pmap.get("arrorders"); + List> Cardstatus = (List>) Pmap.get("Cardstatus"); + List> packet_type = (List>) Pmap.get("packet_type"); + List> takeEffect_type = (List>) Pmap.get("takeEffect_type"); + List> simpleArr = (List>) Pmap.get("simpleArr"); + List> PacketArr = (List>) Pmap.get("PacketArr"); + + String newName = (String) Pmap.get("newName"); + Map task_map = (Map) Pmap.get("task_map"); + + OutDataCard( map,User,outCardIccidArr,deptArr,arrorders,Cardstatus,packet_type,takeEffect_type, newName,task_map,simpleArr,PacketArr); + }catch (Exception e){ + log.error(">>错误 - 订购资费导出 消费者:{}<<", e.getMessage().toString()); + } + } + + private void OutDataCard(Map map, Map user, List> outCardIccidArr, + List> userArr, List> arrorders, List> cardstatus, + List> packet_type, List> takeEffect_type, String newName, Map task_map,List> simpleArr,List> PacketArr) { + + + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + Map Dept = (Map) user.get("dept"); + String agent_id = Dept.get("deptId").toString(); + if(agent_id.equals("100")){ + yzCardFlowMapper.queryPackage_simple(map); + }else{ + Map PackageMap = new HashMap(); + PackageMap.put("agent_id",agent_id); + yzCardFlowMapper.queryAgentPackage_simple(PackageMap); + } + map.put("iccid_arrs",outCardIccidArr); + + try { + WriteOutCard(outCardIccidArr,userArr,arrorders,cardstatus,packet_type,takeEffect_type,newName,task_map,outCardIccidArr,simpleArr,PacketArr); + }catch (Exception e){ + log.error("导出卡信息异常 [导出数据 Exception] "+e.getCause().toString() ); + } + } + + /** + * 字典获取 + * @param CarMap 写入Map + * @param DictDataArr 字典 list + * @param basis 获取依据 字段 与 dictValue 判断 + * @param fieldName 返回字段名称 + * @return + */ + public Map WriteDic (Map CarMap,List> DictDataArr,String basis,String fieldName){ + + Map Rmap = new HashMap(); + String status_id = CarMap.get(basis)!=null?CarMap.get(basis).toString():null; + boolean bool = false; + if(status_id!=null){ + for (int i = 0; i < DictDataArr.size(); i++) { + Map dictData = DictDataArr.get(i); + String dictValue = dictData.get("dictValue").toString(); + if(dictValue.equals(status_id)){ + CarMap.put(fieldName,dictData.get("dictLabel")); + bool = true; + break; + } + } + } + //字段 默认值 + if(!bool){ + CarMap.put(fieldName,""); + } + return CarMap; + } + + /** + * 写入 所属集团信息 + * @param CarMap + * @param deptArr + * @return + */ + protected Map WriteCarUser (Map CarMap,List> deptArr){ + + String user_id = CarMap.get("dept_id")!=null?CarMap.get("dept_id").toString():null; + boolean bool = false; + if(deptArr!=null && user_id !=null){ + for (int i = 0; i < deptArr.size(); i++) { + Map UserMap = deptArr.get(i); + String Fuser_id = UserMap.get("dept_id").toString(); + if(Fuser_id.equals(user_id)){ + CarMap.put("dept_name",UserMap.get("dept_name")); + bool = true; + break; + } + } + } + if(!bool){ + CarMap.put("dept_name",""); + } + return CarMap; + } + + /** + * 写入 资费计划信息 + * @param CarMap + * @param PacketArr + * @return + */ + protected Map WriteCarPacket (Map CarMap,List> PacketArr){ + + String user_id = CarMap.get("dictValue")!=null?CarMap.get("dictValue").toString():null; + boolean bool = false; + if(PacketArr!=null && user_id !=null){ + for (int i = 0; i < PacketArr.size(); i++) { + Map UserMap = PacketArr.get(i); + String Fuser_id = UserMap.get("dictValue").toString(); + if(Fuser_id.equals(user_id)){ + CarMap.put("dictLabel",UserMap.get("dictLabel")); + bool = true; + break; + } + } + } + if(!bool){ + CarMap.put("dictLabel",""); + } + return CarMap; + } + + /** + * 写入 资费组 + * @param CarMap + * @param simpleArr + * @return + */ + protected Map WriteCarsimple (Map CarMap,List> simpleArr){ + + String user_id = CarMap.get("package_id")!=null?CarMap.get("package_id").toString():null; + boolean bool = false; + if(simpleArr!=null && user_id !=null){ + for (int i = 0; i < simpleArr.size(); i++) { + Map UserMap = simpleArr.get(i); + String Fuser_id = UserMap.get("package_id").toString(); + if(Fuser_id.equals(user_id)){ + CarMap.put("package_agentname",UserMap.get("package_agentname")); + bool = true; + break; + } + } + } + if(!bool){ + CarMap.put("package_agentname",""); + } + return CarMap; + } + + /** + * 写入 年月日 + * @param CarMap + * @param deptArr + * @return + */ + protected Map WriteFlow (Map CarMap,List> deptArr){ + + String user_id = CarMap.get("packet_id")!=null?CarMap.get("packet_id").toString():null; + boolean bool = false; + if(deptArr!=null && user_id !=null){ + for (int i = 0; i < deptArr.size(); i++) { + Map UserMap = deptArr.get(i); + String packet_id = UserMap.get("packet_id").toString(); + if(packet_id.equals(user_id)){ + CarMap.put("packet_name_value",UserMap.get("packet_wx_name")); + CarMap.put("packet_valid_name_value",UserMap.get("packet_valid_name")); + CarMap.put("packet_valid__value",UserMap.get("packet_valid_time")); + CarMap.put("packet_flow_value",UserMap.get("packet_flow")); + + bool = true; + break; + } + } + } + if(!bool){ + CarMap.put("packet_name_value",""); + CarMap.put("packet_valid_name_value",""); + CarMap.put("packet_valid__value",""); + CarMap.put("packet_flow_value",""); + } + return CarMap; + } + + private String WriteOutCard(List> outCardIccidArr, List> deptArr, + List> arrorders, List> cardstatus, + List> packet_type, List> takeEffect_type, + String newName, Map task_map, List> outCardArr,List> simpleArr,List> PacketArr + ) { + + boolean outFlowInfo = false; + outFlowInfo = arrorders!=null && arrorders.size()>0?true:false; + + List> out_list = new ArrayList>(); + //循环添加单卡数据信息 + for (int i = 0; i < outCardArr.size(); i++) { + Map CarMap = outCardArr.get(i); + + //写入 卡状态 + CarMap = WriteDic(CarMap,cardstatus,"status","status_value"); + //写入 资费计划类别 + CarMap = WriteDic(CarMap,packet_type,"packet_type","packet_type_value"); + //写入 生效类别 + CarMap = WriteDic(CarMap,takeEffect_type,"validate_type","validate_type_value"); + + //写入 所属集团信息 + CarMap = WriteCarUser(CarMap,deptArr); + //写入 资费组信息 + CarMap = WriteCarsimple(CarMap,simpleArr); + //写入 资费计划信息 + CarMap = WriteCarPacket(CarMap,PacketArr); + //写入 资费计划 信息 + if(outFlowInfo){ + CarMap = WriteFlow(CarMap,arrorders); + } + out_list.add(CarMap); + } + + + String Outcolumns[] = {"id","资费组","资费计划","订单号","流量","生效时间","到期时间","创建时间","状态","资费计划类别","使用流量","对应串号","生效类别","更新累计包时间","天包记录已用流量"}; + String keys[] = {"id","package_agentname","packet_name_value","ord_no","true_flow","start_time","end_time","create_time","status_value","packet_type_value","use_flow","iccid","validate_type_value","validate_time","use_so_flow"}; + + if(outFlowInfo){ + Outcolumns = new String[]{"id","资费组","资费计划","订单号","流量","生效时间","到期时间","创建时间","状态","资费计划类别","使用流量","对应串号","生效类别","更新累计包时间","天包记录已用流量","资费计划规则 月 年","资费计划规格","套餐包流量"}; + keys = new String[]{"id","package_agentname","packet_name_value","ord_no","true_flow","start_time","end_time","create_time","status_value","packet_type_value","use_flow","iccid","validate_type_value","validate_time","use_so_flow","packet_valid_name_value","packet_valid__value","packet_flow_value"}; + } + + writeCSV.Write(newName,out_list,Outcolumns,null,keys); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + return "已下发执行任务可在【设备管理】》【执行任务管理】查看"; + + } + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/ExportFlowHisArr.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/ExportFlowHisArr.java new file mode 100644 index 0000000..3287d51 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/ExportFlowHisArr.java @@ -0,0 +1,167 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.mapper.yunze.YzCardFlowMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 用量详情导出 + */ + +@Slf4j +@Component +public class ExportFlowHisArr { + + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private YzCardFlowMapper yzCardFlowMapper; + + + @RabbitHandler + @RabbitListener(queues = "admin_ExportFlowHis_queue") + public void DbCard(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map Pmap = JSON.parseObject(msg); + //System.out.println(Pmap); + Map map = (Map) Pmap.get("map"); + Map User = (Map) Pmap.get("User"); + + List> outCardIccidArr = (List>) Pmap.get("outCardIccidArr"); + List HisIccid = (List) Pmap.get("iccids"); + List> HisArr = (List>) Pmap.get("HisArr"); + boolean IsGeneralGroupbool = (boolean) Pmap.get("IsGeneralGroupbool"); + + String newName = (String) Pmap.get("newName"); + Map task_map = (Map) Pmap.get("task_map"); + + OutDataCard(map, User, outCardIccidArr, newName, task_map, HisArr,HisIccid,IsGeneralGroupbool); + } catch (Exception e) { + log.error(">>错误 - 用量详情导出 消费者:{}<<", e.getMessage().toString()); + } + } + + private void OutDataCard(Map map, Map user, List> outCardIccidArr, + String newName, Map task_map, List> hisArr, List HisIccid, boolean isGeneralGroupbool) { + + + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + Map Dept = (Map) user.get("dept"); + String agent_id = Dept.get("deptId").toString(); + if (agent_id.equals("100")) { + yzCardFlowMapper.queryPackage_simple(map); + } else { + Map PackageMap = new HashMap(); + PackageMap.put("agent_id", agent_id); + yzCardFlowMapper.queryAgentPackage_simple(PackageMap); + } + map.put("iccid_arrs", outCardIccidArr); + + try { + WriteOutCard(outCardIccidArr, hisArr, newName, task_map,HisIccid,isGeneralGroupbool); + } catch (Exception e) { + log.error("导出卡信息异常 [导出数据 Exception] " + e.getCause().toString()); + } + + } + + + /** + * 写入 分组 、备注、发货时间 + * */ + protected Map WriteCar(Map CarMap, List> HisArr) { + String user_id = CarMap.get("iccid") != null ? CarMap.get("iccid").toString() : null; + boolean bool = false; + if (HisArr != null && user_id != null) { + for (int i = 0; i < HisArr.size(); i++) { + Map UserMap = HisArr.get(i); + String Fuser_id = UserMap.get("iccid").toString(); + if (Fuser_id.equals(user_id)) { + CarMap.put("deliver_date", UserMap.get("deliver_date")); + CarMap.put("customize_grouping", UserMap.get("customize_grouping")); + CarMap.put("remarks", UserMap.get("remarks")); + bool = true; + break; + } + } + } + if (!bool) { + CarMap.put("deliver_date", ""); + CarMap.put("customize_grouping", ""); + CarMap.put("remarks", ""); + } + return CarMap; + } + + + private String WriteOutCard(List> outCardIccidArr, List> hisArr, + String newName, Map task_map, List HisIccid, boolean isGeneralGroupbool) { + + List> out_list = new ArrayList>(); + //循环添加单卡数据信息 + for (int i = 0; i < outCardIccidArr.size(); i++) { + Map CarMap = outCardIccidArr.get(i); + + //写入 分组 、备注、发货时间 + CarMap = WriteCar(CarMap, hisArr); + + out_list.add(CarMap); + } + + String Outcolumns[] = {"iccid", "年份", "月份", "日", "创建时间", "修改时间", "当天使用总量", "当月使用总量", "发货日期", "分组", "备注信息"}; + String keys[] = {"iccid", "year", "month", "day", "create_time", "update_time", "total_show_flow_now", "total_show_flow", "deliver_date", "customize_grouping", "remarks"}; + + if(isGeneralGroupbool){ + Outcolumns = new String[]{"iccid", "年份", "月份", "日", "创建时间", "修改时间", "当天使用总量", "当月使用总量", "发货日期", "分组", "备注信息","API-当天使用","API-当月使用"}; + keys = new String[]{"iccid", "year", "month", "day", "create_time", "update_time", "total_show_flow_now", "total_show_flow", "deliver_date", "customize_grouping", "remarks","total_flow_now","total_flow"}; + } + + writeCSV.Write(newName, out_list, Outcolumns, null, keys); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + return "已下发执行任务可在【设备管理】》【执行任务管理】查看"; + } + +} + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/MonthFirstday.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/MonthFirstday.java new file mode 100644 index 0000000..ee3a919 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/MonthFirstday.java @@ -0,0 +1,236 @@ +package com.yunze.system.card; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.MyDictionary; +import com.yunze.common.mapper.yunze.YzCardInfoChangeMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.utils.yunze.GetShowStatIdArr; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Component; +import javax.annotation.Resource; +import java.io.IOException; +import java.util.*; + +@Slf4j +@Component +public class MonthFirstday { + @Resource + private YzCardMapper yzCardMapper; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private YzCardInfoChangeMapper yzCardInfoChangeMapper; + @Resource + private MyDictionary myDictionary; + @Resource + private GetShowStatIdArr getShowStatIdArr; + + private String Outcolumns[] = {"iccid","返回消息","执行描述","执行人","执行结果"}; + private String keys[] = {"iccid","Message","describe","agentName","result"}; + private int OutSize = 50;//每 50条数据输出一次 + + /** + 月初有订购期内流量卡 进行 复机 + */ + @RabbitHandler + @RabbitListener(queues = "admin_MonthFirstday_queue") + public void CardMonth(String msg) throws IOException { + try { + execution();//月初有订购期内流量卡 进行 复机 + } catch (Exception e) { + log.error(">>错误 - 月初有订购期内流量卡 进行 复机 消费者:{}<<", e.getMessage()); + } + } + + private void execution() { + String Message = ""; + HashMap map = new HashMap<>(); + List> list = yzCardMapper.StatusChange(map);//数据库 查询 + String create_by = " [总平台] - " + " [管理员] "; + //1.读取 上传文件 + String newName = UUID.randomUUID().toString().replace("-", "") + "_CardInfo";//这里 _CardInfo + String task_name = create_by + "-月初复机 [月初 复机] "; + String SaveUrl = "/getcsv/" + newName + ".csv"; + SaveUrl = "/getcsv/" + newName + ".csv"; + Map task_map = new HashMap(); + task_map.put("auth", create_by); + task_map.put("task_name", task_name); + task_map.put("url", SaveUrl); + task_map.put("agent_id", "100"); + task_map.put("type", "9"); //对应的任务类别 + + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + + + map.put("card_arrs", list);//更新 list + + try { + + List> SuccessArr = new ArrayList<>(); + String describe = ""; + List> failArr = new ArrayList<>(); + String cafterward = "正常";//变更后状太 + String OPtionType = "";//操作类型 + for (int i = 0; i < list.size(); i++) { + + Map Obj = new HashMap<>(); + String iccid = list.get(i).get("iccid").toString(); + Obj.put("iccid", iccid); + Obj.put("Is_Stop", "on"); + + + + Map Rmap = internalApiRequest.changeCardStatus(Obj, list.get(i)); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //复机操作 + Object status = Rmap.get("status"); + if (status != null && status != "" && status.toString().trim().length() > 0) { + Obj.put("status", status.toString().trim()); + String RMessage = Rmap.get("Message") != null ? Rmap.get("Message").toString() : "操作成功!"; + Obj.put("Message", RMessage); + Obj.put("describe", describe); + Obj.put("agentName", create_by); + Obj.put("result", "操作成功"); + SuccessArr.add(Obj); + log.info(">>API - 变更操作 成功 = 0 :{} | {}<<", iccid, Rmap); + } + } else { + Obj.put("result", "操作失败"); + Message = Rmap.get("Message") != null ? Rmap.get("Message").toString() : "API异常!"; + Obj.put("Message", Message); + failArr.add(Obj); + } + } + String ctype = ""; + String dict_type = ""; + String key = ""; + key = "status_id"; + dict_type = "yunze_card_status_ShowId"; + ctype = "1"; + + List> lmArr = yzCardMapper.addsel(map);//这里是 查询 出 数据库 操作 前 卡状态 + + List> AddArr = new ArrayList<>(); + + //2. 卡信息 变更表 插入数据 + if (SuccessArr.size() > 0) { + writeCSV.OutCSVObj(SuccessArr, newName, Outcolumns, keys, null, OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + SuccessArr = new ArrayList<>(); + //变更主表信息 + try { + updStatus(SuccessArr, "1");//下发变更 卡状态 队列 + } catch (Exception e) { + log.info(">>错误 - 变更主表信息 :{} | {}<<", e.getMessage()); + } + + for (int j = 0; j < lmArr.size(); j++) { + Map ObjMap = lmArr.get(j); + Map Add_Map = new HashMap<>(); + String value = ObjMap.get(key) != null && ObjMap.get(key).toString().length() > 0 ? ObjMap.get(key).toString() : "未知"; + String cbefore = "";//变更后 + if (!value.equals("未知")) { + cbefore = myDictionary.getdictLabel(dict_type, value); + } else { + cbefore = value; + } + Add_Map.put("iccid", ObjMap.get("iccid")); + Add_Map.put("ctype", ctype);//生命周期 + Add_Map.put("cbefore", cbefore); + Add_Map.put("cafterward", cafterward); + Add_Map.put("remark", "执行成功!"); + Add_Map.put("source_type", "6");// 来源 类型 :6 月初已订购复机 + Add_Map.put("execution_status", "1"); + AddArr.add(Add_Map); + } + Map map1 = new HashMap<>(); + map1.put("CardInfoMapList", AddArr); + map1.put("ctype", lmArr); + int addBool = yzCardInfoChangeMapper.addinfo(map1); + log.info("插入成功"); + log.info("Dlx - " + map.get("iccid") + " 卡信息变更表 插入 : " + OPtionType + " 新增卡信息变更记录 addBool :" + addBool); + + } + if (failArr.size() > 0) { + + writeCSV.OutCSVObj(failArr, newName, Outcolumns, keys, null, OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + failArr = new ArrayList<>(); + for (int j = 0; j < lmArr.size(); j++) { + Map ObjMap = lmArr.get(j); + Map Add_Map = new HashMap<>(); + String value = ObjMap.get(key) != null && ObjMap.get(key).toString().length() > 0 ? ObjMap.get(key).toString() : "未知"; + String cbefore = "";//变更后 + if (!value.equals("未知")) { + cbefore = myDictionary.getdictLabel(dict_type, value); + } else { + cbefore = value; + } + Add_Map.put("iccid", ObjMap.get("iccid")); + Add_Map.put("ctype", ctype);//生命周期 + Add_Map.put("cbefore", cbefore); + Add_Map.put("cafterward", cafterward); + Add_Map.put("describe", describe); + Add_Map.put("agentName", create_by); + Add_Map.put("remark", "执行失败!"); + Add_Map.put("source_type", "6");// 来源 类型 :6 月初已订购复机 + Add_Map.put("execution_status", "2"); + AddArr.add(Add_Map); + } + Map map2 = new HashMap<>(); + map2.put("CardInfoMapList", AddArr); + int addBool = yzCardInfoChangeMapper.addinfo(map2); + log.info("Dlx - " + map.get("iccid") + " 卡信息变更表 插入 : " + SuccessArr + " 新增卡信息变更记录 addBool :" + addBool); + + } + + }catch (DuplicateKeyException e) { + String[] solit = e.getCause().toString().split("'"); + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe",e.getCause().toString()); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">> cardSet-消费者- 上传excel异常 [插入数据 DuplicateKeyException ] :{}<<", e.getMessage().toString()); + } catch (Exception e) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe",e.getCause().toString()); + defOutcolumns.put("agentName",create_by); + defOutcolumns.put("result","查询失败"); + writeCSV.OutCSVObj(list, newName,Outcolumns, keys,defOutcolumns,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">>cardSet-消费者- 批量查询消费者:{}<<", e.getMessage()); + } + } + /** + * 修改卡状态 + * @param SuccessArr + */ + public void updStatus(List> SuccessArr, String statusCode) { + //1. 修改卡状态 || 修改复机状态 + List iccidArr = new ArrayList(); + Map Upd_Map = new HashMap<>(); + for (int i = 0; i < SuccessArr.size(); i++) { + iccidArr.add(SuccessArr.get(i).get("iccid").toString()); + } + Upd_Map.put("iccidArr", iccidArr); + Upd_Map.put("status_id", statusCode); + Upd_Map.put("status_ShowId",getShowStatIdArr.GetShowStatId(statusCode)); + yzCardMapper.updStatusIdArr(Upd_Map); + } +} + + + + diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/OutCat.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/OutCat.java new file mode 100644 index 0000000..b2b38e4 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/OutCat.java @@ -0,0 +1,440 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.*; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 导出 消费 者 + */ +@Slf4j +@Component +public class OutCat { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private YzCardFlowMapper yzCardFlowMapper; + + + + @RabbitHandler + @RabbitListener(queues = "admin_OutCard_queue") + public void DbCard(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map Pmap = JSON.parseObject(msg); + //System.out.println(Pmap); + String create_by = Pmap.get("create_by").toString();//上传新文件名 + Map map = (Map) Pmap.get("map"); + Map User = (Map) Pmap.get("User"); + + List outCardIccidArr = (List) Pmap.get("outCardIccidArr"); + List> userArr = (List>) Pmap.get("userArr"); + List> stateOptions = (List>) Pmap.get("stateOptions"); + List> card_types = (List>) Pmap.get("card_types"); + List> customize_whether = (List>) Pmap.get("customize_whether"); + List> cardConnection_type = (List>) Pmap.get("cardConnection_type"); + + + String newName = (String) Pmap.get("newName"); + Map task_map = (Map) Pmap.get("task_map"); + + String prefix = "admin_OutCard_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ create_by); + if(isExecute==null){ + redisCache.setCacheObject(prefix+":"+ create_by, msg, 3, TimeUnit.SECONDS);//3 秒缓存 避免 重复消费 + OutDataCard( map,User,outCardIccidArr,userArr,stateOptions,card_types,customize_whether, newName,task_map,cardConnection_type); + } + } catch (Exception e) { + log.error(">>错误 - 连接管理导出 消费者:{}<<", e.getMessage().toString()); + } + } + + + + public void OutDataCard(Map map, Map User,List outCardIccidArr,List> userArr,List> stateOptions, + List> card_types,List> customize_whether,String newName,Map task_map,List> cardConnection_type){ + + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + List> outCardArr = yzCardMapper.outCard(map); + Map Dept = (Map) User.get("dept"); + String agent_id = Dept.get("deptId").toString(); + if(agent_id.equals("100")){ + yzCardFlowMapper.queryPackage_simple(map); + }else{ + Map PackageMap = new HashMap(); + PackageMap.put("agent_id",agent_id); + yzCardFlowMapper.queryAgentPackage_simple(PackageMap); + } + map.put("iccid_arrs",outCardIccidArr); + //卡板信息导出需要用到的套餐数据 + List> CardFlowArr = yzCardFlowMapper.outCardFlow(map); + //获取通道信息 + List> routeArr = yzCardRouteMapper.find_simple(map); + //获取 用户信息 + + try { + WriteOutCard(outCardArr,CardFlowArr,stateOptions,card_types,routeArr,userArr,customize_whether,newName,task_map,cardConnection_type); + }catch (Exception e){ + log.error("导出卡信息异常 [导出数据 Exception] "+e.getCause().toString() ); + } + } + + + + + /** + * 写入 套餐详细信息 + * @param CarMap + * @param CardFlowArr + * @return + */ + protected Map WriteCarFlow (Map CarMap,List> CardFlowArr){ + + Map Rmap = new HashMap(); + String iccid = CarMap.get("iccid")!=null?CarMap.get("iccid").toString():null; + boolean bool = false; + if(CardFlowArr!=null && iccid!=null){ + for (int i = 0; i < CardFlowArr.size(); i++) { + Map FlowMap = CardFlowArr.get(i); + String Ficcid = FlowMap.get("iccid").toString(); + if(Ficcid.equals(iccid)){ + CarMap.put("true_flow",FlowMap.get("true_flow")); + CarMap.put("use_so_flow_sum",FlowMap.get("use_so_flow_sum")); + CarMap.put("Percentage",FlowMap.get("Percentage")); + CarMap.put("surplus",FlowMap.get("surplus")); + CarMap.put("packet_name",FlowMap.get("packet_name")); + CarMap.put("packet_valid_time",FlowMap.get("packet_valid_time")); + CarMap.put("packet_valid_name",FlowMap.get("packet_valid_name")); + CardFlowArr.remove(FlowMap); + bool = true; + break; + } + } + } + //字段 默认值 + if(!bool) { + CarMap.put("true_flow",""); + CarMap.put("use_so_flow_sum",""); + CarMap.put("Percentage",""); + CarMap.put("surplus",""); + CarMap.put("packet_name",""); + CarMap.put("packet_valid_time",""); + CarMap.put("packet_valid_name",""); + } + + Rmap.put("CarMap",CarMap); + Rmap.put("CardFlowArr",CardFlowArr); + return Rmap; + } + + + + + + /** + * 输出 导卡操作数据 + * @param list 输出数据 + * @param fileName_flow 文件名 + * @param description 操作描述 + * @param agentName 执行人 + * @param result 执行结果 + */ + public void OutCSV(List> list , String fileName_flow, String description, String agentName, String result){ + + List> out_list = new ArrayList<>(); + + for (int i = 0; i < list.size(); i++) { + Map out_map= new HashMap(); + + Map cardIndex=list.get(i); + String iccid =cardIndex.get("iccid").toString(); + //String tableName ="zy_"+cardType; + //当前时间 + + String Outcolumns[] = {"iccid","操作描述","执行时间","执行结果","执行人"}; + String keys[] = {"iccid","description","time","result","agentName"}; + String Time= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + out_map.put("iccid",iccid); + out_map.put("description",description); + out_map.put("time",Time); + out_map.put("result",result); + out_map.put("agentName",agentName); + + out_list.add(out_map); + if ((i+1)%50==0 || (i+1)==list.size()){ + //执行导出 + if(out_list.size()>0){ + writeCSV.Write(fileName_flow,out_list,Outcolumns,null,keys); + out_list = new ArrayList<>(); + } + + } + } + + } + + + /** + * 获取 运营商类型 的通道id + * @param map + * @return + */ + private Map getChannelIdArr (Map map){ + //判断是否选择 运营商类型 + map.put("selLianTong",false); + Object cd_operator_type=map.get("cd_operator_type"); + if(cd_operator_type!=null){ + String Str_cd_operator_type = cd_operator_type.toString(); + if(Str_cd_operator_type!="" && Str_cd_operator_type.length()>0){ + List> smap = yzCardRouteMapper.find_simple(map); + //添加 【符合 运营类型】 的 通道 查询条件 + List channel_id = new ArrayList(); + if(smap!=null && smap.size()>0){ + for (int i = 0; i < smap.size() ; i++) { + channel_id.add(smap.get(i).get("cd_id").toString()); + } + } + //未找到相匹配的通道时 将 通道id传参 -1 使查询不到相对应数据 + if(channel_id.size()==0){ + channel_id.add("-1"); + } + map.put("channel_id",channel_id); + //如果是联通的查询 条件 且 条件是 卡号 查询长度大于19 或 起止 条件 是 iccid + if(Str_cd_operator_type.equals("2")){ + Object type = map.get("type"); + Object value = map.get("value"); + if(value!=null && value.toString().length()>0 && type!=null){ + map.put("selLianTong",true); + } + Object StartAndEndtype = map.get("StartAndEndtype"); + Object StartValue = map.get("StartValue"); + Object EndValue = map.get("EndValue"); + if(StartAndEndtype!=null && StartAndEndtype.equals("3") && StartValue!=null && EndValue !=null){ + map.put("selLianTong",true); + } + } + + }else{ + Object c_id = map.get("channel_id"); + if(c_id!=null ){ + String Str_c_id = c_id.toString(); + if(Str_c_id!="" && Str_c_id.length()>0) { + List channel_id = new ArrayList(); + channel_id.add(c_id.toString()); + map.put("channel_id",channel_id); + } + } + } + }else{ + Object c_id = map.get("channel_id"); + if(c_id!=null ){ + String Str_c_id = c_id.toString(); + if(Str_c_id!="" && Str_c_id.length()>0) { + List channel_id = new ArrayList(); + channel_id.add(c_id.toString()); + map.put("channel_id",channel_id); + } + } + } + return map; + } + + + + + /** + * 字典获取 + * @param CarMap 写入Map + * @param DictDataArr 字典 list + * @param basis 获取依据 字段 与 dictValue 判断 + * @param fieldName 返回字段名称 + * @return + */ + public Map WriteDic (Map CarMap,List> DictDataArr,String basis,String fieldName){ + + Map Rmap = new HashMap(); + String status_id = CarMap.get(basis)!=null?CarMap.get(basis).toString():null; + boolean bool = false; + if(status_id!=null){ + for (int i = 0; i < DictDataArr.size(); i++) { + Map dictData = DictDataArr.get(i); + String dictValue = dictData.get("dictValue").toString(); + if(dictValue.equals(status_id)){ + CarMap.put(fieldName,dictData.get("dictLabel")); + bool = true; + break; + } + } + } + //字段 默认值 + if(!bool){ + CarMap.put(fieldName,""); + } + return CarMap; + } + + + + /** + * + * 导出写入 卡信息 + * @param outCardArr 卡主信息 + * @param CardFlowArr 套餐用量信息 + * @param stateOptions 卡状态 - 字典表 + * @param card_types 卡类型 - 字典表 + * @param routeArr API 通道信息 + * @param userArr 所属用户信息 + * @param customize_whether 自定义是否 - 字典表 + * @param newName 导出文件名 + * @param task_map 执行任务结束 修改map + * @param cardConnection_type 断开网状态 - 字典表 + * @return + */ + protected String WriteOutCard (List> outCardArr,List> CardFlowArr,List> stateOptions,List> card_types, + List> routeArr,List> userArr,List> customize_whether,String newName,Map task_map,List> cardConnection_type){ + + List> out_list = new ArrayList>(); + //循环添加单卡数据信息 + for (int i = 0; i < outCardArr.size(); i++) { + Map CarMap = outCardArr.get(i); + //写入 套餐详细信息 + Map WriteCarFlowMap = WriteCarFlow(CarMap,CardFlowArr); + CarMap = (Map) WriteCarFlowMap.get("CarMap"); // 更新 CarMap + CardFlowArr = (List>) WriteCarFlowMap.get("CardFlowArr"); // 更新 CardFlowArr + + //写入 卡状态 status_value + CarMap = WriteDic(CarMap,stateOptions,"status_id","status_value"); + //写入 卡类型 type_value + CarMap = WriteDic(CarMap,card_types,"type","type_value"); + //写入 gprs是否开启 gprs_value + CarMap = WriteDic(CarMap,customize_whether,"gprs","gprs_value"); + //写入 未订购资费 是否 轮询停机 gprs_value + CarMap = WriteDic(CarMap,customize_whether,"is_Disconnected","Disconnected_value"); + //写入 断开网状态 connection_status + CarMap = WriteDic(CarMap,cardConnection_type,"connection_status","connection_value"); + + //写入 API 通道信息 + CarMap = WriteCarRout(CarMap,routeArr); + //写入 所属用户信息 + CarMap = WriteCarUser(CarMap,userArr); + + //删除导出不需要的字段 + CarMap.remove("status_id"); + CarMap.remove("type"); + CarMap.remove("package_id"); + CarMap.remove("agent_id"); + CarMap.remove("channel_id"); + CarMap.remove("gprs"); + CarMap.remove("remaining"); + CarMap.remove("is_Disconnected"); + CarMap.remove("connection_status"); + + out_list.add(CarMap); + } + + String Outcolumns[] = {"虚拟编号","MSISDN","ICCID","IMSI","IMEI","出库日期","同步日期","发货日期","周期用量","分组","未订购资费是否停机" ,"备注","所属企业","备注","总量","已使用量(MB)","使用率","剩余用量","资费计划","资费周期","资费时间单位","卡状态","断开网状态","卡类型","GPRS是否开启","API通道","运营商类型","所属用户"}; + String keys[] = {"vid","msisdn","iccid","imsi","imei","out_of_stock","deliver_date","activate_date","used","customize_grouping","Disconnected_value" ,"remainingd","dept_name","remarks","true_flow","use_so_flow_sum","Percentage","surplus","packet_name","packet_valid_time","packet_valid_name","status_value","connection_value","type_value","gprs_value","cd_name","dict_label","user_name"}; + writeCSV.Write(newName,out_list,Outcolumns,null,keys); + + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + return "已下发执行任务可在【设备管理】》【执行任务管理】查看"; + } + + + + /** + * 写入 所属用户信息 + * @param CarMap + * @param userArr + * @return + */ + protected Map WriteCarUser (Map CarMap,List> userArr){ + + Map Rmap = new HashMap(); + String user_id = CarMap.get("user_id")!=null?CarMap.get("user_id").toString():null; + boolean bool = false; + if(userArr!=null && user_id !=null){ + for (int i = 0; i < userArr.size(); i++) { + Map UserMap = userArr.get(i); + String Fuser_id = UserMap.get("user_id").toString(); + if(Fuser_id.equals(user_id)){ + CarMap.put("user_name",UserMap.get("user_name")); + bool = true; + break; + } + } + } + if(!bool){ + CarMap.put("user_name",""); + } + return CarMap; + } + + + /** + * 写入 API 通道信息 + * @param CarMap + * @param routeArr + * @return + */ + protected Map WriteCarRout (Map CarMap,List> routeArr){ + + Map Rmap = new HashMap(); + String channel_id = CarMap.get("channel_id")!=null?CarMap.get("channel_id").toString():null; + boolean bool = false; + if(routeArr!=null && channel_id!=null){ + for (int i = 0; i < routeArr.size(); i++) { + Map RoutMap = routeArr.get(i); + String cd_id = RoutMap.get("cd_id").toString(); + if(cd_id.equals(channel_id)){ + CarMap.put("cd_name",RoutMap.get("cd_alias")); + CarMap.put("dict_label",RoutMap.get("dict_label")); + bool = true; + break; + } + } + } + if(!bool){ + CarMap.put("cd_name",""); + CarMap.put("dict_label",""); + } + return CarMap; + } + + + + + + + + + +} diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/PublicFlowState.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/PublicFlowState.java new file mode 100644 index 0000000..5fcd9b7 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/PublicFlowState.java @@ -0,0 +1,359 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.MyDictionary; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.*; + +/** + * 勾选操作 同步状态,用量 和同步状态和用量 + */ +@Slf4j +@Component +public class PublicFlowState { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private CardFlowSyn cardFlowSyn; + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private GetShowStatIdArr getShowStatIdArr; + @Resource + private MyDictionary myDictionary; + + private String Outcolumns[] = {"iccid","执行人","返回消息 [状态]","同步后状态","描述 [状态]","返回消息 [用量]", "描述 [用量]", "同步后已用用量MB", "同步后剩余用量MB","执行结果"}; + private String keys[] = {"iccid", "agentName","StateMessage","status_ShowId_text","Statedescribe","FlowMessage", "Flowdescribe", "used", "remaining","result"}; + private int OutSize = 50;//每 50条数据输出一次 + + /** + * 同步用量 + */ + @RabbitHandler + @RabbitListener(queues = "admin_Consumption_queue") + public void ConsumptionArr(String msg) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + Map Rmap = (Map) map.get("map");//参数 + execution(Rmap, "Consumption");//同步用量 + } catch (Exception e) { + log.error(">>错误 - 批量 【同步用量】 消费者:{}<<", e.getMessage()); + } + } + + /** + * 同步状态 + */ + @RabbitHandler + @RabbitListener(queues = "admin_PublicMethod_queue") + public void PublicMethodArr(String msg) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + Map Rmap = (Map) map.get("map");//参数 + execution(Rmap, "PublicMethod");//同步状态 + } catch (Exception e) { + log.error(">>错误 - 批量 【同步状态】 消费者:{}<<", e.getMessage()); + } + } + + /** + * 同步状态和用量 + */ + @RabbitHandler + @RabbitListener(queues = "admin_ConsumptionAndState_queue") + public void ConsumptionAndStateArrss(String msg) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + Map Rmap = (Map) map.get("map");//参数 + execution(Rmap, "ConsumptionAndState");//同步状态 + } catch (Exception e) { + log.error(">>错误 - 批量 【同步状态和用量】 消费者:{}<<", e.getMessage()); + } + } + + /** + * 批量执行 公共函数 + */ + private void execution(Map Rmap, String OptionType) { + String StateMessage = ""; + + HashMap map = new HashMap<>(); + List> list = (List>) Rmap.get("iccids"); + + String task_nameApend = "";//执行任务类型 拼接 + String newNameApend = "";//执行任务 文件名 后缀 + String TaskType = "";//执行任务 类型 + + // 批量 同步用量 + switch (OptionType) { + case "Consumption": + task_nameApend = "批量 同步用量"; + newNameApend = "_Consumption"; + TaskType = "18"; + break; + case "PublicMethod": + task_nameApend = "批量 同步状态"; + newNameApend = "_PublicMethod"; + TaskType = "19"; + break; + case "ConsumptionAndState": + task_nameApend = "批量 同步状态和用量"; + newNameApend = "_ConsumptionAndState"; + TaskType = "20"; + break; + } + String create_by = " [总平台] - " + " [管理员] "; + String newName = UUID.randomUUID().toString().replace("-", "") + newNameApend;//这里 _Stopped + String task_name = create_by + "-批量 操作 [" + task_nameApend + "] "; + String SaveUrl = "/getcsv/" + newName + ".csv"; + SaveUrl = "/getcsv/" + newName + ".csv"; + Map task_map = new HashMap(); + task_map.put("auth", create_by); + task_map.put("task_name", task_name); + task_map.put("url", SaveUrl); + task_map.put("agent_id", "100"); + task_map.put("type", TaskType); //对应 字典表的 执行任务类别 + + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + map.put("card_arrs", list);//更新 list + map.put("type", "3"); + + if (list != null && list.size() > 0) { + //筛选出未划分通道的 + map.put("channel_idType", "notNull"); + List Channel_iccidarr = yzCardMapper.isExistence(map); //查询单卡信息 + if (Channel_iccidarr != null && Channel_iccidarr.size() > 0) { + if (!(Channel_iccidarr.size() == list.size())) { + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, Channel_iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("Statedescribe", "未划分通道,取消操作!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(Out_list_Different, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } + map.put("card_arrs", list);//更新 list + + List> find_crArr = yzCardRouteMapper.find_cr();//查询 通道简要信息 状态为 正常 + List channel_idArr = new ArrayList<>(); + if (find_crArr != null && find_crArr.size() > 0) { + for (int i = 0; i < find_crArr.size(); i++) { + channel_idArr.add(find_crArr.get(i).get("dictValue")); + } + } else { + channel_idArr.add("0"); + } + //筛选出通道正常的进行 查询 + map.put("channel_idArr", channel_idArr); + List normalChannel_iccidarr = yzCardMapper.isExistence(map); + if (normalChannel_iccidarr != null && normalChannel_iccidarr.size() > 0) { + if (normalChannel_iccidarr != null && normalChannel_iccidarr.size() > 0) { + if (!(normalChannel_iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, normalChannel_iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + + defOutcolumns.put("Statedescribe", "通道状态 为停用或已删除 取消操作"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(Out_list_Different, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } + map.put("card_arrs", list);//更新 list + + + List> SuccessArr = new ArrayList<>(); + List> failArr = new ArrayList<>(); + + List> findRouteArr = yzCardMapper.findRouteArr(map);//查询 卡号 分配 通道 + for (int i = 0; i < findRouteArr.size(); i++) { + Map Route = findRouteArr.get(i); + String iccid = Route.get("iccid").toString();//获取 + + Map Obj = new HashMap<>();// 定义 Obj + Obj.put("iccid", iccid); + Obj.put("card_arrs", iccid); + String used = "", remaining = "";//CalculationFlow-->返回数据 + String FlowMessage ="",Flowdescribe="",Statedescribe=""; + Map Add_Map = new HashMap<>(); + String status_ShowId_text =""; + + if(OptionType.equals("PublicMethod") || OptionType.equals("ConsumptionAndState") ){ + Map StateRmap = internalApiRequest.queryCardStatus(Obj, findRouteArr.get(i));//同步状态 + String code = StateRmap.get("code") != null ? StateRmap.get("code").toString() : "500"; + if (code.equals("200")) { + //获取 卡状态 + if (StateRmap.get("statusCode") != null && StateRmap.get("statusCode") != "" && StateRmap.get("statusCode").toString().trim().length() > 0) { + String statusCode = StateRmap.get("statusCode").toString().trim(); + if (!statusCode.equals("0")) { + Map Upd_Map = new HashMap<>(); + String status_ShowId = getShowStatIdArr.GetShowStatId(statusCode); + Upd_Map.put("status_id", statusCode); + Upd_Map.put("status_ShowId",status_ShowId); + Upd_Map.put("iccid", Obj.get("iccid").toString()); + try { + boolean bool = yzCardMapper.updStatusId(Upd_Map) > 0;//变更卡状态 + if (bool) { + log.info( "已成功同步卡状态!"); + StateMessage = "成功"; + Statedescribe = "已成功同步卡状态!"; + // status_ShowId_text 匹对 字典表 卡状态 8 个的 前端显示用的 + status_ShowId_text = status_ShowId != null && status_ShowId.length() > 0 ? status_ShowId.toString() : "未知"; + if (!status_ShowId.equals("未知")) { + status_ShowId_text = myDictionary.getdictLabel("yunze_card_status_ShowId", status_ShowId); + } + + } else { + StateMessage = "失败"; + Statedescribe = "保存状态异常!"; + log.error("保存状态异常:False!"); + } + } catch (Exception e) { + StateMessage = "失败"; + Statedescribe = "DB保存状态异常!"; + log.error("DB保存状态异常!e:{} " + e.getMessage()); + } + } else { + StateMessage = "失败"; + Statedescribe = "接口超频返回暂无数据返回,请稍后重试!"; + log.error("接口超频返回暂无数据返回,请稍后重试!"); + } + } + } else { + StateMessage = "失败"; + Statedescribe = "接口超频返回暂无数据返回,请稍后重试!"; + log.error("同步数据失败 " + JSON.toJSONString(StateRmap)); + } + } + + + if(OptionType.equals("Consumption") || OptionType.equals("ConsumptionAndState") ) { + Map FlowRmap = internalApiRequest.queryFlow(Obj, findRouteArr.get(i));//同步用量 + + String Flowcode = FlowRmap.get("code") != null ? FlowRmap.get("code").toString() : "500"; + if (Flowcode.equals("200")) { + //获取 卡用量 开卡日期 更新 card info + if (FlowRmap.get("Use") != null && FlowRmap.get("Use") != "" && FlowRmap.get("Use").toString().trim().length() > 0) { + Double Use = Double.parseDouble(FlowRmap.get("Use").toString()); + if (Use >= 0) { + try { + Map FlowSynRmap = cardFlowSyn.CalculationFlow(Obj.get("iccid").toString(), Use); + boolean bool_info = (boolean) FlowSynRmap.get("bool_info"); + if (bool_info) { //为true成功 + used = FlowSynRmap.get("used").toString(); + remaining = FlowSynRmap.get("remaining").toString(); + log.info("已成功同步用量"); + FlowMessage = "成功"; + Flowdescribe = "已成功同步卡用量!"; + } else { + FlowMessage = "失败"; + Add_Map.put("used", used); + Add_Map.put("remaining", remaining); + failArr.add(Add_Map); + log.error("同步用量异常"); + } + log.info(JSON.toJSONString(FlowRmap)); + } catch (Exception e) { + FlowMessage = "失败"; + Flowdescribe = "用量内部计算错误!"; + log.error("用量内部计算错误!" + e.getMessage().toString()); + } + } else { + FlowMessage = "失败"; + Flowdescribe = "同步数据失败!"; + log.error("同步数据失败 " + JSON.toJSONString(FlowRmap)); + } + } + } else { + FlowMessage = "失败"; + Flowdescribe = "同步数据失败!"; + log.error("同步数据失败 " + JSON.toJSONString(FlowRmap)); + } + } + + Add_Map.put("iccid", iccid);//iccid + Add_Map.put("agentName", create_by); + Add_Map.put("FlowMessage", FlowMessage);//返回消息 [用量] + Add_Map.put("Flowdescribe", Flowdescribe);//描述 [用量] + Add_Map.put("used", used);// CalculationFlow-->返回数据 + Add_Map.put("remaining", remaining);// CalculationFlow-->返回数据 + Add_Map.put("StateMessage", StateMessage);//返回消息 [状态] + Add_Map.put("Statedescribe", Statedescribe);//描述 [状态] + Add_Map.put("status_ShowId_text", status_ShowId_text);//描述 [前端显示用状态 值状态] + Add_Map.put("result", "已执行"); + + SuccessArr.add(Add_Map); + + }//for end + + + //执行 CSV 文件 输出 + if (SuccessArr.size() > 0) { + writeCSV.OutCSVObj(SuccessArr, newName, Outcolumns, keys, null, OutSize); + } else if (failArr.size() > 0) { + writeCSV.OutCSVObj(failArr, newName, Outcolumns, keys, null, OutSize); + } + yzExecutionTaskMapper.set_end_time(task_map); + } else { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "通道状态 为停用或已删除 取消操作!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(list, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } else { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "未划分通道,取消操作!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(list, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } + } + } +} + + + diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/PublicMethod.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/PublicMethod.java new file mode 100644 index 0000000..594db59 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/PublicMethod.java @@ -0,0 +1,475 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.MyDictionary; +import com.yunze.common.mapper.yunze.YzCardInfoChangeMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.*; + +/** + * 勾选操作 停复机,断开网操作 + */ +@Slf4j +@Component +public class PublicMethod { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private YzCardInfoChangeMapper yzCardInfoChangeMapper; + @Resource + private MyDictionary myDictionary; + @Resource + private GetShowStatIdArr getShowStatIdArr; + + private String Outcolumns[] = {"iccid", "返回消息", "执行描述", "执行人", "执行结果"}; + private String keys[] = {"iccid", "Message", "describe", "agentName", "result"}; + private int OutSize = 50;//每 50条数据输出一次 + + /** + * 批量停机 + */ + @RabbitHandler + @RabbitListener(queues = "admin_Stopped_queue") + public void StoppedArr(String msg) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + Map Pmap = (Map) map.get("map");//参数 + execution(Pmap, "Stop");//批量 停机 + } catch (Exception e) { + log.error(">>错误 - 批量 【停机】 消费者:{}<<", e.getMessage()); + } + } + /** + * 批量复机 + */ + @RabbitHandler + @RabbitListener(queues = "admin_Machine_queue") + public void MachineArr(String msg) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + Map Pmap = (Map) map.get("map");//参数 + execution(Pmap, "Machine");//批量 停机 + } catch (Exception e) { + log.error(">>错误 - 批量 【复机】 消费者:{}<<", e.getMessage()); + } + } + /** + * 批量断网 + */ + @RabbitHandler + @RabbitListener(queues = "admin_DisconnectNetwork_queue") + public void DisconnectNetworkArr(String msg) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + Map Pmap = (Map) map.get("map");//参数 + execution(Pmap, "DisconnectNetwork");//批量 停机 + } catch (Exception e) { + log.error(">>错误 - 批量 【断网】 消费者:{}<<", e.getMessage()); + } + } + /** + * 批量开网 + */ + @RabbitHandler + @RabbitListener(queues = "admin_OpenNetwork_queue") + public void OpenNetworkArr(String msg) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + Map Pmap = (Map) map.get("map");//参数 + execution(Pmap, "OpenNetwork");//批量 停机 + } catch (Exception e) { + log.error(">>错误 - 批量 【开网】 消费者:{}<<", e.getMessage()); + } + } + + + /** + * 批量执行 公共函数 + * @param Pmap 请求参数 + * @param OptionType 操作类型 Stop 》 停机 + */ + private void execution(Map Pmap, String OptionType) { + String Message = ""; + HashMap map = new HashMap<>(); + List> list = (List>) Pmap.get("iccids"); + //执行API 调用 参数 Map + Map ApiPmap = new HashMap<>(); + String task_nameApend = "";//执行任务类型 拼接 + String newNameApend = "";//执行任务 文件名 后缀 + String TaskType = "";//执行任务 类型 + String cafterward = "";//变更后状态 + String ctype = ""; + String dict_type = ""; + String key = ""; + // 批量 停机 + switch (OptionType) { + case "Stop": + task_nameApend = "批量 停机"; + newNameApend = "_Stopped"; + TaskType = "14"; + ApiPmap.put("Is_Stop", "off");//上游 API 执行 必要参数 + ApiPmap.put("status_id", "5");// Cupdate 修改队列 修改 card_info 表 字段 名 和 字段值 如 修改为 已停机 status_id = 5 + cafterward = "已停机"; + key = "Sel_status_ShowId";// 获取 变更状态 值 + dict_type = "yunze_card_status_ShowId";//卡状态描述 字典表 + ctype = "1";//变更类型为 生命周期 + break; + // 批量 复机 + case "Machine": + task_nameApend = "批量 复机"; + newNameApend = "_Machine"; + TaskType = "15"; //执行任务类别 + ApiPmap.put("Is_Stop", "on");//复机 + ApiPmap.put("status_id", "4"); + cafterward = "已复机"; + key = "Sel_status_ShowId"; //卡状态 + dict_type = "yunze_card_status_ShowId";//卡状态描述 字典表 + ctype = "1";//变更类型为 生命周期 + break; + // 批量 断网 + case "DisconnectNetwork": + task_nameApend = "批量 断网"; + newNameApend = "_DisconnectNetwork"; + TaskType = "16"; //执行任务类别 + ApiPmap.put("Is_Break", "1");//断网 + ApiPmap.put("status_id", "5"); + cafterward = "已断网"; + key = "connection_status"; //卡状态 + dict_type = "yz_cardConnection_type";//卡状态描述 字典表 + ctype = "2";//变更类型为 生命周期 + break; + // 批量 开网 + case "OpenNetwork": + task_nameApend = "批量 开网"; + newNameApend = "_OpenNetwork"; + TaskType = "17"; //执行任务类别 + ApiPmap.put("Is_Break", "0");//开网 + ApiPmap.put("status_id", "4"); + cafterward = "已开网"; + key = "connection_status"; //卡状态 + dict_type = "yz_cardConnection_type";//卡状态描述 字典表 + ctype = "2";//变更类型为 生命周期 + break; + } + + + String create_by = " [总平台] - " + " [管理员] "; + String newName = UUID.randomUUID().toString().replace("-", "") + newNameApend;//这里 _Stopped + String task_name = create_by + "-批量 操作 [" + task_nameApend + "] "; + String SaveUrl = "/getcsv/" + newName + ".csv"; + SaveUrl = "/getcsv/" + newName + ".csv"; + Map task_map = new HashMap(); + task_map.put("auth", create_by); + task_map.put("task_name", task_name); + task_map.put("url", SaveUrl); + task_map.put("agent_id", "100"); + task_map.put("type", TaskType); //对应 字典表的 执行任务类别 + + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + map.put("card_arrs", list);//更新 list + map.put("type", "3"); + + if (list != null && list.size() > 0) { + //筛选出未划分通道的 + map.put("channel_idType", "notNull"); + List Channel_iccidarr = yzCardMapper.isExistence(map); //查询单卡信息 + if (Channel_iccidarr != null && Channel_iccidarr.size() > 0) { + if (!(Channel_iccidarr.size() == list.size())) { + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, Channel_iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "未划分通道,取消操作!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(Out_list_Different, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } + map.put("card_arrs", list);//更新 list + + List> find_crArr = yzCardRouteMapper.find_cr();//查询 通道简要信息 状态为 正常 + List channel_idArr = new ArrayList<>(); + if (find_crArr != null && find_crArr.size() > 0) { + for (int i = 0; i < find_crArr.size(); i++) { + channel_idArr.add(find_crArr.get(i).get("dictValue")); + } + } else { + channel_idArr.add("0"); + } + //筛选出通道正常的进行 查询 + map.put("channel_idArr", channel_idArr); + List normalChannel_iccidarr = yzCardMapper.isExistence(map); + if (normalChannel_iccidarr != null && normalChannel_iccidarr.size() > 0) { + if (!(normalChannel_iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, normalChannel_iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 查询数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 查询数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "通道状态 为停用或已删除 取消操作"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(Out_list_Different, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } + map.put("card_arrs", list);//更新 list + + List> failArr = new ArrayList<>(); + String describe = ""; + List> SuccessArr = new ArrayList<>(); + + List> findRouteArr = yzCardMapper.findRouteArr(map);//查询 卡号 分配 通道 及变更前 卡状态 断开网状态 + for (int i = 0; i < findRouteArr.size(); i++) { + Map Obj = new HashMap<>(); + Map Route = findRouteArr.get(i); + String iccid = Route.get("iccid").toString(); + Object Sel_status_ShowId = Route.get("Sel_status_ShowId") != null ? Route.get("Sel_status_ShowId") : "8";//默认'未知' + Object Sel_connection_status = Route.get("Sel_connection_status") != null ? Route.get("Sel_connection_status") : "未知"; + + Obj.putAll(ApiPmap);//将 执行 PAI 的 参数 放入执行请求 参数中 + Obj.put("iccid", iccid); + //放入变更前 卡状态 和 断开网状态 + Obj.put("Sel_status_ShowId", Sel_status_ShowId); + Obj.put("Sel_connection_status", Sel_connection_status); + + + + + Map Rmap = null; + switch (OptionType) { + case "Stop": + Rmap = internalApiRequest.changeCardStatus(Obj, findRouteArr.get(i)); + break; + case "Machine": + Rmap = internalApiRequest.changeCardStatus(Obj, findRouteArr.get(i)); + break; + case "DisconnectNetwork": + Rmap = internalApiRequest.FunctionApnStatus(Obj, findRouteArr.get(i)); + break; + case "OpenNetwork": + Rmap = internalApiRequest.FunctionApnStatus(Obj, findRouteArr.get(i)); + break; + } + + + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //停机操作 + Object status = Rmap.get("status"); + if (status != null && status != "" && status.toString().trim().length() > 0) { + //Obj.put("status", status.toString().trim()); + String RMessage = Rmap.get("Message") != null ? Rmap.get("Message").toString() : "操作成功!"; + Obj.put("Message", RMessage); + Obj.put("describe", describe); + Obj.put("agentName", create_by); + Obj.put("result", "操作成功"); + SuccessArr.add(Obj); + log.info(">>API - 变更操作 成功 = 0 :{} | {}<<", iccid, Rmap); + } + } else { + Obj.put("agentName", create_by); + Obj.put("result", "操作失败"); + Message = Rmap.get("Message") != null ? Rmap.get("Message").toString() : "API异常!"; + Obj.put("Message", Message); + failArr.add(Obj); + } + } + //2. 卡信息 变更表 插入数据 + if (SuccessArr.size() > 0) { + writeCSV.OutCSVObj(SuccessArr, newName, Outcolumns, keys, null, OutSize); + yzExecutionTaskMapper.set_end_time(task_map); + switch (OptionType) { + case "Stop": + //变更主表信息 + try { + updStatus(SuccessArr, "1");//下发变更 卡状态 队列 + } catch (Exception e) { + log.info(">>错误 - 变更主表信息 :{} | {}<<", e.getMessage()); + } + break; + case "Machine": + //变更主表信息 + try { + updStatus(SuccessArr, "2");//下发变更 卡状态 队列 + } catch (Exception e) { + log.info(">>错误 - 变更主表信息 :{} | {}<<", e.getMessage()); + } + break; + case "DisconnectNetwork": + //变更主表信息 + try { + updConnectionStatus(SuccessArr, "1");//下发变更 卡状态 队列 + } catch (Exception e) { + log.info(">>错误 - 变更主表信息 :{} | {}<<", e.getMessage()); + } + case "OpenNetwork": + //变更主表信息 + try { + updConnectionStatus(SuccessArr, "0");//下发变更 卡状态 队列 + } catch (Exception e) { + log.info(">>错误 - 变更主表信息 :{} | {}<<", e.getMessage()); + } + break; + } + //变更 信息 遍历放入 插入 list + List> AddArr = new ArrayList<>(); + for (int i = 0; i < SuccessArr.size(); i++) { + Map Obj = SuccessArr.get(i); + String iccid = Obj.get("iccid").toString(); + Map Add_Map = new HashMap<>(); + String value = Obj.get(key) != null && Obj.get(key).toString().length() > 0 ? Obj.get(key).toString() : "未知"; + String cbefore = "";//变更前 + if (!value.equals("未知")) { + cbefore = myDictionary.getdictLabel(dict_type, value); + } else { + cbefore = value; + } + Add_Map.put("iccid", iccid);//查询 卡号 分配 通道 + Add_Map.put("ctype", ctype);//卡信息变更类型 + Add_Map.put("cbefore", cbefore);//变更前 + Add_Map.put("cafterward", cafterward);//变更后 + Add_Map.put("remark", "执行成功!"); + Add_Map.put("source_type", "5");// 来源 类型 :5 批量操作 + Add_Map.put("execution_status", "1"); + AddArr.add(Add_Map); + } + Map map1 = new HashMap<>(); + map1.put("CardInfoMapList", AddArr); + int addBool = yzCardInfoChangeMapper.addinfo(map1);//插入变更 信息 + log.info("成功信息插入 - " + map.get("iccid") + " 卡信息变更表 插入 : " + OptionType + " 新增卡信息变更记录 addBool :" + addBool); + + } + if (failArr.size() > 0) { + writeCSV.OutCSVObj(failArr, newName, Outcolumns, keys, null, OutSize); + yzExecutionTaskMapper.set_end_time(task_map); + List> AddArr = new ArrayList<>(); + for (int j = 0; j < failArr.size(); j++) { + Map ObjMap = failArr.get(j); + String iccid = ObjMap.get("iccid").toString(); + String value = ObjMap.get(key) != null && ObjMap.get(key).toString().length() > 0 ? ObjMap.get(key).toString() : "未知"; + String cbefore = "";//变更前 + if (!value.equals("未知")) { + cbefore = myDictionary.getdictLabel(dict_type, value); + } else { + cbefore = value; + } + Map Add_Map = new HashMap<>(); + Add_Map.put("iccid", iccid);//查询 卡号 分配 通道 + Add_Map.put("ctype", ctype);//变更类型 + Add_Map.put("cbefore", cbefore);//变更前 + Add_Map.put("cafterward", cafterward);//变更后 + Add_Map.put("describe", describe);//执行描述 + Add_Map.put("agentName", create_by); + Add_Map.put("remark", "执行失败!"); + Add_Map.put("source_type", "5");// 来源 类型 :5 批量操作 + Add_Map.put("execution_status", "2");//失败 + AddArr.add(Add_Map); + } + Map map2 = new HashMap<>(); + map2.put("CardInfoMapList", AddArr); + int addBool = yzCardInfoChangeMapper.addinfo(map2); + log.info("失败信息插入 - " + map.get("iccid") + " 卡信息变更表 插入 : " + SuccessArr + " 新增卡信息变更记录 addBool :" + addBool); + } + + } else { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "通道状态 为停用或已删除 取消操作!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(list, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } else { + Map defOutcolumns = new HashMap<>(); + defOutcolumns.put("describe", "未划分通道,取消操作!"); + defOutcolumns.put("agentName", create_by); + defOutcolumns.put("result", "查询失败"); + writeCSV.OutCSVObj(list, newName, Outcolumns, keys, defOutcolumns, OutSize); + } + } + + + } + + /** + * 修改卡状态 + * @param SuccessArr + */ + public void updStatus(List> SuccessArr, String statusCode) { + //1. 修改卡状态 || 修改停机复机状态 + List iccidArr = new ArrayList(); + Map Upd_Map = new HashMap<>(); + for (int i = 0; i < SuccessArr.size(); i++) { + iccidArr.add(SuccessArr.get(i).get("iccid").toString()); + } + Upd_Map.put("iccidArr", iccidArr); + Upd_Map.put("status_id", statusCode); + Upd_Map.put("status_ShowId", getShowStatIdArr.GetShowStatId(statusCode)); + + yzCardMapper.updStatusIdArr(Upd_Map); + } + + + public void updConnectionStatus (List> SuccessArr,String Connection) { + //1. 修改卡状态 || 修改断开网状态 + List iccidArr = new ArrayList(); + Map Upd_Map = new HashMap<>(); + for (int i = 0; i < SuccessArr.size(); i++) { + iccidArr.add(SuccessArr.get(i).get("iccid").toString()); + } + Upd_Map.put("iccidArr",iccidArr); + Upd_Map.put("connection_status",Connection); + yzCardMapper.updction(Upd_Map); + + } + + +} + + + + + + diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/SaveCardArr.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/SaveCardArr.java new file mode 100644 index 0000000..999f473 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/SaveCardArr.java @@ -0,0 +1,232 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.*; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 批量导卡 消费 者 + */ +@Slf4j +@Component +public class SaveCardArr { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + + + + /** + * 批量导入卡 + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "admin_saveCard_queue") + public void Cardsave(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String filePath = map.get("filePath").toString();//项目根目录 + String ReadName = map.get("ReadName").toString();//上传新文件名 + String newName = map.get("newName").toString();//输出文件名 + Map User = ( Map)map.get("User");//登录用户信息 + + String prefix = "admin_saveCard_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ ReadName); + if(isExecute==null){ + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix+":"+ ReadName, msg, 30, TimeUnit.SECONDS);//30 秒缓存 避免 重复消费 + ImportCar(filePath,ReadName,User,newName);//执行导入 + } + } catch (Exception e) { + log.error(">>错误 - 批量导入卡 消费者:{}<<", e.getMessage().toString()); + } + } + + + /** + * 导卡执行 + * @param filePath + * @param ReadName + * @param User + * @param newName + */ + public void ImportCar(String filePath, String ReadName,Map User,String newName){ + String path = filePath + "/upload/uploadCard/" + ReadName; + ExcelConfig excelConfig = new ExcelConfig(); + String columns[] = {"msisdn","iccid","imsi","open_date","activate_date","agent_id","channel_id","is_pool","batch_date","remarks","status_id","package_id","imei","type","network_type","is_sms","sms_number","gprs","user_id"}; + String maxVid = yzCardMapper.findMaxVid(); + maxVid = maxVid!=null?maxVid:"16800000000"; + Long maxVidInt = Long.parseLong(maxVid); + List> list = excelConfig.getExcelListMap(path,columns,maxVidInt); + Map Dept = (Map)User.get("dept"); + + String create_by = " [ "+Dept.get("deptName")+" ] - "+" [ "+User.get("userName")+" ] "; + + String Outcolumns[] = {"iccid","操作描述","执行时间","执行结果","执行人"}; + String keys[] = {"iccid","description","time","result","agentName"}; + + if(list!=null && list.size()>0){ + //筛选出 vid msisdn iccid imsi 的 卡号 重复项 + HashMap map = new HashMap<>(); + map.put("card_arrs",list); + map.put("type","3"); + List iccidarr = yzCardMapper.isExistence(map); + + String SaveUrl = "/getcsv/"+newName+".csv"; + String task_name = create_by+"-连接管理上传 [导入] "; + Map task_map = new HashMap(); + task_map.put("auth",create_by); + task_map.put("task_name",task_name); + task_map.put("url",SaveUrl); + task_map.put("agent_id", Dept.get("deptId")); + task_map.put("type","3"); + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + //1.判断上传数据与数据库现有数据做对比 大于 0 证明有 以存在数据 + if(iccidarr.size()>0){ + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i > Out_list_Different = Different.getIdentical(list1,iccidarr,"iccid"); + if(Out_list_Different.size()>0){ + writeCSV.OutCSV(Out_list_Different,newName,"ICCID重复导入失败!",create_by,"导入失败",Outcolumns,keys); + } + list = Different.delIdentical(list,iccidarr,"iccid");//删除相同的数据 进行批量上传 + } + map.put("card_arrs",list);//更新 list + map.put("create_by",create_by); + try { + if(list.size()>0){ + int sInt = 2000; + //导入批量处理 2k 条 + List> listnew = new ArrayList<>(); + Map>> lMap=new HashMap<>(); + int MaxAdd = 5; + for(int i=0;i(); + listnew.add(list.get(i)); + lMap.put(i+1, listnew); + }else { + //listnew=new ArrayList(); + listnew.add(list.get(i)); + } + } + for(Integer key : lMap.keySet()){ + map.put("card_arrs",lMap.get(key));//更新 list + map.put("create_by",create_by); + sInt += yzCardMapper.importCard(map); + } + + if(sInt>0){ + writeCSV.OutCSV(list,newName,"成功导入卡列表数据 ["+sInt+"] 条",create_by,"导入成功",Outcolumns,keys); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + } + }else{ + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">> admin-消费者- 上传数据已全部在数据库,无需上传卡信息! :{}<<"); + } + }catch (DuplicateKeyException e){ + System.out.println("=================="+e.getCause().toString()); + String[] solit=e.getCause().toString().split("'"); + writeCSV.OutCSV(list,newName,e.getCause().toString(),create_by,"导入失败",Outcolumns,keys); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">> admin-消费者- 上传excel异常 [插入数据 DuplicateKeyException ] :{}<<", e.getMessage().toString()); + }catch (Exception e){ + writeCSV.OutCSV(list,newName,e.getCause().toString(),create_by,"导入失败",Outcolumns,keys); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">>admin-消费者- 批量导卡消费者:{}<<", e.getMessage().toString()); + } + }else{ + log.error( "admin-消费者 上传表格无数据!无需执行导入"); + } + } + + + + + + + /** + * 获取 运营商类型 的通道id + * @param map + * @return + */ + private Map getChannelIdArr (Map map){ + //判断是否选择 运营商类型 + Object cd_operator_type=map.get("cd_operator_type"); + if(cd_operator_type!=null){ + String Str_cd_operator_type = cd_operator_type.toString(); + if(Str_cd_operator_type!="" && Str_cd_operator_type.length()>0){ + List> smap = yzCardRouteMapper.find_simple(map); + //添加 【符合 运营类型】 的 通道 查询条件 + List channel_id = new ArrayList(); + if(smap!=null && smap.size()>0){ + for (int i = 0; i < smap.size() ; i++) { + channel_id.add(smap.get(i).get("cd_id").toString()); + } + } + //未找到相匹配的通道时 将 通道id传参 -1 使查询不到相对应数据 + if(channel_id.size()==0){ + channel_id.add("-1"); + } + map.put("channel_id",channel_id); + }else{ + Object c_id = map.get("channel_id"); + if(c_id!=null ){ + String Str_c_id = c_id.toString(); + if(Str_c_id!="" && Str_c_id.length()>0) { + List channel_id = new ArrayList(); + channel_id.add(c_id.toString()); + map.put("channel_id",channel_id); + } + } + } + }else{ + Object c_id = map.get("channel_id"); + if(c_id!=null ){ + String Str_c_id = c_id.toString(); + if(Str_c_id!="" && Str_c_id.length()>0) { + List channel_id = new ArrayList(); + channel_id.add(c_id.toString()); + map.put("channel_id",channel_id); + } + } + } + return map; + } + + + +} diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/ShoppingOrder.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/ShoppingOrder.java new file mode 100644 index 0000000..4174274 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/ShoppingOrder.java @@ -0,0 +1,256 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.mapper.yunze.YzCardFlowMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 购物订单导出 + * */ + +@Slf4j +@Component +public class ShoppingOrder { + + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private YzCardFlowMapper yzCardFlowMapper; + + + @RabbitHandler + @RabbitListener(queues = "admin_Shoppingexport_queue") + public void DbCard(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map Pmap = JSON.parseObject(msg); + //System.out.println(Pmap); + Map map = (Map) Pmap.get("map"); + Map User = (Map) Pmap.get("User"); + List> outCardIccidArr = (List>) Pmap.get("outCardIccidArr"); + List> shopping_export = (List>) Pmap.get("shopping_export"); + List> stateOptions = (List>) Pmap.get("stateOptions"); + List> payment_method = (List>) Pmap.get("payment_method"); + List> customize_whether = (List>) Pmap.get("customize_whether"); + List> cardConnection_type = (List>) Pmap.get("cardConnection_type"); + List> deptArr = (List>) Pmap.get("deptArr"); + + String newName = (String) Pmap.get("newName"); + Map task_map = (Map) Pmap.get("task_map"); + + String prefix = "admin_Shoppingexport_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + OutDataCard( map,User,outCardIccidArr,deptArr,shopping_export,stateOptions,payment_method,customize_whether, newName,task_map,cardConnection_type); + + }catch (Exception e){ + log.error(">>错误 - 购物订单导出 消费者:{}<<", e.getMessage().toString()); + } + + } + + private void OutDataCard(Map map, Map user, List> outCardIccidArr, List> userArr, List> shopping_export, List> stateOptions, + List> payment_method, List> customize_whether, String newName, Map task_map, List> cardConnection_type) { + + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + Map Dept = (Map) user.get("dept"); + String agent_id = Dept.get("deptId").toString(); + if(agent_id.equals("100")){ + yzCardFlowMapper.queryPackage_simple(map); + }else{ + Map PackageMap = new HashMap(); + PackageMap.put("agent_id",agent_id); + yzCardFlowMapper.queryAgentPackage_simple(PackageMap); + } + map.put("iccid_arrs",outCardIccidArr); + + try { + WriteOutCard(outCardIccidArr,stateOptions,payment_method,userArr,shopping_export,customize_whether,newName,task_map,cardConnection_type); + }catch (Exception e){ + log.error("导出卡信息异常 [导出数据 Exception] "+e.getCause().toString() ); + } + + + + } + + /** + * 字典获取 + * @param CarMap 写入Map + * @param DictDataArr 字典 list + * @param basis 获取依据 字段 与 dictValue 判断 + * @param fieldName 返回字段名称 + * @return + */ + public Map WriteDic (Map CarMap,List> DictDataArr,String basis,String fieldName){ + + Map Rmap = new HashMap(); + String status_id = CarMap.get(basis)!=null?CarMap.get(basis).toString():null; + boolean bool = false; + if(status_id!=null){ + for (int i = 0; i < DictDataArr.size(); i++) { + Map dictData = DictDataArr.get(i); + String dictValue = dictData.get("dictValue").toString(); + if(dictValue.equals(status_id)){ + CarMap.put(fieldName,dictData.get("dictLabel")); + bool = true; + break; + } + } + } + //字段 默认值 + if(!bool){ + CarMap.put(fieldName,""); + } + return CarMap; + } + + /** + * 写入 所属集团信息 + * @param CarMap + * @param deptArr + * @return + */ + protected Map WriteCarUser (Map CarMap,List> deptArr){ + + Map Rmap = new HashMap(); + String user_id = CarMap.get("agent_id")!=null?CarMap.get("agent_id").toString():null; + boolean bool = false; + if(deptArr!=null && user_id !=null){ + for (int i = 0; i < deptArr.size(); i++) { + Map UserMap = deptArr.get(i); + String Fuser_id = UserMap.get("dept_id").toString(); + if(Fuser_id.equals(user_id)){ + CarMap.put("dept_name",UserMap.get("dept_name")); + bool = true; + break; + } + } + } + if(!bool){ + CarMap.put("dept_name",""); + } + return CarMap; + } + + + + /** + * 写入 年月日 + * @param CarMap + * @param deptArr + * @return + */ + protected Map WriteFlow (Map CarMap,List> deptArr){ + + Map Rmap = new HashMap(); + String user_id = CarMap.get("ord_no")!=null?CarMap.get("ord_no").toString():null; + boolean bool = false; + if(deptArr!=null && user_id !=null){ + for (int i = 0; i < deptArr.size(); i++) { + Map UserMap = deptArr.get(i); + String packet_id = UserMap.get("ord_no").toString(); + if(packet_id.equals(user_id)){ + CarMap.put("ord_no_value",UserMap.get("ord_no")); + CarMap.put("shipping_Phone_value",UserMap.get("shipping_Phone")); + CarMap.put("shipping_user_value",UserMap.get("shipping_user")); + CarMap.put("province_value",UserMap.get("province")); + CarMap.put("city_value",UserMap.get("city")); + CarMap.put("district_value",UserMap.get("district")); + CarMap.put("paddress_value",UserMap.get("address")); + CarMap.put("by_count_value",UserMap.get("by_count")); + CarMap.put("product_name_value",UserMap.get("product_name")); + bool = true; + break; + } + } + } + if(!bool){ + CarMap.put("ord_no_value",""); + CarMap.put("shipping_Phone_value",""); + CarMap.put("shipping_user_value",""); + CarMap.put("province_value",""); + CarMap.put("city_value",""); + CarMap.put("district_value",""); + CarMap.put("paddress_value",""); + CarMap.put("by_count_value",""); + CarMap.put("product_name_value",""); + } + return CarMap; + } + + + + private String WriteOutCard(List> outCardArr, + List> stateOptions, List> payment_method, + List> deptArr, List> shopping_export, List> customize_whether, + String newName, Map task_map, List> cardConnection_type) { + boolean outFlowInfo = false; + outFlowInfo = shopping_export != null && shopping_export.size() > 0 ? true : false; + + List> out_list = new ArrayList>(); + //循环添加单卡数据信息 + for (int i = 0; i < outCardArr.size(); i++) { + Map CarMap = outCardArr.get(i); + + //写入 支付方式 payment_method_value + CarMap = WriteDic(CarMap, payment_method, "payment_method", "payment_method_value"); + //写入 支付状态 status_value + CarMap = WriteDic(CarMap, stateOptions, "status", "status_value"); + //写入 自定义是否 pay_type_value + CarMap = WriteDic(CarMap, customize_whether, "add_package", "add_package_value"); + //写入 生效类型 pay_type_value + CarMap = WriteDic(CarMap, cardConnection_type, "validate_type", "validate_type_value"); + + //写入 所属集团信息 + CarMap = WriteCarUser(CarMap, deptArr); + + //写入 + if (outFlowInfo) { + CarMap = WriteFlow(CarMap, shopping_export); + } + + + out_list.add(CarMap); + } + + + String Outcolumns[] = {"订单号", "交易名称", "串号", "微信订单号", "支付状态", "交易金额", "支付方式", "是否已加包", "创建时间", "生效类型", "备注", "加包执行时间", + "订单编号", "收货人电话", "收货人姓名", "省", "市", "区", "地址", "下单数量", "商品名称","所属公司"}; + String keys[] = {"ord_no", "ord_name", "iccid", "wx_ord_no", "status_value", "price", "payment_method_value", "add_package_value", "create_time", "validate_type_value", "info", "add_package_time", + "ord_no_value","shipping_Phone_value","shipping_user_value","province_value","city_value","district_value","paddress_value","by_count_value","product_name_value","dept_name"}; + + + writeCSV.Write(newName, out_list, Outcolumns, null, keys); + + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + return "已下发执行任务可在【设备管理】》【执行任务管理】查看"; + + + } + + + } + + + + + + diff --git a/yunze-consumption-admin/src/main/java/com/yunze/system/card/dlx/DlxCardImportSet.java b/yunze-consumption-admin/src/main/java/com/yunze/system/card/dlx/DlxCardImportSet.java new file mode 100644 index 0000000..7c477a9 --- /dev/null +++ b/yunze-consumption-admin/src/main/java/com/yunze/system/card/dlx/DlxCardImportSet.java @@ -0,0 +1,191 @@ +package com.yunze.system.card.dlx; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.Different; +import com.yunze.common.utils.yunze.ExcelConfig; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 连接设置 【资费组设置、通道设置 、超量停机阈值设定】 消费 者 + */ +@Slf4j +@Component +public class DlxCardImportSet { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + + private String Outcolumns[] = {"id","set_dept_id","set_user_id","执行时间","执行人"}; + private String keys[] = {"id","set_dept_id","set_user_id","time","agentName"}; + private int OutSize = 50;//每 50条数据输出一次 + + /** + * 连接设置 + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "dlx_admin_CardImportSet_queue") + public void CardSet(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String filePath = map.get("filePath").toString();//项目根目录 + String ReadName = map.get("ReadName").toString();//上传新文件名 + Map Pmap = ( Map)map.get("map");//参数 + Map User = ( Map)Pmap.get("User");//登录用户信息 + + String prefix = "dlx_admin_CardImportSet_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ ReadName); + if(isExecute==null){ + redisCache.setCacheObject(prefix+":"+ ReadName, msg, 3, TimeUnit.SECONDS);//3 秒缓存 避免 重复消费 + execution(filePath,ReadName,Pmap,User);//执行连接设置 + } + } catch (Exception e) { + log.error(">>错误 - 连接设置 消费者:{}<<", e.getMessage().toString()); + } + } + + /** + * 设置执行 + */ + public void execution(String filePath,String ReadName,Map Pmap,Map User){ + String Message = ""; + //1.读取 上传文件 + String path = filePath + "/upload/importSet/" + ReadName; + ExcelConfig excelConfig = new ExcelConfig(); + String columns[] = {"iccid"}; + + + + List> list = excelConfig.getExcelListMap(path,columns); + Map Dept = (Map)User.get("dept"); + String create_by = " [ "+Dept.get("deptName")+" ] - "+" [ "+User.get("userName")+" ] "; + String Outcolumns[] = {"iccid","操作描述","执行结果","执行人","执行时间"}; + String keys[] = {"iccid","description","result","agentName","OptionTime"}; + + String newName = UUID.randomUUID().toString().replace("-","")+"_CardImportSet"; + String DistributeBackupName = UUID.randomUUID().toString().replace("-","")+"_CardImportSetBackup"; + String task_name = create_by+"-设备管理 [连接设置] "; + String SaveUrl = "/getcsv/"+newName+".csv"; + SaveUrl = "/getcsv/"+newName+".csv"; + SaveUrl += ",/getcsv/"+DistributeBackupName+".csv"; + Map task_map = new HashMap(); + task_map.put("auth",create_by); + task_map.put("task_name",task_name); + task_map.put("url",SaveUrl); + task_map.put("agent_id",User.get("deptId") ); + task_map.put("type", "6"); + + if(list!=null && list.size()>0) { + //筛选出 iccid 卡号 重复项 + Map getNotRepeatingMap = Different.getNotRepeating(list,"iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap.get("Rlist");//更新 设置数据 + List> Repeatlist = (List>) getNotRepeatingMap.get("Repeatlist"); + if(Repeatlist.size()>0){ + writeCSV.OutCSVObj(Repeatlist,newName,"ICCID重复设置失败!同一ICCID同批次,无需多次设置!",create_by,"设置失败",Outcolumns,keys,OutSize); + } + //查询数据库中 匹对iccid 是否存在 + HashMap map = new HashMap<>(); + //添加修改数据 + map.put("package_id",Pmap.get("package_id")); + map.put("channel_id",Pmap.get("channel_id")); + map.put("Is_remind_ratio",Pmap.get("Is_remind_ratio")); + map.put("remind_ratio",Pmap.get("remind_ratio")); + + map.put("card_arrs",list); + map.put("type","3"); + List iccidarr = yzCardMapper.isExistence(map); + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + if (iccidarr != null && iccidarr.size() > 0) { + //1.判断 设置卡号是否都在库里 + //库中查询出卡号与上传卡号数量 不一致 说明有卡号不在数据库中 + if (!(iccidarr.size() == list.size())) { + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + list1.add(list.get(i).get("iccid").toString()); + } + // 获取 数组去重数据 和 重复值 + Map getNotRepeatingMap_DB = Different.getNotRepeating(list, iccidarr, "iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 设置数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 设置数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if (Out_list_Different.size() > 0) { + writeCSV.OutCSVObj(Out_list_Different, newName, "iccid 不在数据库中!请核对iccid卡号!", create_by, "设置失败", Outcolumns, keys,OutSize); + } + } + map.put("card_arrs", list);//更新 list + try { + if (list.size() > 0) { + //备份设置前属性 + try { + List> Bklist = yzCardMapper.SetBackupAssociate(map); + if(Bklist!=null && Bklist.size()>0){ + String BK_keys[] = {"id","iccid","remind_ratio","channel_id","package_id","OptionTime"}; + writeCSV.OutCSVObj(Bklist, DistributeBackupName, BK_keys, BK_keys,OutSize); + } + }catch (Exception e){ + log.error(">> cardSet-消费者- 备份 异常 :{}<<", e.getMessage()); + } + int sInt = yzCardMapper.SetCard(map); + if (sInt > 0) { + writeCSV.OutCSVObj(list, newName, "批量 设置 成功 数据 [" + sInt + "] 条", create_by, "设置成功", Outcolumns, keys,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + } + } + } catch (DuplicateKeyException e) { + String[] solit = e.getCause().toString().split("'"); + writeCSV.OutCSVObj(list, newName, e.getCause().toString(), create_by, "设置失败", Outcolumns, keys,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">> cardSet-消费者- 上传excel异常 [插入数据 DuplicateKeyException ] :{}<<", e.getMessage().toString()); + } catch (Exception e) { + writeCSV.OutCSVObj(list, newName, e.getCause().toString(), create_by, "设置失败", Outcolumns, keys,OutSize); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">>cardSet-消费者- 批量设置消费者:{}<<", e.getMessage()); + } + + } else { + log.info("上传ICCID卡号不在数据库中!请核对后重试!"); + writeCSV.OutCSVObj(list, newName, "设置iccid卡号平台中未找到!设置取消!", create_by, "设置失败", Outcolumns, keys,OutSize); + } + }else{ + log.error( "admin-消费者 上传表格无数据!无需执行设置"); + } + } + + + + + + + + + + +} diff --git a/yunze-consumption-admin/src/main/resources/application.yml b/yunze-consumption-admin/src/main/resources/application.yml new file mode 100644 index 0000000..198f747 --- /dev/null +++ b/yunze-consumption-admin/src/main/resources/application.yml @@ -0,0 +1,67 @@ +spring: + rabbitmq: + ####连接地址 + host: 127.0.0.1 + ####端口号 + port: 5672 + ####账号 + username: YunZeIotRabbitMq + ####密码 + password: 20220107@yzIot + ## 心跳 请求的心跳超时,以秒为单位; 零表示没有 + requested-heartbeat: 40 + ### 地址 + virtual-host: /VirtualHosts + listener: + simple: + retry: + ####开启消费者(程序出现异常的情况下会)进行重试 + enabled: true + ####最大重试次数 + max-attempts: 1 + ####重试间隔时间 + initial-interval: 3000 + #### 手动应答 manual 自动应答 auto + acknowledge-mode: auto + + application: + name: cAdmin + datasource: + driverClassName: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true + username: iotdb + password: www.5iot.cn + + # redis 配置 + redis: + # 地址 + host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: Rdis20220107 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +# MyBatis配置 +mybatis: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + + + +server: + port: 8076 + diff --git a/yunze-consumption-admin/src/main/resources/logback.xml b/yunze-consumption-admin/src/main/resources/logback.xml new file mode 100644 index 0000000..1ecdf6f --- /dev/null +++ b/yunze-consumption-admin/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + DEBUG + + + ${LOG_PATTERN_CONSOLE} + + + + + + DEBUG + + + ${LOG_PATTERN_FILE} + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}.log + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}-%d{yyyy-MM-dd}.log + + 30 + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-admin/src/main/resources/mybatis/mybatis-config.xml b/yunze-consumption-admin/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e8b52be --- /dev/null +++ b/yunze-consumption-admin/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/yunze-consumption-car-activatedate/cardActivateDate.iml b/yunze-consumption-car-activatedate/cardActivateDate.iml new file mode 100644 index 0000000..f22522b --- /dev/null +++ b/yunze-consumption-car-activatedate/cardActivateDate.iml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-activatedate/pom.xml b/yunze-consumption-car-activatedate/pom.xml new file mode 100644 index 0000000..936b228 --- /dev/null +++ b/yunze-consumption-car-activatedate/pom.xml @@ -0,0 +1,108 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + cardActivateDate + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.apache.commons + commons-lang3 + + + + com.alibaba + fastjson + 1.2.49 + + + + org.projectlombok + lombok + + + com.yunze + yunze-common + + + com.alibaba + druid + 1.2.6 + compile + + + + + mysql + mysql-connector-java + + + + + + + + + + cardActivateDate + + + src/main/resources + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + src/main/java + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-activatedate/src/main/java/com/yunze/CardActivateDateApplication.java b/yunze-consumption-car-activatedate/src/main/java/com/yunze/CardActivateDateApplication.java new file mode 100644 index 0000000..11a8c96 --- /dev/null +++ b/yunze-consumption-car-activatedate/src/main/java/com/yunze/CardActivateDateApplication.java @@ -0,0 +1,15 @@ +package com.yunze; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +@SpringBootApplication +@MapperScan("com.yunze.common.mapper") +@MapperScan("com.yunze.apiCommon.mapper") +public class CardActivateDateApplication { + public static void main(String[] args) { + SpringApplication.run(CardActivateDateApplication.class); + } +} diff --git a/yunze-consumption-car-activatedate/src/main/java/com/yunze/config/DisposableBean.java b/yunze-consumption-car-activatedate/src/main/java/com/yunze/config/DisposableBean.java new file mode 100644 index 0000000..3d500ee --- /dev/null +++ b/yunze-consumption-car-activatedate/src/main/java/com/yunze/config/DisposableBean.java @@ -0,0 +1,47 @@ +package com.yunze.config; + +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @Auther: zhang feng + * @Date: 2021/07/10/14:24 + * @Description: + */ +@Component +public class DisposableBean { + + + @Autowired + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RedisCache redisCache; + + + + @PreDestroy + public void exit(){ + //防止程序意外终止后 redis 还有记录正在监听 记录 下次程序启动不在创建 消费者 + System.out.println("cardActivteDate 程序结束 执行删除redis Listener 记录key "); + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + List IDArr = yzCardRouteMapper.findIDArr(); + if(IDArr!=null && IDArr.size()>0) { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < IDArr.size(); i++) { + String cd_id = IDArr.get(i); + redisCache.redisTemplate.delete("polling-Listener-ActivateDate-"+cd_id); + redisCache.redisTemplate.delete("polling-Listener-dlxActivateDate-"+cd_id); + + + } + } + + } +} diff --git a/yunze-consumption-car-activatedate/src/main/java/com/yunze/polling/CardPollingConsumer.java b/yunze-consumption-car-activatedate/src/main/java/com/yunze/polling/CardPollingConsumer.java new file mode 100644 index 0000000..a9e27a5 --- /dev/null +++ b/yunze-consumption-car-activatedate/src/main/java/com/yunze/polling/CardPollingConsumer.java @@ -0,0 +1,70 @@ +package com.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.polling.card.ActivateDate; +import com.yunze.polling.card.dlx.DlxActivateDate; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.Map; + +/** + * 激活时间轮序消费者 + */ +@Component +@Slf4j +public class CardPollingConsumer { + + + @Autowired + private ActivateDate activateDate; + + @Autowired + private DlxActivateDate dlxActivateDate; + + /** + * 监听队列回调的方法 + * + * @param msg + */ + public void orderConsumer(String msg) { + log.info(">>正常订单消费者消息 1111 MSG:{}<<", msg); + } + + + + + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param message + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_activatedate") + public void pollingStart(String msg, Message message, Channel channel) throws IOException { + + Map map = JSON.parseObject(msg); + String type = map.get("type").toString(); + //激活时间轮序 + if(type.equals("ActivateDate")){ + activateDate.createListener(); + dlxActivateDate.createListener(); + }/*else if(type.equals("CardStatus")){ + cardStatus.createListener(1); + dlxCardStatus.createListener(1); + }else if(type.equals("CardFlow")){ + cardFlow.createListener(2); + dlxCardFlow.createListener(2); + }*/ + } + +} \ No newline at end of file diff --git a/yunze-consumption-car-activatedate/src/main/java/com/yunze/polling/card/ActivateDate.java b/yunze-consumption-car-activatedate/src/main/java/com/yunze/polling/card/ActivateDate.java new file mode 100644 index 0000000..94f1d36 --- /dev/null +++ b/yunze-consumption-car-activatedate/src/main/java/com/yunze/polling/card/ActivateDate.java @@ -0,0 +1,299 @@ +package com.yunze.polling.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.apiCommon.utils.VeDate; +import com.yunze.common.utils.yunze.YzPollingUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * @Auther: zhang feng + * @Date: 2021/07/09/12:43 + * @Description: + */ +@Slf4j +@Component +public class ActivateDate { + + + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + @Resource + private YzPollingUtil yzPollingUtil; + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param channel_1 + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_activateDate_one") + public void pollingStart(String msg, Channel channel_1) throws IOException { + Map map = JSON.parseObject(msg); + String FindCd_id = map.get("FindCd_id").toString(); + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", FindCd_id); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + RunEx(null,ChannelArr,false);//执行 公共部分 + } + + + + /** + * 创建 消费者进行消费 + */ + public void createListener() { + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + List Ex_ChannelArr = yzCardRouteMapper.findCardChannelID();//查询 卡表里已经划分 的 通道信息 + + RunEx(Ex_ChannelArr,ChannelArr,true);//执行 公共部分 + + } + + /** + * 执行 公共部分 + * @param Ex_ChannelArr + * @param ChannelArr + * @param bool 是否过滤 不需要监听的 + */ + public void RunEx(List Ex_ChannelArr,List> ChannelArr,boolean bool){ + + if(ChannelArr!=null && ChannelArr.size()>0){ + ChannelArr = yzPollingUtil.filterNoPollin(Ex_ChannelArr,ChannelArr,bool);//过滤不需要轮询的 通道id + Connection connection = rabbitMQConfig.getConnection(); + Channel channel = null; + try { + channel = connection.createChannel(false); + }catch (Exception e){ + log.error("createListener connection.createChannel() Exception {} "+e.getMessage()); + try { + log.info("再次创建连接====="); + rabbitMQConfig.connection = null; + connection = rabbitMQConfig.getConnection(); + channel = connection.createChannel(false); + }catch (Exception e1){ + log.error("再次创建连接 异常…… Exception {} "+e1.getMessage()); + } + } + + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < ChannelArr.size(); i++) { + Map ChannelObj = ChannelArr.get(i); + String cd_id = ChannelObj.get("cd_id").toString(); + Object cd_concurrency = ChannelObj.get("cd_concurrency");//创建消费者数量 + cd_concurrency = cd_concurrency!=null&&cd_concurrency.toString().trim().length()>0?cd_concurrency:"1"; + int Threads = Integer.parseInt(cd_concurrency.toString()); + + Object isExecute = redisCache.getCacheObject("polling-Listener-ActivateDate-"+cd_id ); + if(isExecute==null || bool==false){ + //redis 存储 + ChannelObj.put("pollingtime", VeDate.getStringDateShort()); + redisCache.setCacheObject("polling-Listener-ActivateDate-"+cd_id, ChannelObj);// 缓存 避免 重复创建 消费 监听 + try { + List(Threads,cd_id,ChannelObj,channel); + }catch (Exception e){ + log.error(">> ActivateDate createListener 失败:{} | {} | {}<<",e.getMessage(),cd_id,ChannelObj.toString()); + } + } + } + } + + } + + + + + public void List(int threadCount,String cd_id, Map ChannelObj, Channel channel){ + ThreadPoolExecutor executor=null; + try { + //创建和线程同等数量的线程池 + executor= (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount); + //阻塞,同步线程 + CountDownLatch countDownLatch=new CountDownLatch(threadCount); + for(int i=0;i ChannelObj; + private Channel channel; + + + public SynTask(String Pcd_id, Map PChannelObj,Channel Pchannel) { + this.cd_id = Pcd_id ; + this.ChannelObj = PChannelObj; + this.channel = Pchannel; + } + + /** + * 消费者 激活时间 消费者 + * @param cd_id + */ + public void activateConsumer(String cd_id,Map ChannelObj,Channel channel){ + try { + String QUEUE_NAME = null,EXCHANGE_NAME = null,ROUTINGKEY = null; + + EXCHANGE_NAME = "polling_cardActivateDate_exchange"; + QUEUE_NAME = "polling_cardActivateDate_queue_"+cd_id; + ROUTINGKEY = "polling.cardActivateDate.routingKey."+cd_id; + + // 关联队列消费者关联队列 + channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, ROUTINGKEY); + DefaultConsumer defaultConsumer = new DefaultConsumer(channel) { + @Override + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { + String msg = new String(body, "UTF-8"); + //System.out.println("polling_cardActivateDate_queue_"+cd_id+" 消费者获取消息:" + msg); + synActivateDate(msg,channel);//同步激活时间 + } + }; + // 开始监听消息 自动签收 + channel.basicConsume(QUEUE_NAME, true, defaultConsumer); + }catch (Exception e){ + log.error(">>DB - 激活时间 创建 轮序消费者 同步激活时间失败:{} | {}<<",e.getMessage().toString(),ChannelObj.toString()); + try { + redisCache.redisTemplate.delete("polling-Listener-ActivateDate-"+cd_id); + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-Listener-ActivateDate-{} | {}<<", cd_id); + }catch (Exception e1){ + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-Listener-ActivateDate-{} 失败 | {}<<", cd_id, e1.getMessage()); + } + } + } + + + + + + + + public void synActivateDate(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + + Map map = JSON.parseObject(msg); + String iccid = map.get("iccid").toString(); + String polling_id = map.get("polling_id").toString();//轮询任务编号 + String prefix = "polling_cardActivateDate_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ iccid); + if(isExecute==null){ + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix+":"+ iccid, msg, 3, TimeUnit.MINUTES);//3 分钟缓存 避免 重复消费 + redisCache.setCacheObject(polling_id+":"+ iccid, msg, 4, TimeUnit.HOURS);//4 小时缓存 用来统计轮序进度 + + + Map Parammap=new HashMap<>(); + Parammap.put("iccid",iccid); + Map Rmap = internalApiRequest.queryCardActiveTime(Parammap,map); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + if(code.equals("200")){ + //获取 激活日期 开卡日期 更新 card info + if(Rmap.get("activateDate")!=null && Rmap.get("activateDate")!="" && Rmap.get("activateDate").toString().trim().length()>0){ + String activateDate = Rmap.get("activateDate").toString().trim(); + Object openDate = Rmap.get("openDate")!=null && Rmap.get("openDate")!="" && Rmap.get("openDate").toString().trim().length()>0? + Rmap.get("openDate").toString().trim():null; + Map Upd_Map = new HashMap<>(); + Upd_Map.put("activate_date",activateDate); + if(openDate!=null){ + Upd_Map.put("open_date",openDate); + } + Upd_Map.put("iccid",iccid); + //1.创建路由 绑定 生产队列 发送消息 + String card_exchangeName = "admin_card_exchange", card_queueName = "admin_CardUpd_queue", card_routingKey = "admin.CardUpd.queue", + card_del_exchangeName = "dlx_"+card_exchangeName,card_del_queueName = "dlx_"+card_queueName, card_del_routingKey = "dlx_"+card_routingKey; + try { + //rabbitMQConfig.creatExchangeQueue(card_exchangeName, card_queueName, card_routingKey, card_del_exchangeName, card_del_queueName, card_del_routingKey,null); + /*Upd_Map.put("queueTypeName","admin_CardUpdActivate_queue"); + rabbitTemplate.convertAndSend(card_exchangeName, card_routingKey, JSON.toJSONString(Upd_Map), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + });*/ + int upd = yzCardMapper.updActivate(Upd_Map); + log.info(">>发送 变更激活时间 指令成功 ! iccid:{} | upd:{} | Upd_Map {}<<", iccid,upd, Upd_Map); + } catch (Exception e) { + System.out.println("变更激活时间 队列 创建 失败 " + e.getMessage().toString()); + } + } + }else{ + log.info(">>API - 激活时间轮序消费者 未获取到激活日期:{} | {} | Parammap {} | map {}<<",iccid,Rmap,Parammap,map); + // System.out.println(map.get("iccid")+" 未获取到激活日期 !"); + } + } + } catch (Exception e) { +// // 记录该消息日志形式 存放数据库db中、后期通过定时任务实现消息补偿、人工实现补偿 + log.error(">>错误 - 激活时间轮序消费者:{}<<", e.getMessage().toString()); +// //将该消息存放到死信队列中,单独写一个死信消费者实现消费。 + } + } + + @Override + public void run() { + activateConsumer(cd_id,ChannelObj,channel); + } + + + + + + } + +} diff --git a/yunze-consumption-car-activatedate/src/main/java/com/yunze/polling/card/dlx/DlxActivateDate.java b/yunze-consumption-car-activatedate/src/main/java/com/yunze/polling/card/dlx/DlxActivateDate.java new file mode 100644 index 0000000..bcc69e8 --- /dev/null +++ b/yunze-consumption-car-activatedate/src/main/java/com/yunze/polling/card/dlx/DlxActivateDate.java @@ -0,0 +1,289 @@ +package com.yunze.polling.card.dlx; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; + +import com.yunze.apiCommon.utils.VeDate; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.utils.yunze.YzPollingUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * @Auther: zhang feng + * @Date: 2021/07/09/12:43 + * @Description: + */ +@Slf4j +@Component +public class DlxActivateDate { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private RedisCache redisCache; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + @Resource + private YzPollingUtil yzPollingUtil; + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param channel_1 + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_activateDate_tow") + public void pollingStart(String msg, Channel channel_1) throws IOException { + Map map = JSON.parseObject(msg); + String FindCd_id = map.get("FindCd_id").toString(); + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", FindCd_id); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + RunEx(null,ChannelArr,false);//执行 公共部分 + } + + + + /** + * 创建 消费者进行消费 + */ + public void createListener() { + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + List Ex_ChannelArr = yzCardRouteMapper.findCardChannelID();//查询 卡表里已经划分 的 通道信息 + RunEx(Ex_ChannelArr,ChannelArr,true);//执行 公共部分 + } + + + /** + * 执行 公共部分 + * @param Ex_ChannelArr + * @param ChannelArr + * @param bool 是否过滤 不需要监听的 + */ + public void RunEx(List Ex_ChannelArr,List> ChannelArr,boolean bool){ + if(ChannelArr!=null && ChannelArr.size()>0){ + ChannelArr = yzPollingUtil.filterNoPollin(Ex_ChannelArr,ChannelArr,bool);//过滤不需要轮询的 通道id + Connection connection = rabbitMQConfig.getConnection(); + Channel channel = null; + try { + channel = connection.createChannel(false); + }catch (Exception e){ + log.error("createListener connection.createChannel() Exception {} "+e.getMessage()); + try { + log.info("再次创建连接====="); + rabbitMQConfig.connection = null; + connection = rabbitMQConfig.getConnection(); + channel = connection.createChannel(false); + }catch (Exception e1){ + log.error("再次创建连接 异常…… Exception {} "+e1.getMessage()); + } + } + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < ChannelArr.size(); i++) { + Map ChannelObj = ChannelArr.get(i); + String cd_id = ChannelObj.get("cd_id").toString(); + Object cd_concurrency = ChannelObj.get("cd_concurrency");//创建消费者数量 + cd_concurrency = cd_concurrency!=null&&cd_concurrency.toString().trim().length()>0?cd_concurrency:"1"; + int Threads = Integer.parseInt(cd_concurrency.toString()); + Object isExecute = redisCache.getCacheObject("polling-Listener-dlxActivateDate-"+cd_id ); + if(isExecute==null || bool==false){ + //redis 存储 + ChannelObj.put("pollingtime", VeDate.getStringDateShort()); + redisCache.setCacheObject("polling-Listener-dlxActivateDate-"+cd_id, ChannelObj);// 缓存 避免 重复创建 消费 监听 + try { + List(Threads,cd_id,ChannelObj,channel); + }catch (Exception e){ + log.error(">> ActivateDate createListener 失败:{} | {} | {}<<",e.getMessage(),cd_id,ChannelObj.toString()); + } + } + } + } + } + + + public void List(int threadCount,String cd_id, Map ChannelObj, Channel channel){ + ThreadPoolExecutor executor=null; + try { + //创建和线程同等数量的线程池 + executor= (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount); + //阻塞,同步线程 + CountDownLatch countDownLatch=new CountDownLatch(threadCount); + for(int i=0;i ChannelObj; + private Channel channel; + + + public SynTask(String Pcd_id, Map PChannelObj,Channel Pchannel) { + this.cd_id = Pcd_id ; + this.ChannelObj = PChannelObj; + this.channel = Pchannel; + } + + /** + * 消费者 激活时间 消费者 + * @param cd_id + */ + public void activateConsumer(String cd_id,Map ChannelObj,Channel channel){ + try { + String QUEUE_NAME = null,EXCHANGE_NAME = null,ROUTINGKEY = null; + + EXCHANGE_NAME = "polling_dlxcardActivateDate_exchange"; + QUEUE_NAME = "polling_dlxcardActivateDate_queue_"+cd_id; + ROUTINGKEY = "polling.dlxcardActivateDate.routingKey."+cd_id; + + // 关联队列消费者关联队列 + channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, ROUTINGKEY); + DefaultConsumer defaultConsumer = new DefaultConsumer(channel) { + @Override + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { + String msg = new String(body, "UTF-8"); + //System.out.println("polling_dlxcardActivateDate_queue_"+cd_id+" 消费者获取消息:" + msg); + synActivateDate(msg,channel);//同步激活时间 + } + }; + // 开始监听消息 自动签收 + channel.basicConsume(QUEUE_NAME, true, defaultConsumer); + }catch (Exception e){ + log.error(">>DB - 激活时间 创建 轮序消费者 同步激活时间失败:{} | {}<<",e.getMessage().toString(),ChannelObj.toString()); + try { + redisCache.redisTemplate.delete("polling-Listener-dlxActivateDate-"+cd_id); + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-Listener-dlxActivateDate-{} | {}<<", cd_id); + }catch (Exception e1){ + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-Listener-dlxActivateDate-{} 失败 | {}<<", cd_id, e1.getMessage()); + } + } + } + + + + + + + + public void synActivateDate(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + + Map map = JSON.parseObject(msg); + String iccid = map.get("iccid").toString(); + String polling_id = map.get("polling_id").toString();//轮询任务编号 + String prefix = "polling_cardActivateDate_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ iccid); + if(isExecute==null){ + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix+":"+ iccid, msg, 3, TimeUnit.MINUTES);//3 分钟缓存 避免 重复消费 + redisCache.setCacheObject(polling_id+":"+ iccid, msg, 4, TimeUnit.HOURS);//4 小时缓存 用来统计轮序进度 + + + Map Parammap=new HashMap<>(); + Parammap.put("iccid",iccid); + Map Rmap = internalApiRequest.queryCardActiveTime(Parammap,map); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + if(code.equals("200")){ + //获取 激活日期 开卡日期 更新 card info + if(Rmap.get("activateDate")!=null && Rmap.get("activateDate")!="" && Rmap.get("activateDate").toString().trim().length()>0){ + String activateDate = Rmap.get("activateDate").toString().trim(); + Object openDate = Rmap.get("openDate")!=null && Rmap.get("openDate")!="" && Rmap.get("openDate").toString().trim().length()>0? + Rmap.get("openDate").toString().trim():null; + Map Upd_Map = new HashMap<>(); + Upd_Map.put("activate_date",activateDate); + if(openDate!=null){ + Upd_Map.put("open_date",openDate); + } + Upd_Map.put("iccid",iccid); + //1.创建路由 绑定 生产队列 发送消息 + String card_exchangeName = "admin_card_exchange", card_queueName = "admin_CardUpd_queue", card_routingKey = "admin.CardUpd.queue", + card_del_exchangeName = "dlx_"+card_exchangeName,card_del_queueName = "dlx_"+card_queueName, card_del_routingKey = "dlx_"+card_routingKey; + try { + //rabbitMQConfig.creatExchangeQueue(card_exchangeName, card_queueName, card_routingKey, card_del_exchangeName, card_del_queueName, card_del_routingKey,null); + /*Upd_Map.put("queueTypeName","admin_CardUpdActivate_queue"); + rabbitTemplate.convertAndSend(card_exchangeName, card_routingKey, JSON.toJSONString(Upd_Map), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + });*/ + int upd = yzCardMapper.updActivate(Upd_Map); + log.info(">>发送 dlx变更激活时间 指令成功 ! iccid:{} | upd:{} | Upd_Map {}<<", iccid,upd, Upd_Map); + } catch (Exception e) { + System.out.println("变更激活时间 队列 创建 失败 " + e.getMessage().toString()); + } + } + }else{ + log.info(">>API - 激活时间轮序消费者 未获取到激活日期:{} | {} | Parammap {} | map {}<<",iccid,Rmap,Parammap,map); + // System.out.println(map.get("iccid")+" 未获取到激活日期 !"); + } + } + } catch (Exception e) { +// // 记录该消息日志形式 存放数据库db中、后期通过定时任务实现消息补偿、人工实现补偿 + log.error(">>错误 - 激活时间轮序消费者:{}<<", e.getMessage().toString()); +// //将该消息存放到死信队列中,单独写一个死信消费者实现消费。 + } + } + @Override + public void run() { + activateConsumer(cd_id,ChannelObj,channel); + } + } + + +} diff --git a/yunze-consumption-car-activatedate/src/main/resources/application.yml b/yunze-consumption-car-activatedate/src/main/resources/application.yml new file mode 100644 index 0000000..be8d277 --- /dev/null +++ b/yunze-consumption-car-activatedate/src/main/resources/application.yml @@ -0,0 +1,73 @@ +spring: + rabbitmq: + ####连接地址 + host: 127.0.0.1 + ####端口号 + port: 5672 + ####账号 + username: YunZeIotRabbitMq + ####密码 + password: 20220107@yzIot + ## 心跳 请求的心跳超时,以秒为单位; 零表示没有 + requested-heartbeat: 40 + ### 地址 + virtual-host: /VirtualHosts + listener: + simple: + retry: + ####开启消费者(程序出现异常的情况下会)进行重试 + enabled: true + ####最大重试次数 + max-attempts: 1 + ####重试间隔时间 + initial-interval: 3000 + #### 手动应答 manual 自动应答 auto + acknowledge-mode: auto + + application: + name: cardActivateDate + datasource: + url: jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: iotdb + password: www.5iot.cn + # redis 配置 + redis: + # 地址 + host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: Rdis20220107 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +# MyBatis配置 +mybatis: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + +logging: + level: + com: + iot: + business: + dao: trace + root: info + pattern: + console: "'%p%m%n'" + +server: + port: 8072 + diff --git a/yunze-consumption-car-activatedate/src/main/resources/logback.xml b/yunze-consumption-car-activatedate/src/main/resources/logback.xml new file mode 100644 index 0000000..50b5cbd --- /dev/null +++ b/yunze-consumption-car-activatedate/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + DEBUG + + + ${LOG_PATTERN_CONSOLE} + + + + + + DEBUG + + + ${LOG_PATTERN_FILE} + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}.log + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}-%d{yyyy-MM-dd}.log + + 30 + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-activatedate/src/main/resources/mybatis/mybatis-config.xml b/yunze-consumption-car-activatedate/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e8b52be --- /dev/null +++ b/yunze-consumption-car-activatedate/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/yunze-consumption-car-disconnected/cardDisconnected.iml b/yunze-consumption-car-disconnected/cardDisconnected.iml new file mode 100644 index 0000000..f22522b --- /dev/null +++ b/yunze-consumption-car-disconnected/cardDisconnected.iml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-disconnected/pom.xml b/yunze-consumption-car-disconnected/pom.xml new file mode 100644 index 0000000..057d567 --- /dev/null +++ b/yunze-consumption-car-disconnected/pom.xml @@ -0,0 +1,108 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + cardDisconnected + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.apache.commons + commons-lang3 + + + + com.alibaba + fastjson + 1.2.49 + + + + org.projectlombok + lombok + + + com.yunze + yunze-common + + + com.alibaba + druid + 1.2.6 + compile + + + + + mysql + mysql-connector-java + + + + + + + + + + cardDisconnected + + + src/main/resources + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + src/main/java + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-disconnected/src/main/java/com/yunze/CardDisconnectedApplication.java b/yunze-consumption-car-disconnected/src/main/java/com/yunze/CardDisconnectedApplication.java new file mode 100644 index 0000000..a485c4f --- /dev/null +++ b/yunze-consumption-car-disconnected/src/main/java/com/yunze/CardDisconnectedApplication.java @@ -0,0 +1,15 @@ +package com.yunze; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +@SpringBootApplication +@MapperScan("com.yunze.common.mapper") +@MapperScan("com.yunze.apiCommon.mapper") +class CardDisconnectedApplication { + public static void main(String[] args) { + SpringApplication.run(CardDisconnectedApplication.class); + } +} diff --git a/yunze-consumption-car-disconnected/src/main/java/com/yunze/config/DisposableBean.java b/yunze-consumption-car-disconnected/src/main/java/com/yunze/config/DisposableBean.java new file mode 100644 index 0000000..8540e4d --- /dev/null +++ b/yunze-consumption-car-disconnected/src/main/java/com/yunze/config/DisposableBean.java @@ -0,0 +1,44 @@ +package com.yunze.config; + +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @Auther: zhang feng + * @Date: 2021/07/10/14:24 + * @Description: + */ +@Component +public class DisposableBean { + + + @Autowired + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RedisCache redisCache; + + + + @PreDestroy + public void exit(){ + //防止程序意外终止后 redis 还有记录正在监听 记录 下次程序启动不在创建 消费者 + System.out.println("cardDisconnected 程序结束 执行删除redis Listener 记录key "); + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + List IDArr = yzCardRouteMapper.findIDArr(); + if(IDArr!=null && IDArr.size()>0) { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < IDArr.size(); i++) { + String cd_id = IDArr.get(i); + redisCache.redisTemplate.delete("polling_cardCardDisconnected_queue_"+cd_id); + } + } + + } +} diff --git a/yunze-consumption-car-disconnected/src/main/java/com/yunze/polling/CardPollingConsumer.java b/yunze-consumption-car-disconnected/src/main/java/com/yunze/polling/CardPollingConsumer.java new file mode 100644 index 0000000..587bed7 --- /dev/null +++ b/yunze-consumption-car-disconnected/src/main/java/com/yunze/polling/CardPollingConsumer.java @@ -0,0 +1,60 @@ +package com.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.polling.card.CardDisconnected; +import com.yunze.polling.card.dlx.DlxCardDisconnected; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Map; + +/** + * 激活时间轮序消费者 + */ +@Component +@Slf4j +public class CardPollingConsumer { + + + @Resource + private CardDisconnected cardDisconnected; + + @Resource + private DlxCardDisconnected dlxCardDisconnected; + + + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param message + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_disconnected") + public void pollingStart(String msg, Message message, Channel channel) throws IOException { + + Map map = JSON.parseObject(msg); + String type = map.get("type").toString(); + //激活时间轮序 + if(type.equals("CardDisconnected")){ + String Listener = map.get("Listener").toString(); + if(Listener.indexOf("polling_cardCardDisconnected_queue_")!=-1){ + cardDisconnected.createListener(5,map); + }else if(Listener.indexOf("polling_dlxcardCardDisconnected_queue_")!=-1){ + dlxCardDisconnected.createListener(5,map); + }else{ + System.out.println("=================【未找到队列!"+Listener+"】================="); + } + } + } + + +} \ No newline at end of file diff --git a/yunze-consumption-car-disconnected/src/main/java/com/yunze/polling/card/CardDisconnected.java b/yunze-consumption-car-disconnected/src/main/java/com/yunze/polling/card/CardDisconnected.java new file mode 100644 index 0000000..c8df293 --- /dev/null +++ b/yunze-consumption-car-disconnected/src/main/java/com/yunze/polling/card/CardDisconnected.java @@ -0,0 +1,315 @@ +package com.yunze.polling.card; + +import com.alibaba.fastjson.JSON; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.MyDictionary; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.card.CardChange; +import com.yunze.common.core.redis.RedisCache; + +import com.yunze.common.utils.yunze.CardFlowSyn; +import com.yunze.apiCommon.utils.VeDate; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; +import javax.annotation.Resource; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 未订购资费停机轮询 轮序消费 者 + */ +@Slf4j +@Component +public class CardDisconnected { + + + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private RedisCache redisCache; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private CardFlowSyn cardFlowSyn; + @Resource + private MyDictionary myDictionary; + @Resource + private CardChange cardChange; + + + + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param channel_1 + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_Disconnected_one") + public void pollingStart(String msg, Channel channel_1) throws IOException { + Map map = JSON.parseObject(msg); + String Listener = map.get("Listener").toString(); + String cd_id = map.get("cd_id").toString(); + RunEx(Listener,1,cd_id,false);//执行 公共部分 + } + + + /** + * 创建 监听 + * @param Threads 消费者创建 数量 + */ + public void createListener(int Threads,Map Pmap) { + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + try { + //获取 key 值对应的 监听 生产 队列 + String Listener = Pmap.get("Listener").toString(); + String cd_id = Pmap.get("cd_id").toString(); + RunEx(Listener,Threads,cd_id,true); + }catch (Exception e){ + log.error(">>createListener - 未订购资费停机轮询 创建 失败:{} | {}<<",e.getMessage()); + } + } + + + /** + * 执行 公共部分 + * @param Listener + * @param Threads + * @param cd_id + * @param bool 是否过滤 不需要监听的 + */ + public void RunEx(String Listener,int Threads,String cd_id, boolean bool){ + + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + try { + //获取 key 值对应的 监听 生产 队列 + Object isExecute = redisCache.getCacheObject(Listener); + if(isExecute==null || bool==false){ + Connection connection = rabbitMQConfig.getConnection(); + Channel channel = null; + try { + channel = connection.createChannel(false); + }catch (Exception e){ + log.error("createListener connection.createChannel() Exception {} "+e.getMessage()); + try { + log.info("再次创建连接====="); + rabbitMQConfig.connection = null; + connection = rabbitMQConfig.getConnection(); + channel = connection.createChannel(false); + }catch (Exception e1){ + log.error("再次创建连接 异常…… Exception {} "+e1.getMessage()); + } + } + //redis 存储 + Map oMap = new HashMap<>(); + oMap.put("pollingtime", VeDate.getStringDateShort()); + redisCache.setCacheObject(Listener, oMap);// 缓存 避免 重复创建 消费 监听 + List(Threads,cd_id,channel); + } + }catch (Exception e){ + log.error(">> {} - 未订购资费停机轮询 创建 失败:cd_id {} | {}<<",Listener,cd_id,e.getMessage()); + } + } + + + + + + public void List(int threadCount,String cd_id,Channel channel){ + ThreadPoolExecutor executor=null; + try { + //创建和线程同等数量的线程池 + executor= (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount); + //阻塞,同步线程 + CountDownLatch countDownLatch=new CountDownLatch(threadCount); + for(int i=0;i>DB - 未订购资费停机轮询 创建 轮序消费者 同步未订购资费停机轮询失败:{} | {}<<",e.getMessage().toString()); + } + } + + + /** + * 同步未订购资费停机轮询 + * @param msg + * @param channel + * @throws IOException + */ + public void synCardDisconnected(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + + Map map = JSON.parseObject(msg); + String iccid = map.get("iccid").toString(); + + + + String polling_id = map.get("polling_id").toString();//轮询任务编号 + String prefix = "polling_cardCardDisconnected_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ iccid); + if(isExecute==null){ + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix+":"+ iccid, msg, 3, TimeUnit.MINUTES);//3 分钟缓存 避免 重复消费 + redisCache.setCacheObject(polling_id+":"+ iccid, msg, 4, TimeUnit.HOURS);//4 小时缓存 用来统计轮序进度 + + Map Parammap=new HashMap<>(); + Parammap.put("iccid",iccid); + Parammap.put("Is_Stop","off"); + Map Rmap = internalApiRequest.queryFlow(Parammap,map); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + if(code.equals("200")){ + //获取 卡用量 开卡日期 更新 card info + if(Rmap.get("Use")!=null && Rmap.get("Use")!="" && Rmap.get("Use").toString().trim().length()>0){ + Double Use = Double.parseDouble(Rmap.get("Use").toString()); + if(Use>=0){ + try { + Map cardFlowSynRMap = cardFlowSyn.CalculationFlow(iccid,Use); + log.info(">>cardFlowSyn - 未订购资费停机轮询-卡用量轮序消费者 同步卡用量返回:{} | {}<<",iccid,JSON.toJSON(cardFlowSynRMap)); + Double remaining = Double.parseDouble(cardFlowSynRMap.get("remaining").toString()); + if(remaining<=0 && remaining!=-1){ + String status_id = map.get("status_id")!=null && map.get("status_id")!="" && map.get("status_id").toString().length()>0?map.get("status_id").toString():"未知"; + log.info(">>Disconnected iccid:{} | cardFlowSynRMap {} | Parammap {} | map {} | status_id {}<<",iccid,JSON.toJSON(cardFlowSynRMap),Parammap,map,status_id); + Disconnected(iccid,Parammap,map,status_id); + } + }catch (Exception e){ + log.error(">>cardFlowSyn - 未订购资费停机轮询-卡用量轮序消费者 同步卡用量失败:{} | {}<<",iccid,e.getMessage()); + } + }else{ + log.info(">>API - 未获取到卡用量 Use>=0 esle :{} | {}<<",iccid,Rmap); + } + } + }else{ + log.info(">>API - 未订购资费停机轮询-卡用量轮序消费者 未获取到卡用量:{} | {}<<",iccid,Rmap); + } + } + } catch (Exception e) { + log.error(">>错误 - 未订购资费停机轮询轮序消费者:{}<<", e.getMessage().toString()); + } + } + + + /** + * 停机 + * @param iccid + * @param Parammap + * @param map + */ + public void Disconnected (String iccid,Map Parammap,Map map,String status_id){ + String cbefore = ""; + if(!status_id.equals("未知")){ + cbefore = myDictionary.getdictLabel("yunze_card_status_ShowId",status_id); + }else{ + cbefore = status_id; + } + cbefore = cbefore !=null && cbefore != "" && cbefore.length()>0?cbefore:"未知"; + Map Add_Map = new HashMap<>(); + Add_Map.put("iccid",iccid); + Add_Map.put("ctype","2");//生命周期 + Add_Map.put("cbefore",cbefore); + Add_Map.put("cafterward","停机"); + Add_Map.put("source_type","2");// 来源 类型 :2 未订购轮询停机 + + Map Upd_Map = new HashMap<>(); + Upd_Map.put("status_id","2"); + Upd_Map.put("iccid",iccid); + cardChange.OnOff(Parammap,map,Add_Map,Upd_Map); + } + + + @Override + public void run() { + activateConsumer(cd_id,channel); + } + + + + } + + + + + +} diff --git a/yunze-consumption-car-disconnected/src/main/java/com/yunze/polling/card/dlx/DlxCardDisconnected.java b/yunze-consumption-car-disconnected/src/main/java/com/yunze/polling/card/dlx/DlxCardDisconnected.java new file mode 100644 index 0000000..2101bed --- /dev/null +++ b/yunze-consumption-car-disconnected/src/main/java/com/yunze/polling/card/dlx/DlxCardDisconnected.java @@ -0,0 +1,314 @@ +package com.yunze.polling.card.dlx; + +import com.alibaba.fastjson.JSON; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.MyDictionary; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardInfoChangeMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; + +import com.yunze.common.utils.yunze.CardFlowSyn; +import com.yunze.apiCommon.utils.VeDate; +import com.yunze.common.utils.yunze.GetShowStatIdArr; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; +import javax.annotation.Resource; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 未订购资费停机轮询 轮序消费 者 + */ +@Slf4j +@Component +public class DlxCardDisconnected { + + + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private CardFlowSyn cardFlowSyn; + @Resource + private YzCardInfoChangeMapper yzCardInfoChangeMapper; + @Resource + private MyDictionary myDictionary; + @Resource + private GetShowStatIdArr getShowStatIdArr; + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param channel_1 + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_Disconnected_tow") + public void pollingStart(String msg, Channel channel_1) throws IOException { + Map map = JSON.parseObject(msg); + String Listener = map.get("Listener").toString(); + String cd_id = map.get("cd_id").toString(); + RunEx(Listener,1,cd_id,false);//执行 公共部分 + } + + + + /** + * 创建 监听 + * @param Threads 消费者创建 数量 + */ + public void createListener(int Threads,Map Pmap) { + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + try { + //获取 key 值对应的 监听 生产 队列 + String Listener = Pmap.get("Listener").toString(); + String cd_id = Pmap.get("cd_id").toString(); + RunEx(Listener,Threads,cd_id,true); + }catch (Exception e){ + log.error(">>createListener - 未订购资费停机轮询 创建 失败:{} | {}<<",e.getMessage()); + } + } + + + /** + * 执行 公共部分 + * @param Listener + * @param Threads + * @param cd_id + * @param bool 是否过滤 不需要监听的 + */ + public void RunEx(String Listener,int Threads,String cd_id, boolean bool){ + + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + try { + //获取 key 值对应的 监听 生产 队列 + Object isExecute = redisCache.getCacheObject(Listener); + if(isExecute==null || bool==false){ + Connection connection = rabbitMQConfig.getConnection(); + Channel channel = null; + try { + channel = connection.createChannel(false); + }catch (Exception e){ + log.error("createListener connection.createChannel() Exception {} "+e.getMessage()); + try { + log.info("再次创建连接====="); + rabbitMQConfig.connection = null; + connection = rabbitMQConfig.getConnection(); + channel = connection.createChannel(false); + }catch (Exception e1){ + log.error("再次创建连接 异常…… Exception {} "+e1.getMessage()); + } + } + //redis 存储 + Map oMap = new HashMap<>(); + oMap.put("pollingtime", VeDate.getStringDateShort()); + redisCache.setCacheObject(Listener, oMap);// 缓存 避免 重复创建 消费 监听 + List(Threads,cd_id,channel); + } + }catch (Exception e){ + log.error(">> {} - 未订购资费停机轮询 创建 失败:cd_id {} | {}<<",Listener,cd_id,e.getMessage()); + } + } + + public void List(int threadCount,String cd_id,Channel channel){ + ThreadPoolExecutor executor=null; + try { + //创建和线程同等数量的线程池 + executor= (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount); + //阻塞,同步线程 + CountDownLatch countDownLatch=new CountDownLatch(threadCount); + for(int i=0;i>DB - 未订购资费停机轮询 创建 轮序消费者 同步未订购资费停机轮询失败:{} | {}<<",e.getMessage().toString()); + } + } + + + /** + * 同步未订购资费停机轮询 + * @param msg + * @param channel + * @throws IOException + */ + public void synCardDisconnected(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + + Map map = JSON.parseObject(msg); + String iccid = map.get("iccid").toString(); + + + + String polling_id = map.get("polling_id").toString();//轮询任务编号 + String prefix = "polling_cardCardDisconnected_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ iccid); + if(isExecute==null){ + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix+":"+ iccid, msg, 3, TimeUnit.MINUTES);//3 分钟缓存 避免 重复消费 + redisCache.setCacheObject(polling_id+":"+ iccid, msg, 4, TimeUnit.HOURS);//4 小时缓存 用来统计轮序进度 + + Map Parammap=new HashMap<>(); + Parammap.put("iccid",iccid); + Parammap.put("Is_Stop","off"); + Map Rmap = internalApiRequest.queryFlow(Parammap,map); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + if(code.equals("200")){ + //获取 卡用量 开卡日期 更新 card info + if(Rmap.get("Use")!=null && Rmap.get("Use")!="" && Rmap.get("Use").toString().trim().length()>0){ + Double Use = Double.parseDouble(Rmap.get("Use").toString()); + if(Use>=0){ + try { + Map cardFlowSynRMap = cardFlowSyn.CalculationFlow(iccid,Use); + log.info("Dlx - "+">>cardFlowSyn - 未订购资费停机轮询-卡用量轮序消费者 同步卡用量返回:{} | {}<<",iccid,JSON.toJSON(cardFlowSynRMap)); + Double remaining = Double.parseDouble(cardFlowSynRMap.get("remaining").toString()); + if(remaining<=0 && remaining!=-1){ + String status_id = map.get("status_id")!=null && map.get("status_id")!="" && map.get("status_id").toString().length()>0?map.get("status_id").toString():"未知"; + Disconnected(iccid,Parammap,map,status_id); + }else{ + log.error("Dlx - >> 数据 同步卡用量失败:{} | {}<<",iccid,JSON.toJSON(cardFlowSynRMap)); + } + }catch (Exception e){ + log.error("Dlx - >>cardFlowSyn - 未订购资费停机轮询-卡用量轮序消费者 同步卡用量失败:{} | {}<<",iccid,e.getMessage().toString()); + } + }else{ + log.info("Dlx - "+">>API - 未订购资费停机轮询-卡用量轮序消费者 未获取到卡用量 statusCode = 0 :{} | {}<<",iccid,Rmap); + } + } + }else{ + log.info("Dlx - "+">>API - 未订购资费停机轮询-卡用量轮序消费者 未获取到卡用量:{} | {}<<",iccid,Rmap); + } + } + } catch (Exception e) { + log.error("Dlx - >>错误 - 未订购资费停机轮询轮序消费者:{}<<", e.getMessage().toString()); + } + } + + + /** + * 停机 + * @param iccid + * @param Parammap + * @param map + */ + public void Disconnected (String iccid,Map Parammap,Map map,String status_id){ + Map Rmap = internalApiRequest.changeCardStatus(Parammap,map); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + if(code.equals("200")){ + //获取 未订购资费停机轮询 开卡日期 更新 card info + Map Upd_Map = new HashMap<>(); + Upd_Map.put("status_id","2"); + Upd_Map.put("iccid",iccid); + String status_ShowId = getShowStatIdArr.GetShowStatId(status_id); + Upd_Map.put("status_ShowId",status_ShowId); + boolean bool = yzCardMapper.updStatusId(Upd_Map)>0;//变更未订购资费停机轮询 + if(bool){ + Map Add_Map = new HashMap<>(); + Add_Map.put("iccid",iccid); + Add_Map.put("ctype","1");//生命周期 + Add_Map.put("cbefore",myDictionary.getdictLabel("yunze_card_status_ShowId",status_id)); + Add_Map.put("cafterward","停机"); + Add_Map.put("remark",""); + Add_Map.put("source_type","2");// 来源 类型 :2 未订购轮询停机 + Add_Map.put("execution_status","1"); + boolean addBool = yzCardInfoChangeMapper.save(Add_Map)>0; + log.info("Dlx - "+map.get("iccid")+" 修改未订购资费停机轮询 bool : "+bool+" 新增卡信息变更记录 addBool :"+addBool); + }else{ + log.error("Dlx - >>DB - 未订购资费停机轮询轮序消费者 同步未订购资费停机轮询失败:{} | {}<<",iccid,Upd_Map); + } + }else{ + log.info("Dlx - "+">>API - 未订购资费停机轮询轮序消费者 未获取到未订购资费停机轮询:{} | {}<<",iccid,Rmap); + } + } + + @Override + public void run() { + activateConsumer(cd_id,channel); + } + + + + } + + + + + + + +} diff --git a/yunze-consumption-car-disconnected/src/main/resources/application.yml b/yunze-consumption-car-disconnected/src/main/resources/application.yml new file mode 100644 index 0000000..108df65 --- /dev/null +++ b/yunze-consumption-car-disconnected/src/main/resources/application.yml @@ -0,0 +1,73 @@ +spring: + rabbitmq: + ####连接地址 + host: 127.0.0.1 + ####端口号 + port: 5672 + ####账号 + username: YunZeIotRabbitMq + ####密码 + password: 20220107@yzIot + ## 心跳 请求的心跳超时,以秒为单位; 零表示没有 + requested-heartbeat: 40 + ### 地址 + virtual-host: /VirtualHosts + listener: + simple: + retry: + ####开启消费者(程序出现异常的情况下会)进行重试 + enabled: true + ####最大重试次数 + max-attempts: 3 + ####重试间隔时间 + initial-interval: 3000 + #### 手动应答 manual 自动应答 auto + acknowledge-mode: auto + + application: + name: cardDisconnected + datasource: + url: jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: iotdb + password: www.5iot.cn + # redis 配置 + redis: + # 地址 + host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: Rdis20220107 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +# MyBatis配置 +mybatis: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + +logging: + level: + com: + iot: + business: + dao: trace + root: info + pattern: + console: "'%p%m%n'" + +server: + port: 8079 + diff --git a/yunze-consumption-car-disconnected/src/main/resources/logback.xml b/yunze-consumption-car-disconnected/src/main/resources/logback.xml new file mode 100644 index 0000000..3bc67e3 --- /dev/null +++ b/yunze-consumption-car-disconnected/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + DEBUG + + + ${LOG_PATTERN_CONSOLE} + + + + + + DEBUG + + + ${LOG_PATTERN_FILE} + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}.log + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}-%d{yyyy-MM-dd}.log + + 30 + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-disconnected/src/main/resources/mybatis/mybatis-config.xml b/yunze-consumption-car-disconnected/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e8b52be --- /dev/null +++ b/yunze-consumption-car-disconnected/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/yunze-consumption-car-flow/cardFlow.iml b/yunze-consumption-car-flow/cardFlow.iml new file mode 100644 index 0000000..f22522b --- /dev/null +++ b/yunze-consumption-car-flow/cardFlow.iml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-flow/pom.xml b/yunze-consumption-car-flow/pom.xml new file mode 100644 index 0000000..33fe06c --- /dev/null +++ b/yunze-consumption-car-flow/pom.xml @@ -0,0 +1,108 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + cardFlow + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.apache.commons + commons-lang3 + + + + com.alibaba + fastjson + 1.2.49 + + + + org.projectlombok + lombok + + + com.yunze + yunze-common + + + com.alibaba + druid + 1.2.6 + compile + + + + + mysql + mysql-connector-java + + + + + + + + + + cardFlow + + + src/main/resources + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + src/main/java + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-flow/src/main/java/com/yunze/CardFlowApplication.java b/yunze-consumption-car-flow/src/main/java/com/yunze/CardFlowApplication.java new file mode 100644 index 0000000..abdbbdf --- /dev/null +++ b/yunze-consumption-car-flow/src/main/java/com/yunze/CardFlowApplication.java @@ -0,0 +1,15 @@ +package com.yunze; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +@SpringBootApplication +@MapperScan("com.yunze.common.mapper") +@MapperScan("com.yunze.apiCommon.mapper") +class CardFlowApplication { + public static void main(String[] args) { + SpringApplication.run(CardFlowApplication.class); + } +} diff --git a/yunze-consumption-car-flow/src/main/java/com/yunze/config/DisposableBean.java b/yunze-consumption-car-flow/src/main/java/com/yunze/config/DisposableBean.java new file mode 100644 index 0000000..cbd4b42 --- /dev/null +++ b/yunze-consumption-car-flow/src/main/java/com/yunze/config/DisposableBean.java @@ -0,0 +1,45 @@ +package com.yunze.config; + +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @Auther: zhang feng + * @Date: 2021/07/10/14:24 + * @Description: + */ +@Component +public class DisposableBean { + + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RedisCache redisCache; + + + + @PreDestroy + public void exit(){ + //防止程序意外终止后 redis 还有记录正在监听 记录 下次程序启动不在创建 消费者 + System.out.println("cardFlow 程序结束 执行删除redis Listener 记录key "); + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + List IDArr = yzCardRouteMapper.findIDArr(); + if(IDArr!=null && IDArr.size()>0) { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < IDArr.size(); i++) { + String cd_id = IDArr.get(i); + redisCache.redisTemplate.delete("polling-Listener-CardFlow-"+cd_id); + redisCache.redisTemplate.delete("polling-dex-Listener-CardFlow-"+cd_id); + } + } + + } +} diff --git a/yunze-consumption-car-flow/src/main/java/com/yunze/polling/CardPollingConsumer.java b/yunze-consumption-car-flow/src/main/java/com/yunze/polling/CardPollingConsumer.java new file mode 100644 index 0000000..2aad4aa --- /dev/null +++ b/yunze-consumption-car-flow/src/main/java/com/yunze/polling/CardPollingConsumer.java @@ -0,0 +1,56 @@ +package com.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.polling.card.CardFlow; +import com.yunze.polling.card.dlx.DlxCardFlow; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.Map; + +/** + * 激活时间轮序消费者 + */ +@Component +@Slf4j +public class CardPollingConsumer { + + + @Autowired + private CardFlow cardFlow; + + @Autowired + private DlxCardFlow dlxCardFlow; + + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param message + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_flow") + public void pollingStart(String msg, Message message, Channel channel) throws IOException { + + Map map = JSON.parseObject(msg); + String type = map.get("type").toString(); + //激活时间轮序 + if(type.equals("CardFlow")){ + cardFlow.createListener(); + dlxCardFlow.createListener(); + } + + + } + + +} \ No newline at end of file diff --git a/yunze-consumption-car-flow/src/main/java/com/yunze/polling/card/CardFlow.java b/yunze-consumption-car-flow/src/main/java/com/yunze/polling/card/CardFlow.java new file mode 100644 index 0000000..8a5800c --- /dev/null +++ b/yunze-consumption-car-flow/src/main/java/com/yunze/polling/card/CardFlow.java @@ -0,0 +1,314 @@ +package com.yunze.polling.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.utils.yunze.CardFlowSyn; +import com.yunze.apiCommon.utils.VeDate; +import com.yunze.common.utils.yunze.YzPollingUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 卡用量轮序消费 者 + */ +@Slf4j +@Component +public class CardFlow { + + + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private RedisCache redisCache; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private CardFlowSyn cardFlowSyn; + @Resource + private YzPollingUtil yzPollingUtil; + + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param channel_1 + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_flow_one") + public void pollingStart(String msg, Channel channel_1) throws IOException { + + Map map = JSON.parseObject(msg); + String FindCd_id = map.get("FindCd_id").toString(); + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", FindCd_id); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + RunEx(null,ChannelArr,false);//执行 公共部分 + } + + + + + + + /** + * 创建 监听 + */ + + public void createListener() { + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", null); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + List Ex_ChannelArr = yzCardRouteMapper.findCardChannelID();//查询 卡表里已经划分 的 通道信息 + + RunEx(Ex_ChannelArr,ChannelArr,true);//执行 公共部分 + + } + + + /** + * 执行 公共部分 + * @param Ex_ChannelArr + * @param ChannelArr + * @param bool 是否过滤 不需要监听的 + */ + public void RunEx(List Ex_ChannelArr,List> ChannelArr,boolean bool){ + if (ChannelArr != null && ChannelArr.size() > 0) { + + ChannelArr = yzPollingUtil.filterNoPollin(Ex_ChannelArr,ChannelArr,bool);//过滤不需要轮询的 通道id + // 创建的连接 + Connection connection = rabbitMQConfig.getConnection(); + Channel channel = null; + try { + channel = connection.createChannel(false); + } catch (Exception e) { + log.error("createListener connection.createChannel() Exception {} " + e.getMessage()); + try { + log.info("再次创建连接====="); + rabbitMQConfig.connection = null; + connection = rabbitMQConfig.getConnection(); + channel = connection.createChannel(false); + } catch (Exception e1) { + log.error("再次创建连接 异常…… Exception {} " + e1.getMessage()); + } + } + + try { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < ChannelArr.size(); i++) { + Map ChannelObj = ChannelArr.get(i); + String cd_id = ChannelObj.get("cd_id").toString(); + Object cd_concurrency = ChannelObj.get("cd_concurrency");//创建消费者数量 + cd_concurrency = cd_concurrency != null && cd_concurrency.toString().trim().length() > 0 ? cd_concurrency : "1"; + int Threads = Integer.parseInt(cd_concurrency.toString()); + Object isExecute = redisCache.getCacheObject("polling-Listener-CardFlow-" + cd_id); + if (isExecute == null || bool==false) { + //redis 存储 + ChannelObj.put("pollingtime", VeDate.getStringDateShort()); + redisCache.setCacheObject("polling-Listener-CardFlow-" + cd_id, ChannelObj);// 缓存 避免 重复创建 消费 监听 + try { + List(Threads, cd_id, ChannelObj, channel); + } catch (Exception e) { + log.error(">> CardFlow activateConsumer 失败:{} | {} | {}<<", e.getMessage(), cd_id, ChannelObj.toString()); + } + } + } + } catch (Exception e) { + log.error("业务逻辑异常 : {} " + e.getMessage()); + } + } + } + + + + + + + + + + + + + public void List(int threadCount, String cd_id, Map ChannelObj, Channel channel) { + ThreadPoolExecutor executor = null; + try { + //创建和线程同等数量的线程池 + executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount); + //阻塞,同步线程 + CountDownLatch countDownLatch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; i++) { + log.info("=====启动 {}=====", Thread.currentThread().getName()); + //开始分配线程处理 + SynTask synTask = new SynTask(cd_id, ChannelObj, channel); + + executor.execute(synTask); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + executor.shutdown(); + while (true) { + if (executor.isTerminated()) { + break; + } + } + } + } + + @Async + class SynTask implements Runnable { + private String cd_id; + private Map ChannelObj; + private Channel channel; + + + public SynTask(String Pcd_id, Map PChannelObj, Channel Pchannel) { + this.cd_id = Pcd_id; + this.ChannelObj = PChannelObj; + this.channel = Pchannel; + //activateConsumer(Pcd_id,PChannelObj,Pchannel); + } + + + /** + * 创建 消费者 卡用量 + * + * @param cd_id + */ + public void activateConsumer(String cd_id, Map ChannelObj, Channel channel) { + System.out.println(channel); + Connection connection = null; + try { + // 创建的连接 + //connection = rabbitMQConfig.getConnection(); + // connection = connection != null ? connection : rabbitMQConfig.getConnection(); + // 创建通道 + //Channel channel = connection.createChannel(false); + String QUEUE_NAME = null, EXCHANGE_NAME = null, ROUTINGKEY = null; + EXCHANGE_NAME = "polling_cardCardFlow_exchange"; + QUEUE_NAME = "polling_cardCardFlow_queue_" + cd_id; + ROUTINGKEY = "polling.cardCardFlow.routingKey." + cd_id; + try { + channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, ROUTINGKEY); + DefaultConsumer defaultConsumer = new DefaultConsumer(channel) { + @Override + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { + String msg = new String(body, "UTF-8"); + //System.out.println("polling_cardCardFlow_queue_"+cd_id+" 消费者获取消息:" + msg); + synCardFlow(msg, channel);//同步卡用量 + } + }; + // 开始监听消息 自动签收 + channel.basicConsume(QUEUE_NAME, true, defaultConsumer); + } catch (Exception e) { + try { + redisCache.redisTemplate.delete("polling-Listener-CardFlow-" + cd_id); + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-Listener-CardFlow-{} | {}<<", cd_id); + } catch (Exception e1) { + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-Listener-CardFlow-{} 失败 | {}<<", cd_id, e1.getMessage()); + } + } + + + } catch (Exception e) { + log.error(">>DB - 卡用量 创建 轮序消费者 同步卡用量失败:{} | {}<<", e.getMessage(), ChannelObj.toString()); + try { + redisCache.redisTemplate.delete("polling-Listener-CardFlow-" + cd_id); + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-Listener-CardFlow-{} | {}<<", cd_id); + } catch (Exception e1) { + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-Listener-CardFlow-{} 失败 | {}<<", cd_id, e1.getMessage()); + } + } + } + + + /** + * 同步卡用量 + * + * @param msg + * @throws IOException + */ + public void synCardFlow(String msg, Channel channel) { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String iccid = map.get("iccid").toString(); + String polling_id = map.get("polling_id").toString();//轮询任务编号 + String prefix = "polling_cardCardFlow_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix + ":" + iccid); + if (isExecute == null) { + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix + ":" + iccid, msg, 3, TimeUnit.MINUTES);//3 分钟缓存 避免 重复消费 + redisCache.setCacheObject(polling_id + ":" + iccid, msg, 4, TimeUnit.HOURS);//4 小时缓存 用来统计轮序进度 + + Map Parammap = new HashMap<>(); + Parammap.put("iccid", iccid); + Map Rmap = internalApiRequest.queryFlow(Parammap, map); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //获取 卡用量 开卡日期 更新 card info + if (Rmap.get("Use") != null && Rmap.get("Use") != "" && Rmap.get("Use").toString().trim().length() > 0) { + Double Use = Double.parseDouble(Rmap.get("Use").toString()); + if (Use >= 0) { + try { + Map RMap = cardFlowSyn.CalculationFlow(iccid, Use); + log.info(">>cardFlowSyn - 卡用量轮序消费者 同步卡用量返回:{} | {} | {}<<", polling_id, iccid, JSON.toJSON(RMap)); + } catch (Exception e) { + log.error(">>cardFlowSyn - 卡用量轮序消费者 同步卡用量失败:{} | {} | {}<<", polling_id, iccid, e.getMessage().toString()); + } + } else { + log.info(">>API - 卡用量轮序消费者 未获取到卡用量 {} | statusCode = 0 :{} | {}<<", polling_id, iccid, Rmap); + } + } + } else { + log.info(">>API - 卡用量轮序消费者 未获取到卡用量:{} | {} | {}<<", polling_id, iccid, Rmap); + // System.out.println(map.get("iccid")+" 未获取到卡用量 !"); + } + } + } catch (Exception e) { +// // 记录该消息日志形式 存放数据库db中、后期通过定时任务实现消息补偿、人工实现补偿 + log.error(">>错误 - 卡用量轮序消费者:{}<<", e.getMessage().toString()); +// //将该消息存放到死信队列中,单独写一个死信消费者实现消费。 + } + } + + + @Override + public void run() { + activateConsumer(cd_id, ChannelObj, channel); + } + + + } + + +} diff --git a/yunze-consumption-car-flow/src/main/java/com/yunze/polling/card/dlx/DlxCardFlow.java b/yunze-consumption-car-flow/src/main/java/com/yunze/polling/card/dlx/DlxCardFlow.java new file mode 100644 index 0000000..a04a055 --- /dev/null +++ b/yunze-consumption-car-flow/src/main/java/com/yunze/polling/card/dlx/DlxCardFlow.java @@ -0,0 +1,304 @@ +package com.yunze.polling.card.dlx; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.utils.yunze.CardFlowSyn; +import com.yunze.apiCommon.utils.VeDate; +import com.yunze.common.utils.yunze.YzPollingUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 卡用量轮序消费 者 + */ +@Slf4j +@Component +public class DlxCardFlow { + + + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private RedisCache redisCache; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private CardFlowSyn cardFlowSyn; + @Resource + private YzPollingUtil yzPollingUtil; + + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param channel_1 + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_flow_tow") + public void pollingStart(String msg, Channel channel_1) throws IOException { + Map map = JSON.parseObject(msg); + String FindCd_id = map.get("FindCd_id").toString(); + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", FindCd_id); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + RunEx(null,ChannelArr,false);//执行 公共部分 + } + + + + + + + + + + + + + + /** + * 创建 监听 + */ + public void createListener() { + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + List Ex_ChannelArr = yzCardRouteMapper.findCardChannelID();//查询 卡表里已经划分 的 通道信息 + RunEx(Ex_ChannelArr,ChannelArr,true);//执行 公共部分 + } + + + + /** + * 执行 公共部分 + * @param Ex_ChannelArr + * @param ChannelArr + * @param bool 是否过滤 不需要监听的 + */ + public void RunEx(List Ex_ChannelArr,List> ChannelArr,boolean bool){ + if (ChannelArr != null && ChannelArr.size() > 0) { + ChannelArr = yzPollingUtil.filterNoPollin(Ex_ChannelArr,ChannelArr,bool);//过滤不需要轮询的 通道id + // 创建的连接 + Connection connection = rabbitMQConfig.getConnection(); + Channel channel = null; + try { + channel = connection.createChannel(false); + } catch (Exception e) { + log.error("createListener connection.createChannel() Exception {} " + e.getMessage()); + try { + log.info("再次创建连接====="); + rabbitMQConfig.connection = null; + connection = rabbitMQConfig.getConnection(); + channel = connection.createChannel(false); + } catch (Exception e1) { + log.error("再次创建连接 异常…… Exception {} " + e1.getMessage()); + } + } + try { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < ChannelArr.size(); i++) { + Map ChannelObj = ChannelArr.get(i); + String cd_id = ChannelObj.get("cd_id").toString(); + Object cd_concurrency = ChannelObj.get("cd_concurrency");//创建消费者数量 + cd_concurrency = cd_concurrency != null && cd_concurrency.toString().trim().length() > 0 ? cd_concurrency : "1"; + int Threads = Integer.parseInt(cd_concurrency.toString()); + Object isExecute = redisCache.getCacheObject("polling-dex-Listener-CardFlow-" + cd_id); + if (isExecute == null) { + //redis 存储 + ChannelObj.put("pollingtime", VeDate.getStringDateShort()); + redisCache.setCacheObject("polling-dex-Listener-CardFlow-" + cd_id, ChannelObj);// 缓存 避免 重复创建 消费 监听 + /*for (int j = 0; j < Threads; j++) { + try { + SynTask synTask=new SynTask(cd_id,ChannelObj,channel); + }catch (Exception e){ + log.error(">> CardFlow activateConsumer 失败:{} | {} | {}<<",e.getMessage(),cd_id,ChannelObj.toString()); + } + }*/ + try { + List(Threads, cd_id, ChannelObj, channel); + } catch (Exception e) { + log.error(">> CardFlow activateConsumer 失败:{} | {} | {}<<", e.getMessage(), cd_id, ChannelObj.toString()); + } + } + } + } catch (Exception e) { + log.error("业务逻辑异常 : {} " + e.getMessage()); + } + } + + } + + + + public void List(int threadCount, String cd_id, Map ChannelObj, Channel channel) { + ThreadPoolExecutor executor = null; + try { + //创建和线程同等数量的线程池 + executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount); + //阻塞,同步线程 + CountDownLatch countDownLatch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; i++) { + log.info("=====启动 {}=====", Thread.currentThread().getName()); + //开始分配线程处理 + SynTask synTask = new SynTask(cd_id, ChannelObj, channel); + + executor.execute(synTask); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + executor.shutdown(); + while (true) { + if (executor.isTerminated()) { + break; + } + } + } + } + + @Async + class SynTask implements Runnable { + private String cd_id; + private Map ChannelObj; + private Channel channel; + + + public SynTask(String Pcd_id, Map PChannelObj, Channel Pchannel) { + this.cd_id = Pcd_id; + this.ChannelObj = PChannelObj; + this.channel = Pchannel; + //activateConsumer(Pcd_id,PChannelObj,Pchannel); + } + + + /** + * 创建 消费者 卡用量 + * + * @param cd_id + */ + public void activateConsumer(String cd_id, Map ChannelObj, Channel channel) { + Connection connection = null; + try { + // 创建的连接 + //connection = rabbitMQConfig.getConnection(); + // connection = connection != null ? connection : rabbitMQConfig.getConnection(); + // 创建通道 + //Channel channel = connection.createChannel(false); + String QUEUE_NAME = null, EXCHANGE_NAME = null, ROUTINGKEY = null; + EXCHANGE_NAME = "polling_dlxcardCardFlow_exchange"; + QUEUE_NAME = "polling_dlxcardCardFlow_queue_" + cd_id; + ROUTINGKEY = "polling.dlxcardCardFlow.routingKey." + cd_id; + + channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, ROUTINGKEY); + DefaultConsumer defaultConsumer = new DefaultConsumer(channel) { + @Override + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { + String msg = new String(body, "UTF-8"); + //System.out.println("polling_dlxcardCardFlow_queue_"+cd_id+" 消费者获取消息:" + msg); + synCardFlow(msg, channel);//同步卡用量 + } + }; + // 开始监听消息 自动签收 + channel.basicConsume(QUEUE_NAME, true, defaultConsumer); + } catch (Exception e) { + log.error(">>DB - 卡用量 创建 轮序消费者 同步卡用量失败:{} | {}<<", e.getMessage(), ChannelObj.toString()); + try { + redisCache.redisTemplate.delete("polling-dex-Listener-CardFlow-" + cd_id); + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-dex-Listener-CardFlow-{} | {}<<", cd_id); + } catch (Exception e1) { + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-dex-Listener-CardFlow-{} 失败 | {}<<", cd_id, e1.getMessage()); + } + } + } + + + /** + * 同步卡用量 + * + * @param msg + * @throws IOException + */ + public void synCardFlow(String msg, Channel channel) { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String iccid = map.get("iccid").toString(); + String polling_id = map.get("polling_id").toString();//轮询任务编号 + String prefix = "polling_cardCardFlow_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix + ":" + iccid); + if (isExecute == null) { + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix + ":" + iccid, msg, 3, TimeUnit.MINUTES);//3 分钟缓存 避免 重复消费 + redisCache.setCacheObject(polling_id + ":" + iccid, msg, 4, TimeUnit.HOURS);//4 小时缓存 用来统计轮序进度 + + Map Parammap = new HashMap<>(); + Parammap.put("iccid", iccid); + Map Rmap = internalApiRequest.queryFlow(Parammap, map); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //获取 卡用量 开卡日期 更新 card info + if (Rmap.get("Use") != null && Rmap.get("Use") != "" && Rmap.get("Use").toString().trim().length() > 0) { + Double Use = Double.parseDouble(Rmap.get("Use").toString()); + if (Use >= 0) { + try { + Map RMap = cardFlowSyn.CalculationFlow(iccid, Use); + log.info(">>cardFlowSyn - 卡用量轮序消费者 同步卡用量返回:{} | {} | {}<<", polling_id, iccid, JSON.toJSON(RMap)); + } catch (Exception e) { + log.error(">>cardFlowSyn - 卡用量轮序消费者 同步卡用量失败:{} | {} | {}<<", polling_id, iccid, e.getMessage().toString()); + } + } else { + log.info(">>API - 卡用量轮序消费者 未获取到卡用量 {} | statusCode = 0 :{} | {}<<", polling_id, iccid, Rmap); + } + } + } else { + log.info(">>API - 卡用量轮序消费者 未获取到卡用量:{} | {} | {}<<", polling_id, iccid, Rmap); + // System.out.println(map.get("iccid")+" 未获取到卡用量 !"); + } + } + } catch (Exception e) { +// // 记录该消息日志形式 存放数据库db中、后期通过定时任务实现消息补偿、人工实现补偿 + log.error(">>错误 - 卡用量轮序消费者:{}<<", e.getMessage().toString()); +// //将该消息存放到死信队列中,单独写一个死信消费者实现消费。 + } + } + + + @Override + public void run() { + activateConsumer(cd_id, ChannelObj, channel); + } + + + } + + +} diff --git a/yunze-consumption-car-flow/src/main/resources/application.yml b/yunze-consumption-car-flow/src/main/resources/application.yml new file mode 100644 index 0000000..202a1e2 --- /dev/null +++ b/yunze-consumption-car-flow/src/main/resources/application.yml @@ -0,0 +1,77 @@ +spring: + rabbitmq: + ####连接地址 + host: 127.0.0.1 + ####端口号 + port: 5672 + ####账号 + username: YunZeIotRabbitMq + ####密码 + password: 20220107@yzIot + ## 心跳 请求的心跳超时,以秒为单位; 零表示没有 + requested-heartbeat: 40 + ### 地址 + virtual-host: /VirtualHosts + listener: + simple: + retry: + ####开启消费者(程序出现异常的情况下会)进行重试 + enabled: true + ####最大重试次数 + max-attempts: 1 + ####重试间隔时间 + initial-interval: 3000 + #### 手动应答 manual 自动应答 auto + acknowledge-mode: auto + + application: + name: cardFlow + datasource: + + url: jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: iotdb + password: www.5iot.cn + + # redis 配置 + redis: + # 地址 + host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: Rdis20220107 + + + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +# MyBatis配置 +mybatis: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + +logging: + level: + com: + iot: + business: + dao: trace + root: info + pattern: + console: "'%p%m%n'" + +server: + port: 8073 + diff --git a/yunze-consumption-car-flow/src/main/resources/logback.xml b/yunze-consumption-car-flow/src/main/resources/logback.xml new file mode 100644 index 0000000..f6d8efc --- /dev/null +++ b/yunze-consumption-car-flow/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + DEBUG + + + ${LOG_PATTERN_CONSOLE} + + + + + + DEBUG + + + ${LOG_PATTERN_FILE} + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}.log + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}-%d{yyyy-MM-dd}.log + + 30 + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-flow/src/main/resources/mybatis/mybatis-config.xml b/yunze-consumption-car-flow/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e8b52be --- /dev/null +++ b/yunze-consumption-car-flow/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/yunze-consumption-car-status/cardStatus.iml b/yunze-consumption-car-status/cardStatus.iml new file mode 100644 index 0000000..f22522b --- /dev/null +++ b/yunze-consumption-car-status/cardStatus.iml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-status/pom.xml b/yunze-consumption-car-status/pom.xml new file mode 100644 index 0000000..bfbc204 --- /dev/null +++ b/yunze-consumption-car-status/pom.xml @@ -0,0 +1,108 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + cardStatus + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.apache.commons + commons-lang3 + + + + com.alibaba + fastjson + 1.2.49 + + + + org.projectlombok + lombok + + + com.yunze + yunze-common + + + com.alibaba + druid + 1.2.6 + compile + + + + + mysql + mysql-connector-java + + + + + + + + + + cardStatus + + + src/main/resources + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + src/main/java + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-status/src/main/java/com/yunze/CardStatusApplication.java b/yunze-consumption-car-status/src/main/java/com/yunze/CardStatusApplication.java new file mode 100644 index 0000000..3795d17 --- /dev/null +++ b/yunze-consumption-car-status/src/main/java/com/yunze/CardStatusApplication.java @@ -0,0 +1,21 @@ +package com.yunze; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +@SpringBootApplication +@MapperScan("com.yunze.common.mapper") +@MapperScan("com.yunze.apiCommon.mapper") +class CardStatusApplication { + + + + public static void main(String[] args) { + + SpringApplication.run(CardStatusApplication.class); + + + } +} diff --git a/yunze-consumption-car-status/src/main/java/com/yunze/config/DisposableBean.java b/yunze-consumption-car-status/src/main/java/com/yunze/config/DisposableBean.java new file mode 100644 index 0000000..557a229 --- /dev/null +++ b/yunze-consumption-car-status/src/main/java/com/yunze/config/DisposableBean.java @@ -0,0 +1,45 @@ +package com.yunze.config; + +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @Auther: zhang feng + * @Date: 2021/07/10/14:24 + * @Description: + */ +@Component +public class DisposableBean { + + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RedisCache redisCache; + + + + @PreDestroy + public void exit(){ + //防止程序意外终止后 redis 还有记录正在监听 记录 下次程序启动不在创建 消费者 + System.out.println("cardStatus 程序结束 执行删除redis Listener 记录key "); + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + List IDArr = yzCardRouteMapper.findIDArr(); + if(IDArr!=null && IDArr.size()>0) { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < IDArr.size(); i++) { + String cd_id = IDArr.get(i); + redisCache.redisTemplate.delete("polling-Listener-CardStatus-"+cd_id); + redisCache.redisTemplate.delete("polling-dxl-Listener-CardStatus-"+cd_id); + } + } + + } +} diff --git a/yunze-consumption-car-status/src/main/java/com/yunze/config/OneRunServiceImpl.java b/yunze-consumption-car-status/src/main/java/com/yunze/config/OneRunServiceImpl.java new file mode 100644 index 0000000..f50c75e --- /dev/null +++ b/yunze-consumption-car-status/src/main/java/com/yunze/config/OneRunServiceImpl.java @@ -0,0 +1,27 @@ +package com.yunze.config; + +import lombok.SneakyThrows; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.core.MessageListener; +import org.springframework.stereotype.Service; + +/** + * 业务执行类 + * @Auther: zhang feng + * @Date: 2021/11/11/9:02 + * @Description: + */ +@Service +public class OneRunServiceImpl implements MessageListener { + + + @SneakyThrows + @Override + public void onMessage(Message message) { + + byte[] body = message.getBody(); + String msg = new String(body, "UTF-8"); + System.out.println("======[接收到消息 One ]=============================="); + System.out.println(msg); + } +} diff --git a/yunze-consumption-car-status/src/main/java/com/yunze/config/RbMQConfig.java b/yunze-consumption-car-status/src/main/java/com/yunze/config/RbMQConfig.java new file mode 100644 index 0000000..aa20c2c --- /dev/null +++ b/yunze-consumption-car-status/src/main/java/com/yunze/config/RbMQConfig.java @@ -0,0 +1,41 @@ +package com.yunze.config; + +import org.springframework.amqp.core.AcknowledgeMode; +import org.springframework.amqp.rabbit.connection.ConnectionFactory; +import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.Resource; + +/** + * @Auther: zhang feng + * @Date: 2021/11/11/9:03 + * @Description: + * + * + * + */ +/*@Configuration*/ +public class RbMQConfig { + + /* @Resource + private OneRunServiceImpl oneRunServiceImpl; + @Resource + private TowRunServiceImpl towRunServiceImpl; + + @Bean + public SimpleMessageListenerContainer simpleMessageListenerContainer(ConnectionFactory connectionFactory) { + SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory); + container.setDefaultRequeueRejected(false);// 是否重回队列 + container.setAcknowledgeMode(AcknowledgeMode.AUTO);// 签收模式 自动 + container.setMessageListener(oneRunServiceImpl);//设置监听类 + container.start(); + return container; + }*/ + + + + +} diff --git a/yunze-consumption-car-status/src/main/java/com/yunze/config/TowRunServiceImpl.java b/yunze-consumption-car-status/src/main/java/com/yunze/config/TowRunServiceImpl.java new file mode 100644 index 0000000..7805f33 --- /dev/null +++ b/yunze-consumption-car-status/src/main/java/com/yunze/config/TowRunServiceImpl.java @@ -0,0 +1,27 @@ +package com.yunze.config; + +import lombok.SneakyThrows; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.core.MessageListener; +import org.springframework.stereotype.Service; + +/** + * 业务执行类 + * @Auther: zhang feng + * @Date: 2021/11/11/9:02 + * @Description: + */ +@Service +public class TowRunServiceImpl implements MessageListener { + + + @SneakyThrows + @Override + public void onMessage(Message message) { + + byte[] body = message.getBody(); + String msg = new String(body, "UTF-8"); + System.out.println("======[接收到消息 Tow ]=============================="); + System.out.println(msg); + } +} diff --git a/yunze-consumption-car-status/src/main/java/com/yunze/polling/CardPollingConsumer.java b/yunze-consumption-car-status/src/main/java/com/yunze/polling/CardPollingConsumer.java new file mode 100644 index 0000000..bbcdf46 --- /dev/null +++ b/yunze-consumption-car-status/src/main/java/com/yunze/polling/CardPollingConsumer.java @@ -0,0 +1,56 @@ +package com.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.polling.card.CardStatus; +import com.yunze.polling.card.dlx.DlxCardStatus; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Map; + +/** + * 激活时间轮序消费者 + */ +@Component +@Slf4j +public class CardPollingConsumer { + + + @Resource + private CardStatus cardStatus; + + @Resource + private DlxCardStatus dlxCardStatus; + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param message + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_status") + public void pollingStart(String msg, Message message, Channel channel) throws IOException { + + //autoListener.A(); + + + Map map = JSON.parseObject(msg); + String type = map.get("type").toString(); + //激活时间轮序 + if(type.equals("CardStatus")){ + cardStatus.createListener(); + dlxCardStatus.createListener(); + } + } + + +} \ No newline at end of file diff --git a/yunze-consumption-car-status/src/main/java/com/yunze/polling/card/CardStatus.java b/yunze-consumption-car-status/src/main/java/com/yunze/polling/card/CardStatus.java new file mode 100644 index 0000000..91d8f4f --- /dev/null +++ b/yunze-consumption-car-status/src/main/java/com/yunze/polling/card/CardStatus.java @@ -0,0 +1,311 @@ +package com.yunze.polling.card; + +import com.alibaba.fastjson.JSON; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.apiCommon.utils.VeDate; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.utils.yunze.GetShowStatIdArr; +import com.yunze.common.utils.yunze.YzPollingUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; +import javax.annotation.Resource; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 卡状态轮序消费 者 + */ +@Slf4j +@Component +public class CardStatus { + + + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private RedisCache redisCache; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + @Resource + private YzPollingUtil yzPollingUtil; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private GetShowStatIdArr getShowStatIdArr; + + + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param channel_1 + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_status_one") + public void pollingStart(String msg, Channel channel_1) throws IOException { + Map map = JSON.parseObject(msg); + String FindCd_id = map.get("FindCd_id").toString(); + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", FindCd_id); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + RunEx(null,ChannelArr,false);//执行 公共部分 + } + + /** + * 创建 监听 + */ + public void createListener() { + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + List Ex_ChannelArr = yzCardRouteMapper.findCardChannelID();//查询 卡表里已经划分 的 通道信息 + RunEx(Ex_ChannelArr,ChannelArr,true);//执行 公共部分 + + + } + + + /** + * 执行 公共部分 + * @param Ex_ChannelArr + * @param ChannelArr + * @param bool 是否过滤 不需要监听的 + */ + public void RunEx(List Ex_ChannelArr,List> ChannelArr,boolean bool){ + + if (ChannelArr != null && ChannelArr.size() > 0) { + ChannelArr = yzPollingUtil.filterNoPollin(Ex_ChannelArr,ChannelArr,bool);//过滤不需要轮询的 通道id + // 创建的连接 + Connection connection = rabbitMQConfig.getConnection(); + Channel channel = null; + try { + channel = connection.createChannel(false); + } catch (Exception e) { + log.error("createListener connection.createChannel() Exception {} " + e.getMessage()); + try { + log.info("再次创建连接====="); + rabbitMQConfig.connection = null; + connection = rabbitMQConfig.getConnection(); + channel = connection.createChannel(false); + } catch (Exception e1) { + log.error("再次创建连接 异常…… Exception {} " + e1.getMessage()); + } + } + try { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < ChannelArr.size(); i++) { + Map ChannelObj = ChannelArr.get(i); + String cd_id = ChannelObj.get("cd_id").toString(); + Object cd_concurrency = ChannelObj.get("cd_concurrency");//创建消费者数量 + cd_concurrency = cd_concurrency != null && cd_concurrency.toString().trim().length() > 0 ? cd_concurrency : "1"; + int Threads = Integer.parseInt(cd_concurrency.toString()); + + Object isExecute = redisCache.getCacheObject("polling-Listener-CardStatus-" + cd_id); + if (isExecute == null || bool==false) { + //redis 存储 + ChannelObj.put("pollingtime", VeDate.getStringDateShort()); + redisCache.setCacheObject("polling-Listener-CardStatus-" + cd_id, ChannelObj);// 缓存 避免 重复创建 消费 监听 + try { + List(Threads, cd_id, ChannelObj, channel); + } catch (Exception e) { + log.error(">> CardFlow activateConsumer 失败:{} | {} | {}<<", e.getMessage(), cd_id, ChannelObj.toString()); + } + } + } + } catch (Exception e) { + log.error("业务逻辑异常 : {} " + e.getMessage()); + } + } + + } + + + + + public void List(int threadCount, String cd_id, Map ChannelObj, Channel channel) { + ThreadPoolExecutor executor = null; + try { + //创建和线程同等数量的线程池 + executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount); + //阻塞,同步线程 + CountDownLatch countDownLatch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; i++) { + log.info("=====启动 {}=====", Thread.currentThread().getName()); + //开始分配线程处理 + SynTask synTask = new SynTask(cd_id, ChannelObj, channel); + + executor.execute(synTask); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + executor.shutdown(); + while (true) { + if (executor.isTerminated()) { + break; + } + } + } + } + + + @Async + class SynTask implements Runnable { + private String cd_id; + private Map ChannelObj; + private Channel channel; + + + public SynTask(String Pcd_id, Map PChannelObj, Channel Pchannel) { + this.cd_id = Pcd_id; + this.ChannelObj = PChannelObj; + this.channel = Pchannel; + } + + + /** + * 创建 消费者 卡状态 + * + * @param cd_id + */ + public void activateConsumer(String cd_id, Map ChannelObj, Channel channel) { + try { + // 创建的连接 + //Connection connection = rabbitMQConfig.getConnection(); + // 创建通道 + // Channel channel = connection.createChannel(false); + String QUEUE_NAME = null, EXCHANGE_NAME = null, ROUTINGKEY = null; + + EXCHANGE_NAME = "polling_cardCardStatus_exchange"; + QUEUE_NAME = "polling_cardCardStatus_queue_" + cd_id; + ROUTINGKEY = "polling.cardCardStatus.routingKey." + cd_id; + + // 关联队列消费者关联队列 + channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, ROUTINGKEY); + DefaultConsumer defaultConsumer = new DefaultConsumer(channel) { + @Override + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { + String msg = new String(body, "UTF-8"); + //System.out.println("polling_cardCardStatus_queue_"+cd_id+" 消费者获取消息:" + msg); + synCardStatus(msg, channel);//同步卡状态 + } + }; + // 开始监听消息 自动签收 + channel.basicConsume(QUEUE_NAME, true, defaultConsumer); + } catch (Exception e) { + log.error(">>DB - 卡状态 创建 轮序消费者 同步卡状态失败:{} | {}<<", e.getMessage(), ChannelObj.toString()); + try { + redisCache.redisTemplate.delete("polling-Listener-CardStatus-" + cd_id); + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-Listener-CardStatus-{} | {}<<", cd_id); + } catch (Exception e1) { + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-Listener-CardStatus-{} 失败 | {}<<", cd_id, e1.getMessage()); + } + } + } + + + /** + * 同步卡状态 + * + * @param msg + * @param channel + * @throws IOException + */ + public void synCardStatus(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + + Map map = JSON.parseObject(msg); + String iccid = map.get("iccid").toString(); + String polling_id = map.get("polling_id").toString();//轮询任务编号 + String prefix = "polling_cardCardStatus_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix + ":" + iccid); + if (isExecute == null) { + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix + ":" + iccid, msg, 3, TimeUnit.MINUTES);//3 分钟缓存 避免 重复消费 + redisCache.setCacheObject(polling_id + ":" + iccid, msg, 4, TimeUnit.HOURS);//4 小时缓存 用来统计轮序进度 + + Map Parammap = new HashMap<>(); + Parammap.put("iccid", iccid); + Map Rmap = internalApiRequest.queryCardStatus(Parammap, map); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //获取 卡状态 开卡日期 更新 card info + if (Rmap.get("statusCode") != null && Rmap.get("statusCode") != "" && Rmap.get("statusCode").toString().trim().length() > 0) { + String statusCode = Rmap.get("statusCode").toString().trim(); + if (!statusCode.equals("0")) { + Map Upd_Map = new HashMap<>(); + Upd_Map.put("status_id", statusCode); + Upd_Map.put("iccid", iccid); + //1.创建路由 绑定 生产队列 发送消息 + String card_exchangeName = "admin_card_exchange", card_queueName = "admin_CardUpd_queue", card_routingKey = "admin.CardUpd.queue", + card_del_exchangeName = "dlx_" + card_exchangeName, card_del_queueName = "dlx_" + card_queueName, card_del_routingKey = "dlx_" + card_routingKey; + try { + //rabbitMQConfig.creatExchangeQueue(card_exchangeName, card_queueName, card_routingKey, card_del_exchangeName, card_del_queueName, card_del_routingKey,null); + /*Upd_Map.put("queueTypeName", "admin_CardUpdStatusId_queue"); + rabbitTemplate.convertAndSend(card_exchangeName, card_routingKey, JSON.toJSONString(Upd_Map), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + });*/ + + Object status_id = Upd_Map.get("status_id"); + String status_ShowId = getShowStatIdArr.GetShowStatId(status_id.toString()); + Upd_Map.put("status_ShowId",status_ShowId); + int upd = yzCardMapper.updStatusId(Upd_Map); + log.info(">>发送 admin_CardUpdStatusId_queue 指令成功 ! iccid:{} | upd:{} | Upd_Map {}<<", iccid,upd, Upd_Map); + } catch (Exception e) { + log.info(">>发送 admin_CardUpdStatusId_queue 失败 ! iccid:{} | Upd_Map {} e : {}<<", iccid, Upd_Map, e.getMessage()); + } + } else { + log.info(">>API - 卡状态轮序消费者 未获取到卡状态 statusCode = 0 :{} | {}<<", iccid, Rmap); + } + } + } else { + log.info(">>API - 卡状态轮序消费者 未获取到卡状态:{} | {}<<", iccid, Rmap); + // System.out.println(map.get("iccid")+" 未获取到卡状态 !"); + } + } + } catch (Exception e) { +// // 记录该消息日志形式 存放数据库db中、后期通过定时任务实现消息补偿、人工实现补偿 + log.error(">>错误 - 卡状态轮序消费者:{}<<", e.getMessage().toString()); +// //将该消息存放到死信队列中,单独写一个死信消费者实现消费。 + } + } + + @Override + public void run() { + activateConsumer(cd_id, ChannelObj, channel); + } + } + +} diff --git a/yunze-consumption-car-status/src/main/java/com/yunze/polling/card/dlx/DlxCardStatus.java b/yunze-consumption-car-status/src/main/java/com/yunze/polling/card/dlx/DlxCardStatus.java new file mode 100644 index 0000000..d009327 --- /dev/null +++ b/yunze-consumption-car-status/src/main/java/com/yunze/polling/card/dlx/DlxCardStatus.java @@ -0,0 +1,311 @@ +package com.yunze.polling.card.dlx; + +import com.alibaba.fastjson.JSON; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.apiCommon.utils.VeDate; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.utils.yunze.GetShowStatIdArr; +import com.yunze.common.utils.yunze.YzPollingUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; +import javax.annotation.Resource; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 卡状态轮序消费 者 + */ +@Slf4j +@Component +public class DlxCardStatus { + + + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private RedisCache redisCache; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + @Resource + private YzPollingUtil yzPollingUtil; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private GetShowStatIdArr getShowStatIdArr; + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param channel_1 + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_status_tow") + public void pollingStart(String msg, Channel channel_1) throws IOException { + + Map map = JSON.parseObject(msg); + String FindCd_id = map.get("FindCd_id").toString(); + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", FindCd_id); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + RunEx(null,ChannelArr,false);//执行 公共部分 + + } + + + /** + * 创建 监听 + */ + public void createListener() { + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + List Ex_ChannelArr = yzCardRouteMapper.findCardChannelID();//查询 卡表里已经划分 的 通道信息 + + RunEx(Ex_ChannelArr,ChannelArr,true);//执行 公共部分 + } + + + + /** + * 执行 公共部分 + * @param Ex_ChannelArr + * @param ChannelArr + * @param bool 是否过滤 不需要监听的 + */ + public void RunEx(List Ex_ChannelArr,List> ChannelArr,boolean bool){ + if (ChannelArr != null && ChannelArr.size() > 0) { + ChannelArr = yzPollingUtil.filterNoPollin(Ex_ChannelArr,ChannelArr,bool);//过滤不需要轮询的 通道id + // 创建的连接 + Connection connection = rabbitMQConfig.getConnection(); + Channel channel = null; + try { + channel = connection.createChannel(false); + } catch (Exception e) { + log.error("createListener connection.createChannel() Exception {} " + e.getMessage()); + try { + log.info("再次创建连接====="); + rabbitMQConfig.connection = null; + connection = rabbitMQConfig.getConnection(); + channel = connection.createChannel(false); + } catch (Exception e1) { + log.error("再次创建连接 异常…… Exception {} " + e1.getMessage()); + } + } + try { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < ChannelArr.size(); i++) { + Map ChannelObj = ChannelArr.get(i); + String cd_id = ChannelObj.get("cd_id").toString(); + Object cd_concurrency = ChannelObj.get("cd_concurrency");//创建消费者数量 + cd_concurrency = cd_concurrency != null && cd_concurrency.toString().trim().length() > 0 ? cd_concurrency : "1"; + int Threads = Integer.parseInt(cd_concurrency.toString()); + + Object isExecute = redisCache.getCacheObject("polling-dxl-Listener-CardStatus-" + cd_id); + if (isExecute == null || bool==false) { + //redis 存储 + ChannelObj.put("pollingtime", VeDate.getStringDateShort()); + redisCache.setCacheObject("polling-dxl-Listener-CardStatus-" + cd_id, ChannelObj);// 缓存 避免 重复创建 消费 监听 + try { + List(Threads, cd_id, ChannelObj, channel); + } catch (Exception e) { + log.error(">> CardFlow activateConsumer 失败:{} | {} | {}<<", e.getMessage(), cd_id, ChannelObj.toString()); + } + } + } + } catch (Exception e) { + log.error("业务逻辑异常 : {} " + e.getMessage()); + } + } + + } + + + + + + public void List(int threadCount, String cd_id, Map ChannelObj, Channel channel) { + ThreadPoolExecutor executor = null; + try { + //创建和线程同等数量的线程池 + executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount); + //阻塞,同步线程 + CountDownLatch countDownLatch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; i++) { + log.info("=====启动 {}=====", Thread.currentThread().getName()); + //开始分配线程处理 + SynTask synTask = new SynTask(cd_id, ChannelObj, channel); + + executor.execute(synTask); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + executor.shutdown(); + while (true) { + if (executor.isTerminated()) { + break; + } + } + } + } + + + @Async + class SynTask implements Runnable { + private String cd_id; + private Map ChannelObj; + private Channel channel; + + + public SynTask(String Pcd_id, Map PChannelObj, Channel Pchannel) { + this.cd_id = Pcd_id; + this.ChannelObj = PChannelObj; + this.channel = Pchannel; + } + + + /** + * 创建 消费者 卡状态 + * + * @param cd_id + */ + public void activateConsumer(String cd_id, Map ChannelObj, Channel channel) { + try { + // 创建的连接 + //Connection connection = rabbitMQConfig.getConnection(); + // 创建通道 + // Channel channel = connection.createChannel(false); + String QUEUE_NAME = null, EXCHANGE_NAME = null, ROUTINGKEY = null; + + EXCHANGE_NAME = "polling_dlxcardCardStatus_exchange"; + QUEUE_NAME = "polling_dlxcardCardStatus_queue_" + cd_id; + ROUTINGKEY = "polling.dlxcardCardStatus.routingKey." + cd_id; + + // 关联队列消费者关联队列 + channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, ROUTINGKEY); + DefaultConsumer defaultConsumer = new DefaultConsumer(channel) { + @Override + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { + String msg = new String(body, "UTF-8"); + //System.out.println("polling_dlxcardCardStatus_queue_"+cd_id+" 消费者获取消息:" + msg); + synCardStatus(msg, channel);//同步卡状态 + } + }; + // 开始监听消息 自动签收 + channel.basicConsume(QUEUE_NAME, true, defaultConsumer); + } catch (Exception e) { + log.error(">>DB - 卡状态 创建 轮序消费者 同步卡状态失败:{} | {}<<", e.getMessage(), ChannelObj.toString()); + try { + redisCache.redisTemplate.delete("polling-dxl-Listener-CardStatus-" + cd_id); + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-dxl-Listener-CardStatus-{} | {}<<", cd_id); + } catch (Exception e1) { + log.error(">> 创建 消费者失败 > 删除 redis记录Key polling-dxl-Listener-CardStatus-{} 失败 | {}<<", cd_id, e1.getMessage()); + } + } + } + + /** + * 同步卡状态 + * + * @param msg + * @param channel + * @throws IOException + */ + public void synCardStatus(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + + Map map = JSON.parseObject(msg); + String iccid = map.get("iccid").toString(); + String polling_id = map.get("polling_id").toString();//轮询任务编号 + String prefix = "polling_cardCardStatus_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix + ":" + iccid); + if (isExecute == null) { + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix + ":" + iccid, msg, 3, TimeUnit.MINUTES);//3 分钟缓存 避免 重复消费 + redisCache.setCacheObject(polling_id + ":" + iccid, msg, 4, TimeUnit.HOURS);//4 小时缓存 用来统计轮序进度 + + Map Parammap = new HashMap<>(); + Parammap.put("iccid", iccid); + Map Rmap = internalApiRequest.queryCardStatus(Parammap, map); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //获取 卡状态 开卡日期 更新 card info + if (Rmap.get("statusCode") != null && Rmap.get("statusCode") != "" && Rmap.get("statusCode").toString().trim().length() > 0) { + String statusCode = Rmap.get("statusCode").toString().trim(); + if (!statusCode.equals("0")) { + Map Upd_Map = new HashMap<>(); + Upd_Map.put("status_id", statusCode); + Upd_Map.put("iccid", iccid); + //1.创建路由 绑定 生产队列 发送消息 + String card_exchangeName = "admin_card_exchange", card_queueName = "admin_CardUpd_queue", card_routingKey = "admin.CardUpd.queue", + card_del_exchangeName = "dlx_" + card_exchangeName, card_del_queueName = "dlx_" + card_queueName, card_del_routingKey = "dlx_" + card_routingKey; + try { + //rabbitMQConfig.creatExchangeQueue(card_exchangeName, card_queueName, card_routingKey, card_del_exchangeName, card_del_queueName, card_del_routingKey,null); + /*Upd_Map.put("queueTypeName", "admin_CardUpdStatusId_queue"); + rabbitTemplate.convertAndSend(card_exchangeName, card_routingKey, JSON.toJSONString(Upd_Map), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + });*/ + Object status_id = Upd_Map.get("status_id"); + String status_ShowId = getShowStatIdArr.GetShowStatId(status_id.toString()); + Upd_Map.put("status_ShowId",status_ShowId); + int upd = yzCardMapper.updStatusId(Upd_Map); + log.info(">>发送 admin_CardUpdStatusId_queue 指令成功 ! iccid:{} | upd:{} | Upd_Map {}<<", iccid,upd, Upd_Map); + } catch (Exception e) { + log.info(">>发送 admin_CardUpdStatusId_queue 失败 ! iccid:{} | Upd_Map {} e : {}<<", iccid, Upd_Map, e.getMessage()); + } + } else { + log.info(">>API - 卡状态轮序消费者 未获取到卡状态 statusCode = 0 :{} | {}<<", iccid, Rmap); + } + } + } else { + log.info(">>API - 卡状态轮序消费者 未获取到卡状态:{} | {}<<", iccid, Rmap); + // System.out.println(map.get("iccid")+" 未获取到卡状态 !"); + } + } + } catch (Exception e) { +// // 记录该消息日志形式 存放数据库db中、后期通过定时任务实现消息补偿、人工实现补偿 + log.error(">>错误 - 卡状态轮序消费者:{}<<", e.getMessage().toString()); +// //将该消息存放到死信队列中,单独写一个死信消费者实现消费。 + } + } + + @Override + public void run() { + activateConsumer(cd_id, ChannelObj, channel); + } + } + + + +} diff --git a/yunze-consumption-car-status/src/main/resources/application.yml b/yunze-consumption-car-status/src/main/resources/application.yml new file mode 100644 index 0000000..3280076 --- /dev/null +++ b/yunze-consumption-car-status/src/main/resources/application.yml @@ -0,0 +1,77 @@ +spring: + rabbitmq: + ####连接地址 + host: 127.0.0.1 + ####端口号 + port: 5672 + ####账号 + username: YunZeIotRabbitMq + ## 心跳 请求的心跳超时,以秒为单位; 零表示没有 + requested-heartbeat: 40 + ####密码 + password: 20220107@yzIot + ### 地址 + virtual-host: /VirtualHosts + listener: + simple: + retry: + ####开启消费者(程序出现异常的情况下会)进行重试 + enabled: true + ####最大重试次数 + max-attempts: 1 + ####重试间隔时间 + initial-interval: 3000 + #### 手动应答 manual 自动应答 auto + acknowledge-mode: auto + + application: + name: cardStatus + datasource: + + url: jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: iotdb + password: www.5iot.cn + + # redis 配置 + redis: + # 地址 + host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: Rdis20220107 + + + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +# MyBatis配置 +mybatis: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + +logging: + level: + com: + iot: + business: + dao: trace + root: info + pattern: + console: "'%p%m%n'" + +server: + port: 8074 + diff --git a/yunze-consumption-car-status/src/main/resources/logback.xml b/yunze-consumption-car-status/src/main/resources/logback.xml new file mode 100644 index 0000000..f6139e5 --- /dev/null +++ b/yunze-consumption-car-status/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + DEBUG + + + ${LOG_PATTERN_CONSOLE} + + + + + + DEBUG + + + ${LOG_PATTERN_FILE} + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}.log + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}-%d{yyyy-MM-dd}.log + + 30 + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-status/src/main/resources/mybatis/mybatis-config.xml b/yunze-consumption-car-status/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e8b52be --- /dev/null +++ b/yunze-consumption-car-status/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/yunze-consumption-car-stop/cardStop.iml b/yunze-consumption-car-stop/cardStop.iml new file mode 100644 index 0000000..f22522b --- /dev/null +++ b/yunze-consumption-car-stop/cardStop.iml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-stop/pom.xml b/yunze-consumption-car-stop/pom.xml new file mode 100644 index 0000000..e4a9a02 --- /dev/null +++ b/yunze-consumption-car-stop/pom.xml @@ -0,0 +1,108 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + cardStop + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.apache.commons + commons-lang3 + + + + com.alibaba + fastjson + 1.2.49 + + + + org.projectlombok + lombok + + + com.yunze + yunze-common + + + com.alibaba + druid + 1.2.6 + compile + + + + + mysql + mysql-connector-java + + + + + + + + + + cardStop + + + src/main/resources + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + src/main/java + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-stop/src/main/java/com/yunze/CardStopApplication.java b/yunze-consumption-car-stop/src/main/java/com/yunze/CardStopApplication.java new file mode 100644 index 0000000..79615fd --- /dev/null +++ b/yunze-consumption-car-stop/src/main/java/com/yunze/CardStopApplication.java @@ -0,0 +1,15 @@ +package com.yunze; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +@SpringBootApplication +@MapperScan("com.yunze.common.mapper") +@MapperScan("com.yunze.apiCommon.mapper") +class CardStopApplication { + public static void main(String[] args) { + SpringApplication.run(CardStopApplication.class); + } +} diff --git a/yunze-consumption-car-stop/src/main/java/com/yunze/config/DisposableBean.java b/yunze-consumption-car-stop/src/main/java/com/yunze/config/DisposableBean.java new file mode 100644 index 0000000..588a08b --- /dev/null +++ b/yunze-consumption-car-stop/src/main/java/com/yunze/config/DisposableBean.java @@ -0,0 +1,45 @@ +package com.yunze.config; + +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @Auther: zhang feng + * @Date: 2021/07/10/14:24 + * @Description: + */ +@Component +public class DisposableBean { + + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RedisCache redisCache; + + + + @PreDestroy + public void exit(){ + //防止程序意外终止后 redis 还有记录正在监听 记录 下次程序启动不在创建 消费者 + System.out.println("cardStop 程序结束 执行删除redis Listener 记录key "); + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + List IDArr = yzCardRouteMapper.findIDArr(); + if(IDArr!=null && IDArr.size()>0) { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < IDArr.size(); i++) { + String cd_id = IDArr.get(i); + redisCache.redisTemplate.delete("polling_cardCardStop_queue_"+cd_id); + redisCache.redisTemplate.delete("dlx_polling_cardCardStop_queue_"+cd_id); + } + } + + } +} diff --git a/yunze-consumption-car-stop/src/main/java/com/yunze/polling/CardPollingConsumer.java b/yunze-consumption-car-stop/src/main/java/com/yunze/polling/CardPollingConsumer.java new file mode 100644 index 0000000..de9398a --- /dev/null +++ b/yunze-consumption-car-stop/src/main/java/com/yunze/polling/CardPollingConsumer.java @@ -0,0 +1,61 @@ +package com.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.polling.card.CardStop; +import com.yunze.polling.card.dlx.DlxCardStop; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.Map; + +/** + * 激活时间轮序消费者 + */ +@Component +@Slf4j +public class CardPollingConsumer { + + + @Autowired + private CardStop cardStop; + + @Autowired + private DlxCardStop dlxCardStop; + + + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param message + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_stop") + public void pollingStart(String msg, Message message, Channel channel) throws IOException { + + Map map = JSON.parseObject(msg); + String type = map.get("type").toString(); + //激活时间轮序 + if(type.equals("CardStop")){ + + String Listener = map.get("Listener").toString(); + if(Listener.indexOf("polling_cardCardStop_queue_")!=-1){ + cardStop.createListener(2,map); + }else if(Listener.indexOf("dlx_polling_cardCardStop_queue_")!=-1){ + dlxCardStop.createListener(2,map); + }else { + System.out.println("=================【未找到队列!"+Listener+"】================="); + } + } + } + + +} \ No newline at end of file diff --git a/yunze-consumption-car-stop/src/main/java/com/yunze/polling/card/CardStop.java b/yunze-consumption-car-stop/src/main/java/com/yunze/polling/card/CardStop.java new file mode 100644 index 0000000..e92d444 --- /dev/null +++ b/yunze-consumption-car-stop/src/main/java/com/yunze/polling/card/CardStop.java @@ -0,0 +1,310 @@ +package com.yunze.polling.card; + +import com.alibaba.fastjson.JSON; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.MyDictionary; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.card.CardChange; +import com.yunze.common.core.redis.RedisCache; + +import com.yunze.common.utils.yunze.CardFlowSyn; +import com.yunze.apiCommon.utils.VeDate; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; +import javax.annotation.Resource; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 达量停机 轮序消费 者 + */ +@Slf4j +@Component +public class CardStop { + + + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private RedisCache redisCache; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private CardFlowSyn cardFlowSyn; + @Resource + private MyDictionary myDictionary; + @Resource + private CardChange cardChange; + + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * @param msg + * @param channel_1 + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_Stop_one") + public void pollingStart(String msg, Channel channel_1) throws IOException { + Map map = JSON.parseObject(msg); + String Listener = map.get("Listener").toString(); + String cd_id = map.get("cd_id").toString(); + RunEx(Listener,1,cd_id,false);//执行 公共部分 + } + + + + /** + * 创建 监听 + * @param Threads 消费者创建 数量 + */ + public void createListener(int Threads,Map Pmap) { + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + try { + //获取 key 值对应的 监听 生产 队列 + String Listener = Pmap.get("Listener").toString(); + String cd_id = Pmap.get("cd_id").toString(); + RunEx(Listener,Threads,cd_id,true); + }catch (Exception e){ + log.error(">>createListener - 未订购资费停机轮询 创建 失败:{} | {}<<",e.getMessage()); + } + } + + + /** + * 执行 公共部分 + * @param Listener + * @param Threads + * @param cd_id + * @param bool 是否过滤 不需要监听的 + */ + public void RunEx(String Listener,int Threads,String cd_id, boolean bool){ + + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + try { + //获取 key 值对应的 监听 生产 队列 + Object isExecute = redisCache.getCacheObject(Listener); + if(isExecute==null || bool==false){ + Connection connection = rabbitMQConfig.getConnection(); + Channel channel = null; + try { + channel = connection.createChannel(false); + }catch (Exception e){ + log.error("createListener connection.createChannel() Exception {} "+e.getMessage()); + try { + log.info("再次创建连接====="); + rabbitMQConfig.connection = null; + connection = rabbitMQConfig.getConnection(); + channel = connection.createChannel(false); + }catch (Exception e1){ + log.error("再次创建连接 异常…… Exception {} "+e1.getMessage()); + } + } + //redis 存储 + Map oMap = new HashMap<>(); + oMap.put("pollingtime", VeDate.getStringDateShort()); + redisCache.setCacheObject(Listener, oMap);// 缓存 避免 重复创建 消费 监听 + List(Threads,cd_id,channel); + } + }catch (Exception e){ + log.error(">> {} - 未订购资费停机轮询 创建 失败:cd_id {} | {}<<",Listener,cd_id,e.getMessage()); + } + } + + + + + + public void List(int threadCount,String cd_id,Channel channel){ + ThreadPoolExecutor executor=null; + try { + //创建和线程同等数量的线程池 + executor= (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount); + //阻塞,同步线程 + CountDownLatch countDownLatch=new CountDownLatch(threadCount); + for(int i=0;i>DB - 达量停机 创建 轮序消费者 同步达量停机失败:{} | {}<<",e.getMessage().toString()); + } + } + + + /** + * 同步达量停机 + * @param msg + * @param channel + * @throws IOException + */ + public void synCardStop(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + + Map map = JSON.parseObject(msg); + String iccid = map.get("iccid").toString(); + boolean is_sel = (boolean) map.get("is_sel"); + + Double Max = Double.parseDouble(map.get("Max").toString()); + + + + String polling_id = map.get("polling_id").toString();//轮询任务编号 + String prefix = "polling_cardCardStop_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ iccid); + if(isExecute==null){ + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix+":"+ iccid, msg, 3, TimeUnit.MINUTES);//3 分钟缓存 避免 重复消费 + redisCache.setCacheObject(polling_id+":"+ iccid, msg, 4, TimeUnit.HOURS);//4 小时缓存 用来统计轮序进度 + + Map Parammap=new HashMap<>(); + Parammap.put("iccid",iccid); + Parammap.put("Is_Stop","off"); + //不需要查询的 已经超出的直接执行停机 + if(is_sel){ + Map Rmap = internalApiRequest.queryFlow(Parammap,map); + String code = Rmap.get("code")!=null?Rmap.get("code").toString():"500"; + if(code.equals("200")){ + //获取 卡用量 开卡日期 更新 card info + if(Rmap.get("Use")!=null && Rmap.get("Use")!="" && Rmap.get("Use").toString().trim().length()>0){ + Double Use = Double.parseDouble(Rmap.get("Use").toString()); + if(Use>=0){ + try { + Map RMap = cardFlowSyn.CalculationFlow(iccid,Use); + log.info(">>cardFlowSyn - 达量停机-卡用量轮序消费者 同步卡用量返回:{} | {}<<",iccid,JSON.toJSON(RMap)); + Double used = Double.parseDouble(RMap.get("used").toString()); + log.info(">>cardFlowSyn - {} | used {} | Max {} | used>=Max {} <<",iccid,used,Max,used>=Max); + if(used>=Max){ + stop(iccid,Parammap,map,map.get("status_id").toString()); + } + }catch (Exception e){ + log.error(">>cardFlowSyn - 达量停机-卡用量轮序消费者 同步卡用量失败:{} | {}<<",iccid,e.getMessage().toString()); + } + }else{ + log.info(">>API - 达量停机-卡用量轮序消费者 未获取到卡用量 statusCode = 0 :{} | {}<<",iccid,Rmap); + } + } + }else{ + log.info(">>API - 达量停机-卡用量轮序消费者 未获取到卡用量:{} | {}<<",iccid,Rmap); + } + }else{ + String status_id = map.get("status_id")!=null?map.get("status_id").toString():"8";//未知 + stop(iccid,Parammap,map,status_id); + } + } + } catch (Exception e) { + log.error(">>错误 - 达量停机轮序消费者:{} | {} <<", e.getMessage(),msg); + } + } + + + /** + * 停机 + * @param iccid + * @param Parammap + * @param map + */ + public void stop (String iccid,Map Parammap,Map map,String status_id){ + Map Add_Map = new HashMap<>(); + Add_Map.put("iccid",iccid); + Add_Map.put("ctype","2");//生命周期 + Add_Map.put("cbefore",myDictionary.getdictLabel("yunze_card_status_ShowId",status_id)); + Add_Map.put("cafterward","停机"); + Add_Map.put("source_type","1");// 来源 类型 :1 达量停机 + + Map Upd_Map = new HashMap<>(); + Upd_Map.put("status_id","2"); + Upd_Map.put("iccid",iccid); + cardChange.OnOff(Parammap,map,Add_Map,Upd_Map); + + + } + + @Override + public void run() { + activateConsumer(cd_id,channel); + } + + + + } + + + + +} diff --git a/yunze-consumption-car-stop/src/main/java/com/yunze/polling/card/dlx/DlxCardStop.java b/yunze-consumption-car-stop/src/main/java/com/yunze/polling/card/dlx/DlxCardStop.java new file mode 100644 index 0000000..1c33e11 --- /dev/null +++ b/yunze-consumption-car-stop/src/main/java/com/yunze/polling/card/dlx/DlxCardStop.java @@ -0,0 +1,332 @@ +package com.yunze.polling.card.dlx; + +import com.alibaba.fastjson.JSON; +import com.yunze.apiCommon.utils.InternalApiRequest; +import com.yunze.common.config.MyDictionary; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.card.CardChange; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; + +import com.yunze.common.utils.yunze.CardFlowSyn; +import com.yunze.apiCommon.utils.VeDate; +import com.yunze.common.utils.yunze.GetShowStatIdArr; +import com.yunze.polling.card.CardStop; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.rabbit.connection.Connection; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import com.rabbitmq.client.AMQP; +import com.rabbitmq.client.Channel; +import com.rabbitmq.client.DefaultConsumer; +import com.rabbitmq.client.Envelope; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * 达量停机轮序消费 者 + */ +@Slf4j +@Component +public class DlxCardStop { + + + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private CardFlowSyn cardFlowSyn; + @Resource + private MyDictionary myDictionary; + @Resource + private CardChange cardChange; + @Resource + private GetShowStatIdArr getShowStatIdArr; + + /** + * 轮序开始类型监听器 通过该监听器灵活监听 + * + * @param msg + * @param channel_1 + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "polling_card_Stop_tow") + public void pollingStart(String msg, Channel channel_1) throws IOException { + Map map = JSON.parseObject(msg); + String Listener = map.get("Listener").toString(); + String cd_id = map.get("cd_id").toString(); + RunEx(Listener, 1, cd_id, false);//执行 公共部分 + } + + + /** + * 创建 监听 + * @param Threads 消费者创建 数量 + */ + public void createListener(int Threads, Map Pmap) { + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + try { + //获取 key 值对应的 监听 生产 队列 + String Listener = Pmap.get("Listener").toString(); + String cd_id = Pmap.get("cd_id").toString(); + RunEx(Listener,Threads,cd_id,true); + }catch (Exception e){ + log.error(">>createListener - 未订购资费停机轮询 创建 失败:{} | {}<<",e.getMessage()); + } + } + + + /** + * 执行 公共部分 + * + * @param Listener + * @param Threads + * @param cd_id + * @param bool 是否过滤 不需要监听的 + */ + public void RunEx(String Listener, int Threads, String cd_id, boolean bool) { + + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + try { + //获取 key 值对应的 监听 生产 队列 + Object isExecute = redisCache.getCacheObject(Listener); + if (isExecute == null || bool == false) { + Connection connection = rabbitMQConfig.getConnection(); + Channel channel = null; + try { + channel = connection.createChannel(false); + } catch (Exception e) { + log.error("createListener connection.createChannel() Exception {} " + e.getMessage()); + try { + log.info("再次创建连接====="); + rabbitMQConfig.connection = null; + connection = rabbitMQConfig.getConnection(); + channel = connection.createChannel(false); + } catch (Exception e1) { + log.error("再次创建连接 异常…… Exception {} " + e1.getMessage()); + } + } + //redis 存储 + Map oMap = new HashMap<>(); + oMap.put("pollingtime", VeDate.getStringDateShort()); + redisCache.setCacheObject(Listener, oMap);// 缓存 避免 重复创建 消费 监听 + List(Threads, cd_id, channel); + } + } catch (Exception e) { + log.error(">> {} - 未订购资费停机轮询 创建 失败:cd_id {} | {}<<", Listener, cd_id, e.getMessage()); + } + } + + + public void List(int threadCount, String cd_id, Channel channel) { + ThreadPoolExecutor executor = null; + try { + //创建和线程同等数量的线程池 + executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(threadCount); + //阻塞,同步线程 + CountDownLatch countDownLatch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; i++) { + log.info("=====启动 {}=====", Thread.currentThread().getName()); + //开始分配线程处理 + SynTask synTask = new SynTask(cd_id, channel); + executor.execute(synTask); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + executor.shutdown(); + while (true) { + if (executor.isTerminated()) { + break; + } + } + } + } + + + @Async + class SynTask implements Runnable { + private String cd_id; + private Channel channel; + + + public SynTask(String Pcd_id, Channel Pchannel) { + this.cd_id = Pcd_id; + this.channel = Pchannel; + } + + + /** + * 创建 消费者 达量停机 + * + * @param cd_id + */ + public void activateConsumer(String cd_id, Channel channel) { + try { + String QUEUE_NAME = null, EXCHANGE_NAME = null, ROUTINGKEY = null; + + EXCHANGE_NAME = "polling_dlxcardCardStop_exchange"; + QUEUE_NAME = "polling_dlxcardCardStop_queue_" + cd_id; + ROUTINGKEY = "polling.dlxcardCardStop.routingKey." + cd_id; + + // 关联队列消费者关联队列 + channel.queueBind(QUEUE_NAME, EXCHANGE_NAME, ROUTINGKEY); + DefaultConsumer defaultConsumer = new DefaultConsumer(channel) { + @Override + public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { + String msg = new String(body, "UTF-8"); + synCardStop(msg, channel);//同步达量停机 + } + }; + // 开始监听消息 自动签收 + channel.basicConsume(QUEUE_NAME, true, defaultConsumer); + } catch (Exception e) { + log.error(">>DB - 死信 达量停机 创建 轮序消费者 同步达量停机失败:{} | {}<<", e.getMessage().toString()); + } + } + + + /** + * 同步达量停机 + * + * @param msg + * @param channel + * @throws IOException + */ + public void synCardStop(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + + Map map = JSON.parseObject(msg); + String iccid = map.get("iccid").toString(); + boolean is_sel = (boolean) map.get("is_sel"); + + Double Max = Double.parseDouble(map.get("Max").toString()); + + + String polling_id = map.get("polling_id").toString();//轮询任务编号 + String prefix = "polling_dlxcardCardStop_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix + ":" + iccid); + if (isExecute == null) { + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix + ":" + iccid, msg, 3, TimeUnit.MINUTES);//3 分钟缓存 避免 重复消费 + redisCache.setCacheObject(polling_id + ":" + iccid, msg, 4, TimeUnit.HOURS);//4 小时缓存 用来统计轮序进度 + + Map Parammap = new HashMap<>(); + Parammap.put("iccid", iccid); + Parammap.put("Is_Stop", "off"); + //不需要查询的 已经超出的直接执行停机 + if (is_sel) { + Map Rmap = internalApiRequest.queryFlow(Parammap, map); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //获取 卡用量 开卡日期 更新 card info + if (Rmap.get("Use") != null && Rmap.get("Use") != "" && Rmap.get("Use").toString().trim().length() > 0) { + Double Use = Double.parseDouble(Rmap.get("Use").toString()); + if (Use >= 0) { + try { + Map RMap = cardFlowSyn.CalculationFlow(iccid, Use); + log.info(">>cardFlowSyn - 死信 达量停机-卡用量轮序消费者 同步卡用量返回:{} | {}<<", iccid, JSON.toJSON(RMap)); + Double used = Double.parseDouble(RMap.get("used").toString()); + if (used >= Max) { + stop(iccid, Parammap, map); + } + } catch (Exception e) { + log.error(">>cardFlowSyn - 死信 达量停机-卡用量轮序消费者 同步卡用量失败:{} | {}<<", iccid, e.getMessage().toString()); + } + } else { + log.info(">>API - 死信 达量停机-卡用量轮序消费者 未获取到卡用量 statusCode = 0 :{} | {}<<", iccid, Rmap); + } + } + } else { + log.info(">>API - 死信 达量停机-卡用量轮序消费者 未获取到卡用量:{} | {}<<", iccid, Rmap); + } + } else { + String status_id = map.get("status_id") != null ? map.get("status_id").toString() : "8";//未知 + stop(iccid, Parammap, map, status_id); + } + } + } catch (Exception e) { + log.error(">>错误 - 死信 达量停机轮序消费者:{}<<", e.getMessage().toString()); + } + } + + + /** + * 停机 + * + * @param iccid + * @param Parammap + * @param map + */ + public void stop(String iccid, Map Parammap, Map map) { + Map Rmap = internalApiRequest.changeCardStatus(Parammap, map); + String code = Rmap.get("code") != null ? Rmap.get("code").toString() : "500"; + if (code.equals("200")) { + //获取 达量停机 开卡日期 更新 card info + Map Upd_Map = new HashMap<>(); + Upd_Map.put("status_id", "2"); + Upd_Map.put("iccid", iccid); + Object status_id = Upd_Map.get("status_id"); + String status_ShowId = getShowStatIdArr.GetShowStatId(status_id.toString()); + Upd_Map.put("status_ShowId",status_ShowId); + boolean bool = yzCardMapper.updStatusId(Upd_Map) > 0;//变更达量停机 + log.info(map.get("iccid") + " 修改死信 达量停机 bool : " + bool); + if (!bool) { + log.error(">>DB - 死信 达量停机轮序消费者 同步达量停机失败:{} | {}<<", iccid, Upd_Map); + } + } else { + log.info(">>API - 死信 达量停机轮序消费者 未获取到达量停机:{} | {}<<", iccid, Rmap); + } + } + + + /** + * 停机 + * + * @param iccid + * @param Parammap + * @param map + */ + public void stop(String iccid, Map Parammap, Map map, String status_id) { + Map Add_Map = new HashMap<>(); + Add_Map.put("iccid", iccid); + Add_Map.put("ctype", "2");//生命周期 + Add_Map.put("cbefore", myDictionary.getdictLabel("yunze_card_status_ShowId", status_id)); + Add_Map.put("cafterward", "停机"); + Add_Map.put("source_type", "1");// 来源 类型 :1 达量停机 + Map Upd_Map = new HashMap<>(); + Upd_Map.put("status_id", "2"); + Upd_Map.put("iccid", iccid); + cardChange.OnOff(Parammap, map, Add_Map, Upd_Map); + } + + @Override + public void run() { + activateConsumer(cd_id, channel); + } + + + } + +} diff --git a/yunze-consumption-car-stop/src/main/resources/application.yml b/yunze-consumption-car-stop/src/main/resources/application.yml new file mode 100644 index 0000000..0fa7ac7 --- /dev/null +++ b/yunze-consumption-car-stop/src/main/resources/application.yml @@ -0,0 +1,76 @@ +spring: + rabbitmq: + ####连接地址 + host: 127.0.0.1 + ####端口号 + port: 5672 + ####账号 + username: YunZeIotRabbitMq + ####密码 + password: 20220107@yzIot + ## 心跳 请求的心跳超时,以秒为单位; 零表示没有 + requested-heartbeat: 40 + ### 地址 + virtual-host: /VirtualHosts + listener: + simple: + retry: + ####开启消费者(程序出现异常的情况下会)进行重试 + enabled: true + ####最大重试次数 + max-attempts: 1 + ####重试间隔时间 + initial-interval: 3000 + #### 手动应答 manual 自动应答 auto + acknowledge-mode: auto + + application: + name: cardStop + datasource: + + url: jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: iotdb + password: www.5iot.cn + + # redis 配置 + redis: + # 地址 + host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: Rdis20220107 + + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +# MyBatis配置 +mybatis: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + +logging: + level: + com: + iot: + business: + dao: trace + root: info + pattern: + console: "'%p%m%n'" + +server: + port: 8075 + diff --git a/yunze-consumption-car-stop/src/main/resources/logback.xml b/yunze-consumption-car-stop/src/main/resources/logback.xml new file mode 100644 index 0000000..1c959b5 --- /dev/null +++ b/yunze-consumption-car-stop/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + DEBUG + + + ${LOG_PATTERN_CONSOLE} + + + + + + DEBUG + + + ${LOG_PATTERN_FILE} + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}.log + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}-%d{yyyy-MM-dd}.log + + 30 + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-car-stop/src/main/resources/mybatis/mybatis-config.xml b/yunze-consumption-car-stop/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e8b52be --- /dev/null +++ b/yunze-consumption-car-stop/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/yunze-consumption-order/cOrder.iml b/yunze-consumption-order/cOrder.iml new file mode 100644 index 0000000..f22522b --- /dev/null +++ b/yunze-consumption-order/cOrder.iml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-order/pom.xml b/yunze-consumption-order/pom.xml new file mode 100644 index 0000000..925358a --- /dev/null +++ b/yunze-consumption-order/pom.xml @@ -0,0 +1,108 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + cOrder + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.apache.commons + commons-lang3 + + + + com.alibaba + fastjson + 1.2.49 + + + + org.projectlombok + lombok + + + com.yunze + yunze-common + + + com.alibaba + druid + 1.2.6 + compile + + + + + mysql + mysql-connector-java + + + + + + + + + + cOrder + + + src/main/resources + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + src/main/java + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-order/src/main/java/com/yunze/OrderApplication.java b/yunze-consumption-order/src/main/java/com/yunze/OrderApplication.java new file mode 100644 index 0000000..12d0036 --- /dev/null +++ b/yunze-consumption-order/src/main/java/com/yunze/OrderApplication.java @@ -0,0 +1,15 @@ +package com.yunze; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +@SpringBootApplication +@MapperScan("com.yunze.common.mapper") +@MapperScan("com.yunze.apiCommon.mapper") +class OrderApplication { + public static void main(String[] args) { + SpringApplication.run(OrderApplication.class); + } +} diff --git a/yunze-consumption-order/src/main/java/com/yunze/config/DisposableBean.java b/yunze-consumption-order/src/main/java/com/yunze/config/DisposableBean.java new file mode 100644 index 0000000..475ff9b --- /dev/null +++ b/yunze-consumption-order/src/main/java/com/yunze/config/DisposableBean.java @@ -0,0 +1,44 @@ +package com.yunze.config; + +import com.yunze.common.core.redis.RedisCache; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * @Auther: zhang feng + * @Date: 2021/07/10/14:24 + * @Description: + */ +@Component +public class DisposableBean { + + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RedisCache redisCache; + + + + @PreDestroy + public void exit(){ + /*//防止程序意外终止后 redis 还有记录正在监听 记录 下次程序启动不在创建 消费者 + System.out.println("cardStop 程序结束 执行删除redis Listener 记录key "); + //获取现在数据库中 开启轮序 状态正常的通道进行监听 + List IDArr = yzCardRouteMapper.findIDArr(); + if(IDArr!=null && IDArr.size()>0) { + //获取redis 中 记录的 已经在监听中的通道名称 避免重复监听 + for (int i = 0; i < IDArr.size(); i++) { + String cd_id = IDArr.get(i); + redisCache.redisTemplate.delete("polling_cardCardStop_queue_"+cd_id); + } + }*/ + + } +} diff --git a/yunze-consumption-order/src/main/java/com/yunze/system/card/PaddPackage.java b/yunze-consumption-order/src/main/java/com/yunze/system/card/PaddPackage.java new file mode 100644 index 0000000..77ca49e --- /dev/null +++ b/yunze-consumption-order/src/main/java/com/yunze/system/card/PaddPackage.java @@ -0,0 +1,89 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.rabbitmq.client.*; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.card.AddPacket; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 轮序批量加包 消费 者 + */ +@Slf4j +@Component +public class PaddPackage { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private AddPacket addPacket; + + + + /** + * 轮序批量加包 + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "p_addPackage_card") + public void createListener(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String oid = map.get("id").toString();//订单 id + String ord_no = map.get("ord_no").toString();//订单 号 + String iccid = map.get("iccid").toString();//iccid + String cid = map.get("Bid").toString();//card id + String validate_type = map.get("validate_type").toString();//生效类型 + String create_time = map.get("create_time").toString();//订单创建时间 + String activate_date = map.get("activate_date")!=null&&map.get("activate_date").toString().trim().length()>6?map.get("activate_date").toString():null;//激活时间 + + + + + + Map add_parameter = JSON.parseObject(map.get("add_parameter").toString());//加包参数 + + String prefix = "p_addPackage_card"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ iccid+":"+ord_no); + if(isExecute==null){ + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix+":"+ iccid+":"+ord_no, msg, 10, TimeUnit.SECONDS);//10 秒缓存 避免 重复消费 + addPacket.addFlow(ord_no,iccid,add_parameter,validate_type,create_time,activate_date);//执行导入 + } + } catch (Exception e) { + log.error(">>错误 - 轮序批量加包 消费者:{}<<", e.getMessage().toString()); + } + } + + + + +} diff --git a/yunze-consumption-order/src/main/java/com/yunze/system/card/WxAddOrder.java b/yunze-consumption-order/src/main/java/com/yunze/system/card/WxAddOrder.java new file mode 100644 index 0000000..697cf6d --- /dev/null +++ b/yunze-consumption-order/src/main/java/com/yunze/system/card/WxAddOrder.java @@ -0,0 +1,84 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzOrderMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 微信订单 消费 + * @Auther: zhang feng + * @Date: 2021/09/02/11:55 + * @Description: + */ +@Slf4j +@Component +public class WxAddOrder { + + @Resource + private RedisCache redisCache; + @Resource + private YzOrderMapper yzOrderMapper; + + + /** + * 微信充值 订单 消费者 + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "admin_WxWebOrder_queue") + public void createListener(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map MsgMap = JSON.parseObject(msg); + Map OrderMap = (Map) MsgMap.get("OrderMap"); + String ord_no = OrderMap.get("ord_no").toString(); + String iccid = OrderMap.get("iccid").toString(); + String prefix = "admin_WxWebOrder_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ord_no+":"+iccid); + if(isExecute==null){ + redisCache.setCacheObject(prefix+":"+ord_no+":"+iccid, msg, 3, TimeUnit.SECONDS);//3 秒缓存 避免 重复消费 + AddOrder(OrderMap);//生成订单 + } + } catch (Exception e) { + log.error(">>错误 - 微信充值 订单 消费者:{}<<", e.getMessage()); + } + } + + + /** + * 生成订单 + * @param OrderMap + */ + public void AddOrder(Map OrderMap){ + try { + int saveCount = yzOrderMapper.save(OrderMap); + if(saveCount>0){ + log.info(">>成功 - 微信充值新增订单 受影响数据:{}<<", saveCount); + }else{ + log.error(">>失败 - 微信充值 新增订单 受影响数据:{}<<", saveCount); + } + }catch (Exception e){ + log.error(">>异常 - 微信充值 AddOrder {} /n 信息 :{}<<",OrderMap,e.getMessage()); + } + + } + + + +} diff --git a/yunze-consumption-order/src/main/java/com/yunze/system/card/addOrder.java b/yunze-consumption-order/src/main/java/com/yunze/system/card/addOrder.java new file mode 100644 index 0000000..30b4049 --- /dev/null +++ b/yunze-consumption-order/src/main/java/com/yunze/system/card/addOrder.java @@ -0,0 +1,186 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.core.card.AddPacket; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardFlowMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.mapper.yunze.YzOrderMapper; +import com.yunze.common.utils.yunze.Different; +import com.yunze.common.utils.yunze.ExcelConfig; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 平台批量充值 消费 者 + */ +@Slf4j +@Component +public class addOrder { + + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RedisCache redisCache; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + @Resource + private YzOrderMapper yzOrderMapper; + + + /** + * 平台批量充值 + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "admin_OrderImportRecharge_queue") + public void createListener(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map map = JSON.parseObject(msg); + String filePath = map.get("filePath").toString();//项目根目录 + String ReadName = map.get("ReadName").toString();//上传新文件名 + String newName = map.get("newName").toString();//输出文件名 + Map Pmap = ( Map)map.get("map");//参数 + Map User = ( Map)Pmap.get("User");//登录用户信息 + Map OrderMap = ( Map)Pmap.get("OrderMap");//添加订单生成参数 + + + + String prefix = "admin_OrderImportRecharge_queue"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix+":"+ newName); + if(isExecute==null){ + //System.out.println("SUCCESS"); + redisCache.setCacheObject(prefix+":"+ newName, msg, 30, TimeUnit.SECONDS);//30 秒缓存 避免 重复消费 + AddOrder(filePath,ReadName,newName,Pmap,User,OrderMap);//生成订单 + } + } catch (Exception e) { + log.error(">>错误 - 轮序批量加包 消费者:{}<<", e.getMessage().toString()); + } + } + + + /** + * 生成订单 + * @param filePath + * @param ReadName + * @param newName + * @param Pmap + * @param User + * @param OrderMap + */ + public void AddOrder(String filePath,String ReadName,String newName,Map Pmap,Map User,Map OrderMap){ + + //1.读取 上传文件 + String path = filePath + "/upload/importRecharge/" + ReadName; + ExcelConfig excelConfig = new ExcelConfig(); + String columns[] = {"iccid"}; + + List> list = excelConfig.getExcelListMap(path,columns,OrderMap,"order"); + Map Dept = (Map)User.get("dept"); + String create_by = " [ "+Dept.get("deptName")+" ] - "+" [ "+User.get("userName")+" ] "; + String Outcolumns[] = {"iccid","操作描述","执行时间","执行结果","执行人"}; + String keys[] = {"iccid","description","time","result","agentName"}; + + if(list!=null && list.size()>0){ + //筛选出 iccid 卡号 重复项 + Map getNotRepeatingMap = Different.getNotRepeating(list,"iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap.get("Rlist");//更新 充值数据 + List> Repeatlist = (List>) getNotRepeatingMap.get("Repeatlist"); + if(Repeatlist.size()>0){ + writeCSV.OutCSVObj(Repeatlist,newName,"ICCID重复充值失败!同一ICCID同批次,多次充值不允许!",create_by,"充值失败",Outcolumns,keys); + } + //查询数据库中 匹对iccid 是否存在 + HashMap map = new HashMap<>(); + map.put("order_arrs",list); + map.put("card_arrs",list); + map.put("type","3"); + List iccidarr = yzCardMapper.isExistence(map); + + String SaveUrl = "/getcsv/"+newName+".csv"; + String task_name = create_by+"-平台批量充值 [充值] "; + Map task_map = new HashMap(); + task_map.put("auth",create_by); + task_map.put("task_name",task_name); + task_map.put("url",SaveUrl); + task_map.put("agent_id", Dept.get("deptId")); + task_map.put("type","5"); + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + //1.判断 充值卡号是否都在库里 + if(iccidarr.size()>0){ + //库中查询出卡号与上传卡号数量 不一致 说明有卡号不在数据库中 + if(!(iccidarr.size()==list.size())){ + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i getNotRepeatingMap_DB = Different.getNotRepeating(list,iccidarr,"iccid");//获取 筛选不重复的某列值 和 重复的 + list = (List>) getNotRepeatingMap_DB.get("Rlist");//更新 充值数据 + List> Out_list_Different = (List>) getNotRepeatingMap_DB.get("Repeatlist");//更新 充值数据 + //找出与数据库已存在 相同 ICCID 去除 重复 iccid + if(Out_list_Different.size()>0){ + writeCSV.OutCSVObj(Out_list_Different,newName,"iccid 不在数据库中!请核对iccid卡号!",create_by,"充值失败",Outcolumns,keys); + } + } + map.put("order_arrs",list);//更新 list + map.put("create_by",create_by); + try { + if(list.size()>0){ + int sInt = yzOrderMapper.importOrder(map); + if(sInt>0){ + writeCSV.OutCSVObj(list,newName,"平台批量成功 充值 数据 ["+sInt+"] 条",create_by,"充值成功",Outcolumns,keys); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + } + } + }catch (DuplicateKeyException e){ + String[] solit=e.getCause().toString().split("'"); + writeCSV.OutCSVObj(list,newName,e.getCause().toString(),create_by,"充值失败",Outcolumns,keys); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">> order-消费者- 上传excel异常 [插入数据 DuplicateKeyException ] :{}<<", e.getMessage().toString()); + }catch (Exception e){ + writeCSV.OutCSVObj(list,newName,e.getCause().toString(),create_by,"充值失败",Outcolumns,keys); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + log.error(">>order-消费者- 批量充值消费者:{}<<", e.getMessage().toString()); + } + }else{ + //上传卡号不在数据库中 + writeCSV.OutCSVObj(list,newName,"充值iccid卡号平台中未找到!充值取消!",create_by,"充值失败",Outcolumns,keys); + } + }else{ + log.error( "admin-消费者 上传表格无数据!无需执行充值"); + } + } + + + + + + + + + + +} diff --git a/yunze-consumption-order/src/main/resources/application.yml b/yunze-consumption-order/src/main/resources/application.yml new file mode 100644 index 0000000..13fef87 --- /dev/null +++ b/yunze-consumption-order/src/main/resources/application.yml @@ -0,0 +1,75 @@ +spring: + rabbitmq: + ####连接地址 + host: 127.0.0.1 + ####端口号 + port: 5672 + ####账号 + username: YunZeIotRabbitMq + ####密码 + password: 20220107@yzIot + ## 心跳 请求的心跳超时,以秒为单位; 零表示没有 + requested-heartbeat: 40 + ### 地址 + virtual-host: /VirtualHosts + listener: + simple: + retry: + ####开启消费者(程序出现异常的情况下会)进行重试 + enabled: true + ####最大重试次数 + max-attempts: 1 + ####重试间隔时间 + initial-interval: 3000 + #### 手动应答 manual 自动应答 auto + acknowledge-mode: auto + + application: + name: backup + datasource: + driverClassName: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: iotdb + password: www.5iot.cn + + # redis 配置 + redis: + # 地址 + host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: Rdis20220107 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +# MyBatis配置 +mybatis: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + +logging: + level: + com: + iot: + business: + dao: trace + root: info + pattern: + console: "'%p%m%n'" + +server: + port: 8061 + diff --git a/yunze-consumption-order/src/main/resources/logback.xml b/yunze-consumption-order/src/main/resources/logback.xml new file mode 100644 index 0000000..4f6ff88 --- /dev/null +++ b/yunze-consumption-order/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + DEBUG + + + ${LOG_PATTERN_CONSOLE} + + + + + + DEBUG + + + ${LOG_PATTERN_FILE} + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}.log + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}-%d{yyyy-MM-dd}.log + + 60 + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-order/src/main/resources/mybatis/mybatis-config.xml b/yunze-consumption-order/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e8b52be --- /dev/null +++ b/yunze-consumption-order/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/yunze-consumption-update/cUpdate.iml b/yunze-consumption-update/cUpdate.iml new file mode 100644 index 0000000..5ee1f7e --- /dev/null +++ b/yunze-consumption-update/cUpdate.iml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-update/pom.xml b/yunze-consumption-update/pom.xml new file mode 100644 index 0000000..ae7f5cd --- /dev/null +++ b/yunze-consumption-update/pom.xml @@ -0,0 +1,108 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + cUpdate + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-amqp + + + org.apache.commons + commons-lang3 + + + + com.alibaba + fastjson + 1.2.49 + + + + org.projectlombok + lombok + + + com.yunze + yunze-common + + + com.alibaba + druid + 1.2.6 + compile + + + + + mysql + mysql-connector-java + + + + + + + + + + cUpdate + + + src/main/resources + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + src/main/java + + **/*.properties + **/*.yml + **/*.xml + **/*.tld + + false + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-update/src/main/java/com/yunze/CUpdateApplication.java b/yunze-consumption-update/src/main/java/com/yunze/CUpdateApplication.java new file mode 100644 index 0000000..f177687 --- /dev/null +++ b/yunze-consumption-update/src/main/java/com/yunze/CUpdateApplication.java @@ -0,0 +1,15 @@ +package com.yunze; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +@SpringBootApplication +@MapperScan("com.yunze.common.mapper") +@MapperScan("com.yunze.apiCommon.mapper") +class CUpdateApplication { + public static void main(String[] args) { + SpringApplication.run(CUpdateApplication.class); + } +} diff --git a/yunze-consumption-update/src/main/java/com/yunze/system/card/CardUpd.java b/yunze-consumption-update/src/main/java/com/yunze/system/card/CardUpd.java new file mode 100644 index 0000000..0f1e9f2 --- /dev/null +++ b/yunze-consumption-update/src/main/java/com/yunze/system/card/CardUpd.java @@ -0,0 +1,88 @@ +package com.yunze.system.card; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.utils.yunze.GetShowStatIdArr; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 修改 卡 消费 者 + */ +@Slf4j +@Component +public class CardUpd { + + @Resource + private RedisCache redisCache; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private GetShowStatIdArr getShowStatIdArr; + + + /** + * 修改 用量 + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "admin_CardUpd_queue") + public void CardUpd(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map Pmap = JSON.parseObject(msg); + String queueTypeName = Pmap.get("queueTypeName").toString(); + String iccid = Pmap.get("iccid").toString(); + + + String prefix = queueTypeName; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix + ":" + iccid); + if (isExecute == null) { + redisCache.setCacheObject(prefix + ":" + iccid, msg, 3, TimeUnit.SECONDS);//3 秒缓存 避免 重复消费 + int upd = 0; + if(queueTypeName.equals("admin_CardUpdUsed_queue")){ + upd = yzCardMapper.updUsed(Pmap); + }else if(queueTypeName.equals("admin_CardUpdActivate_queue")){ + upd = yzCardMapper.updActivate(Pmap); + }else if(queueTypeName.equals("admin_CardUpdStatusId_queue")) { + Object status_id = Pmap.get("status_id"); + String status_ShowId = getShowStatIdArr.GetShowStatId(status_id.toString()); + Pmap.put("status_ShowId",status_ShowId); + upd = yzCardMapper.updStatusId(Pmap); + }else if(queueTypeName.equals("admin_CardAddInfoRemaining_queue")){ + upd = yzCardMapper.addInfoRemaining(Pmap); + }else if(queueTypeName.equals("admin_CardUpdimei_queue")){ + upd = yzCardMapper.updimei(Pmap); + } + log.info(">> {} 执行结果 - 修改 {} 消费者:{}<<",iccid,queueTypeName,upd); + } + } catch (Exception e) { + log.error(">>错误 - 修改 admin_CardUpd_queue 消费者:{}<<", e.getMessage().toString()); + } + } + + + + + + + +} + + + diff --git a/yunze-consumption-update/src/main/java/com/yunze/system/card/dlx/DlxCardUpd.java b/yunze-consumption-update/src/main/java/com/yunze/system/card/dlx/DlxCardUpd.java new file mode 100644 index 0000000..689bbca --- /dev/null +++ b/yunze-consumption-update/src/main/java/com/yunze/system/card/dlx/DlxCardUpd.java @@ -0,0 +1,96 @@ +package com.yunze.system.card.dlx; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.Channel; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.utils.yunze.GetShowStatIdArr; +import com.yunze.common.utils.yunze.WriteCSV; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 修改 卡 消费 者 [死信队列] + */ +@Slf4j +@Component +public class DlxCardUpd { + + @Resource + private RedisCache redisCache; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private GetShowStatIdArr getShowStatIdArr; + + /** + * 修改 用量 + * @param msg + * @param channel + * @throws IOException + */ + @RabbitHandler + @RabbitListener(queues = "dlx_admin_CardUpd_queue") + public void CardUpd(String msg, Channel channel) throws IOException { + try { + if (StringUtils.isEmpty(msg)) { + return; + } + Map Pmap = JSON.parseObject(msg); + String queueTypeName = Pmap.get("queueTypeName").toString(); + String iccid = Pmap.get("iccid").toString(); + String prefix = queueTypeName+"_dlx"; + //执行前判断 redis 是否存在 执行数据 存在时 不执行 + Object isExecute = redisCache.getCacheObject(prefix + ":" + iccid); + if (isExecute == null) { + redisCache.setCacheObject(prefix + ":" + iccid, msg, 3, TimeUnit.SECONDS);//3 秒缓存 避免 重复消费 + int upd = 0; + if(queueTypeName.equals("admin_CardUpdUsed_queue")){ + upd = yzCardMapper.updUsed(Pmap); + }else if(queueTypeName.equals("admin_CardUpdActivate_queue")){ + upd = yzCardMapper.updActivate(Pmap); + }else if(queueTypeName.equals("admin_CardUpdStatusId_queue")){ + Object status_id = Pmap.get("status_id"); + String status_ShowId = getShowStatIdArr.GetShowStatId(status_id.toString()); + Pmap.put("status_ShowId",status_ShowId); + upd = yzCardMapper.updStatusId(Pmap); + }else if(queueTypeName.equals("admin_CardAddInfoRemaining_queue")){ + upd = yzCardMapper.addInfoRemaining(Pmap); + }else if(queueTypeName.equals("admin_CardUpdimei_queue")){ + upd = yzCardMapper.updimei(Pmap); + } + log.info(">> {} 执行结果 - delx 修改 {} 消费者:{}<<",iccid,queueTypeName,upd); + } + } catch (Exception e) { + log.error(">>错误 - 修改 dlx_admin_CardUpd_queue 消费者:{}<<", e.getMessage().toString()); + } + } + + + + + + + + + + + + + + + + + +} + + + diff --git a/yunze-consumption-update/src/main/resources/application.yml b/yunze-consumption-update/src/main/resources/application.yml new file mode 100644 index 0000000..d86b3cb --- /dev/null +++ b/yunze-consumption-update/src/main/resources/application.yml @@ -0,0 +1,75 @@ +spring: + rabbitmq: + ####连接地址 + host: 127.0.0.1 + ####端口号 + port: 5672 + ####账号 + username: YunZeIotRabbitMq + ####密码 + password: 20220107@yzIot + ## 心跳 请求的心跳超时,以秒为单位; 零表示没有 + requested-heartbeat: 40 + ### 地址 + virtual-host: /VirtualHosts + listener: + simple: + retry: + ####开启消费者(程序出现异常的情况下会)进行重试 + enabled: true + ####最大重试次数 + max-attempts: 1 + ####重试间隔时间 + initial-interval: 3000 + #### 手动应答 manual 自动应答 auto + acknowledge-mode: auto + + application: + name: backup + datasource: + + url: jdbc:mysql://127.0.0.1/iotdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: iotdb + password: www.5iot.cn + + # redis 配置 + redis: + # 地址 + host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: Rdis20220107 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +# MyBatis配置 +mybatis: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + +logging: + level: + com: + iot: + business: + dao: trace + root: info + pattern: + console: "'%p%m%n'" + +server: + port: 8063 + diff --git a/yunze-consumption-update/src/main/resources/logback.xml b/yunze-consumption-update/src/main/resources/logback.xml new file mode 100644 index 0000000..f0350e6 --- /dev/null +++ b/yunze-consumption-update/src/main/resources/logback.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + DEBUG + + + ${LOG_PATTERN_CONSOLE} + + + + + + DEBUG + + + ${LOG_PATTERN_FILE} + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}.log + + + ${LOG_PATH}/${LOG_FILE}/${LOG_FILE}-%d{yyyy-MM-dd}.log + + 60 + + + + + + + + + \ No newline at end of file diff --git a/yunze-consumption-update/src/main/resources/mybatis/mybatis-config.xml b/yunze-consumption-update/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..e8b52be --- /dev/null +++ b/yunze-consumption-update/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/yunze-framework/pom.xml b/yunze-framework/pom.xml new file mode 100644 index 0000000..47c4122 --- /dev/null +++ b/yunze-framework/pom.xml @@ -0,0 +1,64 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + yunze-framework + + + framework框架核心 + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-aop + + + + + com.alibaba + druid-spring-boot-starter + + + + + com.github.penggle + kaptcha + + + javax.servlet-api + javax.servlet + + + + + + + com.github.oshi + oshi-core + + + + + com.yunze + yunze-system + + + + + \ No newline at end of file diff --git a/yunze-framework/src/main/java/com/yunze/framework/aspectj/DataScopeAspect.java b/yunze-framework/src/main/java/com/yunze/framework/aspectj/DataScopeAspect.java new file mode 100644 index 0000000..87fdd54 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/aspectj/DataScopeAspect.java @@ -0,0 +1,197 @@ +package com.yunze.framework.aspectj; + +import java.lang.reflect.Method; +import java.util.Map; + +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.Signature; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.stereotype.Component; +import com.yunze.common.annotation.DataScope; +import com.yunze.common.core.domain.BaseEntity; +import com.yunze.common.core.domain.entity.SysRole; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.framework.web.service.TokenService; + +/** + * 数据过滤处理 + * + * @author yunze + */ +@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"; + + // 配置织入点 + @Pointcut("@annotation(com.yunze.common.annotation.DataScope)") + public void dataScopePointCut() + { + } + + @Before("dataScopePointCut()") + public void doBefore(JoinPoint point) throws Throwable + { + clearDataScope(point); + handleDataScope(point); + } + + protected void handleDataScope(final JoinPoint joinPoint) + { + // 获得注解 + DataScope controllerDataScope = getAnnotationLog(joinPoint); + if (controllerDataScope == null) + { + return; + } + // 获取当前的用户 + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + if (StringUtils.isNotNull(loginUser)) + { + SysUser currentUser = loginUser.getUser(); + // 如果是超级管理员,则不过滤数据 + if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) + { + dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), + controllerDataScope.userAlias(),controllerDataScope.isMap()); + } + } + } + + /** + * 数据范围过滤 + * + * @param joinPoint 切点 + * @param user 用户 + * @param userAlias 别名 + */ + public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias,boolean isMap) + { + StringBuilder sqlString = new StringBuilder(); + + for (SysRole role : user.getRoles()) + { + String dataScope = role.getDataScope(); + 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 ) )", + 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(" OR 1=0 "); + } + } + } + + if (StringUtils.isNotBlank(sqlString.toString())) + { + Object params = joinPoint.getArgs()[0]; + + if(isMap==true){ + if (StringUtils.isNotNull(params)) + { + Map baseMap = (Map) params; + baseMap.put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); + } + }else{ + if (StringUtils.isNotNull(params) && params instanceof BaseEntity) + { + BaseEntity baseEntity = (BaseEntity) params; + baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); + } + } + + + + } + } + + /** + * 是否存在注解,如果存在就获取 + */ + private DataScope getAnnotationLog(JoinPoint joinPoint) + { + Signature signature = joinPoint.getSignature(); + MethodSignature methodSignature = (MethodSignature) signature; + Method method = methodSignature.getMethod(); + + if (method != null) + { + return method.getAnnotation(DataScope.class); + } + return null; + } + + /** + * 拼接权限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/yunze-framework/src/main/java/com/yunze/framework/aspectj/DataSourceAspect.java b/yunze-framework/src/main/java/com/yunze/framework/aspectj/DataSourceAspect.java new file mode 100644 index 0000000..87aaf2f --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/aspectj/DataSourceAspect.java @@ -0,0 +1,72 @@ +package com.yunze.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.yunze.common.annotation.DataSource; +import com.yunze.common.utils.StringUtils; +import com.yunze.framework.datasource.DynamicDataSourceContextHolder; + +/** + * 多数据源处理 + * + * @author yunze + */ +@Aspect +@Order(1) +@Component +public class DataSourceAspect +{ + protected Logger logger = LoggerFactory.getLogger(getClass()); + + @Pointcut("@annotation(com.yunze.common.annotation.DataSource)" + + "|| @within(com.yunze.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/yunze-framework/src/main/java/com/yunze/framework/aspectj/LogAspect.java b/yunze-framework/src/main/java/com/yunze/framework/aspectj/LogAspect.java new file mode 100644 index 0000000..3793fad --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/aspectj/LogAspect.java @@ -0,0 +1,244 @@ +package com.yunze.framework.aspectj; + +import java.lang.reflect.Method; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.Signature; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.AfterThrowing; +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.stereotype.Component; +import org.springframework.validation.BindingResult; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.HandlerMapping; +import com.alibaba.fastjson.JSON; +import com.yunze.common.annotation.Log; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.BusinessStatus; +import com.yunze.common.enums.HttpMethod; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.framework.manager.AsyncManager; +import com.yunze.framework.manager.factory.AsyncFactory; +import com.yunze.framework.web.service.TokenService; +import com.yunze.system.domain.SysOperLog; + +/** + * 操作日志记录处理 + * + * @author yunze + */ +@Aspect +@Component +public class LogAspect +{ + private static final Logger log = LoggerFactory.getLogger(LogAspect.class); + + // 配置织入点 + @Pointcut("@annotation(com.yunze.common.annotation.Log)") + public void logPointCut() + { + } + + /** + * 处理完请求后执行 + * + * @param joinPoint 切点 + */ + @AfterReturning(pointcut = "logPointCut()", returning = "jsonResult") + public void doAfterReturning(JoinPoint joinPoint, Object jsonResult) + { + handleLog(joinPoint, null, jsonResult); + } + + /** + * 拦截异常操作 + * + * @param joinPoint 切点 + * @param e 异常 + */ + @AfterThrowing(value = "logPointCut()", throwing = "e") + public void doAfterThrowing(JoinPoint joinPoint, Exception e) + { + handleLog(joinPoint, e, null); + } + + protected void handleLog(final JoinPoint joinPoint, final Exception e, Object jsonResult) + { + try + { + // 获得注解 + Log controllerLog = getAnnotationLog(joinPoint); + if (controllerLog == null) + { + return; + } + + // 获取当前的用户 + LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest()); + + // *========数据库日志=========*// + SysOperLog operLog = new SysOperLog(); + operLog.setStatus(BusinessStatus.SUCCESS.ordinal()); + // 请求的地址 + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + operLog.setOperIp(ip); + // 返回参数 + operLog.setJsonResult(JSON.toJSONString(jsonResult)); + + operLog.setOperUrl(ServletUtils.getRequest().getRequestURI()); + 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); + // 保存数据库 + AsyncManager.me().execute(AsyncFactory.recordOper(operLog)); + } + catch (Exception exp) + { + // 记录本地异常日志 + log.error("==前置通知异常=="); + log.error("异常信息:{}", exp.getMessage()); + exp.printStackTrace(); + } + } + + /** + * 获取注解中对方法的描述信息 用于Controller层注解 + * + * @param log 日志 + * @param operLog 操作日志 + * @throws Exception + */ + public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog) throws Exception + { + // 设置action动作 + operLog.setBusinessType(log.businessType().ordinal()); + // 设置标题 + operLog.setTitle(log.title()); + // 设置操作人类别 + operLog.setOperatorType(log.operatorType().ordinal()); + // 是否需要保存request,参数和值 + if (log.isSaveRequestData()) + { + // 获取参数的信息,传入到数据库中。 + setRequestValue(joinPoint, operLog); + } + } + + /** + * 获取请求的参数,放到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 = (Map) ServletUtils.getRequest().getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); + operLog.setOperParam(StringUtils.substring(paramsMap.toString(), 0, 2000)); + } + } + + /** + * 是否存在注解,如果存在就获取 + */ + private Log getAnnotationLog(JoinPoint joinPoint) throws Exception + { + Signature signature = joinPoint.getSignature(); + MethodSignature methodSignature = (MethodSignature) signature; + Method method = methodSignature.getMethod(); + + if (method != null) + { + return method.getAnnotation(Log.class); + } + return null; + } + + /** + * 参数拼装 + */ + private String argsArrayToString(Object[] paramsArray) + { + String params = ""; + if (paramsArray != null && paramsArray.length > 0) + { + for (int i = 0; i < paramsArray.length; i++) + { + if (StringUtils.isNotNull(paramsArray[i]) && !isFilterObject(paramsArray[i])) + { + Object jsonObj = JSON.toJSON(paramsArray[i]); + params += jsonObj.toString() + " "; + } + } + } + return params.trim(); + } + + /** + * 判断是否需要过滤的对象。 + * + * @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 (Iterator iter = collection.iterator(); iter.hasNext();) + { + return iter.next() instanceof MultipartFile; + } + } + else if (Map.class.isAssignableFrom(clazz)) + { + Map map = (Map) o; + for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) + { + Map.Entry entry = (Map.Entry) iter.next(); + return entry.getValue() instanceof MultipartFile; + } + } + return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse + || o instanceof BindingResult; + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/config/ApplicationConfig.java b/yunze-framework/src/main/java/com/yunze/framework/config/ApplicationConfig.java new file mode 100644 index 0000000..6dad2e6 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/ApplicationConfig.java @@ -0,0 +1,30 @@ +package com.yunze.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 yunze + */ +@Configuration +// 表示通过aop框架暴露该代理对象,AopContext能够访问 +@EnableAspectJAutoProxy(exposeProxy = true) +// 指定要扫描的Mapper类的包的路径 +@MapperScan("com.yunze.**.mapper") +public class ApplicationConfig +{ + /** + * 时区配置 + */ + @Bean + public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() + { + return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/config/CaptchaConfig.java b/yunze-framework/src/main/java/com/yunze/framework/config/CaptchaConfig.java new file mode 100644 index 0000000..b27184d --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/CaptchaConfig.java @@ -0,0 +1,83 @@ +package com.yunze.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 yunze + */ +@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.yunze.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/yunze-framework/src/main/java/com/yunze/framework/config/DruidConfig.java b/yunze-framework/src/main/java/com/yunze/framework/config/DruidConfig.java new file mode 100644 index 0000000..2f73672 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/DruidConfig.java @@ -0,0 +1,126 @@ +package com.yunze.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.yunze.common.enums.DataSourceType; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.framework.config.properties.DruidProperties; +import com.yunze.framework.datasource.DynamicDataSource; + +/** + * druid 配置多数据源 + * + * @author yunze + */ +@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/yunze-framework/src/main/java/com/yunze/framework/config/FastJson2JsonRedisSerializer.java b/yunze-framework/src/main/java/com/yunze/framework/config/FastJson2JsonRedisSerializer.java new file mode 100644 index 0000000..6d82bd8 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/FastJson2JsonRedisSerializer.java @@ -0,0 +1,71 @@ +package com.yunze.framework.config; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.SerializationException; +import com.alibaba.fastjson.parser.ParserConfig; +import org.springframework.util.Assert; +import java.nio.charset.Charset; + +/** + * Redis使用FastJson序列化 + * + * @author yunze + */ +public class FastJson2JsonRedisSerializer implements RedisSerializer +{ + @SuppressWarnings("unused") + private ObjectMapper objectMapper = new ObjectMapper(); + + public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); + + private Class clazz; + + static + { + ParserConfig.getGlobalInstance().setAutoTypeSupport(true); + } + + 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, SerializerFeature.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); + } + + public void setObjectMapper(ObjectMapper objectMapper) + { + Assert.notNull(objectMapper, "'objectMapper' must not be null"); + this.objectMapper = objectMapper; + } + + protected JavaType getJavaType(Class clazz) + { + return TypeFactory.defaultInstance().constructType(clazz); + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/config/FilterConfig.java b/yunze-framework/src/main/java/com/yunze/framework/config/FilterConfig.java new file mode 100644 index 0000000..abe5aaf --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/FilterConfig.java @@ -0,0 +1,60 @@ +package com.yunze.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.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.yunze.common.filter.RepeatableFilter; +import com.yunze.common.filter.XssFilter; +import com.yunze.common.utils.StringUtils; + +/** + * Filter配置 + * + * @author yunze + */ +@Configuration +public class FilterConfig +{ + @Value("${xss.enabled}") + private String enabled; + + @Value("${xss.excludes}") + private String excludes; + + @Value("${xss.urlPatterns}") + private String urlPatterns; + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Bean + 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); + initParameters.put("enabled", enabled); + 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/yunze-framework/src/main/java/com/yunze/framework/config/KaptchaTextCreator.java b/yunze-framework/src/main/java/com/yunze/framework/config/KaptchaTextCreator.java new file mode 100644 index 0000000..ba9268a --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/KaptchaTextCreator.java @@ -0,0 +1,75 @@ +package com.yunze.framework.config; + +import java.util.Random; +import com.google.code.kaptcha.text.impl.DefaultTextCreator; + +/** + * 验证码文本生成器 + * + * @author yunze + */ +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 = (int) Math.round(Math.random() * 2); + 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 (randomoperands == 2) + { + 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]); + } + } + else + { + result = x + y; + suChinese.append(CNUMBERS[x]); + suChinese.append("+"); + suChinese.append(CNUMBERS[y]); + } + suChinese.append("=?@" + result); + return suChinese.toString(); + } +} \ No newline at end of file diff --git a/yunze-framework/src/main/java/com/yunze/framework/config/MyBatisConfig.java b/yunze-framework/src/main/java/com/yunze/framework/config/MyBatisConfig.java new file mode 100644 index 0000000..c709f12 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/MyBatisConfig.java @@ -0,0 +1,132 @@ +package com.yunze.framework.config; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import javax.sql.DataSource; +import org.apache.ibatis.io.VFS; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionFactoryBean; +import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.io.DefaultResourceLoader; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; +import org.springframework.core.type.classreading.CachingMetadataReaderFactory; +import org.springframework.core.type.classreading.MetadataReader; +import org.springframework.core.type.classreading.MetadataReaderFactory; +import org.springframework.util.ClassUtils; +import com.yunze.common.utils.StringUtils; + +/** + * Mybatis支持*匹配扫描包 + * + * @author yunze + */ +@Configuration +public class MyBatisConfig +{ + @Autowired + private Environment env; + + static final String DEFAULT_RESOURCE_PATTERN = "**/*.class"; + + public static String setTypeAliasesPackage(String typeAliasesPackage) + { + ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver(); + MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver); + List allResult = new ArrayList(); + try + { + for (String aliasesPackage : typeAliasesPackage.split(",")) + { + List result = new ArrayList(); + aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN; + Resource[] resources = resolver.getResources(aliasesPackage); + if (resources != null && resources.length > 0) + { + MetadataReader metadataReader = null; + for (Resource resource : resources) + { + if (resource.isReadable()) + { + metadataReader = metadataReaderFactory.getMetadataReader(resource); + try + { + result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName()); + } + catch (ClassNotFoundException e) + { + e.printStackTrace(); + } + } + } + } + if (result.size() > 0) + { + HashSet hashResult = new HashSet(result); + allResult.addAll(hashResult); + } + } + if (allResult.size() > 0) + { + typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0])); + } + else + { + throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包"); + } + } + catch (IOException e) + { + e.printStackTrace(); + } + return typeAliasesPackage; + } + + public Resource[] resolveMapperLocations(String[] mapperLocations) + { + ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(); + List resources = new ArrayList(); + if (mapperLocations != null) + { + for (String mapperLocation : mapperLocations) + { + try + { + Resource[] mappers = resourceResolver.getResources(mapperLocation); + resources.addAll(Arrays.asList(mappers)); + } + catch (IOException e) + { + // ignore + } + } + } + return resources.toArray(new Resource[resources.size()]); + } + + @Bean + public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception + { + String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); + String mapperLocations = env.getProperty("mybatis.mapperLocations"); + String configLocation = env.getProperty("mybatis.configLocation"); + typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); + VFS.addImplClass(SpringBootVFS.class); + + final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); + sessionFactory.setDataSource(dataSource); + sessionFactory.setTypeAliasesPackage(typeAliasesPackage); + sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); + sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); + return sessionFactory.getObject(); + } +} \ No newline at end of file diff --git a/yunze-framework/src/main/java/com/yunze/framework/config/RedisConfig.java b/yunze-framework/src/main/java/com/yunze/framework/config/RedisConfig.java new file mode 100644 index 0000000..e8d6387 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/RedisConfig.java @@ -0,0 +1,50 @@ +package com.yunze.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.core.RedisTemplate; +import org.springframework.data.redis.serializer.StringRedisSerializer; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; + +/** + * redis配置 + * + * @author yunze + */ +@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); + + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); + serializer.setObjectMapper(mapper); + + // 使用StringRedisSerializer来序列化和反序列化redis的key值 + template.setKeySerializer(new StringRedisSerializer()); + template.setValueSerializer(serializer); + + // Hash的key也采用StringRedisSerializer的序列化方式 + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(serializer); + + template.afterPropertiesSet(); + return template; + } +} \ No newline at end of file diff --git a/yunze-framework/src/main/java/com/yunze/framework/config/ResourcesConfig.java b/yunze-framework/src/main/java/com/yunze/framework/config/ResourcesConfig.java new file mode 100644 index 0000000..b5ed5e2 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/ResourcesConfig.java @@ -0,0 +1,66 @@ +package com.yunze.framework.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +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.yunze.common.config.YunZeConfig; +import com.yunze.common.constant.Constants; +import com.yunze.framework.interceptor.RepeatSubmitInterceptor; + +/** + * 通用配置 + * + * @author yunze + */ +@Configuration +public class ResourcesConfig implements WebMvcConfigurer +{ + @Autowired + private RepeatSubmitInterceptor repeatSubmitInterceptor; + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) + { + /** 本地文件上传路径 */ + registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + YunZeConfig.getProfile() + "/"); + + /** swagger配置 */ + registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); + } + + /** + * 自定义拦截规则 + */ + @Override + public void addInterceptors(InterceptorRegistry registry) + { + registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**"); + } + + /** + * 跨域配置 + */ + @Bean + public CorsFilter corsFilter() + { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + // 设置访问源地址 + config.addAllowedOrigin("*"); + // 设置访问源请求头 + config.addAllowedHeader("*"); + // 设置访问源请求方法 + config.addAllowedMethod("*"); + // 对接口配置跨域设置 + source.registerCorsConfiguration("/**", config); + return new CorsFilter(source); + } +} \ No newline at end of file diff --git a/yunze-framework/src/main/java/com/yunze/framework/config/SecurityConfig.java b/yunze-framework/src/main/java/com/yunze/framework/config/SecurityConfig.java new file mode 100644 index 0000000..52c752d --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/SecurityConfig.java @@ -0,0 +1,148 @@ +package com.yunze.framework.config; + +import org.springframework.beans.factory.annotation.Autowired; +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.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.yunze.framework.security.filter.JwtAuthenticationTokenFilter; +import com.yunze.framework.security.handle.AuthenticationEntryPointImpl; +import com.yunze.framework.security.handle.LogoutSuccessHandlerImpl; + +/** + * spring security配置 + * + * @author yunze + */ +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class SecurityConfig extends WebSecurityConfigurerAdapter +{ + /** + * 自定义用户认证逻辑 + */ + @Autowired + private UserDetailsService userDetailsService; + + /** + * 认证失败处理类 + */ + @Autowired + private AuthenticationEntryPointImpl unauthorizedHandler; + + /** + * 退出处理类 + */ + @Autowired + private LogoutSuccessHandlerImpl logoutSuccessHandler; + + /** + * token认证过滤器 + */ + @Autowired + private JwtAuthenticationTokenFilter authenticationTokenFilter; + + /** + * 跨域过滤器 + */ + @Autowired + private CorsFilter corsFilter; + + /** + * 解决 无法直接注入 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 + { + httpSecurity + // CSRF禁用,因为不使用session + .csrf().disable() + // 认证失败处理类 + .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() + // 基于token,所以不需要session + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() + // 过滤请求 + .authorizeRequests() + // 对于登录login 验证码captchaImage 允许匿名访问 + .antMatchers("/login", "/captchaImage").anonymous() + .antMatchers("/yunze/ExecutionTask/download","/yunze/ExecutionTask/downloadConversion").anonymous()//放行下载 + .antMatchers( + HttpMethod.GET, + "/*.html", + "/**/*.html", + "/**/*.css", + "/**/*.js" + ).permitAll() + .antMatchers("/profile/**").anonymous() + .antMatchers("/common/download**").anonymous() + .antMatchers("/common/download/resource**").anonymous() + .antMatchers("/swagger-ui.html").anonymous() + .antMatchers("/swagger-resources/**").anonymous() + .antMatchers("/webjars/**").anonymous() + .antMatchers("/*/api-docs").anonymous() + .antMatchers("/druid/**").anonymous() + .antMatchers("/yunze/productPic/readImage").anonymous() + // 除上面外的所有请求全部需要鉴权认证 ,"" + .anyRequest().authenticated() + .and() + .headers().frameOptions().disable(); + 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.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/config/ServerConfig.java b/yunze-framework/src/main/java/com/yunze/framework/config/ServerConfig.java new file mode 100644 index 0000000..fcd18aa --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/ServerConfig.java @@ -0,0 +1,32 @@ +package com.yunze.framework.config; + +import javax.servlet.http.HttpServletRequest; +import org.springframework.stereotype.Component; +import com.yunze.common.utils.ServletUtils; + +/** + * 服务相关配置 + * + * @author yunze + */ +@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/yunze-framework/src/main/java/com/yunze/framework/config/ThreadPoolConfig.java b/yunze-framework/src/main/java/com/yunze/framework/config/ThreadPoolConfig.java new file mode 100644 index 0000000..2bd265d --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/ThreadPoolConfig.java @@ -0,0 +1,62 @@ +package com.yunze.framework.config; + +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; +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 com.yunze.common.utils.Threads; + +/** + * 线程池配置 + * + * @author yunze + **/ +@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()) + { + @Override + protected void afterExecute(Runnable r, Throwable t) + { + super.afterExecute(r, t); + Threads.printException(r, t); + } + }; + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/config/properties/DruidProperties.java b/yunze-framework/src/main/java/com/yunze/framework/config/properties/DruidProperties.java new file mode 100644 index 0000000..8d1d0f1 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/config/properties/DruidProperties.java @@ -0,0 +1,77 @@ +package com.yunze.framework.config.properties; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import com.alibaba.druid.pool.DruidDataSource; + +/** + * druid 配置属性 + * + * @author yunze + */ +@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/yunze-framework/src/main/java/com/yunze/framework/datasource/DynamicDataSource.java b/yunze-framework/src/main/java/com/yunze/framework/datasource/DynamicDataSource.java new file mode 100644 index 0000000..65804ae --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/datasource/DynamicDataSource.java @@ -0,0 +1,26 @@ +package com.yunze.framework.datasource; + +import java.util.Map; +import javax.sql.DataSource; +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +/** + * 动态数据源 + * + * @author yunze + */ +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/yunze-framework/src/main/java/com/yunze/framework/datasource/DynamicDataSourceContextHolder.java b/yunze-framework/src/main/java/com/yunze/framework/datasource/DynamicDataSourceContextHolder.java new file mode 100644 index 0000000..08dfd00 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/datasource/DynamicDataSourceContextHolder.java @@ -0,0 +1,45 @@ +package com.yunze.framework.datasource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 数据源切换处理 + * + * @author yunze + */ +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/yunze-framework/src/main/java/com/yunze/framework/interceptor/RepeatSubmitInterceptor.java b/yunze-framework/src/main/java/com/yunze/framework/interceptor/RepeatSubmitInterceptor.java new file mode 100644 index 0000000..8b6c2cf --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/interceptor/RepeatSubmitInterceptor.java @@ -0,0 +1,55 @@ +package com.yunze.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.handler.HandlerInterceptorAdapter; +import com.alibaba.fastjson.JSONObject; +import com.yunze.common.annotation.RepeatSubmit; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.utils.ServletUtils; + +/** + * 防止重复提交拦截器 + * + * @author yunze + */ +@Component +public abstract class RepeatSubmitInterceptor extends HandlerInterceptorAdapter +{ + @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 (this.isRepeatSubmit(request)) + { + AjaxResult ajaxResult = AjaxResult.error("不允许重复提交,请稍后再试"); + ServletUtils.renderString(response, JSONObject.toJSONString(ajaxResult)); + return false; + } + } + return true; + } + else + { + return super.preHandle(request, response, handler); + } + } + + /** + * 验证是否重复提交由子类实现具体的防重复提交的规则 + * + * @param request + * @return + * @throws Exception + */ + public abstract boolean isRepeatSubmit(HttpServletRequest request); +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/interceptor/impl/SameUrlDataInterceptor.java b/yunze-framework/src/main/java/com/yunze/framework/interceptor/impl/SameUrlDataInterceptor.java new file mode 100644 index 0000000..9af1e11 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/interceptor/impl/SameUrlDataInterceptor.java @@ -0,0 +1,126 @@ +package com.yunze.framework.interceptor.impl; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import com.alibaba.fastjson.JSONObject; +import com.yunze.common.constant.Constants; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.filter.RepeatedlyRequestWrapper; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.http.HttpHelper; +import com.yunze.framework.interceptor.RepeatSubmitInterceptor; + +/** + * 判断请求url和数据是否和上一次相同, + * 如果和上次相同,则是重复提交表单。 有效时间为10秒内。 + * + * @author yunze + */ +@Component +public class SameUrlDataInterceptor extends RepeatSubmitInterceptor +{ + public final String REPEAT_PARAMS = "repeatParams"; + + public final String REPEAT_TIME = "repeatTime"; + + // 令牌自定义标识 + @Value("${token.header}") + private String header; + + @Resource + private RedisCache redisCache; + + /** + * 间隔时间,单位:秒 默认10秒 + * + * 两次相同参数的请求,如果间隔时间大于该参数,系统不会认定为重复提交的数据 + */ + private int intervalTime = 10; + + public void setIntervalTime(int intervalTime) + { + this.intervalTime = intervalTime; + } + + @SuppressWarnings("unchecked") + @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 = JSONObject.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 = request.getHeader(header); + if (StringUtils.isEmpty(submitKey)) + { + submitKey = url; + } + + // 唯一标识(指定key + 消息头) + String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + submitKey; + + Object sessionObj = redisCache.getCacheObject(cacheRepeatKey); + if (sessionObj != null) + { + Map sessionMap = (Map) sessionObj; + if (sessionMap.containsKey(url)) + { + Map preDataMap = (Map) sessionMap.get(url); + if (compareParams(nowDataMap, preDataMap) && compareTime(nowDataMap, preDataMap)) + { + return true; + } + } + } + Map cacheMap = new HashMap(); + cacheMap.put(url, nowDataMap); + redisCache.setCacheObject(cacheRepeatKey, cacheMap, intervalTime, TimeUnit.SECONDS); + 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) + { + long time1 = (Long) nowMap.get(REPEAT_TIME); + long time2 = (Long) preMap.get(REPEAT_TIME); + if ((time1 - time2) < (this.intervalTime * 1000)) + { + return true; + } + return false; + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/manager/AsyncManager.java b/yunze-framework/src/main/java/com/yunze/framework/manager/AsyncManager.java new file mode 100644 index 0000000..cc32f2b --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/manager/AsyncManager.java @@ -0,0 +1,55 @@ +package com.yunze.framework.manager; + +import java.util.TimerTask; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import com.yunze.common.utils.Threads; +import com.yunze.common.utils.spring.SpringUtils; + +/** + * 异步任务管理器 + * + * @author yunze + */ +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/yunze-framework/src/main/java/com/yunze/framework/manager/ShutdownManager.java b/yunze-framework/src/main/java/com/yunze/framework/manager/ShutdownManager.java new file mode 100644 index 0000000..0c24c76 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/manager/ShutdownManager.java @@ -0,0 +1,39 @@ +package com.yunze.framework.manager; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import javax.annotation.PreDestroy; + +/** + * 确保应用退出时能关闭后台线程 + * + * @author yunze + */ +@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/yunze-framework/src/main/java/com/yunze/framework/manager/factory/AsyncFactory.java b/yunze-framework/src/main/java/com/yunze/framework/manager/factory/AsyncFactory.java new file mode 100644 index 0000000..248d637 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/manager/factory/AsyncFactory.java @@ -0,0 +1,101 @@ +package com.yunze.framework.manager.factory; + +import java.util.TimerTask; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.yunze.common.constant.Constants; +import com.yunze.common.utils.LogUtils; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.AddressUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.system.domain.SysLogininfor; +import com.yunze.system.domain.SysOperLog; +import com.yunze.system.service.ISysLogininforService; +import com.yunze.system.service.ISysOperLogService; +import eu.bitwalker.useragentutils.UserAgent; + +/** + * 异步工厂(产生任务用) + * + * @author yunze + */ +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 (Constants.LOGIN_SUCCESS.equals(status) || Constants.LOGOUT.equals(status)) + { + 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/yunze-framework/src/main/java/com/yunze/framework/security/filter/JwtAuthenticationTokenFilter.java b/yunze-framework/src/main/java/com/yunze/framework/security/filter/JwtAuthenticationTokenFilter.java new file mode 100644 index 0000000..f617ec5 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/security/filter/JwtAuthenticationTokenFilter.java @@ -0,0 +1,44 @@ +package com.yunze.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.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.framework.web.service.TokenService; + +/** + * token过滤器 验证token有效性 + * + * @author yunze + */ +@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/yunze-framework/src/main/java/com/yunze/framework/security/handle/AuthenticationEntryPointImpl.java b/yunze-framework/src/main/java/com/yunze/framework/security/handle/AuthenticationEntryPointImpl.java new file mode 100644 index 0000000..4bb91d6 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/security/handle/AuthenticationEntryPointImpl.java @@ -0,0 +1,34 @@ +package com.yunze.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.fastjson.JSON; +import com.yunze.common.constant.HttpStatus; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; + +/** + * 认证失败处理类 返回未授权 + * + * @author yunze + */ +@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/yunze-framework/src/main/java/com/yunze/framework/security/handle/LogoutSuccessHandlerImpl.java b/yunze-framework/src/main/java/com/yunze/framework/security/handle/LogoutSuccessHandlerImpl.java new file mode 100644 index 0000000..d16c2bf --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/security/handle/LogoutSuccessHandlerImpl.java @@ -0,0 +1,53 @@ +package com.yunze.framework.security.handle; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +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 com.alibaba.fastjson.JSON; +import com.yunze.common.constant.Constants; +import com.yunze.common.constant.HttpStatus; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.framework.manager.AsyncManager; +import com.yunze.framework.manager.factory.AsyncFactory; +import com.yunze.framework.web.service.TokenService; + +/** + * 自定义退出处理类 返回成功 + * + * @author yunze + */ +@Configuration +public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler +{ + @Autowired + private TokenService tokenService; + + /** + * 退出处理 + * + * @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()); + // 记录用户退出日志 + AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功")); + } + ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(HttpStatus.SUCCESS, "退出成功"))); + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/web/domain/Server.java b/yunze-framework/src/main/java/com/yunze/framework/web/domain/Server.java new file mode 100644 index 0000000..ffdcd13 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/domain/Server.java @@ -0,0 +1,240 @@ +package com.yunze.framework.web.domain; + +import java.net.UnknownHostException; +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; +import com.yunze.common.utils.Arith; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.framework.web.domain.server.Cpu; +import com.yunze.framework.web.domain.server.Jvm; +import com.yunze.framework.web.domain.server.Mem; +import com.yunze.framework.web.domain.server.Sys; +import com.yunze.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 yunze + */ +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/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Cpu.java b/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Cpu.java new file mode 100644 index 0000000..a139644 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Cpu.java @@ -0,0 +1,101 @@ +package com.yunze.framework.web.domain.server; + +import com.yunze.common.utils.Arith; + +/** + * CPU相关信息 + * + * @author yunze + */ +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/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Jvm.java b/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Jvm.java new file mode 100644 index 0000000..b3a558b --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Jvm.java @@ -0,0 +1,122 @@ +package com.yunze.framework.web.domain.server; + +import java.lang.management.ManagementFactory; +import com.yunze.common.utils.Arith; +import com.yunze.common.utils.DateUtils; + +/** + * JVM相关信息 + * + * @author yunze + */ +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()); + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Mem.java b/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Mem.java new file mode 100644 index 0000000..bcd5c77 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Mem.java @@ -0,0 +1,61 @@ +package com.yunze.framework.web.domain.server; + +import com.yunze.common.utils.Arith; + +/** + * 內存相关信息 + * + * @author yunze + */ +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/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Sys.java b/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Sys.java new file mode 100644 index 0000000..4b19791 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/Sys.java @@ -0,0 +1,84 @@ +package com.yunze.framework.web.domain.server; + +/** + * 系统相关信息 + * + * @author yunze + */ +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/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/SysFile.java b/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/SysFile.java new file mode 100644 index 0000000..0507adf --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/domain/server/SysFile.java @@ -0,0 +1,114 @@ +package com.yunze.framework.web.domain.server; + +/** + * 系统文件相关信息 + * + * @author yunze + */ +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/yunze-framework/src/main/java/com/yunze/framework/web/exception/GlobalExceptionHandler.java b/yunze-framework/src/main/java/com/yunze/framework/web/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000..46f582c --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/exception/GlobalExceptionHandler.java @@ -0,0 +1,117 @@ +package com.yunze.framework.web.exception; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.AccountExpiredException; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.validation.BindException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.NoHandlerFoundException; +import com.yunze.common.constant.HttpStatus; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.exception.BaseException; +import com.yunze.common.exception.CustomException; +import com.yunze.common.exception.DemoModeException; +import com.yunze.common.utils.StringUtils; + +/** + * 全局异常处理器 + * + * @author yunze + */ +@RestControllerAdvice +public class GlobalExceptionHandler +{ + private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); + + /** + * 基础异常 + */ + @ExceptionHandler(BaseException.class) + public AjaxResult baseException(BaseException e) + { + return AjaxResult.error(e.getMessage()); + } + + /** + * 业务异常 + */ + @ExceptionHandler(CustomException.class) + public AjaxResult businessException(CustomException e) + { + if (StringUtils.isNull(e.getCode())) + { + return AjaxResult.error(e.getMessage()); + } + return AjaxResult.error(e.getCode(), e.getMessage()); + } + + @ExceptionHandler(NoHandlerFoundException.class) + public AjaxResult handlerNoFoundException(Exception e) + { + log.error(e.getMessage(), e); + return AjaxResult.error(HttpStatus.NOT_FOUND, "路径不存在,请检查路径是否正确"); + } + + @ExceptionHandler(AccessDeniedException.class) + public AjaxResult handleAuthorizationException(AccessDeniedException e) + { + log.error(e.getMessage()); + return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权"); + } + + @ExceptionHandler(AccountExpiredException.class) + public AjaxResult handleAccountExpiredException(AccountExpiredException e) + { + log.error(e.getMessage(), e); + return AjaxResult.error(e.getMessage()); + } + + @ExceptionHandler(UsernameNotFoundException.class) + public AjaxResult handleUsernameNotFoundException(UsernameNotFoundException e) + { + log.error(e.getMessage(), e); + return AjaxResult.error(e.getMessage()); + } + + @ExceptionHandler(Exception.class) + public AjaxResult handleException(Exception e) + { + log.error(e.getMessage(), e); + return AjaxResult.error(e.getMessage()); + } + + /** + * 自定义验证异常 + */ + @ExceptionHandler(BindException.class) + public AjaxResult validatedBindException(BindException e) + { + log.error(e.getMessage(), e); + String message = e.getAllErrors().get(0).getDefaultMessage(); + return AjaxResult.error(message); + } + + /** + * 自定义验证异常 + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public Object validExceptionHandler(MethodArgumentNotValidException e) + { + log.error(e.getMessage(), e); + String message = e.getBindingResult().getFieldError().getDefaultMessage(); + return AjaxResult.error(message); + } + + /** + * 演示模式异常 + */ + @ExceptionHandler(DemoModeException.class) + public AjaxResult demoModeException(DemoModeException e) + { + return AjaxResult.error("演示模式,不允许操作"); + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/web/service/PermissionService.java b/yunze-framework/src/main/java/com/yunze/framework/web/service/PermissionService.java new file mode 100644 index 0000000..f211ef4 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/service/PermissionService.java @@ -0,0 +1,169 @@ +package com.yunze.framework.web.service; + +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import com.yunze.common.core.domain.entity.SysRole; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; + +/** + * YunZe首创 自定义权限实现,ss取自SpringSecurity首字母 + * + * @author yunze + */ +@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 = ","; + + @Autowired + private TokenService tokenService; + + /** + * 验证用户是否具备某权限 + * + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + public boolean hasPermi(String permission) + { + if (StringUtils.isEmpty(permission)) + { + return false; + } + LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) + { + return false; + } + 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 = tokenService.getLoginUser(ServletUtils.getRequest()); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) + { + return false; + } + 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 = tokenService.getLoginUser(ServletUtils.getRequest()); + 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 = tokenService.getLoginUser(ServletUtils.getRequest()); + 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/yunze-framework/src/main/java/com/yunze/framework/web/service/SysLoginService.java b/yunze-framework/src/main/java/com/yunze/framework/web/service/SysLoginService.java new file mode 100644 index 0000000..a899c59 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/service/SysLoginService.java @@ -0,0 +1,107 @@ +package com.yunze.framework.web.service; + +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Autowired; +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 com.yunze.common.constant.Constants; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.exception.CustomException; +import com.yunze.common.exception.user.CaptchaException; +import com.yunze.common.exception.user.CaptchaExpireException; +import com.yunze.common.exception.user.UserPasswordNotMatchException; +import com.yunze.common.utils.DateUtils; +import com.yunze.common.utils.MessageUtils; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.framework.manager.AsyncManager; +import com.yunze.framework.manager.factory.AsyncFactory; +import com.yunze.system.service.ISysUserService; + +/** + * 登录校验方法 + * + * @author yunze + */ +@Component +public class SysLoginService +{ + @Autowired + private TokenService tokenService; + + @Resource + private AuthenticationManager authenticationManager; + + @Resource + private RedisCache redisCache; + + @Autowired + private ISysUserService userService; + + /** + * 登录验证 + * + * @param username 用户名 + * @param password 密码 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public String login(String username, String password, String code, String uuid) + { + String verifyKey = Constants.CAPTCHA_CODE_KEY + 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(); + } + // 用户验证 + Authentication authentication = null; + try + { + // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername + authentication = authenticationManager + .authenticate(new UsernamePasswordAuthenticationToken(username, password)); + } + 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 CustomException(e.getMessage()); + } + } + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); + LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + recordLoginInfo(loginUser.getUser()); + // 生成token + return tokenService.createToken(loginUser); + } + + /** + * 记录登录信息 + */ + public void recordLoginInfo(SysUser user) + { + user.setLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest())); + user.setLoginDate(DateUtils.getNowDate()); + userService.updateUserProfile(user); + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/web/service/SysPermissionService.java b/yunze-framework/src/main/java/com/yunze/framework/web/service/SysPermissionService.java new file mode 100644 index 0000000..af16d67 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/service/SysPermissionService.java @@ -0,0 +1,66 @@ +package com.yunze.framework.web.service; + +import java.util.HashSet; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.system.service.ISysMenuService; +import com.yunze.system.service.ISysRoleService; + +/** + * 用户权限处理 + * + * @author yunze + */ +@Component +public class SysPermissionService +{ + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysMenuService menuService; + + /** + * 获取角色数据权限 + * + * @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 + { + perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); + } + return perms; + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/web/service/TokenService.java b/yunze-framework/src/main/java/com/yunze/framework/web/service/TokenService.java new file mode 100644 index 0000000..f298727 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/service/TokenService.java @@ -0,0 +1,247 @@ +package com.yunze.framework.web.service; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import com.yunze.common.constant.Constants; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.ip.AddressUtils; +import com.yunze.common.utils.ip.IpUtils; +import com.yunze.common.utils.uuid.IdUtils; +import eu.bitwalker.useragentutils.UserAgent; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; + +/** + * token验证处理 + * + * @author yunze + */ +@Component +public class TokenService +{ + // 令牌自定义标识 + @Value("${token.header}") + private String header; + + // 令牌秘钥 + @Value("${token.secret}") + private String secret; + + // 令牌有效期(默认180分钟) + @Value("${token.expireTime}") + private int expireTime; + + 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; + + @Resource + private RedisCache redisCache; + + /** + * 获取用户身份信息 + * + * @return 用户信息 + */ + public LoginUser getLoginUser(HttpServletRequest request) + { + // 获取请求携带的令牌 + String token = getToken(request); + if (StringUtils.isNotEmpty(token)) + { + Claims claims = parseToken(token); + // 解析对应的权限以及用户信息 + String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); + String userKey = getTokenKey(uuid); + LoginUser user = redisCache.getCacheObject(userKey); + return user; + } + return null; + } + + + /** + * 获取用户身份信息 + * + * @return 用户信息 + */ + public LoginUser getLoginUser(String token) + { + // 获取请求携带的令牌 + 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){ + System.out.println(e.getCause().toString()); + } + + } + return null; + } + + + /** + * 设置用户身份信息 + */ + public void setLoginUser(LoginUser loginUser) + { + if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken())) + { + refreshToken(loginUser); + } + } + + /** + * 删除用户身份信息 + */ + public void delLoginUser(String token) + { + if (StringUtils.isNotEmpty(token)) + { + String userKey = getTokenKey(token); + redisCache.deleteObject(userKey); + } + } + + /** + * 创建令牌 + * + * @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()); + redisCache.setCacheObject(userKey, loginUser, 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()); + } + + /** + * 从数据声明生成令牌 + * + * @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 Constants.LOGIN_TOKEN_KEY + uuid; + } +} diff --git a/yunze-framework/src/main/java/com/yunze/framework/web/service/UserDetailsServiceImpl.java b/yunze-framework/src/main/java/com/yunze/framework/web/service/UserDetailsServiceImpl.java new file mode 100644 index 0000000..976bff6 --- /dev/null +++ b/yunze-framework/src/main/java/com/yunze/framework/web/service/UserDetailsServiceImpl.java @@ -0,0 +1,60 @@ +package com.yunze.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.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.enums.UserStatus; +import com.yunze.common.exception.BaseException; +import com.yunze.common.utils.StringUtils; +import com.yunze.system.service.ISysUserService; + +/** + * 用户验证处理 + * + * @author yunze + */ +@Service +public class UserDetailsServiceImpl implements UserDetailsService +{ + private static final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class); + + @Autowired + private ISysUserService userService; + + @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 UsernameNotFoundException("登录用户:" + username + " 不存在"); + } + else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) + { + log.info("登录用户:{} 已被删除.", username); + throw new BaseException("对不起,您的账号:" + username + " 已被删除"); + } + else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) + { + log.info("登录用户:{} 已被停用.", username); + throw new BaseException("对不起,您的账号:" + username + " 已停用"); + } + + return createLoginUser(user); + } + + public UserDetails createLoginUser(SysUser user) + { + return new LoginUser(user, permissionService.getMenuPermission(user)); + } +} diff --git a/yunze-framework/yunze-framework.iml b/yunze-framework/yunze-framework.iml new file mode 100644 index 0000000..da22de9 --- /dev/null +++ b/yunze-framework/yunze-framework.iml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-generator/pom.xml b/yunze-generator/pom.xml new file mode 100644 index 0000000..559279d --- /dev/null +++ b/yunze-generator/pom.xml @@ -0,0 +1,40 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + yunze-generator + + + generator代码生成 + + + + + + + org.apache.velocity + velocity + + + + + commons-collections + commons-collections + + + + + com.yunze + yunze-common + + + + + \ No newline at end of file diff --git a/yunze-generator/src/main/java/com/yunze/generator/config/GenConfig.java b/yunze-generator/src/main/java/com/yunze/generator/config/GenConfig.java new file mode 100644 index 0000000..e410bdb --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/config/GenConfig.java @@ -0,0 +1,73 @@ +package com.yunze.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 yunze + */ +@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/yunze-generator/src/main/java/com/yunze/generator/controller/GenController.java b/yunze-generator/src/main/java/com/yunze/generator/controller/GenController.java new file mode 100644 index 0000000..86665e6 --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/controller/GenController.java @@ -0,0 +1,214 @@ +package com.yunze.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.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.core.text.Convert; +import com.yunze.common.enums.BusinessType; +import com.yunze.generator.domain.GenTable; +import com.yunze.generator.domain.GenTableColumn; +import com.yunze.generator.service.IGenTableColumnService; +import com.yunze.generator.service.IGenTableService; + +/** + * 代码生成 操作处理 + * + * @author yunze + */ +@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 = "/{talbleId}") + public AjaxResult getInfo(@PathVariable Long talbleId) + { + GenTable table = genTableService.selectGenTableById(talbleId); + List tables = genTableService.selectGenTableAll(); + List list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); + Map map = new HashMap(); + map.put("info", table); + map.put("rows", list); + map.put("tables", tables); + return AjaxResult.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/{talbleId}") + 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 AjaxResult.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 AjaxResult.success(); + } + + /** + * 删除代码生成 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:remove')") + @Log(title = "代码生成", businessType = BusinessType.DELETE) + @DeleteMapping("/{tableIds}") + public AjaxResult remove(@PathVariable Long[] tableIds) + { + genTableService.deleteGenTableByIds(tableIds); + return AjaxResult.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 AjaxResult.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 AjaxResult.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 AjaxResult.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=\"yunze.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/yunze-generator/src/main/java/com/yunze/generator/domain/GenTable.java b/yunze-generator/src/main/java/com/yunze/generator/domain/GenTable.java new file mode 100644 index 0000000..4dfc08f --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/domain/GenTable.java @@ -0,0 +1,372 @@ +package com.yunze.generator.domain; + +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.apache.commons.lang3.ArrayUtils; +import com.yunze.common.constant.GenConstants; +import com.yunze.common.core.domain.BaseEntity; +import com.yunze.common.utils.StringUtils; + +/** + * 业务表 gen_table + * + * @author yunze + */ +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/yunze-generator/src/main/java/com/yunze/generator/domain/GenTableColumn.java b/yunze-generator/src/main/java/com/yunze/generator/domain/GenTableColumn.java new file mode 100644 index 0000000..0ee2488 --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/domain/GenTableColumn.java @@ -0,0 +1,373 @@ +package com.yunze.generator.domain; + +import javax.validation.constraints.NotBlank; +import com.yunze.common.core.domain.BaseEntity; +import com.yunze.common.utils.StringUtils; + +/** + * 代码生成业务字段表 gen_table_column + * + * @author yunze + */ +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/yunze-generator/src/main/java/com/yunze/generator/mapper/GenTableColumnMapper.java b/yunze-generator/src/main/java/com/yunze/generator/mapper/GenTableColumnMapper.java new file mode 100644 index 0000000..b1f52d1 --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/mapper/GenTableColumnMapper.java @@ -0,0 +1,60 @@ +package com.yunze.generator.mapper; + +import java.util.List; +import com.yunze.generator.domain.GenTableColumn; + +/** + * 业务字段 数据层 + * + * @author yunze + */ +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/yunze-generator/src/main/java/com/yunze/generator/mapper/GenTableMapper.java b/yunze-generator/src/main/java/com/yunze/generator/mapper/GenTableMapper.java new file mode 100644 index 0000000..7be4e68 --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/mapper/GenTableMapper.java @@ -0,0 +1,83 @@ +package com.yunze.generator.mapper; + +import java.util.List; +import com.yunze.generator.domain.GenTable; + +/** + * 业务 数据层 + * + * @author yunze + */ +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/yunze-generator/src/main/java/com/yunze/generator/service/GenTableColumnServiceImpl.java b/yunze-generator/src/main/java/com/yunze/generator/service/GenTableColumnServiceImpl.java new file mode 100644 index 0000000..f8c9926 --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/service/GenTableColumnServiceImpl.java @@ -0,0 +1,68 @@ +package com.yunze.generator.service; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.yunze.common.core.text.Convert; +import com.yunze.generator.domain.GenTableColumn; +import com.yunze.generator.mapper.GenTableColumnMapper; + +/** + * 业务字段 服务层实现 + * + * @author yunze + */ +@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/yunze-generator/src/main/java/com/yunze/generator/service/GenTableServiceImpl.java b/yunze-generator/src/main/java/com/yunze/generator/service/GenTableServiceImpl.java new file mode 100644 index 0000000..8aa2dae --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/service/GenTableServiceImpl.java @@ -0,0 +1,500 @@ +package com.yunze.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.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; +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.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.yunze.common.constant.Constants; +import com.yunze.common.constant.GenConstants; +import com.yunze.common.core.text.CharsetKit; +import com.yunze.common.exception.CustomException; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.file.FileUtils; +import com.yunze.generator.domain.GenTable; +import com.yunze.generator.domain.GenTableColumn; +import com.yunze.generator.mapper.GenTableColumnMapper; +import com.yunze.generator.mapper.GenTableMapper; +import com.yunze.generator.util.GenUtils; +import com.yunze.generator.util.VelocityInitializer; +import com.yunze.generator.util.VelocityUtils; + +/** + * 业务 服务层实现 + * + * @author yunze + */ +@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 CustomException("导入失败:" + 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 CustomException("渲染模板失败,表名:" + table.getTableName()); + } + } + } + } + + /** + * 同步数据库 + * + * @param tableName 表名称 + */ + @Override + @Transactional + public void synchDb(String tableName) + { + GenTable table = genTableMapper.selectGenTableByName(tableName); + List tableColumns = table.getColumns(); + List tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); + + List dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); + if (StringUtils.isEmpty(dbTableColumns)) + { + throw new CustomException("同步数据失败,原表结构不存在"); + } + List dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); + + dbTableColumns.forEach(column -> { + if (!tableColumnNames.contains(column.getColumnName())) + { + GenUtils.initColumnField(column, table); + 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 = JSONObject.parseObject(options); + if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) + { + throw new CustomException("树编码字段不能为空"); + } + else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) + { + throw new CustomException("树父编码字段不能为空"); + } + else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) + { + throw new CustomException("树名称字段不能为空"); + } + else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) + { + if (StringUtils.isEmpty(genTable.getSubTableName())) + { + throw new CustomException("关联子表的表名不能为空"); + } + else if (StringUtils.isEmpty(genTable.getSubTableFkName())) + { + throw new CustomException("子表关联的外键名不能为空"); + } + } + } + } + + /** + * 设置主键列信息 + * + * @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 = JSONObject.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/yunze-generator/src/main/java/com/yunze/generator/service/IGenTableColumnService.java b/yunze-generator/src/main/java/com/yunze/generator/service/IGenTableColumnService.java new file mode 100644 index 0000000..ea9b48f --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/service/IGenTableColumnService.java @@ -0,0 +1,44 @@ +package com.yunze.generator.service; + +import java.util.List; +import com.yunze.generator.domain.GenTableColumn; + +/** + * 业务字段 服务层 + * + * @author yunze + */ +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/yunze-generator/src/main/java/com/yunze/generator/service/IGenTableService.java b/yunze-generator/src/main/java/com/yunze/generator/service/IGenTableService.java new file mode 100644 index 0000000..c609a7a --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/service/IGenTableService.java @@ -0,0 +1,121 @@ +package com.yunze.generator.service; + +import java.util.List; +import java.util.Map; +import com.yunze.generator.domain.GenTable; + +/** + * 业务 服务层 + * + * @author yunze + */ +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/yunze-generator/src/main/java/com/yunze/generator/util/GenUtils.java b/yunze-generator/src/main/java/com/yunze/generator/util/GenUtils.java new file mode 100644 index 0000000..0f590e6 --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/util/GenUtils.java @@ -0,0 +1,258 @@ +package com.yunze.generator.util; + +import java.util.Arrays; +import org.apache.commons.lang3.RegExUtils; +import com.yunze.common.constant.GenConstants; +import com.yunze.common.utils.StringUtils; +import com.yunze.generator.config.GenConfig; +import com.yunze.generator.domain.GenTable; +import com.yunze.generator.domain.GenTableColumn; + +/** + * 代码生成器 工具类 + * + * @author yunze + */ +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); + + 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(); + String moduleName = StringUtils.substring(packageName, lastIndex + 1, nameLength); + return moduleName; + } + + /** + * 获取业务名 + * + * @param tableName 表名 + * @return 业务名 + */ + public static String getBusinessName(String tableName) + { + int lastIndex = tableName.lastIndexOf("_"); + int nameLength = tableName.length(); + String businessName = StringUtils.substring(tableName, lastIndex + 1, nameLength); + return businessName; + } + + /** + * 表名转换成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/yunze-generator/src/main/java/com/yunze/generator/util/VelocityInitializer.java b/yunze-generator/src/main/java/com/yunze/generator/util/VelocityInitializer.java new file mode 100644 index 0000000..f654d69 --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/util/VelocityInitializer.java @@ -0,0 +1,35 @@ +package com.yunze.generator.util; + +import java.util.Properties; +import org.apache.velocity.app.Velocity; +import com.yunze.common.constant.Constants; + +/** + * VelocityEngine工厂 + * + * @author yunze + */ +public class VelocityInitializer +{ + /** + * 初始化vm方法 + */ + public static void initVelocity() + { + Properties p = new Properties(); + try + { + // 加载classpath目录下的vm文件 + p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + // 定义字符集 + p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8); + p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8); + // 初始化Velocity引擎,指定配置Properties + Velocity.init(p); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } +} diff --git a/yunze-generator/src/main/java/com/yunze/generator/util/VelocityUtils.java b/yunze-generator/src/main/java/com/yunze/generator/util/VelocityUtils.java new file mode 100644 index 0000000..9b4827d --- /dev/null +++ b/yunze-generator/src/main/java/com/yunze/generator/util/VelocityUtils.java @@ -0,0 +1,361 @@ +package com.yunze.generator.util; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import org.apache.velocity.VelocityContext; +import com.alibaba.fastjson.JSONObject; +import com.yunze.common.constant.GenConstants; +import com.yunze.common.utils.DateUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.generator.domain.GenTable; +import com.yunze.generator.domain.GenTableColumn; + +/** + * 模板处理工具类 + * + * @author yunze + */ +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); + 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 = JSONObject.parseObject(options); + String parentMenuId = getParentMenuId(paramsObj); + context.put("parentMenuId", parentMenuId); + } + + public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) + { + String options = genTable.getOptions(); + JSONObject paramsObj = JSONObject.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("."); + String basePackage = StringUtils.substring(packageName, 0, lastIndex); + return basePackage; + } + + /** + * 根据列类型获取导入包 + * + * @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 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)) + { + 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 = JSONObject.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/yunze-generator/src/main/resources/generator.yml b/yunze-generator/src/main/resources/generator.yml new file mode 100644 index 0000000..c08a938 --- /dev/null +++ b/yunze-generator/src/main/resources/generator.yml @@ -0,0 +1,10 @@ +# 代码生成 +gen: + # 作者 + author: yunze + # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool + packageName: com.yunze.system + # 自动去除表前缀,默认是false + autoRemovePre: false + # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) + tablePrefix: sys_ \ No newline at end of file diff --git a/yunze-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/yunze-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml new file mode 100644 index 0000000..6f5605c --- /dev/null +++ b/yunze-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}, + sysdate() + ) + + + + 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 = sysdate() + + 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/yunze-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/yunze-generator/src/main/resources/mapper/generator/GenTableMapper.xml new file mode 100644 index 0000000..4953d26 --- /dev/null +++ b/yunze-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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}, + sysdate() + ) + + + + 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 = sysdate() + + where table_id = #{tableId} + + + + delete from gen_table where table_id in + + #{tableId} + + + + \ No newline at end of file diff --git a/yunze-generator/src/main/resources/vm/java/controller.java.vm b/yunze-generator/src/main/resources/vm/java/controller.java.vm new file mode 100644 index 0000000..2c82c31 --- /dev/null +++ b/yunze-generator/src/main/resources/vm/java/controller.java.vm @@ -0,0 +1,114 @@ +package ${packageName}.controller; + +import java.util.List; +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.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.enums.BusinessType; +import ${packageName}.domain.${ClassName}; +import ${packageName}.service.I${ClassName}Service; +import com.yunze.common.utils.poi.ExcelUtil; +#if($table.crud || $table.sub) +import com.yunze.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 AjaxResult.success(list); + } +#end + + /** + * 导出${functionName}列表 + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") + @Log(title = "${functionName}", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(${ClassName} ${className}) + { + List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); + ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); + return util.exportExcel(list, "${functionName}数据"); + } + + /** + * 获取${functionName}详细信息 + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") + @GetMapping(value = "/{${pkColumn.javaField}}") + public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) + { + return AjaxResult.success(${className}Service.select${ClassName}ById(${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}ByIds(${pkColumn.javaField}s)); + } +} diff --git a/yunze-generator/src/main/resources/vm/java/domain.java.vm b/yunze-generator/src/main/resources/vm/java/domain.java.vm new file mode 100644 index 0000000..a931a97 --- /dev/null +++ b/yunze-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.yunze.common.annotation.Excel; +#if($table.crud || $table.sub) +import com.yunze.common.core.domain.BaseEntity; +#elseif($table.tree) +import com.yunze.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/yunze-generator/src/main/resources/vm/java/mapper.java.vm b/yunze-generator/src/main/resources/vm/java/mapper.java.vm new file mode 100644 index 0000000..282d9ea --- /dev/null +++ b/yunze-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}ID + * @return ${functionName} + */ + public ${ClassName} select${ClassName}ById(${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}ID + * @return 结果 + */ + public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); + + /** + * 批量删除${functionName} + * + * @param ${pkColumn.javaField}s 需要删除的数据ID + * @return 结果 + */ + public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s); +#if($table.sub) + + /** + * 批量删除${subTable.functionName} + * + * @param customerIds 需要删除的数据ID + * @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}ID删除${subTable.functionName}信息 + * + * @param ${pkColumn.javaField} ${functionName}ID + * @return 结果 + */ + public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); +#end +} diff --git a/yunze-generator/src/main/resources/vm/java/service.java.vm b/yunze-generator/src/main/resources/vm/java/service.java.vm new file mode 100644 index 0000000..1217d53 --- /dev/null +++ b/yunze-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}ID + * @return ${functionName} + */ + public ${ClassName} select${ClassName}ById(${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}ID + * @return 结果 + */ + public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s); + + /** + * 删除${functionName}信息 + * + * @param ${pkColumn.javaField} ${functionName}ID + * @return 结果 + */ + public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); +} diff --git a/yunze-generator/src/main/resources/vm/java/serviceImpl.java.vm b/yunze-generator/src/main/resources/vm/java/serviceImpl.java.vm new file mode 100644 index 0000000..761ae9a --- /dev/null +++ b/yunze-generator/src/main/resources/vm/java/serviceImpl.java.vm @@ -0,0 +1,166 @@ +package ${packageName}.service.impl; + +import java.util.List; +#foreach ($column in $columns) +#if($column.javaField == 'createTime' || $column.javaField == 'updateTime') +import com.yunze.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.yunze.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}ID + * @return ${functionName} + */ + @Override + public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}) + { + return ${className}Mapper.select${ClassName}ById(${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}ID + * @return 结果 + */ +#if($table.sub) + @Transactional +#end + @Override + public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s) + { +#if($table.sub) + ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s); +#end + return ${className}Mapper.delete${ClassName}ByIds(${pkColumn.javaField}s); + } + + /** + * 删除${functionName}信息 + * + * @param ${pkColumn.javaField} ${functionName}ID + * @return 结果 + */ + @Override + public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}) + { +#if($table.sub) + ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField}); +#end + return ${className}Mapper.delete${ClassName}ById(${pkColumn.javaField}); + } +#if($table.sub) + + /** + * 新增${subTable.functionName}信息 + * + * @param ${className} ${functionName}对象 + */ + public void insert${subClassName}(${ClassName} ${className}) + { + List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List(); + Long ${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/yunze-generator/src/main/resources/vm/java/sub-domain.java.vm b/yunze-generator/src/main/resources/vm/java/sub-domain.java.vm new file mode 100644 index 0000000..f575309 --- /dev/null +++ b/yunze-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.yunze.common.annotation.Excel; +import com.yunze.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/yunze-generator/src/main/resources/vm/js/api.js.vm b/yunze-generator/src/main/resources/vm/js/api.js.vm new file mode 100644 index 0000000..296d41a --- /dev/null +++ b/yunze-generator/src/main/resources/vm/js/api.js.vm @@ -0,0 +1,53 @@ +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' + }) +} + +// 导出${functionName} +export function export${BusinessName}(query) { + return request({ + url: '/${moduleName}/${businessName}/export', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/yunze-generator/src/main/resources/vm/sql/sql.vm b/yunze-generator/src/main/resources/vm/sql/sql.vm new file mode 100644 index 0000000..0575583 --- /dev/null +++ b/yunze-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/yunze-generator/src/main/resources/vm/vue/index-tree.vue.vm b/yunze-generator/src/main/resources/vm/vue/index-tree.vue.vm new file mode 100644 index 0000000..83fc310 --- /dev/null +++ b/yunze-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -0,0 +1,539 @@ + + + diff --git a/yunze-generator/src/main/resources/vm/vue/index.vue.vm b/yunze-generator/src/main/resources/vm/vue/index.vue.vm new file mode 100644 index 0000000..f99ef49 --- /dev/null +++ b/yunze-generator/src/main/resources/vm/vue/index.vue.vm @@ -0,0 +1,646 @@ + + + diff --git a/yunze-generator/src/main/resources/vm/xml/mapper.xml.vm b/yunze-generator/src/main/resources/vm/xml/mapper.xml.vm new file mode 100644 index 0000000..86ae9f4 --- /dev/null +++ b/yunze-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($velocityCount != $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($velocityCount != $subTable.columns.size()),#end#end) values + + (#foreach($column in $subTable.columns) #{item.$column.javaField}#if($velocityCount != $subTable.columns.size()),#end#end) + + +#end + \ No newline at end of file diff --git a/yunze-generator/yunze-generator.iml b/yunze-generator/yunze-generator.iml new file mode 100644 index 0000000..caacd0b --- /dev/null +++ b/yunze-generator/yunze-generator.iml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-quartz/pom.xml b/yunze-quartz/pom.xml new file mode 100644 index 0000000..152d9bf --- /dev/null +++ b/yunze-quartz/pom.xml @@ -0,0 +1,40 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + yunze-quartz + + + quartz定时任务 + + + + + + + org.quartz-scheduler + quartz + + + com.mchange + c3p0 + + + + + + + com.yunze + yunze-common + + + + + \ No newline at end of file diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/config/ScheduleConfig.java b/yunze-quartz/src/main/java/com/yunze/quartz/config/ScheduleConfig.java new file mode 100644 index 0000000..b9ae35d --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/config/ScheduleConfig.java @@ -0,0 +1,57 @@ +package com.yunze.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; + +/** + * 定时任务配置 + * + * @author yunze + */ +@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.quartz.impl.jdbcjobstore.JobStoreTX"); + // 集群配置 + 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/yunze-quartz/src/main/java/com/yunze/quartz/controller/SysJobController.java b/yunze-quartz/src/main/java/com/yunze/quartz/controller/SysJobController.java new file mode 100644 index 0000000..674ad36 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/controller/SysJobController.java @@ -0,0 +1,142 @@ +package com.yunze.quartz.controller; + +import java.util.List; +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.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.exception.job.TaskException; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.quartz.domain.SysJob; +import com.yunze.quartz.service.ISysJobService; +import com.yunze.quartz.util.CronUtils; + +/** + * 调度任务信息操作处理 + * + * @author yunze + */ +@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) + @GetMapping("/export") + public AjaxResult export(SysJob sysJob) + { + List list = jobService.selectJobList(sysJob); + ExcelUtil util = new ExcelUtil(SysJob.class); + return util.exportExcel(list, "定时任务"); + } + + /** + * 获取定时任务详细信息 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:query')") + @GetMapping(value = "/{jobId}") + public AjaxResult getInfo(@PathVariable("jobId") Long jobId) + { + return AjaxResult.success(jobService.selectJobById(jobId)); + } + + /** + * 新增定时任务 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:add')") + @Log(title = "定时任务", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysJob sysJob) throws SchedulerException, TaskException + { + if (!CronUtils.isValid(sysJob.getCronExpression())) + { + return AjaxResult.error("cron表达式不正确"); + } + sysJob.setCreateBy(SecurityUtils.getUsername()); + return toAjax(jobService.insertJob(sysJob)); + } + + /** + * 修改定时任务 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:edit')") + @Log(title = "定时任务", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysJob sysJob) throws SchedulerException, TaskException + { + if (!CronUtils.isValid(sysJob.getCronExpression())) + { + return AjaxResult.error("cron表达式不正确"); + } + sysJob.setUpdateBy(SecurityUtils.getUsername()); + return toAjax(jobService.updateJob(sysJob)); + } + + /** + * 定时任务状态修改 + */ + @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 + { + jobService.run(job); + return AjaxResult.success(); + } + + /** + * 删除定时任务 + */ + @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 AjaxResult.success(); + } +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/controller/SysJobLogController.java b/yunze-quartz/src/main/java/com/yunze/quartz/controller/SysJobLogController.java new file mode 100644 index 0000000..1d7ae84 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/controller/SysJobLogController.java @@ -0,0 +1,90 @@ +package com.yunze.quartz.controller; + +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.yunze.common.annotation.Log; +import com.yunze.common.core.controller.BaseController; +import com.yunze.common.core.domain.AjaxResult; +import com.yunze.common.core.page.TableDataInfo; +import com.yunze.common.enums.BusinessType; +import com.yunze.common.utils.poi.ExcelUtil; +import com.yunze.quartz.domain.SysJobLog; +import com.yunze.quartz.service.ISysJobLogService; + +/** + * 调度日志操作处理 + * + * @author yunze + */ +@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) + @GetMapping("/export") + public AjaxResult export(SysJobLog sysJobLog) + { + List list = jobLogService.selectJobLogList(sysJobLog); + ExcelUtil util = new ExcelUtil(SysJobLog.class); + return util.exportExcel(list, "调度日志"); + } + + /** + * 根据调度编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:query')") + @GetMapping(value = "/{configId}") + public AjaxResult getInfo(@PathVariable Long jobLogId) + { + return AjaxResult.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 AjaxResult.success(); + } +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/domain/SysJob.java b/yunze-quartz/src/main/java/com/yunze/quartz/domain/SysJob.java new file mode 100644 index 0000000..f759590 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/domain/SysJob.java @@ -0,0 +1,171 @@ +package com.yunze.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.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.constant.ScheduleConstants; +import com.yunze.common.core.domain.BaseEntity; +import com.yunze.common.utils.StringUtils; +import com.yunze.quartz.util.CronUtils; + +/** + * 定时任务调度表 sys_job + * + * @author yunze + */ +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/yunze-quartz/src/main/java/com/yunze/quartz/domain/SysJobLog.java b/yunze-quartz/src/main/java/com/yunze/quartz/domain/SysJobLog.java new file mode 100644 index 0000000..d7a5908 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/domain/SysJobLog.java @@ -0,0 +1,155 @@ +package com.yunze.quartz.domain; + +import java.util.Date; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.yunze.common.annotation.Excel; +import com.yunze.common.core.domain.BaseEntity; + +/** + * 定时任务调度日志表 sys_job_log + * + * @author yunze + */ +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/yunze-quartz/src/main/java/com/yunze/quartz/mapper/SysJobLogMapper.java b/yunze-quartz/src/main/java/com/yunze/quartz/mapper/SysJobLogMapper.java new file mode 100644 index 0000000..e4f8c19 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/mapper/SysJobLogMapper.java @@ -0,0 +1,64 @@ +package com.yunze.quartz.mapper; + +import java.util.List; +import com.yunze.quartz.domain.SysJobLog; + +/** + * 调度任务日志信息 数据层 + * + * @author yunze + */ +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 void cleanJobLog(); +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/mapper/SysJobMapper.java b/yunze-quartz/src/main/java/com/yunze/quartz/mapper/SysJobMapper.java new file mode 100644 index 0000000..e02ccd9 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/mapper/SysJobMapper.java @@ -0,0 +1,67 @@ +package com.yunze.quartz.mapper; + +import java.util.List; +import com.yunze.quartz.domain.SysJob; + +/** + * 调度任务信息 数据层 + * + * @author yunze + */ +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/yunze-quartz/src/main/java/com/yunze/quartz/service/ISysJobLogService.java b/yunze-quartz/src/main/java/com/yunze/quartz/service/ISysJobLogService.java new file mode 100644 index 0000000..40ca1b1 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/service/ISysJobLogService.java @@ -0,0 +1,56 @@ +package com.yunze.quartz.service; + +import java.util.List; +import com.yunze.quartz.domain.SysJobLog; + +/** + * 定时任务调度日志信息信息 服务层 + * + * @author yunze + */ +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/yunze-quartz/src/main/java/com/yunze/quartz/service/ISysJobService.java b/yunze-quartz/src/main/java/com/yunze/quartz/service/ISysJobService.java new file mode 100644 index 0000000..9cd167f --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/service/ISysJobService.java @@ -0,0 +1,102 @@ +package com.yunze.quartz.service; + +import java.util.List; +import org.quartz.SchedulerException; +import com.yunze.common.exception.job.TaskException; +import com.yunze.quartz.domain.SysJob; + +/** + * 定时任务调度信息信息 服务层 + * + * @author yunze + */ +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 void 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/yunze-quartz/src/main/java/com/yunze/quartz/service/impl/SysJobLogServiceImpl.java b/yunze-quartz/src/main/java/com/yunze/quartz/service/impl/SysJobLogServiceImpl.java new file mode 100644 index 0000000..d72df87 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/service/impl/SysJobLogServiceImpl.java @@ -0,0 +1,87 @@ +package com.yunze.quartz.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.yunze.quartz.domain.SysJobLog; +import com.yunze.quartz.mapper.SysJobLogMapper; +import com.yunze.quartz.service.ISysJobLogService; + +/** + * 定时任务调度日志信息 服务层 + * + * @author yunze + */ +@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/yunze-quartz/src/main/java/com/yunze/quartz/service/impl/SysJobServiceImpl.java b/yunze-quartz/src/main/java/com/yunze/quartz/service/impl/SysJobServiceImpl.java new file mode 100644 index 0000000..dbf1f03 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/service/impl/SysJobServiceImpl.java @@ -0,0 +1,254 @@ +package com.yunze.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.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.yunze.common.constant.ScheduleConstants; +import com.yunze.common.exception.job.TaskException; +import com.yunze.quartz.domain.SysJob; +import com.yunze.quartz.mapper.SysJobMapper; +import com.yunze.quartz.service.ISysJobService; +import com.yunze.quartz.util.CronUtils; +import com.yunze.quartz.util.ScheduleUtils; + +/** + * 定时任务调度信息 服务层 + * + * @author yunze + */ +@Service +public class SysJobServiceImpl implements ISysJobService +{ + @Autowired + private Scheduler scheduler; + + @Autowired + private SysJobMapper jobMapper; + + /** + * 项目启动时,初始化定时器 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据) + */ + @PostConstruct + public void init() throws SchedulerException, TaskException + { + 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 + 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 + 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 + 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 + public void deleteJobByIds(Long[] jobIds) throws SchedulerException + { + for (Long jobId : jobIds) + { + SysJob job = jobMapper.selectJobById(jobId); + deleteJob(job); + } + } + + /** + * 任务调度状态修改 + * + * @param job 调度信息 + */ + @Override + @Transactional + 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 + public void run(SysJob job) throws SchedulerException + { + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + SysJob properties = selectJobById(job.getJobId()); + // 参数 + JobDataMap dataMap = new JobDataMap(); + dataMap.put(ScheduleConstants.TASK_PROPERTIES, properties); + scheduler.triggerJob(ScheduleUtils.getJobKey(jobId, jobGroup), dataMap); + } + + /** + * 新增任务 + * + * @param job 调度信息 调度信息 + */ + @Override + @Transactional + 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 + 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/yunze-quartz/src/main/java/com/yunze/quartz/task/RyTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/RyTask.java new file mode 100644 index 0000000..2cf393b --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/RyTask.java @@ -0,0 +1,28 @@ +package com.yunze.quartz.task; + +import org.springframework.stereotype.Component; +import com.yunze.common.utils.StringUtils; + +/** + * 定时任务调度测试 + * + * @author yunze + */ +@Component("ryTask") +public class RyTask +{ + 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("执行无参方法"); + } +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/InitMQ.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/InitMQ.java new file mode 100644 index 0000000..5636dc2 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/InitMQ.java @@ -0,0 +1,416 @@ +package com.yunze.quartz.task.yunze; + +import com.yunze.common.config.RabbitMQConfig; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Auther: zhang feng + * @Date: 2021/08/31/12:13 + * @Description: + */ +@Component("initMQ") +public class InitMQ { + @Resource + private RabbitTemplate rabbitTemplate; + @Resource + private RabbitMQConfig rabbitMQConfig; + + /** + * 初始化 Mq + */ + public void initMQConfig(){ + + List> MqinitArr = new ArrayList>(); + Map Obj_1 = new HashMap(); + Map Obj_2 = new HashMap(); + Map Obj_3 = new HashMap(); + Map Obj_4 = new HashMap(); + Map Obj_5 = new HashMap(); + Map Obj_6 = new HashMap(); + Map Obj_7 = new HashMap(); + Map Obj_8 = new HashMap(); + Map Obj_9 = new HashMap(); + Map Obj_10 = new HashMap(); + Map Obj_11 = new HashMap(); + Map Obj_12 = new HashMap(); + Map Obj_13 = new HashMap(); + Map Obj_14 = new HashMap(); + Map Obj_15 = new HashMap(); + Map Obj_16 = new HashMap(); + Map Obj_17 = new HashMap(); + Map Obj_18 = new HashMap(); + Map Obj_19 = new HashMap(); + Map Obj_20 = new HashMap(); + Map Obj_21 = new HashMap(); + Map Obj_22 = new HashMap(); + Map Obj_23 = new HashMap(); + Map Obj_24 = new HashMap(); + Map Obj_25 = new HashMap(); + Map Obj_26 = new HashMap(); + Map Obj_27 = new HashMap(); + Map Obj_28 = new HashMap(); + Map Obj_29 = new HashMap(); + Map Obj_30 = new HashMap(); + Map Obj_31 = new HashMap(); + Map Obj_32 = new HashMap(); + Map Obj_33 = new HashMap(); + Map Obj_34 = new HashMap(); + Map Obj_35 = new HashMap(); + + Map Obj_36 = new HashMap(); + Map Obj_37 = new HashMap(); + Map Obj_38 = new HashMap(); + Map Obj_39 = new HashMap(); + Map Obj_40 = new HashMap(); + Map Obj_41 = new HashMap(); + Map Obj_42 = new HashMap(); + Map Obj_43 = new HashMap(); + Map Obj_44 = new HashMap(); + Map Obj_45 = new HashMap(); + Map Obj_46 = new HashMap(); + Map Obj_47 = new HashMap(); + Map Obj_48 = new HashMap(); + Map Obj_49 = new HashMap(); + Map Obj_50 = new HashMap(); + + + + + + + Obj_1.put("card_exchangeName","admin_exchange"); + Obj_1.put("card_queueName","admin_CardImportSelImei_queue"); + Obj_1.put("card_routingKey","admin.CardImportSelImei.queue"); + + Obj_2.put("card_exchangeName","admin_exchange"); + Obj_2.put("card_queueName","admin_CardImportSet_queue"); + Obj_2.put("card_routingKey","admin.CardImportSet.queue"); + + Obj_3.put("card_exchangeName","admin_exchange"); + Obj_3.put("card_queueName","admin_saveCard_queue"); + Obj_3.put("card_routingKey","admin.saveCard.queue"); + Obj_3.put("is_noDxl","1"); + + Obj_4.put("card_exchangeName","admin_exchange"); + Obj_4.put("card_queueName","admin_DistributeCard_queue"); + Obj_4.put("card_routingKey","admin.DistributeCard.queue"); + Obj_4.put("is_noDxl","1"); + + Obj_5.put("card_exchangeName","admin_exchange"); + Obj_5.put("card_queueName","admin_OutCard_queue"); + Obj_5.put("card_routingKey","admin_OutCard_queue"); + Obj_5.put("is_noDxl","1"); + + + Obj_6.put("card_exchangeName","admin_exchange"); + Obj_6.put("card_queueName","admin_BackupsyzSysLogs_queue"); + Obj_6.put("card_routingKey","admin.BackupsyzSysLogs.queue"); + Obj_6.put("is_noDxl","1"); + + Obj_7.put("card_exchangeName","admin_exchange"); + Obj_7.put("card_queueName","admin_BackupsGenTable_queue"); + Obj_7.put("card_routingKey","admin.BackupsGenTable.queue"); + Obj_7.put("is_noDxl","1"); + + Obj_8.put("card_exchangeName","polling_card"); + Obj_8.put("card_queueName","polling_card_activatedate"); + Obj_8.put("card_routingKey","polling.card.activatedate"); + Obj_8.put("is_noDxl","1"); + + + Obj_9.put("card_exchangeName","polling_card"); + Obj_9.put("card_queueName","polling_card_flow"); + Obj_9.put("card_routingKey","polling.card.flow"); + Obj_9.put("is_noDxl","1"); + + Obj_10.put("card_exchangeName","polling_card"); + Obj_10.put("card_queueName","polling_card_status"); + Obj_10.put("card_routingKey","polling.card.status"); + Obj_10.put("is_noDxl","1"); + + Obj_11.put("card_exchangeName","polling_card"); + Obj_11.put("card_queueName","polling_card_stop"); + Obj_11.put("card_routingKey","polling.card.stop"); + Obj_11.put("is_noDxl","1"); + + Obj_12.put("card_exchangeName","admin_exchange"); + Obj_12.put("card_queueName","admin_OrderImportRecharge_queue"); + Obj_12.put("card_routingKey","admin.OrderImportRecharge.queue"); + + + Obj_13.put("card_exchangeName","polling_addPackage_card"); + Obj_13.put("card_queueName","p_addPackage_card"); + Obj_13.put("card_routingKey","p.addPackage.card"); + + + + Obj_14.put("card_exchangeName","admin_card_exchange"); + Obj_14.put("card_queueName","admin_CardUpd_queue"); + Obj_14.put("card_routingKey","admin.CardUpd.queue"); + + /* Obj_15.put("card_exchangeName","dlx_admin_card_exchange"); + Obj_15.put("card_queueName","dlx_admin_CardUpd_queue"); + Obj_15.put("card_routingKey","dlx_admin.CardUpd.queue");*/ + + + Obj_16.put("card_exchangeName","admin_exchange"); + Obj_16.put("card_queueName","admin_WxWebOrder_queue"); + Obj_16.put("card_routingKey","admin.WxWebOrder.queue"); + + /* Obj_17.put("card_exchangeName","dlx_admin_exchange"); + Obj_17.put("card_queueName","dlx_admin_WxWebOrder_queue"); + Obj_17.put("card_routingKey","dlx_admin.WxWebOrder.queue");*/ + + Obj_18.put("card_exchangeName","polling_card"); + Obj_18.put("card_queueName","polling_card_disconnected"); + Obj_18.put("card_routingKey","polling.card.disconnected"); + Obj_18.put("is_noDxl","1"); + + Obj_19.put("card_exchangeName","admin_card_exchange"); + Obj_19.put("card_queueName","admin_CardDiagnosis_queue"); + Obj_19.put("card_routingKey","admin.CardDiagnosis.queue"); + + + Obj_20.put("card_exchangeName","admin_exchange"); + Obj_20.put("card_queueName","admin_CardImportBatch_queue"); + Obj_20.put("card_routingKey","admin.CardImportBatch.queue"); + + Obj_21.put("card_exchangeName","admin_exchange"); + Obj_21.put("card_queueName","admin_importSetCardInfo_queue"); + Obj_21.put("card_routingKey","admin.importSetCardInfo.queue"); + + + + Obj_22.put("card_exchangeName","admin_exchange"); + Obj_22.put("card_queueName","admin_MonthFirstday_queue"); + Obj_22.put("card_routingKey","admin.MonthFirstday.queue"); + + + Obj_23.put("card_exchangeName","admin_exchange"); + Obj_23.put("card_queueName","admin_CEndValue_queue"); + Obj_23.put("card_routingKey","admin.CEndValue.queue"); + + + + Obj_24.put("card_exchangeName","admin_exchange"); + Obj_24.put("card_queueName","admin_WxShopping_queue"); + Obj_24.put("card_routingKey","admin.WxShopping.queue"); + + Obj_25.put("card_exchangeName","admin_CC_exchange"); + Obj_25.put("card_queueName","admin_ShoppingEmail_queue"); + Obj_25.put("card_routingKey","admin.ShoppingEmail.queue"); + + + + Obj_26.put("card_exchangeName","polling_cardCardFlow_exchange"); + Obj_26.put("card_queueName","polling_card_flow_one"); + Obj_26.put("card_routingKey","admin.CardFlow.queue.One"); + + Obj_27.put("card_exchangeName","polling_cardCardFlow_exchange"); + Obj_27.put("card_queueName","polling_card_flow_tow"); + Obj_27.put("card_routingKey","admin.CardFlow.queue.Tow"); + + + Obj_28.put("card_exchangeName","polling_cardActivateDate_exchange"); + Obj_28.put("card_queueName","polling_card_activateDate_one"); + Obj_28.put("card_routingKey","admin.CardActivateDate.queue.One"); + + Obj_29.put("card_exchangeName","polling_cardActivateDate_exchange"); + Obj_29.put("card_queueName","polling_card_activateDate_tow"); + Obj_29.put("card_routingKey","admin.CardActivateDate.queue.Tow"); + + + + Obj_30.put("card_exchangeName","polling_cardCardStatus_exchange"); + Obj_30.put("card_queueName","polling_card_status_one"); + Obj_30.put("card_routingKey","admin.CardStatus.queue.One"); + + Obj_31.put("card_exchangeName","polling_cardCardStatus_exchange"); + Obj_31.put("card_queueName","polling_card_status_tow"); + Obj_31.put("card_routingKey","admin.CardStatus.queue.Tow"); + + + Obj_32.put("card_exchangeName","polling_cardCardStop_exchange"); + Obj_32.put("card_queueName","polling_card_Stop_one"); + Obj_32.put("card_routingKey","admin.CardStop.queue.One"); + + Obj_33.put("card_exchangeName","polling_cardCardStop_exchange"); + Obj_33.put("card_queueName","polling_card_Stop_tow"); + Obj_33.put("card_routingKey","admin.CardStop.queue.Tow"); + + + Obj_34.put("card_exchangeName","polling_cardCardDisconnected_exchange"); + Obj_34.put("card_queueName","polling_card_Disconnected_one"); + Obj_34.put("card_routingKey","admin.CardDisconnected.queue.One"); + + Obj_35.put("card_exchangeName","polling_cardCardDisconnected_exchange"); + Obj_35.put("card_queueName","polling_card_Disconnected_tow"); + Obj_35.put("card_routingKey","admin.CardDisconnected.queue.Tow"); + + + Obj_36.put("card_exchangeName","admin_exchange"); + Obj_36.put("card_queueName","admin_Exportallorders_queue"); + Obj_36.put("card_routingKey","admin.Exportallorders.queue"); + Obj_36.put("is_noDxl","1"); + + + Obj_37.put("card_exchangeName","admin_exchange"); + Obj_37.put("card_queueName","admin_Shoppingexport_queue"); + Obj_37.put("card_routingKey","admin.Shoppingexport.queue"); + Obj_37.put("is_noDxl","1"); + + + + Obj_38.put("card_exchangeName","admin_exchange"); + Obj_38.put("card_queueName","admin_Consumption_queue"); + Obj_38.put("card_routingKey","admin.Consumption.queue"); + + + Obj_39.put("card_exchangeName","admin_exchange"); + Obj_39.put("card_queueName","admin_Stopped_queue"); + Obj_39.put("card_routingKey","admin.Stopped.queue"); + + + Obj_40.put("card_exchangeName","admin_exchange"); + Obj_40.put("card_queueName","admin_PublicMethod_queue"); + Obj_40.put("card_routingKey","admin.PublicMethod.queue"); + + + Obj_41.put("card_exchangeName","admin_exchange"); + Obj_41.put("card_queueName","admin_ConsumptionAndState_queue"); + Obj_41.put("card_routingKey","admin.ConsumptionAndState.queue"); + + Obj_42.put("card_exchangeName","admin_exchange"); + Obj_42.put("card_queueName","admin_DueExpireTime_queue"); + Obj_42.put("card_routingKey","admin.DueExpireTim.queue"); + + + Obj_43.put("card_exchangeName","admin_exchange"); + Obj_43.put("card_queueName","admin_ImportStock_queue"); + Obj_43.put("card_routingKey","admin.ImportStock.queue"); + + Obj_44.put("card_exchangeName","admin_exchange"); + Obj_44.put("card_queueName","admin_OpenNetwork_queue"); + Obj_44.put("card_routingKey","admin.OpenNetwork.queue"); + + + Obj_45.put("card_exchangeName","admin_exchange"); + Obj_45.put("card_queueName","admin_DisconnectNetwork_queue"); + Obj_45.put("card_routingKey","admin.DisconnectNetwork.queue"); + + Obj_46.put("card_exchangeName","admin_exchange"); + Obj_46.put("card_queueName","admin_OpenNetwork_queue"); + Obj_46.put("card_routingKey","admin.OpenNetwork.queue"); + + + Obj_47.put("card_exchangeName","admin_exchange"); + Obj_47.put("card_queueName","admin_Machine_queue"); + Obj_47.put("card_routingKey","admin.Machine.queue"); + + Obj_48.put("card_exchangeName","admin_exchange"); + Obj_48.put("card_queueName","admin_ExportFlow_queue"); + Obj_48.put("card_routingKey","admin.ExportFlow.queue"); + + Obj_49.put("card_exchangeName","admin_exchange"); + Obj_49.put("card_queueName","admin_ExportFlowHis_queue"); + Obj_49.put("card_routingKey","admin.ExportFlowHis.queue"); + + + Obj_50.put("card_exchangeName","admin_exchange"); + Obj_50.put("card_queueName","admin_uploadCustomer_queue"); + Obj_50.put("card_routingKey","admin.uploadCustomer.queue"); + + MqinitArr.add(Obj_1); + MqinitArr.add(Obj_2); + MqinitArr.add(Obj_3); + MqinitArr.add(Obj_4); + MqinitArr.add(Obj_5); + MqinitArr.add(Obj_6); + MqinitArr.add(Obj_7); + MqinitArr.add(Obj_8); + MqinitArr.add(Obj_9); + MqinitArr.add(Obj_10); + MqinitArr.add(Obj_11); + MqinitArr.add(Obj_12); + MqinitArr.add(Obj_13); + MqinitArr.add(Obj_14); + //MqinitArr.add(Obj_15); + MqinitArr.add(Obj_16); + //MqinitArr.add(Obj_17); + MqinitArr.add(Obj_18); + MqinitArr.add(Obj_19); + + MqinitArr.add(Obj_20); + MqinitArr.add(Obj_21); + MqinitArr.add(Obj_22); + MqinitArr.add(Obj_23); + MqinitArr.add(Obj_24); + MqinitArr.add(Obj_25); + MqinitArr.add(Obj_26); + MqinitArr.add(Obj_27); + MqinitArr.add(Obj_28); + MqinitArr.add(Obj_29); + MqinitArr.add(Obj_30); + MqinitArr.add(Obj_31); + + MqinitArr.add(Obj_32); + MqinitArr.add(Obj_33); + MqinitArr.add(Obj_34); + MqinitArr.add(Obj_35); + + + MqinitArr.add(Obj_36); + MqinitArr.add(Obj_37); + + + MqinitArr.add(Obj_38); + MqinitArr.add(Obj_39); + MqinitArr.add(Obj_40); + MqinitArr.add(Obj_41); + MqinitArr.add(Obj_42); + MqinitArr.add(Obj_43); + MqinitArr.add(Obj_44); + MqinitArr.add(Obj_45); + MqinitArr.add(Obj_46); + MqinitArr.add(Obj_47); + MqinitArr.add(Obj_48); + MqinitArr.add(Obj_49); + + MqinitArr.add(Obj_50); + + + for (int i = 0; i < MqinitArr.size(); i++) { + Map Obj = MqinitArr.get(i); + String card_exchangeName = Obj.get("card_exchangeName").toString(); + String card_queueName = Obj.get("card_queueName").toString(); + String card_routingKey = Obj.get("card_routingKey").toString(); + String card_del_exchangeName = "dlx_"+card_exchangeName,card_del_queueName = "dlx_"+card_queueName, card_del_routingKey = "dlx_"+card_routingKey; + + try { + if(Obj.get("is_noDxl")!=null){ + rabbitMQConfig.creatExchangeQueue(card_exchangeName, card_queueName, card_routingKey, null, null, null,null); + }else{ + rabbitMQConfig.creatExchangeQueue(card_exchangeName, card_queueName, card_routingKey, card_del_exchangeName, card_del_queueName, card_del_routingKey,null); + } + }catch (Exception e){ + System.out.println("exchangeName "+card_exchangeName+" Mqinit 初始化失败 ……"+e.getMessage()); + } + } + + + } + + public static void main(String[] args) { + InitMQ init = new InitMQ(); + init.initMQConfig(); + } + + +} \ No newline at end of file diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/OrderAddPackageProductionTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/OrderAddPackageProductionTask.java new file mode 100644 index 0000000..e03e810 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/OrderAddPackageProductionTask.java @@ -0,0 +1,200 @@ +package com.yunze.quartz.task.yunze; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.mapper.yunze.YzOrderMapper; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.yunze.ApiParamMap; +import com.yunze.apiCommon.utils.InternalApiRequest; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 定时任务 未执行加包订单执行 加包任务生产 + * @author root + */ +@Component("orderAddPackageProductionTask") +public class OrderAddPackageProductionTask +{ + + @Resource + private YzOrderMapper yzOrderMapper; + @Resource + private InternalApiRequest internalApiRequest; + @Resource + private ApiParamMap apiParamMap; + @Autowired + private RabbitMQConfig mQConfig; + @Autowired + private RabbitTemplate rabbitTemplate; + + + + + //路由队列 + String addPackage_exchangeName = "polling_addPackage_card", addPackage_queueName = "p_addPackage_card", addPackage_routingKey = "p.addPackage.card", + addPackage_del_exchangeName = "dlx_"+addPackage_exchangeName,addPackage_del_queueName = "dlx_"+addPackage_queueName, addPackage_del_routingKey = "dlx_"+addPackage_routingKey; + + + // 除 生效类型为 [激活生效] 外 所有加包 增加到生产任务中去 + public void addPackageProduction(Integer time) + { + + //0.自动 修改已经加包的订单加包状态 [防止重复加包] + try { + yzOrderMapper.updAutomatic(); + }catch (Exception e){ + System.out.println("无 修改已经加包的订单加包状态"); + } + + //1.获取 支付成功 > 用量充值 > 未执行加包的 订单 + Map findAddPackage_Map = new HashMap<>(); + findAddPackage_Map.put("validate_type","4"); + findAddPackage_Map.put("type","notin"); + List> AddPackageArr = yzOrderMapper.findAddPackage(findAddPackage_Map); + AddPackag(AddPackageArr,time); + } + + + // 生效类型为 [激活生效] 且 已有生效时间 增加到生产任务中去 + public void activationAddPackageProductionAndActivateDate(Integer time) + { + + //0.自动 修改已经加包的订单加包状态 [防止重复加包] + try { + yzOrderMapper.updAutomatic(); + }catch (Exception e){ + System.out.println("无 修改已经加包的订单加包状态"); + } + + //1.获取 支付成功 > 用量充值 > 未执行加包的 [激活生效] 订单 + Map findAddPackage_Map = new HashMap<>(); + findAddPackage_Map.put("validate_type","4"); + findAddPackage_Map.put("type","in"); + findAddPackage_Map.put("activate_date","notnull"); + List> AddPackageArr = yzOrderMapper.findAddPackage(findAddPackage_Map); + AddPackag(AddPackageArr,time); + } + + + + public void AddPackag(List> AddPackageArr,int time){ + if(AddPackageArr!=null && AddPackageArr.size()>0){ + //卡号放入路由 + for (int j = 0; j < AddPackageArr.size(); j++) { + Map card = AddPackageArr.get(j); + //生产任务 + try { + if (j == 0) { + //设置任务 路由器 名称 与队列 名称 + mQConfig.creatExchangeQueue(addPackage_exchangeName, addPackage_queueName, addPackage_routingKey, addPackage_del_exchangeName, addPackage_del_queueName, addPackage_del_routingKey,null); + } + rabbitTemplate.convertAndSend(addPackage_exchangeName, addPackage_routingKey, JSON.toJSONString(card), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println(e.getMessage().toString()); + } + } + } + } + + + + + + // 生效类型为 [激活生效] 且 无生效时间 API更新激活时间 【不生产】让 activationAddPackageProductionAndActivateDate 去生产 + public void activationAddPackageProduction() + { + + //0.自动 修改已经加包的订单加包状态 [防止重复加包] + try { + yzOrderMapper.updAutomatic(); + }catch (Exception e){ + System.out.println("无 修改已经加包的订单加包状态"); + } + + + //1.获取 支付成功 > 用量充值 > 未执行加包的 [激活生效] 订单 + Map findAddPackage_Map = new HashMap<>(); + findAddPackage_Map.put("validate_type","4"); + findAddPackage_Map.put("type","in"); + findAddPackage_Map.put("activate_date","null"); + findAddPackage_Map.put("channel_id","notnull"); + + + List> AddPackageArr = yzOrderMapper.findAddPackage(findAddPackage_Map); + + if(AddPackageArr!=null && AddPackageArr.size()>0){ + //2.筛选出 无 激活日期的卡信息 调用API接口请求 获取 激活信息 + for (int i = 0; i < AddPackageArr.size(); i++) { + Map map = AddPackageArr.get(i); + Map Parammap=new HashMap<>(); + Parammap.put("iccid",map.get("iccid")); + Map apiMapNet=apiParamMap.getApiParams(Parammap); + Map Rmap = null;//apiUtil.queryCardActiveTime(apiMapNet,); + String statusCode = Rmap.get("statusCode")!=null?Rmap.get("statusCode").toString():"500"; + if(statusCode.equals("200")){ + //获取 激活日期 开卡日期 更新 card info + if(Rmap.get("activateDate")!=null && Rmap.get("activateDate")!="" && Rmap.get("activateDate").toString().trim().length()>0){ + String activateDate = Rmap.get("activateDate").toString().trim(); + Object openDate = Rmap.get("openDate")!=null && Rmap.get("openDate")!="" && Rmap.get("openDate").toString().trim().length()>0? + Rmap.get("openDate").toString().trim():null; + Map Upd_Map = new HashMap<>(); + Upd_Map.put("activate_date",activateDate); + if(openDate!=null){ + Upd_Map.put("open_date",openDate); + } + Upd_Map.put("id",map.get("Bid")); + boolean bool = yzOrderMapper.updActivate(Upd_Map)>0;//变更激活时间 + System.out.println(map.get("iccid")+" 修改激活时间 bool : "+bool); + } + }else{ + System.out.println(map.get("iccid")+" 未获取到激活日期 !"); + } + } + } + } + + + /** + * 创建 生产者路由队列 + * @param time + * @param size + * @param polling_id + * @param p_Map + * @param type + * @return + */ + public boolean CreateExchange(int time, int size, String polling_id,Map p_Map,String type) { + boolean bool = true; + //卡状态 轮询 + try { + mQConfig.creatExchangeQueue(addPackage_exchangeName, addPackage_queueName, addPackage_routingKey, null, null, null, BuiltinExchangeType.FANOUT); + Map start_type = new HashMap<>(); + start_type.putAll(p_Map); + start_type.put("type", type); + rabbitTemplate.convertAndSend(addPackage_exchangeName, addPackage_queueName, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + bool = false; + System.out.println("轮序 生产激活生效包 [CreateExchange] 启动类型 失败 " + e.getMessage().toString()); + } + return bool; + } + + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/backups/BackupTest.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/backups/BackupTest.java new file mode 100644 index 0000000..339d9a2 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/backups/BackupTest.java @@ -0,0 +1,46 @@ +package com.yunze.quartz.task.yunze.backups; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; +/** + * 定时任务 通道轮序 达量停机 + * + * @author root + */ +@Component("backupTest") +public class BackupTest { + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + + /** + * 备份 GenTableTask + * */ + public void gentable(Integer Time) { + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_BackupsGenTable_queue"; + String polling_routingKey = "admin.BackupsGenTable.queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.put("Masage", "备份 执行 admin_BackupsGenTable_queue ");//启动类型 + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (Time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("导入 卡号 失败 " + e.getMessage().toString()); + } + } +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/backups/RollbackCardagent.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/backups/RollbackCardagent.java new file mode 100644 index 0000000..9ddef54 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/backups/RollbackCardagent.java @@ -0,0 +1,66 @@ +package com.yunze.quartz.task.yunze.backups; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.utils.yunze.VeDate; +import com.yunze.common.utils.yunze.WriteCSV; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 回滚 划卡备份 + */ +@Component("rollbackCardagent") +public class RollbackCardagent { + @Resource + private YzCardMapper yzCardMapper; + @Resource + private WriteCSV writeCSV; + + + /** + * 读取 划卡备份 回滚 属性 + * @param Url 文件地址 + * @param error_agent_id 错误的 agent_id + * @param error_user_id 错误的 user_id + */ + public void rollbackError(String Url,Integer error_agent_id,Integer error_user_id){ + + List> dataList = WriteCSV.readCSV(Url,null); + + //分组 更具 dept_id-user_id + Map>> collect = dataList.stream().collect(Collectors.groupingBy(scope->scope.get("dept_id").toString()+'-'+scope.get("user_id").toString())); + System.out.println(JSON.toJSONString(collect)); + System.out.println("=========================="); + int UpdCpunt = 0 ; + for(Map.Entry>> entry:collect.entrySet()){ + String Keys[] = entry.getKey().split("-"); + List> idArr = entry.getValue(); + String dept_id = Keys[0]; + String user_id = Keys[1]; + Map setMap = new HashMap<>(); + setMap.put("dept_id",dept_id); + setMap.put("user_id",user_id); + setMap.put("error_agent_id",error_agent_id); + setMap.put("error_user_id",error_user_id); + setMap.put("idArr",idArr); + int CUpdCpunt = yzCardMapper.dividCardBk(setMap); + UpdCpunt += CUpdCpunt; + System.out.println(" 总修改 :"+UpdCpunt+" ,本次 【"+ VeDate.getStringDateSSS()+"】 ["+entry.getKey()+"] 修改 "+CUpdCpunt+" idArr.size() "+idArr.size()); + } + + System.out.println(" 修改完成 "+VeDate.getStringDateSSS()+" UpdCpunt "+UpdCpunt); + } + + public static void main(String[] args) { + RollbackCardagent init = new RollbackCardagent(); + //init.initMQConfig(); + } + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/backups/SysLogsTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/backups/SysLogsTask.java new file mode 100644 index 0000000..7dca2cb --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/backups/SysLogsTask.java @@ -0,0 +1,71 @@ +package com.yunze.quartz.task.yunze.backups; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.mapper.yunze.YzSysLogsMapper; +import com.yunze.common.utils.yunze.VeDate; +import com.yunze.common.utils.yunze.WriteCSV; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Queue; + +/** + * 定时任务 通道轮序 达量停机 + * + * @author root + */ +@Component("sysLogsTask") +public class SysLogsTask { + + + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + + /** + * 备份 SysLogsTask + */ + public void backups() { + + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_BackupsyzSysLogs_queue"; + String polling_routingKey = "admin.BackupsyzSysLogs.queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.put("Masage", "备份 执行 GenTableTask ");//启动类型 + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("导入 卡号 失败 " + e.getMessage().toString()); + } + + + + + } + + + + + + + + + + + + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/cardflow/MqCardFlow.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/cardflow/MqCardFlow.java new file mode 100644 index 0000000..6ae38c1 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/cardflow/MqCardFlow.java @@ -0,0 +1,143 @@ +package com.yunze.quartz.task.yunze.cardflow; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +/** + * 定时任务 同步主表到期日期 + * + * @author root + */ + +@Component("mqcardflow") +public class MqCardFlow { + + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + + public void gettime(Integer Time){ + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_DueExpireTime_queue"; + String polling_routingKey = "admin.DueExpireTim.queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.put("Masage", "备份 执行 admin_DueExpireTime_queue ");//启动类型 + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (Time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("同步主表到期日期 失败 " + e.getMessage().toString()); + } + + } + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/cvalue/CEndValue.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/cvalue/CEndValue.java new file mode 100644 index 0000000..02e7d46 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/cvalue/CEndValue.java @@ -0,0 +1,42 @@ +package com.yunze.quartz.task.yunze.cvalue; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; +@Component("cendvalue") +public class CEndValue { + + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + + /** + * C端充值 轮询 卡状态变更失败的 进行再次 复机;(前提是没用完用量) + * */ + public void cendalue(Integer Time) { + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_CEndValue_queue"; + String polling_routingKey = "admin.CEndValue.queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.put("Masage", "备份 执行 admin_CEndValue_queue ");//启动类型 + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (Time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("导入 卡号 失败 " + e.getMessage().toString()); + } + } +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/mouthfirst/Month.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/mouthfirst/Month.java new file mode 100644 index 0000000..d98a13f --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/mouthfirst/Month.java @@ -0,0 +1,42 @@ +package com.yunze.quartz.task.yunze.mouthfirst; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; +@Component("month") +public class Month { + + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + + /** + * 月初有订购期内流量卡 进行 复机 + * */ + public void gentable(Integer Time) { + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_MonthFirstday_queue"; + String polling_routingKey = "admin.MonthFirstday.queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.put("Masage", "备份 执行 admin_MonthFirstday_queue ");//启动类型 + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (Time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("导入 卡号 失败 " + e.getMessage().toString()); + } + } +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardActivateDateTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardActivateDateTask.java new file mode 100644 index 0000000..634af2c --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardActivateDateTask.java @@ -0,0 +1,179 @@ +package com.yunze.quartz.task.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzPassagewayPollingMapper; +import com.yunze.apiCommon.utils.VeDate; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 定时任务 通道轮序 + * + * @author root + */ +@Component("cardActivateDateTask") +public class CardActivateDateTask { + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private YzCardMapper yzCardMapper; + @Autowired + private RabbitTemplate rabbitTemplate; + + @Autowired + private YzPassagewayPollingMapper yzPassagewayPollingMapper; + + @Resource + private RabbitMQConfig rabbitMQConfig; + + //卡轮询 路由队列 + String polling_queueName = "polling_card_activatedate"; + String polling_routingKey = "polling.card.activatedate"; + String polling_exchangeName = "polling_card"; + + // + String ad_exchangeName = null, ad_queueName = null, ad_routingKey = null, + ad_del_exchangeName = null,ad_del_queueName = null, ad_del_routingKey = null; + + + + + + /** + * 轮序 激活时间 + * type Slight .还没有用量的数据; 2.超出用量的 Serious + * @param type + * @param time 多少 分钟 后失效 + */ + public void pollingActivateDate(String type, Integer time) { + //1.状态 正常 轮询开启 时 获取 每个 通道下卡号 加入队列 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + if (channelArr != null && channelArr.size() > 0) { + //2.获取 通道下卡号 + boolean bool = false; + bool = type.equalsIgnoreCase("Slight") ? true : false;// 轮询 还没有用量的数据 是 开启 激活时间 任务生产 + for (int i = 0; i < channelArr.size(); i++) { + Map channel_obj = channelArr.get(i); + Map findMap = new HashMap<>(); + String cd_id = channel_obj.get("cd_id").toString(); + findMap.put("channel_id", cd_id); + findMap.put("type", type); + List> cardArr = yzCardMapper.channelCardSeriousAndSlight(findMap); + if (cardArr != null && cardArr.size() > 0) { + //插入 通道轮序详情表 + Map pollingPublic_Map = new HashMap<>(); + pollingPublic_Map.put("cd_id", cd_id); + pollingPublic_Map.put("cd_current", 0); + //激活时间 任务生产 + //if (bool) { + findMap.put("Arr", cardArr); + List> ActivateArr = yzCardMapper.activate_dateNull(findMap);// 获取激活时间为空 iccid + if (ActivateArr != null && ActivateArr.size() > 0) { + String polling_id = VeDate.getNo(4); + //创建 路由 新增轮序详情 生产启动类型消息 + if(ActivateDate(time,ActivateArr.size(),polling_id,pollingPublic_Map)){ + ActivateDateRun(ActivateArr,channel_obj,polling_id,cd_id,time); + } + } + //} + + } + } + } + } + + + + /** + * 激活时间 任务发送消息 + * @param ActivateArr + * @param channel_obj + * @param polling_id + * @param cd_id + * @param time + */ + public void ActivateDateRun(List> ActivateArr, Map channel_obj, String polling_id,String cd_id,int time) { + for (int j = 0; j < ActivateArr.size(); j++) { + Map card = ActivateArr.get(j); + Map Card = new HashMap<>(); + Card.putAll(channel_obj); + Card.put("iccid", card.get("iccid")); + Card.put("card_no", card.get("card_no")); + Card.put("polling_id", polling_id);//轮序任务详情编号 + String msg = JSON.toJSONString(Card); + //1. 更新激活时间 [生产任务] + try { + if (j == 0) { + //设置任务 路由器 名称 与队列 名称 + ad_exchangeName = "polling_cardActivateDate_exchange"; + ad_queueName = "polling_cardActivateDate_queue_" + cd_id; + ad_routingKey = "polling.cardActivateDate.routingKey." + cd_id; + ad_del_exchangeName = "polling_dlxcardActivateDate_exchange"; + ad_del_queueName = "polling_dlxcardActivateDate_queue_" + cd_id; + ad_del_routingKey = "polling.dlxcardActivateDate.routingKey." + cd_id; + rabbitMQConfig.creatExchangeQueue(ad_exchangeName, ad_queueName, ad_routingKey, ad_del_exchangeName, ad_del_queueName, ad_del_routingKey,null); + } + //rabbitMQConfig.send(exchangeName,queueName,routingKey,"direct",msg); + rabbitTemplate.convertAndSend(ad_exchangeName, ad_routingKey, msg, message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println(e.getMessage().toString()); + } + } + } + + + + + /** + * 创建 激活时间 轮询 生产者路由队列 及 数据库 插入 轮询信息 + * @param time + * @param size + * @param polling_id + * @param pollingPublic_Map + * @return + */ + public boolean ActivateDate(int time, int size, String polling_id,Map pollingPublic_Map) { + boolean bool = true; + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.FANOUT); + Map start_type = new HashMap<>(); + start_type.put("type", "ActivateDate"); + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + pollingPublic_Map.put("polling_type", "1"); + pollingPublic_Map.put("cd_count", size); + pollingPublic_Map.put("polling_id", polling_id); + yzPassagewayPollingMapper.add(pollingPublic_Map);//新增 轮序详情表 + } catch (Exception e) { + System.out.println("生产 轮序 [ActivateDate] 启动类型 失败 " + e.getMessage().toString()); + } + return bool; + } + + + + + + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardDisconnectedTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardDisconnectedTask.java new file mode 100644 index 0000000..49ed148 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardDisconnectedTask.java @@ -0,0 +1,176 @@ +package com.yunze.quartz.task.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzPassagewayPollingMapper; +import com.yunze.apiCommon.utils.VeDate; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 定时任务 通道轮序 未订购停机 + * + * @author root + */ +@Component("cardDisconnectedTask") +public class CardDisconnectedTask { + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RabbitTemplate rabbitTemplate; + + @Resource + private YzPassagewayPollingMapper yzPassagewayPollingMapper; + + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RedisCache redisCache; + //卡轮询 路由队列 + String polling_queueName = "polling_card_disconnected"; + String polling_routingKey = "polling.card.disconnected"; + String polling_exchangeName = "polling_card"; + + // + String ad_exchangeName = null, ad_queueName = null, ad_routingKey = null, + ad_del_exchangeName = null,ad_del_queueName = null, ad_del_routingKey = null; + + + + + + /** + * 轮序 卡状态 + * @param time 多少 分钟 后失效 + */ + public void pollingCardDisconnected(Integer time) { + //1.状态 正常 轮询开启 时 获取 每个 通道下卡号 加入队列 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + if (channelArr != null && channelArr.size() > 0) { + //2.获取 通道下卡号 + for (int i = 0; i < channelArr.size(); i++) { + Map channel_obj = channelArr.get(i); + Map findMap = new HashMap<>(); + String cd_id = channel_obj.get("cd_id").toString(); + findMap.put("channel_id", cd_id); + List> cardArr = yzCardMapper.findChannelIdDisconnected(findMap); + if (cardArr != null && cardArr.size() > 0) { + //插入 通道轮序详情表 + Map pollingPublic_Map = new HashMap<>(); + pollingPublic_Map.put("cd_id", cd_id); + pollingPublic_Map.put("cd_current", 0); + + //卡状态 用量 轮询 + String polling_id_CardDisconnected = VeDate.getNo(4); + //创建 路由 新增轮序详情 生产启动类型消息 + Map start_type = new HashMap(); + start_type.put("Listener","polling_cardCardDisconnected_queue_" + cd_id); + start_type.put("cd_id", cd_id); + boolean CardDisconnectedBool = CardDisconnected(time, cardArr.size(), polling_id_CardDisconnected,pollingPublic_Map,start_type); + String CardDisconnected_routingKey = ""; + //String CardFlow_routingKey = ""; + //2.卡状态 + //卡号放入路由 + for (int j = 0; j < cardArr.size(); j++) { + Map card = cardArr.get(j); + Map Card = new HashMap<>(); + Card.putAll(channel_obj); + Card.put("iccid", card.get("iccid")); + Card.put("card_no", card.get("card_no")); + Card.put("status_id", card.get("status_id")); + Card.put("polling_id", polling_id_CardDisconnected);//轮序任务详情编号 + + String msg = JSON.toJSONString(Card); + //生产任务 + try { + if (j == 0) { + //设置任务 路由器 名称 与队列 名称 + if(CardDisconnectedBool){ //卡状态 + ad_exchangeName = "polling_cardCardDisconnected_exchange"; + ad_queueName = "polling_cardCardDisconnected_queue_" + cd_id; + CardDisconnected_routingKey = "polling.cardCardDisconnected.routingKey." + cd_id; + ad_del_exchangeName = "polling_dlxcardCardDisconnected_exchange"; + ad_del_queueName = "polling_dlxcardCardDisconnected_queue_" + cd_id; + ad_del_routingKey = "polling.dlxcardCardDisconnected.routingKey." + cd_id; + rabbitMQConfig.creatExchangeQueue(ad_exchangeName, ad_queueName, CardDisconnected_routingKey, ad_del_exchangeName, ad_del_queueName, ad_del_routingKey,null); + + redisCache.setCacheObject("polling-Listener-CardDisconnected-"+cd_id, ad_queueName+","+ad_del_queueName);// 缓存 避免 重复创建 消费 监听 + } + } + if(CardDisconnectedBool){ //卡状态 + rabbitTemplate.convertAndSend("polling_cardCardDisconnected_exchange", CardDisconnected_routingKey, msg, message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } + //rabbitMQConfig.send(exchangeName,queueName,routingKey,"direct",msg); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + } + } + } + } + + + /** + * 创建 卡状态 轮询 生产者路由队列 及 数据库 插入 轮询信息 + * @param time + * @param size + * @param polling_id + * @param pollingPublic_Map + * @param start_type + * @return + */ + public boolean CardDisconnected(int time, int size, String polling_id,Map pollingPublic_Map,Map start_type) { + boolean bool = true; + //卡状态 轮询 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.FANOUT); + start_type.put("type", "CardDisconnected"); + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + pollingPublic_Map.put("polling_type", "5"); + pollingPublic_Map.put("cd_count", size); + pollingPublic_Map.put("polling_id", polling_id); + yzPassagewayPollingMapper.add(pollingPublic_Map);//新增 轮序详情表 + + } catch (Exception e) { + bool = false; + System.out.println("生产 轮序 [CardDisconnected] 启动类型 失败 " + e.getMessage().toString()); + } + return bool; + } + + + + + + + + + + + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardFlowTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardFlowTask.java new file mode 100644 index 0000000..f7d92ac --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardFlowTask.java @@ -0,0 +1,276 @@ +package com.yunze.quartz.task.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzPassagewayPollingMapper; +import com.yunze.apiCommon.utils.VeDate; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 定时任务 通道轮序 + * + * @author root + */ +@Component("cardFlowTask") +public class CardFlowTask { + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RabbitTemplate rabbitTemplate; + + @Resource + private YzPassagewayPollingMapper yzPassagewayPollingMapper; + + @Resource + private RabbitMQConfig rabbitMQConfig; + + //卡轮询 路由队列 + String polling_queueName = "polling_card_flow"; + String polling_routingKey = "polling.card.flow"; + String polling_exchangeName = "polling_card"; + + // + String ad_exchangeName = null, ad_queueName = null, ad_routingKey = null, + ad_del_exchangeName = null, ad_del_queueName = null, ad_del_routingKey = null; + + + /** + * 轮序 用量 指定单个通道创建 消费者 【用来补救 消费者灵活监听时 没有创建 成功 消费者 进行 手动 补救创建 消费者】 + * @param time 多少 分钟 后失效 + */ + public void CardFlowCreateListener(Integer time, String cd_id) { + + + + + + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", cd_id); + //生产任务 + try { + rabbitTemplate.convertAndSend("polling_cardCardFlow_exchange", "admin.CardFlow.queue.One", JSON.toJSONString(findRouteID_Map), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println(e.getMessage().toString()); + } + } + + + + /** + * 轮序 用量 指定单个通道轮询 + * + * @param time 多少 分钟 后失效 + */ + public void pollingCardFlowOne(Integer time, String cd_id) { + + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", cd_id); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + + Map findMap = new HashMap<>(); + findMap.put("channel_id", cd_id); + List> cardArr = yzCardMapper.findChannelIdCar(findMap); + if (cardArr != null && cardArr.size() > 0) { + //插入 通道轮序详情表 + Map pollingPublic_Map = new HashMap<>(); + pollingPublic_Map.put("cd_id", cd_id); + pollingPublic_Map.put("cd_current", 0); + + //卡状态 用量 轮询 + String polling_id_CardFlow = VeDate.getNo(4); + //创建 路由 新增轮序详情 生产启动类型消息 + pollingPublic_Map.put("polling_type", "3"); + pollingPublic_Map.put("cd_count", cardArr.size()); + pollingPublic_Map.put("polling_id", polling_id_CardFlow); + yzPassagewayPollingMapper.add(pollingPublic_Map);//新增 轮序详情表 + //2.卡状态 + //卡号放入路由 + //设置任务 路由器 名称 与队列 名称 + String card_exchangeName = "", card_queueName = "", card_routingKey = "", + card_del_exchangeName = "", card_del_queueName = "" , card_del_routingKey = ""; + + try { + card_exchangeName = "polling_cardCardFlow_exchange"; + card_queueName = "polling_cardCardFlow_queue_" + cd_id; + card_routingKey = "polling.cardCardFlow.routingKey." + cd_id; + card_del_exchangeName = "polling_dlxcardCardFlow_exchange"; + card_del_queueName = "polling_dlxcardCardFlow_queue_" + cd_id; + card_del_routingKey = "polling.dlxcardCardFlow.routingKey." + cd_id; + rabbitMQConfig.creatExchangeQueue(card_exchangeName, card_queueName, card_routingKey, card_del_exchangeName, card_del_queueName, card_del_routingKey, null); + System.out.println("pollingCardFlowOne 创建 【" + channelArr.get(0) + "】 成功 !"); + } catch (Exception e) { + System.out.println("pollingCardFlowOne 队列 创建 【" + channelArr.get(0) + "】 失败 " + e.getMessage()); + } + + + for (int j = 0; j < cardArr.size(); j++) { + Map card = cardArr.get(j); + Map Card = new HashMap<>(); + Card.putAll(channelArr.get(0)); + Card.put("iccid", card.get("iccid")); + Card.put("card_no", card.get("card_no")); + Card.put("polling_id", polling_id_CardFlow);//轮序任务详情编号 + String msg = JSON.toJSONString(Card); + //生产任务 + try { + rabbitTemplate.convertAndSend(card_exchangeName, card_routingKey, msg, message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println(e.getMessage().toString()); + } + } + } + } + + + /** + * 轮序 卡状态 + * + * @param time 多少 分钟 后失效 + */ + public void pollingCardFlow(Integer time) { + //1.状态 正常 轮询开启 时 获取 每个 通道下卡号 加入队列 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", null); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + if (channelArr != null && channelArr.size() > 0) { + //2.获取 通道下卡号 + for (int i = 0; i < channelArr.size(); i++) { + Map channel_obj = channelArr.get(i); + Map findMap = new HashMap<>(); + String cd_id = channel_obj.get("cd_id").toString(); + findMap.put("channel_id", cd_id); + List> cardArr = yzCardMapper.findChannelIdCar(findMap); + if (cardArr != null && cardArr.size() > 0) { + //插入 通道轮序详情表 + Map pollingPublic_Map = new HashMap<>(); + pollingPublic_Map.put("cd_id", cd_id); + pollingPublic_Map.put("cd_current", 0); + + //卡状态 用量 轮询 + String polling_id_CardFlow = VeDate.getNo(4); + //创建 路由 新增轮序详情 生产启动类型消息 + boolean CardFlowBool = CardFlow(time, cardArr.size(), polling_id_CardFlow, pollingPublic_Map); + String CardFlow_routingKey = ""; + //2.卡状态 + //卡号放入路由 + for (int j = 0; j < cardArr.size(); j++) { + Map card = cardArr.get(j); + Map Card = new HashMap<>(); + Card.putAll(channel_obj); + Card.put("iccid", card.get("iccid")); + Card.put("card_no", card.get("card_no")); + Card.put("polling_id", polling_id_CardFlow);//轮序任务详情编号 + String msg = JSON.toJSONString(Card); + //生产任务 + try { + if (j == 0) { + //设置任务 路由器 名称 与队列 名称 + if (CardFlowBool) { + ad_exchangeName = "polling_cardCardFlow_exchange"; + ad_queueName = "polling_cardCardFlow_queue_" + cd_id; + CardFlow_routingKey = "polling.cardCardFlow.routingKey." + cd_id; + ad_del_exchangeName = "polling_dlxcardCardFlow_exchange"; + ad_del_queueName = "polling_dlxcardCardFlow_queue_" + cd_id; + ad_del_routingKey = "polling.dlxcardCardFlow.routingKey." + cd_id; + rabbitMQConfig.creatExchangeQueue(ad_exchangeName, ad_queueName, CardFlow_routingKey, ad_del_exchangeName, ad_del_queueName, ad_del_routingKey, null); + } + } + if (CardFlowBool) { + rabbitTemplate.convertAndSend("polling_cardCardFlow_exchange", CardFlow_routingKey, msg, message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } + //rabbitMQConfig.send(exchangeName,queueName,routingKey,"direct",msg); + } catch (Exception e) { + System.out.println(e.getMessage().toString()); + } + } + } + } + } + } + + + /** + * 创建 卡状态 轮询 生产者路由队列 及 数据库 插入 轮询信息 + * + * @param time + * @param size + * @param polling_id + * @param pollingPublic_Map + * @return + */ + public boolean CardFlow(Integer time, Integer size, String polling_id, Map pollingPublic_Map) { + boolean bool = true; + //卡状态 轮询 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.FANOUT); + Map start_type = new HashMap<>(); + start_type.put("type", "CardFlow"); + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + pollingPublic_Map.put("polling_type", "3"); + pollingPublic_Map.put("cd_count", size); + pollingPublic_Map.put("polling_id", polling_id); + yzPassagewayPollingMapper.add(pollingPublic_Map);//新增 轮序详情表 + } catch (Exception e) { + bool = false; + System.out.println("生产 轮序 [CardFlow] 启动类型 失败 " + e.getMessage().toString()); + } + return bool; + } + + + /** + * 直接再次启动 + * + * @param time + * @return + */ + public boolean StartCardFlow(Integer time) { + boolean bool = true; + //卡状态 轮询 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.FANOUT); + Map start_type = new HashMap<>(); + start_type.put("type", "CardFlow"); + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + bool = false; + System.out.println("生产 轮序 [StartCardFlow] 启动类型 失败 " + e.getMessage().toString()); + } + return bool; + } + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardStatusTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardStatusTask.java new file mode 100644 index 0000000..5c9ff36 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardStatusTask.java @@ -0,0 +1,168 @@ +package com.yunze.quartz.task.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzPassagewayPollingMapper; +import com.yunze.apiCommon.utils.VeDate; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 定时任务 通道轮序 + * + * @author root + */ +@Component("cardStatusTask") +public class CardStatusTask { + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RabbitTemplate rabbitTemplate; + + @Resource + private YzPassagewayPollingMapper yzPassagewayPollingMapper; + + @Resource + private RabbitMQConfig rabbitMQConfig; + + //卡轮询 路由队列 + String polling_queueName = "polling_card_status"; + String polling_routingKey = "polling.card.status"; + String polling_exchangeName = "polling_card"; + + // + String ad_exchangeName = null, ad_queueName = null, ad_routingKey = null, + ad_del_exchangeName = null,ad_del_queueName = null, ad_del_routingKey = null; + + + + + + /** + * 轮序 卡状态 + * @param time 多少 分钟 后失效 + */ + public void pollingCardStatus(Integer time) { + //1.状态 正常 轮询开启 时 获取 每个 通道下卡号 加入队列 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + if (channelArr != null && channelArr.size() > 0) { + //2.获取 通道下卡号 + for (int i = 0; i < channelArr.size(); i++) { + Map channel_obj = channelArr.get(i); + Map findMap = new HashMap<>(); + String cd_id = channel_obj.get("cd_id").toString(); + findMap.put("channel_id", cd_id); + List> cardArr = yzCardMapper.findChannelIdCar(findMap); + if (cardArr != null && cardArr.size() > 0) { + //插入 通道轮序详情表 + Map pollingPublic_Map = new HashMap<>(); + pollingPublic_Map.put("cd_id", cd_id); + pollingPublic_Map.put("cd_current", 0); + + //卡状态 用量 轮询 + String polling_id_CardStatus = VeDate.getNo(4); + //创建 路由 新增轮序详情 生产启动类型消息 + boolean CardStatusBool = CardStatus(time, cardArr.size(), polling_id_CardStatus,pollingPublic_Map); + String CardStatus_routingKey = ""; + //String CardFlow_routingKey = ""; + //2.卡状态 + //卡号放入路由 + for (int j = 0; j < cardArr.size(); j++) { + Map card = cardArr.get(j); + Map Card = new HashMap<>(); + Card.putAll(channel_obj); + Card.put("iccid", card.get("iccid")); + Card.put("card_no", card.get("card_no")); + Card.put("polling_id", polling_id_CardStatus);//轮序任务详情编号 + String msg = JSON.toJSONString(Card); + //生产任务 + try { + if (j == 0) { + //设置任务 路由器 名称 与队列 名称 + if(CardStatusBool){ //卡状态 + ad_exchangeName = "polling_cardCardStatus_exchange"; + ad_queueName = "polling_cardCardStatus_queue_" + cd_id; + CardStatus_routingKey = "polling.cardCardStatus.routingKey." + cd_id; + ad_del_exchangeName = "polling_dlxcardCardStatus_exchange"; + ad_del_queueName = "polling_dlxcardCardStatus_queue_" + cd_id; + ad_del_routingKey = "polling.dlxcardCardStatus.routingKey." + cd_id; + rabbitMQConfig.creatExchangeQueue(ad_exchangeName, ad_queueName, CardStatus_routingKey, ad_del_exchangeName, ad_del_queueName, ad_del_routingKey,null); + } + } + if(CardStatusBool){ //卡状态 + rabbitTemplate.convertAndSend("polling_cardCardStatus_exchange", CardStatus_routingKey, msg, message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } + //rabbitMQConfig.send(exchangeName,queueName,routingKey,"direct",msg); + } catch (Exception e) { + System.out.println(e.getMessage().toString()); + } + } + } + } + } + } + + + + /** + * 创建 卡状态 轮询 生产者路由队列 及 数据库 插入 轮询信息 + * @param time + * @param size + * @param polling_id + * @param pollingPublic_Map + * @return + */ + public boolean CardStatus(int time, int size, String polling_id,Map pollingPublic_Map) { + boolean bool = true; + //卡状态 轮询 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.FANOUT); + Map start_type = new HashMap<>(); + start_type.put("type", "CardStatus"); + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + pollingPublic_Map.put("polling_type", "2"); + pollingPublic_Map.put("cd_count", size); + pollingPublic_Map.put("polling_id", polling_id); + yzPassagewayPollingMapper.add(pollingPublic_Map);//新增 轮序详情表 + + } catch (Exception e) { + bool = false; + System.out.println("生产 轮序 [CardStatus] 启动类型 失败 " + e.getMessage().toString()); + } + return bool; + } + + + + + + + + + + + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardStopTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardStopTask.java new file mode 100644 index 0000000..317dcb0 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/CardStopTask.java @@ -0,0 +1,203 @@ +package com.yunze.quartz.task.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzPassagewayPollingMapper; +import com.yunze.apiCommon.utils.VeDate; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 定时任务 通道轮序 达量停机 + * + * @author root + */ +@Component("cardStopTask") +public class CardStopTask { + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RabbitTemplate rabbitTemplate; + + @Resource + private YzPassagewayPollingMapper yzPassagewayPollingMapper; + + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RedisCache redisCache; + //卡轮询 路由队列 + String polling_queueName = "polling_card_stop"; + String polling_routingKey = "polling.card.stop"; + String polling_exchangeName = "polling_card"; + + // + String ad_exchangeName = null, ad_queueName = null, ad_routingKey = null, + ad_del_exchangeName = null,ad_del_queueName = null, ad_del_routingKey = null; + + + + + + /** + * 轮序 卡状态 + * @param time 多少 分钟 后失效 + */ + public void pollingCardStop(Integer time) { + //1.状态 正常 轮询开启 时 获取 每个 通道下卡号 加入队列 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + if (channelArr != null && channelArr.size() > 0) { + //2.获取 通道下卡号 + for (int i = 0; i < channelArr.size(); i++) { + Map channel_obj = channelArr.get(i); + Map findMap = new HashMap<>(); + String cd_id = channel_obj.get("cd_id").toString(); + findMap.put("channel_id", cd_id); + List> cardArr = yzCardMapper.findChannelIdCarStop(findMap); + if (cardArr != null && cardArr.size() > 0) { + //插入 通道轮序详情表 + Map pollingPublic_Map = new HashMap<>(); + pollingPublic_Map.put("cd_id", cd_id); + pollingPublic_Map.put("cd_current", 0); + + //卡状态 用量 轮询 + String polling_id_CardStop = VeDate.getNo(4); + //创建 路由 新增轮序详情 生产启动类型消息 + Map start_type = new HashMap(); + start_type.put("Listener","polling_cardCardStop_queue_" + cd_id); + start_type.put("cd_id", cd_id); + boolean CardStopBool = CardStop(time, cardArr.size(), polling_id_CardStop,pollingPublic_Map,start_type); + String CardStop_routingKey = ""; + //String CardFlow_routingKey = ""; + //2.卡状态 + //卡号放入路由 + for (int j = 0; j < cardArr.size(); j++) { + Map card = cardArr.get(j); + Map Card = new HashMap<>(); + Card.putAll(channel_obj); + Card.put("iccid", card.get("iccid")); + Card.put("card_no", card.get("card_no")); + Card.put("status_id", card.get("status_id")); + + Card.put("polling_id", polling_id_CardStop);//轮序任务详情编号 + Object remind_ratio = card.get("remind_ratio"); + Object used = card.get("used"); + boolean is_sel = true;//是否需要查询 + String YyyyAndMm[] = VeDate.getYyyyAndMm(); + String day = YyyyAndMm[2]; + //默认赋值停机值 + if(remind_ratio!=null && remind_ratio.toString().length()>0){ + Card.put("Max", card.get("remind_ratio")); + } + //月初一号 或 27号 通用出账日 、 联通出账日 需要更新最新用量 + if(Integer.parseInt(day)!=1 && Integer.parseInt(day)!=27){ + //并且同步时间等于今天 + Object syn_Time = card.get("syn_Time"); + if(syn_Time!=null){ + String Ymd = YyyyAndMm[0]+"-"+YyyyAndMm[1]+"-"+YyyyAndMm[2]; + if(syn_Time.toString().equals(Ymd)){ + if(remind_ratio!=null && used!=null && remind_ratio.toString().trim().length()>0 && used.toString().trim().length()>0){ + Double d_Max = Double.parseDouble(remind_ratio.toString().trim()); + Double d_used = Double.parseDouble(used.toString().trim()); + is_sel = d_used>d_Max?false:true;//用量大于 最大值 时 不需要查询直接停机 + Card.put("Max", d_Max); + } + } + } + } + + Card.put("is_sel", is_sel);//是否需要接口同步用量 + String msg = JSON.toJSONString(Card); + //生产任务 + try { + if (j == 0) { + //设置任务 路由器 名称 与队列 名称 + if(CardStopBool){ //卡状态 + ad_exchangeName = "polling_cardCardStop_exchange"; + ad_queueName = "polling_cardCardStop_queue_" + cd_id; + CardStop_routingKey = "polling.cardCardStop.routingKey." + cd_id; + ad_del_exchangeName = "polling_dlxcardCardStop_exchange"; + ad_del_queueName = "polling_dlxcardCardStop_queue_" + cd_id; + ad_del_routingKey = "polling.dlxcardCardStop.routingKey." + cd_id; + rabbitMQConfig.creatExchangeQueue(ad_exchangeName, ad_queueName, CardStop_routingKey, ad_del_exchangeName, ad_del_queueName, ad_del_routingKey,null); + + redisCache.setCacheObject("polling-Listener-CardStop-"+cd_id, ad_queueName+","+ad_del_queueName);// 缓存 避免 重复创建 消费 监听 + } + } + if(CardStopBool){ //卡状态 + rabbitTemplate.convertAndSend("polling_cardCardStop_exchange", CardStop_routingKey, msg, message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } + //rabbitMQConfig.send(exchangeName,queueName,routingKey,"direct",msg); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + } + } + } + } + + + /** + * 创建 卡状态 轮询 生产者路由队列 及 数据库 插入 轮询信息 + * @param time + * @param size + * @param polling_id + * @param pollingPublic_Map + * @param start_type + * @return + */ + public boolean CardStop(int time, int size, String polling_id,Map pollingPublic_Map,Map start_type) { + boolean bool = true; + //卡状态 轮询 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.FANOUT); + start_type.put("type", "CardStop"); + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + pollingPublic_Map.put("polling_type", "4"); + pollingPublic_Map.put("cd_count", size); + pollingPublic_Map.put("polling_id", polling_id); + yzPassagewayPollingMapper.add(pollingPublic_Map);//新增 轮序详情表 + + } catch (Exception e) { + bool = false; + System.out.println("生产 轮序 [CardStop] 启动类型 失败 " + e.getMessage().toString()); + } + return bool; + } + + + + + + + + + + + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/ChannelTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/ChannelTask.java new file mode 100644 index 0000000..e5e264f --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/ChannelTask.java @@ -0,0 +1,464 @@ +package com.yunze.quartz.task.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YzPassagewayPollingMapper; + +import com.yunze.apiCommon.utils.VeDate; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 定时任务 通道轮序 + * + * @author root + */ +@Component("channelTask") +public class ChannelTask { + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Autowired + private YzCardMapper cardMapper; + + @Autowired + private RabbitTemplate rabbitTemplate; + + @Autowired + private YzPassagewayPollingMapper yzPassagewayPollingMapper; + + + @Resource + private RabbitMQConfig rabbitMQConfig; + + //卡轮询 路由队列 + String polling_queueName = "polling_start_type"; + String polling_routingKey = "polling.start.type"; + String polling_exchangeName = "polling_card"; + + // + String ad_exchangeName = null, ad_queueName = null, ad_routingKey = null, + ad_del_exchangeName = null,ad_del_queueName = null, ad_del_routingKey = null; + + + /** + * 轮序 还没有用量的数据 超出用量的 的生产者 + * type Slight .还没有用量的数据; 2.超出用量的 Serious + * + * @param type + * @param time 多少 分钟 后失效 + */ + public void channelType(String type, Integer time) { + //1.状态 正常 轮询开启 时 获取 每个 通道下卡号 加入队列 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + + if (channelArr != null && channelArr.size() > 0) { + //2.获取 通道下卡号 + boolean bool = false; + bool = type.equalsIgnoreCase("Slight") ? true : false;// 轮询 还没有用量的数据 是 开启 激活时间 任务生产 + for (int i = 0; i < channelArr.size(); i++) { + Map channel_obj = channelArr.get(i); + Map findMap = new HashMap<>(); + String cd_id = channel_obj.get("cd_id").toString(); + findMap.put("channel_id", cd_id); + findMap.put("type", type); + List> cardArr = cardMapper.channelCardSeriousAndSlight(findMap); + if (cardArr != null && cardArr.size() > 0) { + + //插入 通道轮序详情表 + Map pollingPublic_Map = new HashMap<>(); + pollingPublic_Map.put("cd_id", cd_id); + pollingPublic_Map.put("cd_current", 0); + + //激活时间 任务生产 + if (bool) { + findMap.put("Arr", cardArr); + List> ActivateArr = cardMapper.activate_dateNull(findMap);// 获取激活时间为空 iccid + if (ActivateArr != null && ActivateArr.size() > 0) { + String polling_id = VeDate.getNo(4); + //创建 路由 新增轮序详情 生产启动类型消息 + if(ActivateDate(time,ActivateArr.size(),polling_id,pollingPublic_Map)){ + ActivateDateRun(ActivateArr,channel_obj,polling_id,cd_id,time); + } + } + } + + + + + } + + } + } + } + + + + + + /** + * 轮序 激活时间 + * type Slight .还没有用量的数据; 2.超出用量的 Serious + * @param type + * @param time 多少 分钟 后失效 + */ + public void pollingActivateDate(String type, Integer time) { + //1.状态 正常 轮询开启 时 获取 每个 通道下卡号 加入队列 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + if (channelArr != null && channelArr.size() > 0) { + //2.获取 通道下卡号 + boolean bool = false; + bool = type.equalsIgnoreCase("Slight") ? true : false;// 轮询 还没有用量的数据 是 开启 激活时间 任务生产 + for (int i = 0; i < channelArr.size(); i++) { + Map channel_obj = channelArr.get(i); + Map findMap = new HashMap<>(); + String cd_id = channel_obj.get("cd_id").toString(); + findMap.put("channel_id", cd_id); + findMap.put("type", type); + List> cardArr = cardMapper.channelCardSeriousAndSlight(findMap); + if (cardArr != null && cardArr.size() > 0) { + //插入 通道轮序详情表 + Map pollingPublic_Map = new HashMap<>(); + pollingPublic_Map.put("cd_id", cd_id); + pollingPublic_Map.put("cd_current", 0); + //激活时间 任务生产 + // if (bool) { + findMap.put("Arr", cardArr); + List> ActivateArr = cardMapper.activate_dateNull(findMap);// 获取激活时间为空 iccid + if (ActivateArr != null && ActivateArr.size() > 0) { + String polling_id = VeDate.getNo(4); + //创建 路由 新增轮序详情 生产启动类型消息 + if(ActivateDate(time,ActivateArr.size(),polling_id,pollingPublic_Map)){ + ActivateDateRun(ActivateArr,channel_obj,polling_id,cd_id,time); + } + } + // } + + } + } + } + } + + + + /** + * 轮序 卡状态 + * @param time 多少 分钟 后失效 + */ + public void pollingCardStatus(Integer time) { + //1.状态 正常 轮询开启 时 获取 每个 通道下卡号 加入队列 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + if (channelArr != null && channelArr.size() > 0) { + //2.获取 通道下卡号 + for (int i = 0; i < channelArr.size(); i++) { + Map channel_obj = channelArr.get(i); + Map findMap = new HashMap<>(); + String cd_id = channel_obj.get("cd_id").toString(); + findMap.put("channel_id", cd_id); + List> cardArr = cardMapper.findChannelIdCar(findMap); + if (cardArr != null && cardArr.size() > 0) { + //插入 通道轮序详情表 + Map pollingPublic_Map = new HashMap<>(); + pollingPublic_Map.put("cd_id", cd_id); + pollingPublic_Map.put("cd_current", 0); + + //卡状态 用量 轮询 + String polling_id_CardStatus = VeDate.getNo(4); + //创建 路由 新增轮序详情 生产启动类型消息 + boolean CardStatusBool = CardStatus(time, cardArr.size(), polling_id_CardStatus,pollingPublic_Map); + String CardStatus_routingKey = ""; + String CardFlow_routingKey = ""; + //2.卡状态 + //卡号放入路由 + for (int j = 0; j < cardArr.size(); j++) { + Map card = cardArr.get(j); + Map Card = new HashMap<>(); + Card.putAll(channel_obj); + Card.put("iccid", card.get("iccid")); + Card.put("card_no", card.get("card_no")); + Card.put("polling_id", polling_id_CardStatus);//轮序任务详情编号 + String msg = JSON.toJSONString(Card); + //生产任务 + try { + if (j == 0) { + //设置任务 路由器 名称 与队列 名称 + if(CardStatusBool){ //卡状态 + ad_exchangeName = "polling_cardCardStatus_exchange"; + ad_queueName = "polling_cardCardStatus_queue_" + cd_id; + CardStatus_routingKey = "polling.cardCardStatus.routingKey." + cd_id; + ad_del_exchangeName = "polling_dlxcardCardStatus_exchange"; + ad_del_queueName = "polling_dlxcardCardStatus_queue_" + cd_id; + ad_del_routingKey = "polling.dlxcardCardStatus.routingKey." + cd_id; + rabbitMQConfig.creatExchangeQueue(ad_exchangeName, ad_queueName, CardStatus_routingKey, ad_del_exchangeName, ad_del_queueName, ad_del_routingKey,null); + } + } + if(CardStatusBool){ //卡状态 + rabbitTemplate.convertAndSend("polling_cardCardStatus_exchange", CardStatus_routingKey, msg, message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } + //rabbitMQConfig.send(exchangeName,queueName,routingKey,"direct",msg); + } catch (Exception e) { + System.out.println(e.getMessage().toString()); + } + } + } + } + } + } + + + + + + + + + + + + + + + + + + + + + + // 通道 轮序 3.正常使用的卡号数据 + public void channel(Integer time) { + //1.状态 正常 轮序开启 时 获取 每个 通道下卡号 加入队列 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + + if (channelArr != null && channelArr.size() > 0) { + //2.获取 通道下卡号 + for (int i = 0; i < channelArr.size(); i++) { + Map channel_obj = channelArr.get(i); + Map findMap = new HashMap<>(); + findMap.put("channel_id", channel_obj.get("cd_id")); + String cd_id = channel_obj.get("cd_id").toString(); + + List> cardArr = cardMapper.channelCardCommonly(findMap); + if (cardArr != null && cardArr.size() > 0) { + + + + //插入 通道轮序详情表 + Map pollingPublic_Map = new HashMap<>(); + pollingPublic_Map.put("cd_id", cd_id); + pollingPublic_Map.put("cd_current", 0); + + //卡状态 用量 轮询 + String polling_id_CardStatus = VeDate.getNo(4); + //创建 路由 新增轮序详情 生产启动类型消息 + boolean CardStatusBool = CardStatus(time, cardArr.size(), polling_id_CardStatus,pollingPublic_Map); + + + String CardStatus_routingKey = ""; + String CardFlow_routingKey = ""; + + + + //卡号放入路由 + for (int j = 0; j < cardArr.size(); j++) { + Map card = cardArr.get(j); + Map Card = new HashMap<>(); + Card.putAll(channel_obj); + Card.put("iccid", card.get("iccid")); + Card.put("card_no", card.get("card_no")); + String msg = JSON.toJSONString(Card); + //生产任务 + //2.卡状态 + try { + if (j == 0) { + //设置任务 路由器 名称 与队列 名称 + if(CardStatusBool){ //卡状态 + ad_exchangeName = "polling_cardCardStatus_exchange"; + ad_queueName = "polling_cardCardStatus_queue_" + cd_id; + CardStatus_routingKey = "polling.cardCardStatus.routingKey." + cd_id; + ad_del_exchangeName = "polling_dlxcardCardStatus_exchange"; + ad_del_queueName = "polling_dlxcardCardStatus_queue_" + cd_id; + ad_del_routingKey = "polling.dlxcardCardStatus.routingKey." + cd_id; + rabbitMQConfig.creatExchangeQueue(ad_exchangeName, ad_queueName, CardStatus_routingKey, ad_del_exchangeName, ad_del_queueName, ad_del_routingKey,null); + } + } + if(CardStatusBool){ //卡状态 + rabbitTemplate.convertAndSend("polling_cardCardStatus_exchange", CardStatus_routingKey, msg, message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } + //rabbitMQConfig.send(exchangeName,queueName,routingKey,"direct",msg); + } catch (Exception e) { + System.out.println(e.getMessage().toString()); + } + + } + } + + } + } + } + + + // 通道 轮序 2.超过百分之多少的数据进行轮序生产 + public void channelFindPercentage(String percentage) { + //1.状态 正常 轮序开启 时 获取 每个 通道下卡号 加入队列 + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id",null); + List> channelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + + if (channelArr != null && channelArr.size() > 0) { + //2.获取 通道下卡号 + for (int i = 0; i < channelArr.size(); i++) { + Map channel_obj = channelArr.get(i); + Map findMap = new HashMap<>(); + findMap.put("channel_id", channel_obj.get("cd_id")); + findMap.put("percentage", percentage); + List> cardArr = cardMapper.findPercentage(findMap); + if (cardArr != null && cardArr.size() > 0) { + //卡号放入路由 + for (int j = 0; j < cardArr.size(); j++) { + Map card = cardArr.get(j); + Map Card = new HashMap<>(); + Card.putAll(channel_obj); + Card.put("iccid", card.get("iccid")); + Card.put("card_no", card.get("card_no")); + String msg = JSON.toJSONString(Card); + + + } + } + + } + } + } + + + /** + * 创建 卡状态 轮询 生产者路由队列 及 数据库 插入 轮询信息 + * @param time + * @param size + * @param polling_id + * @param pollingPublic_Map + * @return + */ + public boolean CardStatus(int time, int size, String polling_id,Map pollingPublic_Map) { + boolean bool = true; + //卡状态 轮询 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.FANOUT); + Map start_type = new HashMap<>(); + start_type.put("type", "CardStatus"); + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + pollingPublic_Map.put("polling_type", "2"); + pollingPublic_Map.put("cd_count", size); + pollingPublic_Map.put("polling_id", polling_id); + yzPassagewayPollingMapper.add(pollingPublic_Map);//新增 轮序详情表 + + } catch (Exception e) { + bool = false; + System.out.println("生产 轮序 [CardStatus] 启动类型 失败 " + e.getMessage().toString()); + } + return bool; + } + + /** + * 创建 激活时间 轮询 生产者路由队列 及 数据库 插入 轮询信息 + * @param time + * @param size + * @param polling_id + * @param pollingPublic_Map + * @return + */ + public boolean ActivateDate(int time, int size, String polling_id,Map pollingPublic_Map) { + boolean bool = true; + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null,BuiltinExchangeType.FANOUT); + Map start_type = new HashMap<>(); + start_type.put("type", "ActivateDate"); + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + pollingPublic_Map.put("polling_type", "1"); + pollingPublic_Map.put("cd_count", size); + pollingPublic_Map.put("polling_id", polling_id); + yzPassagewayPollingMapper.add(pollingPublic_Map);//新增 轮序详情表 + } catch (Exception e) { + System.out.println("生产 轮序 [ActivateDate] 启动类型 失败 " + e.getMessage().toString()); + } + return bool; + } + + + /** + * 激活时间 任务发送消息 + * @param ActivateArr + * @param channel_obj + * @param polling_id + * @param cd_id + * @param time + */ + public void ActivateDateRun(List> ActivateArr, Map channel_obj, String polling_id,String cd_id,int time) { + for (int j = 0; j < ActivateArr.size(); j++) { + Map card = ActivateArr.get(j); + Map Card = new HashMap<>(); + Card.putAll(channel_obj); + Card.put("iccid", card.get("iccid")); + Card.put("card_no", card.get("card_no")); + Card.put("polling_id", polling_id);//轮序任务详情编号 + String msg = JSON.toJSONString(Card); + //1. 更新激活时间 [生产任务] + try { + if (j == 0) { + //设置任务 路由器 名称 与队列 名称 + ad_exchangeName = "polling_cardActivateDate_exchange"; + ad_queueName = "polling_cardActivateDate_queue_" + cd_id; + ad_routingKey = "polling.cardActivateDate.routingKey." + cd_id; + ad_del_exchangeName = "polling_dlxcardActivateDate_exchange"; + ad_del_queueName = "polling_dlxcardActivateDate_queue_" + cd_id; + ad_del_routingKey = "polling.dlxcardActivateDate.routingKey." + cd_id; + rabbitMQConfig.creatExchangeQueue(ad_exchangeName, ad_queueName, ad_routingKey, ad_del_exchangeName, ad_del_queueName, ad_del_routingKey,null); + } + //rabbitMQConfig.send(exchangeName,queueName,routingKey,"direct",msg); + rabbitTemplate.convertAndSend(ad_exchangeName, ad_routingKey, msg, message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println(e.getMessage().toString()); + } + } + } + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/PassagewayPollingTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/PassagewayPollingTask.java new file mode 100644 index 0000000..967bc65 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/PassagewayPollingTask.java @@ -0,0 +1,65 @@ +package com.yunze.quartz.task.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; + +import com.yunze.common.mapper.yunze.YzPassagewayPollingMapper; + +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 定时任务 通道轮序进度同步任务 + * @author root + */ +@Component("passagewayPollingTask") +public class PassagewayPollingTask +{ + + @Resource + private YzPassagewayPollingMapper yzPassagewayPollingMapper; + @Resource + private RedisCache redisCache; + + @Resource + private RabbitMQConfig rabbitMQConfig; + + + /** + * 获取正在执行的轮序任务进度获取 通过 redis 模糊key 查询 获取 轮序任务编号下的卡号 + */ + public void SynChannel() + { + //1. 查询 近三天 正在执行的轮序任务 并且 当前执行任务数 小于 任务总数 (三天以上的可能读取数据误差或其他原因不在同步数据了) + List> channelArr = yzPassagewayPollingMapper.find_execute(); + if(channelArr!=null && channelArr.size()>0){ + + for (int i = 0; i < channelArr.size(); i++) { + Map obj = channelArr.get(i); + String polling_id = obj.get("polling_id").toString(); + Integer cd_current = Integer.parseInt(obj.get("cd_current").toString()); + + Collection keys = redisCache.scanKeys(polling_id); + if(keys!=null && keys.size()>0){ + //redis 缓存数据大于数据库当前轮询数量时 修改 + if(keys.size()>cd_current){ + Map updMap = new HashMap(); + updMap.put("polling_id",polling_id); + updMap.put("cd_current",keys.size()); + yzPassagewayPollingMapper.update_cd_current(updMap); + } + } + } + + } + } + + + + + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/RebootTask.java b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/RebootTask.java new file mode 100644 index 0000000..940151d --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/task/yunze/polling/RebootTask.java @@ -0,0 +1,432 @@ +package com.yunze.quartz.task.yunze.polling; + +import com.alibaba.fastjson.JSON; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.commodity.YzWxByProductAgentMapper; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 定时任务 重新启动 》大于系统参数 多少条数据的 轮序通道队列 + * + * @author root + */ +@Component("rebootTask") +public class RebootTask { + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private RabbitTemplate rabbitTemplate; + + @Resource + private RedisCache redisCache; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private YzWxByProductAgentMapper yzWxByProductAgentMapper; + + /** + * 轮序 用量 指定单个通道创建 消费者 【用来补救 消费者灵活监听时 没有创建 成功 消费者 进行 手动 补救创建 消费者】 + * + * @param time 多少 分钟 后失效 + */ + public void CardFlowCreateListener(Integer time, String cd_id) { + Map findRouteID_Map = new HashMap<>(); + findRouteID_Map.put("FindCd_id", cd_id); + //生产任务 + try { + rabbitTemplate.convertAndSend("polling_cardCardFlow_exchange", "admin.CardFlow.queue.One", JSON.toJSONString(findRouteID_Map), message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + } + + + /** + * 重新启动 没有在Redis 记录 的轮询 通道 创建 消费者 轮询 + * @param time + */ + public void RebootFlowPolling(Integer time) { + Map findRouteID_Map = new HashMap<>(); + + List Cd_idArr = yzCardRouteMapper.findCardChannelID(); + Cd_idArr = Cd_idArr != null && Cd_idArr.size() > 0 ? Cd_idArr : null; + findRouteID_Map.put("FindCd_id", null); + findRouteID_Map.put("Cd_idArr", Cd_idArr); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + + Map rebootStandardMap = new HashMap<>(); + + Object rebootStandard = redisCache.getCacheObject("polling.rebootStandard"); + Integer rebootStandardint = null; + if (rebootStandard != null && rebootStandard.toString().length() > 0) { + rebootStandard = rebootStandard != null ? rebootStandard : "1000";//默认 1K + } else { + rebootStandardMap.put("config_key", "polling.rebootStandard"); + rebootStandard = yzWxByProductAgentMapper.findConfig(rebootStandardMap); + rebootStandard = rebootStandard != null ? rebootStandard : "1000";//默认 1K + redisCache.setCacheObject("polling.rebootStandard", rebootStandard, 6, TimeUnit.HOURS);//6 小时 缓存 + } + + rebootStandardint = Integer.parseInt(rebootStandard.toString()); + String Type = "direct"; + if (ChannelArr != null && ChannelArr.size() > 0) { + for (int i = 0; i < ChannelArr.size(); i++) { + Map ChannelObj = ChannelArr.get(i); + Map msg_Map = new HashMap<>(); + String cd_id = ChannelObj.get("cd_id").toString(); + msg_Map.put("FindCd_id", ChannelObj.get("cd_id")); + + RebootFlow(cd_id,time,rebootStandardint,msg_Map,Type); + RebootStatus(cd_id,time,rebootStandardint,msg_Map,Type); + RebootActivateDate(cd_id,time,rebootStandardint,msg_Map,Type); + + } + } + } + + + + + + /** + * 重新启动 没有在Redis 记录 的轮询 通道 创建 消费者 轮询 + * @param time + */ + public void RebootCardStop(Integer time) { + Map findRouteID_Map = new HashMap<>(); + + List Cd_idArr = yzCardRouteMapper.findRemindRatioChannelID(); + Cd_idArr = Cd_idArr != null && Cd_idArr.size() > 0 ? Cd_idArr : null; + findRouteID_Map.put("FindCd_id", null); + findRouteID_Map.put("Cd_idArr", Cd_idArr); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + + Map rebootStandardMap = new HashMap<>(); + + Object rebootStandard = redisCache.getCacheObject("polling.rebootCardStop"); + Integer rebootStandardint = null; + if (rebootStandard != null && rebootStandard.toString().length() > 0) { + rebootStandard = rebootStandard != null ? rebootStandard : "100";//默认 100 + } else { + rebootStandardMap.put("config_key", "polling.rebootCardStop"); + rebootStandard = yzWxByProductAgentMapper.findConfig(rebootStandardMap); + rebootStandard = rebootStandard != null ? rebootStandard : "100";//默认 100 + redisCache.setCacheObject("polling.rebootStandard", rebootStandard, 6, TimeUnit.HOURS);//6 小时 缓存 + } + + rebootStandardint = Integer.parseInt(rebootStandard.toString()); + String Type = "direct"; + if (ChannelArr != null && ChannelArr.size() > 0) { + for (int i = 0; i < ChannelArr.size(); i++) { + Map ChannelObj = ChannelArr.get(i); + Map msg_Map = new HashMap<>(); + String cd_id = ChannelObj.get("cd_id").toString(); + msg_Map.put("cd_id", ChannelObj.get("cd_id")); + + RebootCardStop(cd_id,time,rebootStandardint,msg_Map,Type); + + + } + } + } + + /** + * 重新启动 没有在Redis 记录 的轮询 通道 创建 消费者 轮询 + * @param time + */ + public void RebootCardDisconnected(Integer time) { + Map findRouteID_Map = new HashMap<>(); + + List Cd_idArr = yzCardRouteMapper.findIsDisconnectedChannelID(); + Cd_idArr = Cd_idArr != null && Cd_idArr.size() > 0 ? Cd_idArr : null; + findRouteID_Map.put("FindCd_id", null); + findRouteID_Map.put("Cd_idArr", Cd_idArr); + List> ChannelArr = yzCardRouteMapper.findRouteID(findRouteID_Map); + + Map rebootStandardMap = new HashMap<>(); + + Object rebootStandard = redisCache.getCacheObject("polling.rebootCardDisconnected"); + Integer rebootStandardint = null; + if (rebootStandard != null && rebootStandard.toString().length() > 0) { + rebootStandard = rebootStandard != null ? rebootStandard : "100";//默认 100 + } else { + rebootStandardMap.put("config_key", "polling.rebootCardDisconnected"); + rebootStandard = yzWxByProductAgentMapper.findConfig(rebootStandardMap); + rebootStandard = rebootStandard != null ? rebootStandard : "100";//默认 100 + redisCache.setCacheObject("polling.rebootStandard", rebootStandard, 6, TimeUnit.HOURS);//6 小时 缓存 + } + rebootStandardint = Integer.parseInt(rebootStandard.toString()); + String Type = "direct"; + if (ChannelArr != null && ChannelArr.size() > 0) { + for (int i = 0; i < ChannelArr.size(); i++) { + Map ChannelObj = ChannelArr.get(i); + Map msg_Map = new HashMap<>(); + String cd_id = ChannelObj.get("cd_id").toString(); + msg_Map.put("cd_id", ChannelObj.get("cd_id")); + RebootCardDisconnected(cd_id,time,rebootStandardint,msg_Map,Type); + } + } + } + + + + + + + + /** + * 重启 轮询 超停阈值 + * @param cd_id + * @param time + * @param rebootStandardint + * @param msg_Map + * @param Type + */ + public void RebootCardStop(String cd_id,Integer time,Integer rebootStandardint,Map msg_Map,String Type){ + String QFlowName = "polling_cardCardStop_queue_" + cd_id ; + String dlxQFlowName = QFlowName;//死信 redis + + String card_exchangeName = "polling_cardCardStop_exchange"; + String card_queueName = "polling_cardCardStop_queue_"+cd_id; + String card_routingKey = "polling.cardCardStop.routingKey."+cd_id; + String OneKey = "admin.CardStop.queue.One"; + + String card_del_exchangeName = "polling_dlxcardCardStop_exchange"; + String card_del_queueName = "polling_dlxcardCardStop_queue_" + cd_id; + String card_del_routingKey = "polling.dlxcardCardStop.routingKey." + cd_id; + String TowKey = "admin.CardStop.queue.Tow"; + msg_Map.put("Listener",QFlowName); + RebootCommon( time, rebootStandardint, msg_Map, Type, QFlowName, dlxQFlowName, + card_exchangeName, card_queueName, card_routingKey, OneKey, TowKey, + card_del_exchangeName, card_del_queueName, card_del_routingKey, "超停阈值"); + } + + + + + /** + * 重启 轮询 未订购轮询停机 + * @param cd_id + * @param time + * @param rebootStandardint + * @param msg_Map + * @param Type + */ + public void RebootCardDisconnected(String cd_id,Integer time,Integer rebootStandardint,Map msg_Map,String Type){ + String QFlowName = "polling_cardCardDisconnected_queue_" + cd_id ; + String dlxQFlowName = QFlowName;//死信 redis + + String card_exchangeName = "polling_cardCardDisconnected_exchange"; + String card_queueName = "polling_cardCardDisconnected_queue_" + cd_id; + String card_routingKey = "polling.cardCardDisconnected.routingKey." + cd_id; + String OneKey = "admin.CardDisconnected.queue.One"; + + String card_del_exchangeName = "polling_dlxcardCardDisconnected_exchange"; + String card_del_queueName = "polling_dlxcardCardDisconnected_queue_" + cd_id; + String card_del_routingKey = "polling.dlxcardCardDisconnected.routingKey." + cd_id; + String TowKey = "admin.CardDisconnected.queue.Tow"; + + msg_Map.put("Listener",QFlowName); + RebootCommon( time, rebootStandardint, msg_Map, Type, QFlowName, dlxQFlowName, + card_exchangeName, card_queueName, card_routingKey, OneKey, TowKey, + card_del_exchangeName, card_del_queueName, card_del_routingKey, "未订购停机"); + } + + + + + + + /** + * 重启 轮询用量 + * @param cd_id + * @param time + * @param rebootStandardint + * @param msg_Map + * @param Type + */ + public void RebootFlow(String cd_id,Integer time,Integer rebootStandardint,Map msg_Map,String Type){ + String QFlowName = "polling-Listener-CardFlow-" + cd_id; + String dlxQFlowName = "polling-dex-Listener-CardFlow-" + cd_id;//死信 redis + + String card_exchangeName = "polling_cardCardFlow_exchange"; + String card_queueName = "polling_cardCardFlow_queue_" + cd_id; + String card_routingKey = "polling.cardCardFlow.routingKey." + cd_id; + String OneKey = "admin.CardFlow.queue.One"; + + String card_del_exchangeName = "polling_dlxcardCardFlow_exchange"; + String card_del_queueName = "polling_dlxcardCardFlow_queue_" + cd_id; + String card_del_routingKey = "polling.dlxcardCardFlow.routingKey." + cd_id; + String TowKey = "admin.CardFlow.queue.Tow"; + + RebootCommon( time, rebootStandardint, msg_Map, Type, QFlowName, dlxQFlowName, + card_exchangeName, card_queueName, card_routingKey, OneKey, TowKey, + card_del_exchangeName, card_del_queueName, card_del_routingKey, "卡用量"); + } + + + + + /** + * 重启 轮询 状态 + * @param cd_id + * @param time + * @param rebootStandardint + * @param msg_Map + * @param Type + */ + public void RebootStatus(String cd_id,Integer time,Integer rebootStandardint,Map msg_Map,String Type){ + String QFlowName = "polling-Listener-CardStatus-" + cd_id; + String dlxQFlowName = "polling-dxl-Listener-CardStatus-" + cd_id;//死信队列 名称 + + String card_exchangeName = "polling_cardCardStatus_exchange"; + String card_queueName = "polling_cardCardStatus_queue_" + cd_id; + String card_routingKey = "polling.cardCardStatus.routingKey." + cd_id; + String OneKey = "admin.CardStatus.queue.One"; + + String card_del_exchangeName = "polling_dlxcardCardStatus_exchange"; + String card_del_queueName = "polling_dlxcardCardStatus_queue_" + cd_id; + String card_del_routingKey = "polling.dlxcardCardStatus.routingKey." + cd_id; + String TowKey = "admin.CardStatus.queue.Tow"; + + RebootCommon( time, rebootStandardint, msg_Map, Type, QFlowName, dlxQFlowName, + card_exchangeName, card_queueName, card_routingKey, OneKey, TowKey, + card_del_exchangeName, card_del_queueName, card_del_routingKey, "卡状态"); + } + + + + + /** + * 重启 轮询 激活时间 + * @param cd_id + * @param time + * @param rebootStandardint + * @param msg_Map + * @param Type + */ + public void RebootActivateDate(String cd_id,Integer time,Integer rebootStandardint,Map msg_Map,String Type){ + String QFlowName = "polling-Listener-ActivateDate-" + cd_id; + String dlxQFlowName = "polling-Listener-dlxActivateDate-" + cd_id;//死信队列 名称 + + String card_exchangeName = "polling_cardActivateDate_exchange"; + String card_queueName = "polling_cardActivateDate_queue_"+cd_id; + String card_routingKey = "polling.cardActivateDate.routingKey."+cd_id; + String OneKey = "admin.CardActivateDate.queue.One"; + + String card_del_exchangeName = "polling_dlxcardActivateDate_exchange"; + String card_del_queueName = "polling_dlxcardActivateDate_queue_"+cd_id; + String card_del_routingKey = "polling.dlxcardActivateDate.routingKey."+cd_id; + + String TowKey = "admin.CardActivateDate.queue.Tow"; + + RebootCommon( time, rebootStandardint, msg_Map, Type, QFlowName, dlxQFlowName, + card_exchangeName, card_queueName, card_routingKey, OneKey, TowKey, + card_del_exchangeName, card_del_queueName, card_del_routingKey, "激活时间"); + } + + + + /** + * 重启 轮询 公共部分 + * @param time 消息进入死信时间 + * @param rebootStandardint 待销费数量大于多少时再次开启一个消费者 + * @param msg_Map 通道查询参数 + * @param Type RabbitMq type + * @param QFlowName Redis 记录轮询类型前缀名称 + * @param dlxQFlowName Redis 记录轮询类型前缀名称 【死信】 + * @param card_exchangeName 队列路由名称 + * @param card_queueName 队列名称 + * @param card_routingKey 队列key + * @param OneKey 重启队列key + * @param TowKey 重启队列key 【死信】 + * @param card_del_exchangeName 队列路由名称【死信】 + * @param card_del_queueName 队列名称【死信】 + * @param card_del_routingKey 队列key【死信】 + * @param LogoTypeName sout 输出 重启类型名字 + */ + public void RebootCommon(Integer time,Integer rebootStandardint,Map msg_Map,String Type,String QFlowName,String dlxQFlowName, + String card_exchangeName,String card_queueName,String card_routingKey,String OneKey,String TowKey, + String card_del_exchangeName,String card_del_queueName,String card_del_routingKey,String LogoTypeName){ + + Collection keys = redisCache.scanKeys(QFlowName); + //没有检测到消费者直接创建 消费者 + if(keys!=null && keys.size()>0){ + System.out.println("重启 "+LogoTypeName+" 轮询消费者 " + QFlowName); + //生产任务 + Send(time,card_exchangeName,OneKey,JSON.toJSONString(msg_Map), QFlowName ); + }else{ + //有消费查询 队列 待销费数量 是否大于 系统参数 + try { + Integer Count = rabbitMQConfig.getCount(card_exchangeName,card_queueName,card_routingKey,Type); + System.out.println(card_exchangeName+" "+card_queueName+" "+Count+" : "+rebootStandardint); + if(Count!=null && rebootStandardint!=null){ + //待销费 >= 设定值时 创建 发送重启消费者指令 + if(Count>=rebootStandardint){ + Send(time,card_exchangeName,OneKey,JSON.toJSONString(msg_Map), QFlowName );//生产任务 + } + } + }catch (Exception e){ + System.out.println(" getCount 获取 Exception "+card_exchangeName+" "+card_queueName+" "+e.getMessage()); + } + } + Collection delkeys = redisCache.scanKeys(dlxQFlowName); + //没有检测到消费者直接创建 消费者 + if(delkeys!=null && delkeys.size()>0){ + System.out.println("重启 "+LogoTypeName+" 轮询消费者 " + dlxQFlowName); + //生产任务 + Send(time,card_exchangeName,TowKey,JSON.toJSONString(msg_Map), QFlowName ); + }else{ + //有消费查询 队列 待销费数量 是否大于 系统参数 + try { + Integer Count = rabbitMQConfig.getCount(card_del_exchangeName,card_del_queueName,card_del_routingKey,Type); + System.out.println(card_del_exchangeName+" "+card_del_queueName+" "+Count+" : "+rebootStandardint); + if(Count!=null && rebootStandardint!=null){ + //待销费 >= 设定值时 创建 发送重启消费者指令 + if(Count>=rebootStandardint){ + Send(time,card_exchangeName,TowKey,JSON.toJSONString(msg_Map), QFlowName ); + } + } + }catch (Exception e){ + System.out.println(" getCount 获取 Exception "+card_del_exchangeName+" "+card_del_queueName+" "+e.getMessage()); + } + } + } + + + + + public void Send(Integer time,String exchange, String routingKey, Object Obj,String quenName){ + //生产任务 + try { + rabbitTemplate.convertAndSend(exchange, routingKey, Obj, message -> { + // 设置消息过期时间 time 分钟 过期 + message.getMessageProperties().setExpiration("" + (time * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("重启 用量轮询消费者 失败 === " +quenName); + System.out.println(e.getMessage()); + } + + } + + + + +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/util/AbstractQuartzJob.java b/yunze-quartz/src/main/java/com/yunze/quartz/util/AbstractQuartzJob.java new file mode 100644 index 0000000..20ad667 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/util/AbstractQuartzJob.java @@ -0,0 +1,107 @@ +package com.yunze.quartz.util; + +import java.util.Date; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.yunze.common.constant.Constants; +import com.yunze.common.constant.ScheduleConstants; +import com.yunze.common.utils.ExceptionUtil; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.bean.BeanUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.quartz.domain.SysJob; +import com.yunze.quartz.domain.SysJobLog; +import com.yunze.quartz.service.ISysJobLogService; + +/** + * 抽象quartz调用 + * + * @author yunze + */ +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); + } + 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/yunze-quartz/src/main/java/com/yunze/quartz/util/CronUtils.java b/yunze-quartz/src/main/java/com/yunze/quartz/util/CronUtils.java new file mode 100644 index 0000000..ea36310 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/util/CronUtils.java @@ -0,0 +1,63 @@ +package com.yunze.quartz.util; + +import java.text.ParseException; +import java.util.Date; +import org.quartz.CronExpression; + +/** + * cron表达式工具类 + * + * @author yunze + * + */ +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/yunze-quartz/src/main/java/com/yunze/quartz/util/JobInvokeUtil.java b/yunze-quartz/src/main/java/com/yunze/quartz/util/JobInvokeUtil.java new file mode 100644 index 0000000..e58dcab --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/util/JobInvokeUtil.java @@ -0,0 +1,182 @@ +package com.yunze.quartz.util; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.LinkedList; +import java.util.List; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.quartz.domain.SysJob; + +/** + * 任务执行工具 + * + * @author yunze + */ +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().getDeclaredMethod(methodName, getMethodParamsType(methodParams)); + method.invoke(bean, getMethodParamsValue(methodParams)); + } + else + { + Method method = bean.getClass().getDeclaredMethod(methodName); + method.invoke(bean); + } + } + + /** + * 校验是否为为class包名 + * + * @param str 名称 + * @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.contains(str, "'")) + { + classs.add(new Object[] { StringUtils.replace(str, "'", ""), String.class }); + } + // boolean布尔类型,等于true或者false + else if (StringUtils.equals(str, "true") || StringUtils.equalsIgnoreCase(str, "false")) + { + classs.add(new Object[] { Boolean.valueOf(str), Boolean.class }); + } + // long长整形,包含L + else if (StringUtils.containsIgnoreCase(str, "L")) + { + classs.add(new Object[] { Long.valueOf(StringUtils.replaceIgnoreCase(str, "L", "")), Long.class }); + } + // double浮点类型,包含D + else if (StringUtils.containsIgnoreCase(str, "D")) + { + classs.add(new Object[] { Double.valueOf(StringUtils.replaceIgnoreCase(str, "D", "")), 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/yunze-quartz/src/main/java/com/yunze/quartz/util/QuartzDisallowConcurrentExecution.java b/yunze-quartz/src/main/java/com/yunze/quartz/util/QuartzDisallowConcurrentExecution.java new file mode 100644 index 0000000..5cafe0c --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/util/QuartzDisallowConcurrentExecution.java @@ -0,0 +1,21 @@ +package com.yunze.quartz.util; + +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; +import com.yunze.quartz.domain.SysJob; + +/** + * 定时任务处理(禁止并发执行) + * + * @author yunze + * + */ +@DisallowConcurrentExecution +public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob +{ + @Override + protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception + { + JobInvokeUtil.invokeMethod(sysJob); + } +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/util/QuartzJobExecution.java b/yunze-quartz/src/main/java/com/yunze/quartz/util/QuartzJobExecution.java new file mode 100644 index 0000000..46f42fd --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/util/QuartzJobExecution.java @@ -0,0 +1,19 @@ +package com.yunze.quartz.util; + +import org.quartz.JobExecutionContext; +import com.yunze.quartz.domain.SysJob; + +/** + * 定时任务处理(允许并发执行) + * + * @author yunze + * + */ +public class QuartzJobExecution extends AbstractQuartzJob +{ + @Override + protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception + { + JobInvokeUtil.invokeMethod(sysJob); + } +} diff --git a/yunze-quartz/src/main/java/com/yunze/quartz/util/ScheduleUtils.java b/yunze-quartz/src/main/java/com/yunze/quartz/util/ScheduleUtils.java new file mode 100644 index 0000000..342b0b7 --- /dev/null +++ b/yunze-quartz/src/main/java/com/yunze/quartz/util/ScheduleUtils.java @@ -0,0 +1,113 @@ +package com.yunze.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.yunze.common.constant.ScheduleConstants; +import com.yunze.common.exception.job.TaskException; +import com.yunze.common.exception.job.TaskException.Code; +import com.yunze.quartz.domain.SysJob; + +/** + * 定时任务工具类 + * + * @author yunze + * + */ +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)); + } + + 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); + } + } +} diff --git a/yunze-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml b/yunze-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml new file mode 100644 index 0000000..376eb3c --- /dev/null +++ b/yunze-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + 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} + + + + + 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}, + sysdate() + ) + + + \ No newline at end of file diff --git a/yunze-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml b/yunze-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml new file mode 100644 index 0000000..235912d --- /dev/null +++ b/yunze-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 = sysdate() + + 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}, + sysdate() + ) + + + \ No newline at end of file diff --git a/yunze-quartz/yunze-quartz.iml b/yunze-quartz/yunze-quartz.iml new file mode 100644 index 0000000..d0972e1 --- /dev/null +++ b/yunze-quartz/yunze-quartz.iml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-system/pom.xml b/yunze-system/pom.xml new file mode 100644 index 0000000..8750fe3 --- /dev/null +++ b/yunze-system/pom.xml @@ -0,0 +1,28 @@ + + + + yunze + com.yunze + 0.5.0 + + 4.0.0 + + yunze-system + + + system系统模块 + + + + + + + com.yunze + yunze-common + + + + + \ No newline at end of file diff --git a/yunze-system/src/main/java/com/yunze/system/domain/SysConfig.java b/yunze-system/src/main/java/com/yunze/system/domain/SysConfig.java new file mode 100644 index 0000000..c389f5b --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/SysConfig.java @@ -0,0 +1,111 @@ +package com.yunze.system.domain; + +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.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.core.domain.BaseEntity; + +/** + * 参数配置表 sys_config + * + * @author yunze + */ +public class SysConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 参数主键 */ + @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) + private Long configId; + + /** 参数名称 */ + @Excel(name = "参数名称") + private String configName; + + /** 参数键名 */ + @Excel(name = "参数键名") + private String configKey; + + /** 参数键值 */ + @Excel(name = "参数键值") + private String configValue; + + /** 系统内置(Y是 N否) */ + @Excel(name = "系统内置", readConverterExp = "Y=是,N=否") + 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/yunze-system/src/main/java/com/yunze/system/domain/SysLogininfor.java b/yunze-system/src/main/java/com/yunze/system/domain/SysLogininfor.java new file mode 100644 index 0000000..026853b --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/SysLogininfor.java @@ -0,0 +1,144 @@ +package com.yunze.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.core.domain.BaseEntity; + +/** + * 系统访问记录表 sys_logininfor + * + * @author yunze + */ +public class SysLogininfor extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + @Excel(name = "序号", cellType = ColumnType.NUMERIC) + private Long infoId; + + /** 用户账号 */ + @Excel(name = "用户账号") + private String userName; + + /** 登录状态 0成功 1失败 */ + @Excel(name = "登录状态", readConverterExp = "0=成功,1=失败") + private String status; + + /** 登录IP地址 */ + @Excel(name = "登录地址") + private String ipaddr; + + /** 登录地点 */ + @Excel(name = "登录地点") + 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") + @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + 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/yunze-system/src/main/java/com/yunze/system/domain/SysNotice.java b/yunze-system/src/main/java/com/yunze/system/domain/SysNotice.java new file mode 100644 index 0000000..14951ba --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/SysNotice.java @@ -0,0 +1,100 @@ +package com.yunze.system.domain; + +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.yunze.common.core.domain.BaseEntity; + +/** + * 通知公告表 sys_notice + * + * @author yunze + */ +public class SysNotice extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 公告ID */ + private Long noticeId; + + /** 公告标题 */ + private String noticeTitle; + + /** 公告类型(1通知 2公告) */ + private String noticeType; + + /** 公告内容 */ + private String noticeContent; + + /** 公告状态(0正常 1关闭) */ + private String status; + + public Long getNoticeId() + { + return noticeId; + } + + public void setNoticeId(Long noticeId) + { + this.noticeId = noticeId; + } + + public void setNoticeTitle(String noticeTitle) + { + this.noticeTitle = noticeTitle; + } + + @NotBlank(message = "公告标题不能为空") + @Size(min = 0, max = 50, message = "公告标题不能超过50个字符") + public String getNoticeTitle() + { + return noticeTitle; + } + + public void setNoticeType(String noticeType) + { + this.noticeType = noticeType; + } + + public String getNoticeType() + { + return noticeType; + } + + public void setNoticeContent(String noticeContent) + { + this.noticeContent = noticeContent; + } + + public String getNoticeContent() + { + return noticeContent; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("noticeId", getNoticeId()) + .append("noticeTitle", getNoticeTitle()) + .append("noticeType", getNoticeType()) + .append("noticeContent", getNoticeContent()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/domain/SysOperLog.java b/yunze-system/src/main/java/com/yunze/system/domain/SysOperLog.java new file mode 100644 index 0000000..2b01864 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/SysOperLog.java @@ -0,0 +1,255 @@ +package com.yunze.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.core.domain.BaseEntity; + +/** + * 操作日志记录表 oper_log + * + * @author yunze + */ +public class SysOperLog extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 日志主键 */ + @Excel(name = "操作序号", cellType = ColumnType.NUMERIC) + 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=清空数据") + private Integer businessType; + + /** 业务类型数组 */ + private Integer[] businessTypes; + + /** 请求方法 */ + @Excel(name = "请求方法") + private String method; + + /** 请求方式 */ + @Excel(name = "请求方式") + private String requestMethod; + + /** 操作类别(0其它 1后台用户 2手机端用户) */ + @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户") + private Integer operatorType; + + /** 操作人员 */ + @Excel(name = "操作人员") + private String operName; + + /** 部门名称 */ + @Excel(name = "部门名称") + private String deptName; + + /** 请求url */ + @Excel(name = "请求地址") + private String operUrl; + + /** 操作地址 */ + @Excel(name = "操作地址") + private String operIp; + + /** 操作地点 */ + @Excel(name = "操作地点") + private String operLocation; + + /** 请求参数 */ + @Excel(name = "请求参数") + private String operParam; + + /** 返回参数 */ + @Excel(name = "返回参数") + private String jsonResult; + + /** 操作状态(0正常 1异常) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=异常") + private Integer status; + + /** 错误消息 */ + @Excel(name = "错误消息") + private String errorMsg; + + /** 操作时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + 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/yunze-system/src/main/java/com/yunze/system/domain/SysPost.java b/yunze-system/src/main/java/com/yunze/system/domain/SysPost.java new file mode 100644 index 0000000..21e5b49 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/SysPost.java @@ -0,0 +1,123 @@ +package com.yunze.system.domain; + +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.yunze.common.annotation.Excel; +import com.yunze.common.annotation.Excel.ColumnType; +import com.yunze.common.core.domain.BaseEntity; + +/** + * 岗位表 sys_post + * + * @author yunze + */ +public class SysPost extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 岗位序号 */ + @Excel(name = "岗位序号", cellType = ColumnType.NUMERIC) + private Long postId; + + /** 岗位编码 */ + @Excel(name = "岗位编码") + private String postCode; + + /** 岗位名称 */ + @Excel(name = "岗位名称") + private String postName; + + /** 岗位排序 */ + @Excel(name = "岗位排序") + private String 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; + } + + @NotBlank(message = "显示顺序不能为空") + public String getPostSort() + { + return postSort; + } + + public void setPostSort(String 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/yunze-system/src/main/java/com/yunze/system/domain/SysRoleDept.java b/yunze-system/src/main/java/com/yunze/system/domain/SysRoleDept.java new file mode 100644 index 0000000..1b0f8a5 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/SysRoleDept.java @@ -0,0 +1,46 @@ +package com.yunze.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 角色和部门关联 sys_role_dept + * + * @author yunze + */ +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/yunze-system/src/main/java/com/yunze/system/domain/SysRoleMenu.java b/yunze-system/src/main/java/com/yunze/system/domain/SysRoleMenu.java new file mode 100644 index 0000000..98f1555 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/SysRoleMenu.java @@ -0,0 +1,46 @@ +package com.yunze.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 角色和菜单关联 sys_role_menu + * + * @author yunze + */ +public class SysRoleMenu +{ + /** 角色ID */ + private Long roleId; + + /** 菜单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/yunze-system/src/main/java/com/yunze/system/domain/SysUserOnline.java b/yunze-system/src/main/java/com/yunze/system/domain/SysUserOnline.java new file mode 100644 index 0000000..40e4e9a --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/SysUserOnline.java @@ -0,0 +1,113 @@ +package com.yunze.system.domain; + +/** + * 当前在线会话 + * + * @author yunze + */ +public class SysUserOnline +{ + /** 会话编号 */ + private String tokenId; + + /** 部门名称 */ + private String deptName; + + /** 用户名称 */ + 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/yunze-system/src/main/java/com/yunze/system/domain/SysUserPost.java b/yunze-system/src/main/java/com/yunze/system/domain/SysUserPost.java new file mode 100644 index 0000000..b87e6d2 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/SysUserPost.java @@ -0,0 +1,46 @@ +package com.yunze.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 用户和岗位关联 sys_user_post + * + * @author yunze + */ +public class SysUserPost +{ + /** 用户ID */ + private Long userId; + + /** 岗位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/yunze-system/src/main/java/com/yunze/system/domain/SysUserRole.java b/yunze-system/src/main/java/com/yunze/system/domain/SysUserRole.java new file mode 100644 index 0000000..970ebbf --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/SysUserRole.java @@ -0,0 +1,46 @@ +package com.yunze.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 用户和角色关联 sys_user_role + * + * @author yunze + */ +public class SysUserRole +{ + /** 用户ID */ + private Long userId; + + /** 角色ID */ + private Long roleId; + + 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/yunze-system/src/main/java/com/yunze/system/domain/vo/MetaVo.java b/yunze-system/src/main/java/com/yunze/system/domain/vo/MetaVo.java new file mode 100644 index 0000000..89b6c62 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/vo/MetaVo.java @@ -0,0 +1,71 @@ +package com.yunze.system.domain.vo; + +/** + * 路由显示信息 + * + * @author yunze + */ +public class MetaVo +{ + /** + * 设置该路由在侧边栏和面包屑中展示的名字 + */ + private String title; + + /** + * 设置该路由的图标,对应路径src/assets/icons/svg + */ + private String icon; + + /** + * 设置为true,则不会被 缓存 + */ + private boolean noCache; + + 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 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; + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/domain/vo/RouterVo.java b/yunze-system/src/main/java/com/yunze/system/domain/vo/RouterVo.java new file mode 100644 index 0000000..5c29aad --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/domain/vo/RouterVo.java @@ -0,0 +1,133 @@ +package com.yunze.system.domain.vo; + +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; + +/** + * 路由配置信息 + * + * @author yunze + */ +@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; + + /** + * 当你一个路由下面的 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 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/yunze-system/src/main/java/com/yunze/system/mapper/SysConfigMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysConfigMapper.java new file mode 100644 index 0000000..cf068d5 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysConfigMapper.java @@ -0,0 +1,68 @@ +package com.yunze.system.mapper; + +import java.util.List; +import com.yunze.system.domain.SysConfig; + +/** + * 参数配置 数据层 + * + * @author yunze + */ +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/yunze-system/src/main/java/com/yunze/system/mapper/SysDeptMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysDeptMapper.java new file mode 100644 index 0000000..e765825 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysDeptMapper.java @@ -0,0 +1,129 @@ +package com.yunze.system.mapper; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Param; +import com.yunze.common.core.domain.entity.SysDept; + +/** + * 部门管理 数据层 + * + * @author yunze + */ +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 dept 部门 + */ + public void updateDeptStatus(SysDept dept); + + /** + * 修改子元素关系 + * + * @param depts 子元素 + * @return 结果 + */ + public int updateDeptChildren(@Param("depts") List depts); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); + + /** + * 获取部门名称 + * @param map + * @return + */ + public List> getDeptName(); + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/mapper/SysDictDataMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysDictDataMapper.java new file mode 100644 index 0000000..c12a3a7 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysDictDataMapper.java @@ -0,0 +1,96 @@ +package com.yunze.system.mapper; + +import com.yunze.common.core.domain.entity.SysDictData; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 字典表 数据层 + * + * @author yunze + */ +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); + + /** + * 根据字典数据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); +} diff --git a/yunze-system/src/main/java/com/yunze/system/mapper/SysDictTypeMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysDictTypeMapper.java new file mode 100644 index 0000000..834e09a --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysDictTypeMapper.java @@ -0,0 +1,85 @@ +package com.yunze.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import com.yunze.common.core.domain.entity.SysDictType; + +/** + * 字典表 数据层 + * + * @author yunze + */ +@Mapper +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/yunze-system/src/main/java/com/yunze/system/mapper/SysLogininforMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysLogininforMapper.java new file mode 100644 index 0000000..91cce3a --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysLogininforMapper.java @@ -0,0 +1,42 @@ +package com.yunze.system.mapper; + +import java.util.List; +import com.yunze.system.domain.SysLogininfor; + +/** + * 系统访问日志情况信息 数据层 + * + * @author yunze + */ +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(); +} diff --git a/yunze-system/src/main/java/com/yunze/system/mapper/SysMenuMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysMenuMapper.java new file mode 100644 index 0000000..2790a7f --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysMenuMapper.java @@ -0,0 +1,117 @@ +package com.yunze.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import com.yunze.common.core.domain.entity.SysMenu; + +/** + * 菜单表 数据层 + * + * @author yunze + */ +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 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 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/yunze-system/src/main/java/com/yunze/system/mapper/SysNoticeMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysNoticeMapper.java new file mode 100644 index 0000000..f75c327 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysNoticeMapper.java @@ -0,0 +1,60 @@ +package com.yunze.system.mapper; + +import java.util.List; +import com.yunze.system.domain.SysNotice; + +/** + * 通知公告表 数据层 + * + * @author yunze + */ +public interface SysNoticeMapper +{ + /** + * 查询公告信息 + * + * @param noticeId 公告ID + * @return 公告信息 + */ + public SysNotice selectNoticeById(Long noticeId); + + /** + * 查询公告列表 + * + * @param notice 公告信息 + * @return 公告集合 + */ + public List selectNoticeList(SysNotice notice); + + /** + * 新增公告 + * + * @param notice 公告信息 + * @return 结果 + */ + public int insertNotice(SysNotice notice); + + /** + * 修改公告 + * + * @param notice 公告信息 + * @return 结果 + */ + public int updateNotice(SysNotice notice); + + /** + * 批量删除公告 + * + * @param noticeId 公告ID + * @return 结果 + */ + public int deleteNoticeById(Long noticeId); + + /** + * 批量删除公告信息 + * + * @param noticeIds 需要删除的公告ID + * @return 结果 + */ + public int deleteNoticeByIds(Long[] noticeIds); +} diff --git a/yunze-system/src/main/java/com/yunze/system/mapper/SysOperLogMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysOperLogMapper.java new file mode 100644 index 0000000..7793181 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysOperLogMapper.java @@ -0,0 +1,48 @@ +package com.yunze.system.mapper; + +import java.util.List; +import com.yunze.system.domain.SysOperLog; + +/** + * 操作日志 数据层 + * + * @author yunze + */ +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(); +} diff --git a/yunze-system/src/main/java/com/yunze/system/mapper/SysPostMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysPostMapper.java new file mode 100644 index 0000000..81ade5c --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysPostMapper.java @@ -0,0 +1,99 @@ +package com.yunze.system.mapper; + +import java.util.List; +import com.yunze.system.domain.SysPost; + +/** + * 岗位信息 数据层 + * + * @author yunze + */ +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/yunze-system/src/main/java/com/yunze/system/mapper/SysRoleDeptMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysRoleDeptMapper.java new file mode 100644 index 0000000..af79fb2 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysRoleDeptMapper.java @@ -0,0 +1,44 @@ +package com.yunze.system.mapper; + +import java.util.List; +import com.yunze.system.domain.SysRoleDept; + +/** + * 角色与部门关联表 数据层 + * + * @author yunze + */ +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/yunze-system/src/main/java/com/yunze/system/mapper/SysRoleMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysRoleMapper.java new file mode 100644 index 0000000..ddacc99 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysRoleMapper.java @@ -0,0 +1,107 @@ +package com.yunze.system.mapper; + +import java.util.List; +import com.yunze.common.core.domain.entity.SysRole; + +/** + * 角色表 数据层 + * + * @author yunze + */ +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); +} diff --git a/yunze-system/src/main/java/com/yunze/system/mapper/SysRoleMenuMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysRoleMenuMapper.java new file mode 100644 index 0000000..45ed09b --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysRoleMenuMapper.java @@ -0,0 +1,44 @@ +package com.yunze.system.mapper; + +import java.util.List; +import com.yunze.system.domain.SysRoleMenu; + +/** + * 角色与菜单关联表 数据层 + * + * @author yunze + */ +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/yunze-system/src/main/java/com/yunze/system/mapper/SysUserMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysUserMapper.java new file mode 100644 index 0000000..2b80fdb --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysUserMapper.java @@ -0,0 +1,136 @@ +package com.yunze.system.mapper; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Param; +import com.yunze.common.core.domain.entity.SysUser; + +/** + * 用户表 数据层 + * + * @author yunze + */ +public interface SysUserMapper +{ + /** + * 根据条件分页查询用户列表 + * + * @param sysUser 用户信息 + * @return 用户信息集合信息 + */ + public List selectUserList(SysUser sysUser); + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public SysUser selectUserByUserName(String userName); + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + public SysUser selectUserById(Long userId); + + /** + * 新增用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int insertUser(SysUser user); + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUser(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 int checkUserNameUnique(String userName); + + /** + * 校验手机号码是否唯一 + * + * @param phonenumber 手机号码 + * @return 结果 + */ + public SysUser checkPhoneUnique(String phonenumber); + + /** + * 校验email是否唯一 + * + * @param email 用户邮箱 + * @return 结果 + */ + public SysUser checkEmailUnique(String email); + + + /** + * 查询用户简要信息 + * @return + */ + public List> find_simple(); + + /** + * 查询集团简要信息 + * @return + */ + public List> find_flow(); + + /** + * 查询部门下用户信息 + * @param map + * @return + */ + public List> findDeptUser(Map map); + + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/mapper/SysUserPostMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysUserPostMapper.java new file mode 100644 index 0000000..e7ebf47 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysUserPostMapper.java @@ -0,0 +1,44 @@ +package com.yunze.system.mapper; + +import java.util.List; +import com.yunze.system.domain.SysUserPost; + +/** + * 用户与岗位关联表 数据层 + * + * @author yunze + */ +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/yunze-system/src/main/java/com/yunze/system/mapper/SysUserRoleMapper.java b/yunze-system/src/main/java/com/yunze/system/mapper/SysUserRoleMapper.java new file mode 100644 index 0000000..13bc2d7 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/mapper/SysUserRoleMapper.java @@ -0,0 +1,62 @@ +package com.yunze.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import com.yunze.system.domain.SysUserRole; + +/** + * 用户与角色关联表 数据层 + * + * @author yunze + */ +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); +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/ISysConfigService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysConfigService.java new file mode 100644 index 0000000..d7c596e --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysConfigService.java @@ -0,0 +1,83 @@ +package com.yunze.system.service; + +import java.util.List; +import com.yunze.system.domain.SysConfig; + +/** + * 参数配置 服务层 + * + * @author yunze + */ +public interface ISysConfigService +{ + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + public SysConfig selectConfigById(Long configId); + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数键值 + */ + public String selectConfigByKey(String configKey); + + /** + * 查询参数配置列表 + * + * @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 + * @return 结果 + */ + 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/yunze-system/src/main/java/com/yunze/system/service/ISysDeptService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysDeptService.java new file mode 100644 index 0000000..0492edb --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysDeptService.java @@ -0,0 +1,109 @@ +package com.yunze.system.service; + +import java.util.List; +import com.yunze.common.core.domain.TreeSelect; +import com.yunze.common.core.domain.entity.SysDept; + +/** + * 部门管理 服务层 + * + * @author yunze + */ +public interface ISysDeptService +{ + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + public List selectDeptList(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 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/yunze-system/src/main/java/com/yunze/system/service/ISysDictDataService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysDictDataService.java new file mode 100644 index 0000000..3cd7961 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysDictDataService.java @@ -0,0 +1,61 @@ +package com.yunze.system.service; + +import java.util.List; +import com.yunze.common.core.domain.entity.SysDictData; + +/** + * 字典 业务层 + * + * @author yunze + */ +public interface ISysDictDataService +{ + /** + * 根据条件分页查询字典数据 + * + * @param dictData 字典数据信息 + * @return 字典数据集合信息 + */ + public List selectDictDataList(SysDictData dictData); + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + public String selectDictLabel(String dictType, String dictValue); + + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + public SysDictData selectDictDataById(Long dictCode); + + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + * @return 结果 + */ + public void deleteDictDataByIds(Long[] dictCodes); + + /** + * 新增保存字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int insertDictData(SysDictData dictData); + + /** + * 修改保存字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int updateDictData(SysDictData dictData); +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/ISysDictTypeService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysDictTypeService.java new file mode 100644 index 0000000..9bdb525 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysDictTypeService.java @@ -0,0 +1,99 @@ +package com.yunze.system.service; + +import java.util.List; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.core.domain.entity.SysDictType; + +/** + * 字典 业务层 + * + * @author yunze + */ +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 + * @return 结果 + */ + 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); +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/ISysLogininforService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysLogininforService.java new file mode 100644 index 0000000..8b0cd21 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysLogininforService.java @@ -0,0 +1,40 @@ +package com.yunze.system.service; + +import java.util.List; +import com.yunze.system.domain.SysLogininfor; + +/** + * 系统访问日志情况信息 服务层 + * + * @author yunze + */ +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/yunze-system/src/main/java/com/yunze/system/service/ISysMenuService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysMenuService.java new file mode 100644 index 0000000..f0da7fc --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysMenuService.java @@ -0,0 +1,136 @@ +package com.yunze.system.service; + +import java.util.List; +import java.util.Set; +import com.yunze.common.core.domain.TreeSelect; +import com.yunze.common.core.domain.entity.SysMenu; +import com.yunze.system.domain.vo.RouterVo; + +/** + * 菜单 业务层 + * + * @author yunze + */ +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 userId 用户ID + * @return 菜单列表 + */ + public List selectMenuTreeByUserId(Long userId); + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @return 选中菜单列表 + */ + public List selectMenuListByRoleId(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/yunze-system/src/main/java/com/yunze/system/service/ISysNoticeService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysNoticeService.java new file mode 100644 index 0000000..3239a61 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysNoticeService.java @@ -0,0 +1,60 @@ +package com.yunze.system.service; + +import java.util.List; +import com.yunze.system.domain.SysNotice; + +/** + * 公告 服务层 + * + * @author yunze + */ +public interface ISysNoticeService +{ + /** + * 查询公告信息 + * + * @param noticeId 公告ID + * @return 公告信息 + */ + public SysNotice selectNoticeById(Long noticeId); + + /** + * 查询公告列表 + * + * @param notice 公告信息 + * @return 公告集合 + */ + public List selectNoticeList(SysNotice notice); + + /** + * 新增公告 + * + * @param notice 公告信息 + * @return 结果 + */ + public int insertNotice(SysNotice notice); + + /** + * 修改公告 + * + * @param notice 公告信息 + * @return 结果 + */ + public int updateNotice(SysNotice notice); + + /** + * 删除公告信息 + * + * @param noticeId 公告ID + * @return 结果 + */ + public int deleteNoticeById(Long noticeId); + + /** + * 批量删除公告信息 + * + * @param noticeIds 需要删除的公告ID + * @return 结果 + */ + public int deleteNoticeByIds(Long[] noticeIds); +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/ISysOperLogService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysOperLogService.java new file mode 100644 index 0000000..52741d7 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysOperLogService.java @@ -0,0 +1,48 @@ +package com.yunze.system.service; + +import java.util.List; +import com.yunze.system.domain.SysOperLog; + +/** + * 操作日志 服务层 + * + * @author yunze + */ +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/yunze-system/src/main/java/com/yunze/system/service/ISysPostService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysPostService.java new file mode 100644 index 0000000..bcbcf43 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysPostService.java @@ -0,0 +1,100 @@ +package com.yunze.system.service; + +import java.util.List; +import com.yunze.system.domain.SysPost; + +/** + * 岗位信息 服务层 + * + * @author yunze + */ +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 结果 + * @throws Exception 异常 + */ + public int deletePostByIds(Long[] postIds); + + /** + * 新增保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int insertPost(SysPost post); + + /** + * 修改保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int updatePost(SysPost post); +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/ISysRoleService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysRoleService.java new file mode 100644 index 0000000..8ba512b --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysRoleService.java @@ -0,0 +1,131 @@ +package com.yunze.system.service; + +import java.util.List; +import java.util.Set; +import com.yunze.common.core.domain.entity.SysRole; + +/** + * 角色业务层 + * + * @author yunze + */ +public interface ISysRoleService +{ + /** + * 根据条件分页查询角色数据 + * + * @param role 角色信息 + * @return 角色数据集合信息 + */ + public List selectRoleList(SysRole role); + + /** + * 根据用户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); + + /** + * 通过角色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); + + /** + * 修改角色状态 + * + * @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); +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/ISysUserOnlineService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysUserOnlineService.java new file mode 100644 index 0000000..2941f62 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysUserOnlineService.java @@ -0,0 +1,48 @@ +package com.yunze.system.service; + +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.system.domain.SysUserOnline; + +/** + * 在线用户 服务层 + * + * @author yunze + */ +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/yunze-system/src/main/java/com/yunze/system/service/ISysUserService.java b/yunze-system/src/main/java/com/yunze/system/service/ISysUserService.java new file mode 100644 index 0000000..7a008d2 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/ISysUserService.java @@ -0,0 +1,179 @@ +package com.yunze.system.service; + +import java.util.List; +import java.util.Map; + +import com.yunze.common.core.domain.entity.SysUser; + +/** + * 用户 业务层 + * + * @author yunze + */ +public interface ISysUserService +{ + /** + * 根据条件分页查询用户列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectUserList(SysUser user); + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public SysUser selectUserByUserName(String userName); + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + public SysUser selectUserById(Long userId); + + /** + * 根据用户ID查询用户所属角色组 + * + * @param userName 用户名 + * @return 结果 + */ + public String selectUserRoleGroup(String userName); + + /** + * 根据用户ID查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + public String selectUserPostGroup(String userName); + + /** + * 校验用户名称是否唯一 + * + * @param userName 用户名称 + * @return 结果 + */ + public String checkUserNameUnique(String userName); + + /** + * 校验手机号码是否唯一 + * + * @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 user 用户信息 + * @return 结果 + */ + public int insertUser(SysUser user); + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUser(SysUser user); + + /** + * 修改用户状态 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserStatus(SysUser user); + + /** + * 修改用户基本信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserProfile(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); + + + /** + * 查询部门下用户信息 + * @param map + * @return + */ + public List> findDeptUser(Map map); + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/SysConfigServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysConfigServiceImpl.java new file mode 100644 index 0000000..55636e3 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysConfigServiceImpl.java @@ -0,0 +1,213 @@ +package com.yunze.system.service.impl; + +import java.util.Collection; +import java.util.List; +import javax.annotation.PostConstruct; +import javax.annotation.Resource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.yunze.common.annotation.DataSource; +import com.yunze.common.constant.Constants; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.core.text.Convert; +import com.yunze.common.enums.DataSourceType; +import com.yunze.common.exception.CustomException; +import com.yunze.common.utils.StringUtils; +import com.yunze.system.domain.SysConfig; +import com.yunze.system.mapper.SysConfigMapper; +import com.yunze.system.service.ISysConfigService; + +/** + * 参数配置 服务层实现 + * + * @author yunze + */ +@Service +public class SysConfigServiceImpl implements ISysConfigService +{ + @Autowired + private SysConfigMapper configMapper; + + @Resource + 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; + } + + /** + * 查询参数配置列表 + * + * @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 + * @return 结果 + */ + @Override + public void deleteConfigByIds(Long[] configIds) + { + for (Long configId : configIds) + { + SysConfig config = selectConfigById(configId); + if (StringUtils.equals(UserConstants.YES, config.getConfigType())) + { + throw new CustomException(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(Constants.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 Constants.SYS_CONFIG_KEY + configKey; + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/SysDeptServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysDeptServiceImpl.java new file mode 100644 index 0000000..cf0b64e --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysDeptServiceImpl.java @@ -0,0 +1,306 @@ +package com.yunze.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.yunze.common.annotation.DataScope; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.domain.TreeSelect; +import com.yunze.common.core.domain.entity.SysDept; +import com.yunze.common.core.domain.entity.SysRole; +import com.yunze.common.exception.CustomException; +import com.yunze.common.utils.StringUtils; +import com.yunze.system.mapper.SysDeptMapper; +import com.yunze.system.mapper.SysRoleMapper; +import com.yunze.system.service.ISysDeptService; + +/** + * 部门管理 服务实现 + * + * @author yunze + */ +@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 depts 部门列表 + * @return 树结构列表 + */ + @Override + public List buildDeptTree(List depts) + { + List returnList = new ArrayList(); + List tempList = new ArrayList(); + for (SysDept dept : depts) + { + tempList.add(dept.getDeptId()); + } + for (Iterator iterator = depts.iterator(); iterator.hasNext();) + { + SysDept dept = (SysDept) iterator.next(); + // 如果是顶级节点, 遍历该父节点的所有子节点 + 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 ? true : false; + } + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + @Override + public boolean checkDeptExistUser(Long deptId) + { + int result = deptMapper.checkDeptExistUser(deptId); + return result > 0 ? true : false; + } + + /** + * 校验部门名称是否唯一 + * + * @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 dept 部门信息 + * @return 结果 + */ + @Override + public int insertDept(SysDept dept) + { + SysDept info = deptMapper.selectDeptById(dept.getParentId()); + // 如果父节点不为正常状态,则不允许新增子节点 + if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) + { + throw new CustomException("部门停用,不允许新增"); + } + 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())) + { + // 如果该部门是启用状态,则启用该部门的所有上级部门 + updateParentDeptStatus(dept); + } + return result; + } + + /** + * 修改该部门的父级部门状态 + * + * @param dept 当前部门 + */ + private void updateParentDeptStatus(SysDept dept) + { + String updateBy = dept.getUpdateBy(); + dept = deptMapper.selectDeptById(dept.getDeptId()); + dept.setUpdateBy(updateBy); + deptMapper.updateDeptStatus(dept); + } + + /** + * 修改子元素关系 + * + * @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 ? true : false; + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/SysDictDataServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysDictDataServiceImpl.java new file mode 100644 index 0000000..6b73301 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysDictDataServiceImpl.java @@ -0,0 +1,113 @@ +package com.yunze.system.service.impl; + +import java.util.List; + +import com.yunze.system.mapper.SysDictDataMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.utils.DictUtils; +import com.yunze.system.service.ISysDictDataService; + +/** + * 字典 业务层处理 + * + * @author yunze + */ +@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); + } + + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + @Override + public SysDictData selectDictDataById(Long dictCode) + { + return dictDataMapper.selectDictDataById(dictCode); + } + + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + * @return 结果 + */ + @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/yunze-system/src/main/java/com/yunze/system/service/impl/SysDictTypeServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysDictTypeServiceImpl.java new file mode 100644 index 0000000..a794d19 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysDictTypeServiceImpl.java @@ -0,0 +1,218 @@ +package com.yunze.system.service.impl; + +import java.util.List; +import javax.annotation.PostConstruct; + +import com.yunze.system.mapper.SysDictDataMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.core.domain.entity.SysDictType; +import com.yunze.common.exception.CustomException; +import com.yunze.common.utils.DictUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.system.mapper.SysDictTypeMapper; +import com.yunze.system.service.ISysDictTypeService; + +/** + * 字典 业务层处理 + * + * @author yunze + */ +@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 + * @return 结果 + */ + @Override + public void deleteDictTypeByIds(Long[] dictIds) + { + for (Long dictId : dictIds) + { + SysDictType dictType = selectDictTypeById(dictId); + if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0) + { + throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName())); + } + dictTypeMapper.deleteDictTypeById(dictId); + DictUtils.removeDictCache(dictType.getDictType()); + } + } + + /** + * 加载字典缓存数据 + */ + public void loadingDictCache() + { + List dictTypeList = dictTypeMapper.selectDictTypeAll(); + for (SysDictType dictType : dictTypeList) + { + List dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType()); + DictUtils.setDictCache(dictType.getDictType(), dictDatas); + } + } + + /** + * 清空字典缓存数据 + */ + public void clearDictCache() + { + DictUtils.clearDictCache(); + } + + /** + * 重置字典缓存数据 + */ + 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; + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/SysLogininforServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysLogininforServiceImpl.java new file mode 100644 index 0000000..05b9321 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysLogininforServiceImpl.java @@ -0,0 +1,65 @@ +package com.yunze.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.yunze.system.domain.SysLogininfor; +import com.yunze.system.mapper.SysLogininforMapper; +import com.yunze.system.service.ISysLogininforService; + +/** + * 系统访问日志情况信息 服务层处理 + * + * @author yunze + */ +@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/yunze-system/src/main/java/com/yunze/system/service/impl/SysMenuServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysMenuServiceImpl.java new file mode 100644 index 0000000..635d874 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysMenuServiceImpl.java @@ -0,0 +1,466 @@ +package com.yunze.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.yunze.common.constant.UserConstants; +import com.yunze.common.core.domain.TreeSelect; +import com.yunze.common.core.domain.entity.SysMenu; +import com.yunze.common.core.domain.entity.SysRole; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.system.domain.vo.MetaVo; +import com.yunze.system.domain.vo.RouterVo; +import com.yunze.system.mapper.SysMenuMapper; +import com.yunze.system.mapper.SysRoleMapper; +import com.yunze.system.mapper.SysRoleMenuMapper; +import com.yunze.system.service.ISysMenuService; + +/** + * 菜单 业务层处理 + * + * @author yunze + */ +@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 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) + { + SysRole role = roleMapper.selectRoleById(roleId); + return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly()); + } + + /** + * 构建前端路由所需要的菜单 + * + * @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.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()))); + 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()))); + 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 = new ArrayList(); + for (SysMenu dept : menus) + { + tempList.add(dept.getMenuId()); + } + 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 ? true : false; + } + + /** + * 查询菜单使用数量 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public boolean checkMenuExistRole(Long menuId) + { + int result = roleMenuMapper.checkMenuExistRole(menuId); + return result > 0 ? true : false; + } + + /** + * 新增保存菜单信息 + * + * @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 (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()) && 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); + } + + /** + * 是否为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 ? true : false; + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/SysNoticeServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysNoticeServiceImpl.java new file mode 100644 index 0000000..0e816da --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysNoticeServiceImpl.java @@ -0,0 +1,92 @@ +package com.yunze.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.yunze.system.domain.SysNotice; +import com.yunze.system.mapper.SysNoticeMapper; +import com.yunze.system.service.ISysNoticeService; + +/** + * 公告 服务层实现 + * + * @author yunze + */ +@Service +public class SysNoticeServiceImpl implements ISysNoticeService +{ + @Autowired + private SysNoticeMapper noticeMapper; + + /** + * 查询公告信息 + * + * @param noticeId 公告ID + * @return 公告信息 + */ + @Override + public SysNotice selectNoticeById(Long noticeId) + { + return noticeMapper.selectNoticeById(noticeId); + } + + /** + * 查询公告列表 + * + * @param notice 公告信息 + * @return 公告集合 + */ + @Override + public List selectNoticeList(SysNotice notice) + { + return noticeMapper.selectNoticeList(notice); + } + + /** + * 新增公告 + * + * @param notice 公告信息 + * @return 结果 + */ + @Override + public int insertNotice(SysNotice notice) + { + return noticeMapper.insertNotice(notice); + } + + /** + * 修改公告 + * + * @param notice 公告信息 + * @return 结果 + */ + @Override + public int updateNotice(SysNotice notice) + { + return noticeMapper.updateNotice(notice); + } + + /** + * 删除公告对象 + * + * @param noticeId 公告ID + * @return 结果 + */ + @Override + public int deleteNoticeById(Long noticeId) + { + return noticeMapper.deleteNoticeById(noticeId); + } + + /** + * 批量删除公告信息 + * + * @param noticeIds 需要删除的公告ID + * @return 结果 + */ + @Override + public int deleteNoticeByIds(Long[] noticeIds) + { + return noticeMapper.deleteNoticeByIds(noticeIds); + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/SysOperLogServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysOperLogServiceImpl.java new file mode 100644 index 0000000..7f762f2 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysOperLogServiceImpl.java @@ -0,0 +1,76 @@ +package com.yunze.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.yunze.system.domain.SysOperLog; +import com.yunze.system.mapper.SysOperLogMapper; +import com.yunze.system.service.ISysOperLogService; + +/** + * 操作日志 服务层处理 + * + * @author yunze + */ +@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/yunze-system/src/main/java/com/yunze/system/service/impl/SysPostServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysPostServiceImpl.java new file mode 100644 index 0000000..820f708 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysPostServiceImpl.java @@ -0,0 +1,179 @@ +package com.yunze.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.exception.CustomException; +import com.yunze.common.utils.StringUtils; +import com.yunze.system.domain.SysPost; +import com.yunze.system.mapper.SysPostMapper; +import com.yunze.system.mapper.SysUserPostMapper; +import com.yunze.system.service.ISysPostService; + +/** + * 岗位信息 服务层处理 + * + * @author yunze + */ +@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 结果 + * @throws Exception 异常 + */ + @Override + public int deletePostByIds(Long[] postIds) + { + for (Long postId : postIds) + { + SysPost post = selectPostById(postId); + if (countUserPostById(postId) > 0) + { + throw new CustomException(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/yunze-system/src/main/java/com/yunze/system/service/impl/SysRoleServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysRoleServiceImpl.java new file mode 100644 index 0000000..26e5b5c --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysRoleServiceImpl.java @@ -0,0 +1,328 @@ +package com.yunze.system.service.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.yunze.common.annotation.DataScope; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.domain.entity.SysRole; +import com.yunze.common.exception.CustomException; +import com.yunze.common.utils.StringUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.system.domain.SysRoleDept; +import com.yunze.system.domain.SysRoleMenu; +import com.yunze.system.mapper.SysRoleDeptMapper; +import com.yunze.system.mapper.SysRoleMapper; +import com.yunze.system.mapper.SysRoleMenuMapper; +import com.yunze.system.mapper.SysUserRoleMapper; +import com.yunze.system.service.ISysRoleService; + +/** + * 角色 业务层处理 + * + * @author yunze + */ +@Service +public class SysRoleServiceImpl implements ISysRoleService +{ + @Autowired + private SysRoleMapper roleMapper; + + @Autowired + private SysRoleMenuMapper roleMenuMapper; + + @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 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 CustomException("不允许操作超级管理员角色"); + } + } + + /** + * 通过角色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()); + return insertRoleMenu(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); + } + 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)); + SysRole role = selectRoleById(roleId); + if (countUserRoleByRoleId(roleId) > 0) + { + throw new CustomException(String.format("%1$s已分配,不能删除", role.getRoleName())); + } + } + // 删除角色与菜单关联 + roleMenuMapper.deleteRoleMenu(roleIds); + // 删除角色与部门关联 + roleDeptMapper.deleteRoleDept(roleIds); + return roleMapper.deleteRoleByIds(roleIds); + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/SysUserOnlineServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysUserOnlineServiceImpl.java new file mode 100644 index 0000000..525c491 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysUserOnlineServiceImpl.java @@ -0,0 +1,96 @@ +package com.yunze.system.service.impl; + +import org.springframework.stereotype.Service; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.utils.StringUtils; +import com.yunze.system.domain.SysUserOnline; +import com.yunze.system.service.ISysUserOnlineService; + +/** + * 在线用户 服务层处理 + * + * @author yunze + */ +@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.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/yunze-system/src/main/java/com/yunze/system/service/impl/SysUserServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000..dde010f --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/SysUserServiceImpl.java @@ -0,0 +1,472 @@ +package com.yunze.system.service.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +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.yunze.common.annotation.DataScope; +import com.yunze.common.constant.UserConstants; +import com.yunze.common.core.domain.entity.SysRole; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.exception.CustomException; +import com.yunze.common.utils.SecurityUtils; +import com.yunze.common.utils.StringUtils; +import com.yunze.system.domain.SysPost; +import com.yunze.system.domain.SysUserPost; +import com.yunze.system.domain.SysUserRole; +import com.yunze.system.mapper.SysPostMapper; +import com.yunze.system.mapper.SysRoleMapper; +import com.yunze.system.mapper.SysUserMapper; +import com.yunze.system.mapper.SysUserPostMapper; +import com.yunze.system.mapper.SysUserRoleMapper; +import com.yunze.system.service.ISysConfigService; +import com.yunze.system.service.ISysUserService; + +/** + * 用户 业务层处理 + * + * @author yunze + */ +@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 ISysConfigService configService; + + /** + * 根据条件分页查询用户列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + @Override + @DataScope(deptAlias = "d", userAlias = "u") + public List selectUserList(SysUser user) + { + return userMapper.selectUserList(user); + } + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + @Override + public SysUser selectUserByUserName(String userName) + { + return userMapper.selectUserByUserName(userName); + } + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + @Override + public SysUser selectUserById(Long userId) + { + return userMapper.selectUserById(userId); + } + + /** + * 查询用户所属角色组 + * + * @param userName 用户名 + * @return 结果 + */ + @Override + public String selectUserRoleGroup(String userName) + { + List list = roleMapper.selectRolesByUserName(userName); + StringBuffer idsStr = new StringBuffer(); + for (SysRole role : list) + { + idsStr.append(role.getRoleName()).append(","); + } + if (StringUtils.isNotEmpty(idsStr.toString())) + { + return idsStr.substring(0, idsStr.length() - 1); + } + return idsStr.toString(); + } + + /** + * 查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + @Override + public String selectUserPostGroup(String userName) + { + List list = postMapper.selectPostsByUserName(userName); + StringBuffer idsStr = new StringBuffer(); + for (SysPost post : list) + { + idsStr.append(post.getPostName()).append(","); + } + if (StringUtils.isNotEmpty(idsStr.toString())) + { + return idsStr.substring(0, idsStr.length() - 1); + } + return idsStr.toString(); + } + + /** + * 校验用户名称是否唯一 + * + * @param userName 用户名称 + * @return 结果 + */ + @Override + public String checkUserNameUnique(String userName) + { + int count = userMapper.checkUserNameUnique(userName); + if (count > 0) + { + 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 CustomException("不允许操作超级管理员用户"); + } + } + + /** + * 新增保存用户信息 + * + * @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 + @Transactional + public int updateUser(SysUser user) + { + Long userId = user.getUserId(); + // 删除用户与角色关联 + userRoleMapper.deleteUserRoleByUserId(userId); + // 新增用户与角色管理 + insertUserRole(user); + // 删除用户与岗位关联 + userPostMapper.deleteUserPostByUserId(userId); + // 新增用户与岗位管理 + insertUserPost(user); + return userMapper.updateUser(user); + } + + /** + * 修改用户状态 + * + * @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); + } + + /** + * 修改用户头像 + * + * @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) + { + Long[] roles = user.getRoleIds(); + if (StringUtils.isNotNull(roles)) + { + // 新增用户与角色管理 + List list = new ArrayList(); + for (Long roleId : roles) + { + SysUserRole ur = new SysUserRole(); + ur.setUserId(user.getUserId()); + ur.setRoleId(roleId); + list.add(ur); + } + if (list.size() > 0) + { + userRoleMapper.batchUserRole(list); + } + } + } + + /** + * 新增用户岗位信息 + * + * @param user 用户对象 + */ + public void insertUserPost(SysUser user) + { + Long[] posts = user.getPostIds(); + if (StringUtils.isNotNull(posts)) + { + // 新增用户与岗位管理 + List list = new ArrayList(); + for (Long postId : posts) + { + SysUserPost up = new SysUserPost(); + up.setUserId(user.getUserId()); + up.setPostId(postId); + list.add(up); + } + if (list.size() > 0) + { + userPostMapper.batchUserPost(list); + } + } + } + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + @Override + @Transactional + public int deleteUserById(Long 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)); + } + // 删除用户与角色关联 + userRoleMapper.deleteUserRole(userIds); + // 删除用户与岗位关联 + userPostMapper.deleteUserPost(userIds); + 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 CustomException("导入用户数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + String password = configService.selectConfigByKey("sys.user.initPassword"); + for (SysUser user : userList) + { + try + { + // 验证是否存在这个用户 + SysUser u = userMapper.selectUserByUserName(user.getUserName()); + if (StringUtils.isNull(u)) + { + user.setPassword(SecurityUtils.encryptPassword(password)); + user.setCreateBy(operName); + this.insertUser(user); + successNum++; + successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 导入成功"); + } + else if (isUpdateSupport) + { + user.setUpdateBy(operName); + this.updateUser(user); + successNum++; + successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 更新成功"); + } + else + { + failureNum++; + failureMsg.append("
" + failureNum + "、账号 " + user.getUserName() + " 已存在"); + } + } + catch (Exception e) + { + failureNum++; + String msg = "
" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + log.error(msg, e); + } + } + if (failureNum > 0) + { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new CustomException(failureMsg.toString()); + } + else + { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + } + return successMsg.toString(); + } + + @Override + public List> findDeptUser(Map map) { + return userMapper.findDeptUser(map); + } + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzAgentPackageServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzAgentPackageServiceImpl.java new file mode 100644 index 0000000..4657be1 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzAgentPackageServiceImpl.java @@ -0,0 +1,139 @@ +package com.yunze.system.service.impl.yunze; + + +import com.yunze.common.annotation.DataScope; +import com.yunze.common.mapper.yunze.YzAgentPackageMapper; +import com.yunze.common.mapper.yunze.YzAgentPacketMapper; +import com.yunze.common.utils.yunze.Different; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.common.utils.yunze.VeDate; +import com.yunze.system.service.yunze.IYzAgentPackageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 资费组 业务实现类 + * + * @author root + */ +@Service +public class YzAgentPackageServiceImpl implements IYzAgentPackageService +{ + + + @Resource + private YzAgentPackageMapper yzAgentPackageMapper; + @Resource + private YzAgentPacketMapper yzAgentPacketMapper; + + @Override + @DataScope(deptAlias = "d" , userAlias = "a" , isMap=true) + public Map selMap(Map map) { + Map omp=new HashMap(); + + //查询数据前过滤 资费计划 条件数据 判断 是否选择资费计划 查询条件未选择时 不做条件限制 + Object packetType = map.get("packetType"); + Object packetValue = map.get("packetValue"); + boolean Sel = false; + if(packetValue!=null && packetType !=null && packetValue.toString().trim().length()>0 && packetType.toString().trim().length()>0){ + Sel = true; + } + if(!Sel){ + List packet_valid_type = (List) map.get("packet_valid_type"); + List in_stock = (List) map.get("in_stock"); + List is_month = (List) map.get("is_month"); + List balance_pay = (List) map.get("balance_pay"); + List wechat_pay = (List) map.get("wechat_pay"); + Sel = packet_valid_type!=null && packet_valid_type.size()>0?true:Sel; + if(!Sel){ Sel = in_stock!=null && in_stock.size()>0?true:Sel;} + if(!Sel){ Sel = is_month!=null && is_month.size()>0?true:Sel;} + if(!Sel){ Sel = balance_pay!=null && balance_pay.size()>0?true:Sel;} + if(!Sel){ Sel = wechat_pay!=null && wechat_pay.size()>0?true:Sel;} + } + + List package_idArr = null; + if(Sel){ + Map getPacketMap = map ; + getPacketMap.remove("pageNum"); + getPacketMap.remove("pageSize"); + package_idArr = yzAgentPacketMapper.getPackage_id(getPacketMap); + map.put("package_idArr",package_idArr); + if(package_idArr!=null && package_idArr.size()>0){ + }else{ + omp.put("Pu", new PageUtil(1,1 , 10)); + omp.put("Data", new ArrayList>()); + return omp;//选择了 资费计划 查询条件 5r未查询到 资费计划时 直接跳出查询返回 null + } + } + + Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0; + Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10; + + Map CountMap = new HashMap<>(); + CountMap.putAll(map); + CountMap.remove("pageNum"); + CountMap.remove("pageSize"); + List CountArr = yzAgentPackageMapper.selMapCount(CountMap); + Integer rowCount = CountArr!=null && CountArr.size()>0?CountArr.size():0; + + PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + List> cardPackageArr = yzAgentPackageMapper.selMap(map); + omp.put("Data", cardPackageArr); + //如果查询到了资费组信息 获取 资费计划 + if(cardPackageArr!=null && cardPackageArr.size()>0){ + List package_id = new ArrayList(); + //获取查询的 资费组 ID + for (int i = 0; i map) { + map.put("package_id","YZ"+ VeDate.getNo(4)); + return yzAgentPackageMapper.add(map)>0; + } + + @Override + public Map find(Map map) { + List> Rarr = yzAgentPackageMapper.find(map); + if(Rarr!=null && Rarr.size()>0){ + return yzAgentPackageMapper.find(map).get(0); + }else{ + return null ; + } + } + + @Override + public List> findPackage(Map map) { + List agent_id = (List) map.get("agent_id"); + if(Different.Is_existence(agent_id,"100")){ + return yzAgentPackageMapper.find(map); + }else{ + return yzAgentPackageMapper.find(map); + } + } + + @Override + public boolean update(Map map) { + return yzAgentPackageMapper.update(map)>0; + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzAgentPacketServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzAgentPacketServiceImpl.java new file mode 100644 index 0000000..9c6a692 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzAgentPacketServiceImpl.java @@ -0,0 +1,62 @@ +package com.yunze.system.service.impl.yunze; + + +import com.yunze.common.mapper.yunze.YzAgentPacketMapper; +import com.yunze.common.mapper.yunze.YzCardPacketMapper; +import com.yunze.common.utils.yunze.Different; +import com.yunze.common.utils.yunze.VeDate; +import com.yunze.system.service.yunze.IYzAgentPacketService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * 资费计划 业务实现类 + * + * @author root + */ +@Service +public class YzAgentPacketServiceImpl implements IYzAgentPacketService +{ + + @Autowired + private YzCardPacketMapper cardPacketMapper; + @Autowired + private YzAgentPacketMapper agentPacketMapper; + + + @Override + public boolean add(Map map) { + String package_id = map.get("package_id").toString(); + package_id = package_id.substring(package_id.length()-4,package_id.length());//后四位 作为 资费计划 的 编码头 + map.put("packet_id","YZ"+package_id+ VeDate.getNo(4)); + return cardPacketMapper.add(map)>0; + } + + @Override + public Map find(Map map) { + List> Rarr = cardPacketMapper.find(map); + if(Rarr!=null && Rarr.size()>0){ + return Rarr.get(0); + }else{ + return null ; + } + } + + @Override + public boolean update(Map map) { + return cardPacketMapper.update(map)>0; + } + + @Override + public List> findPacket(Map map) { + List agent_id = (List) map.get("agent_id"); + if(Different.Is_existence(agent_id,"100")){ + return cardPacketMapper.findPacket(map); + }else{ + return agentPacketMapper.findPacket(map); + } + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardFlowServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardFlowServiceImpl.java new file mode 100644 index 0000000..54ef0ce --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardFlowServiceImpl.java @@ -0,0 +1,231 @@ +package com.yunze.system.service.impl.yunze; + + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.mapper.yunze.YzCardFlowMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.utils.yunze.Different; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.mapper.SysDictDataMapper; +import com.yunze.system.mapper.SysUserMapper; +import com.yunze.system.service.yunze.IYzCardFlowService; +import com.yunze.system.service.yunze.IYzUserService; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 订购资费计划 业务实现类 + * + * @author root + */ +@Service +public class YzCardFlowServiceImpl implements IYzCardFlowService { + + @Resource + private YzCardFlowMapper cardFlowMapper; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private IYzUserService iYzUserService; + @Resource + private RabbitTemplate rabbitTemplate; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private SysDictDataMapper dictDataMapper; + @Autowired + private SysUserMapper userMapper; + + + @Override + public List> queryflow(Map map) { + String agent_id = map.get("agent_id").toString(); + if (agent_id.equals("100")) { + return cardFlowMapper.queryflow(map); + } else { + return cardFlowMapper.queryflow_agent(map); + } + } + + @Override + public Map queryflow_simple(Map map) { + String agent_id = map.get("agent_id").toString(); + if (agent_id.equals("100")) { + return cardFlowMapper.queryflow_simple(map); + } else { + return cardFlowMapper.queryflowAgent_simple(map); + } + } + + @Override + public List> queryPackage_simple(Map map) { + String agent_id = map.get("agent_id").toString(); + if (agent_id.equals("100")) { + return cardFlowMapper.queryPackage_simple(map); + } else { + return cardFlowMapper.queryAgentPackage_simple(map); + } + } + + @Override + public List> queryPacket_simple(Map map) { + List agent_id = (List) map.get("agent_id"); + if (Different.Is_existence(agent_id, "100")) { + return cardFlowMapper.queryPacket_simple(map); + } else { + List user_id = iYzUserService.getUserID(map); + map.put("agent_id", user_id); + return cardFlowMapper.queryAgentPacket_simple(map); + } + } + + @Override + public Map FindPacket(Map map) { + String agent_id = map.get("agent_id").toString(); + if (agent_id.equals("100")) { + return cardFlowMapper.FindPacket(map); + } else { + return cardFlowMapper.FindPacketAgent(map); + } + } + + @Override + public Map getList(Map map) { + Map omp = new HashMap(); + Integer currenPage = map.get("pageNum") != null ? Integer.parseInt(map.get("pageNum").toString()) : 0; + Integer pageSize = map.get("pageSize") != null ? Integer.parseInt(map.get("pageSize").toString()) : 10; + //权限过滤 + if (map.get("agent_id") != null) { + List agent_id = (List) map.get("agent_id"); + if (!Different.Is_existence(agent_id, 100)) { + List IccidArr = yzCardMapper.findBelongingCard(map); + map.put("IccidArr", IccidArr); + } + } + Integer rowCount = cardFlowMapper.MapCount(map); + rowCount = rowCount != null ? rowCount : 0; + PageUtil pu = new PageUtil(rowCount, currenPage, pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", cardFlowMapper.getList(map)); + return omp; + } + + @Override + public List> sleTime(Map map) { + return cardFlowMapper.sleTime(map); + } + + @Override + public String exportflow(Map map, SysUser User) { + Object MapAgent_id = map.get("agent_id"); + //导出时 未选中 当前 集团编号时 且登录 部门不是 总平台 赋值部门 + if (MapAgent_id == null && User.getDeptId() != 100) { + List agent_idArr = new ArrayList(); + agent_idArr.add("" + User.getDeptId()); + map.put("agent_id", agent_idArr); + } + map.remove("pageNum"); + map.remove("pageSize"); + List> outCardIccidArr = null; + //权限过滤 + if (map.get("agent_id") != null) { + List agent_id = (List) map.get("agent_id"); + if (!Different.Is_existence(agent_id, 100)) { + List user_id = iYzUserService.getUserID(map); + map.put("user_id", user_id); + } + } + + outCardIccidArr = cardFlowMapper.exportArr(map);//查询导出内容 + + if (outCardIccidArr != null && outCardIccidArr.size() > 0) { + String create_by = " [ " + User.getDept().getDeptName() + " ] - " + " [ " + User.getUserName() + " ] "; + String newName = UUID.randomUUID().toString().replace("-", "") + "_ExportFlow"; + + String agent_id = User.getDept().getDeptId().toString(); + String task_name = create_by + "-订购资费 [导出] "; + String SaveUrl = "/getcsv/" + newName + ".csv"; + + Map task_map = new HashMap(); + task_map.put("auth", create_by); + task_map.put("task_name", task_name); + task_map.put("url", SaveUrl); + task_map.put("agent_id", agent_id); + task_map.put("type", "11"); + + //获取字典信息 + List Cardstatus = dictDataMapper.selectDictDataByType("yunze_card_valid_type");//卡状态 + List packet_type = dictDataMapper.selectDictDataByType("yunze_packet_type");//资费计划类别 + List takeEffect_type = dictDataMapper.selectDictDataByType("yunze_card_takeEffect_type");//生效类别 + + //获取 集团信息 + List> arrorders = cardFlowMapper.exportflow(map);//查询yz_card_packet + List> deptArr = userMapper.find_flow();//写入集团信息 + List> simpleArr = cardFlowMapper.queryPackage_simple(map);//写入资费组信息 + List> PacketArr = cardFlowMapper.queryPacket_simple(map);//写入资费计划信息 + + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_ExportFlow_queue"; + String polling_routingKey = "admin.ExportFlow.queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.put("type", "importCardData");//启动类型 + start_type.put("newName", newName);//输出文件名 + start_type.put("task_map", task_map);// + start_type.put("create_by", create_by);// + start_type.put("arrorders", arrorders);//查询yz_card_packet + start_type.put("User", User); + start_type.put("outCardIccidArr", outCardIccidArr); + start_type.put("Cardstatus", Cardstatus); + start_type.put("packet_type", packet_type); + start_type.put("takeEffect_type", takeEffect_type); + start_type.put("deptArr", deptArr); + start_type.put("PacketArr", PacketArr); + start_type.put("simpleArr", simpleArr); + start_type.put("map", map); + + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("导出 卡号 失败 " + e.getMessage().toString()); + return "订购资费 导出 操作失败!"; + } + } else { + return "您当前的筛选的查询条件 未找到数据!导出任务取消!"; + } + return "已下发执行任务可在【设备管理】》【执行任务管理】查看"; + + } + + +} + + + + + + + + + + + + + diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardPackageServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardPackageServiceImpl.java new file mode 100644 index 0000000..5268941 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardPackageServiceImpl.java @@ -0,0 +1,248 @@ +package com.yunze.system.service.impl.yunze; + + +import com.yunze.common.annotation.DataScope; +import com.yunze.common.mapper.yunze.YzAgentPackageMapper; +import com.yunze.common.mapper.yunze.YzAgentPacketMapper; +import com.yunze.common.mapper.yunze.YzCardPackageMapper; +import com.yunze.common.mapper.yunze.YzCardPacketMapper; +import com.yunze.common.utils.yunze.Different; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.common.utils.yunze.VeDate; +import com.yunze.system.service.yunze.IYzCardPackageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 资费组 业务实现类 + * + * @author root + */ +@Service +public class YzCardPackageServiceImpl implements IYzCardPackageService +{ + + @Autowired + private YzCardPackageMapper cardPackageMapper; + @Autowired + private YzAgentPackageMapper agentPackageMapper; + @Autowired + private YzCardPacketMapper cardPacketMapper; + @Autowired + private YzAgentPacketMapper agentPacketMapper; + + + @Override + @DataScope(deptAlias = "d" , userAlias = "a" , isMap=true) + public Map selMap(Map map) { + Map omp=new HashMap(); + + //查询数据前过滤 资费计划 条件数据 判断 是否选择资费计划 查询条件未选择时 不做条件限制 + Object packetType = map.get("packetType"); + Object packetValue = map.get("packetValue"); + boolean Sel = false; + if(packetValue!=null && packetType !=null && packetValue.toString().trim().length()>0 && packetType.toString().trim().length()>0){ + Sel = true; + } + if(!Sel){ + List packet_valid_type = (List) map.get("packet_valid_type"); + List in_stock = (List) map.get("in_stock"); + List is_month = (List) map.get("is_month"); + List balance_pay = (List) map.get("balance_pay"); + List wechat_pay = (List) map.get("wechat_pay"); + Sel = packet_valid_type!=null && packet_valid_type.size()>0?true:Sel; + if(!Sel){ Sel = in_stock!=null && in_stock.size()>0?true:Sel;} + if(!Sel){ Sel = is_month!=null && is_month.size()>0?true:Sel;} + if(!Sel){ Sel = balance_pay!=null && balance_pay.size()>0?true:Sel;} + if(!Sel){ Sel = wechat_pay!=null && wechat_pay.size()>0?true:Sel;} + } + + List package_idArr = null; + if(Sel){ + Map getPacketMap = map ; + getPacketMap.remove("pageNum"); + getPacketMap.remove("pageSize"); + package_idArr = cardPacketMapper.getPackage_id(getPacketMap); + map.put("package_idArr",package_idArr); + if(package_idArr!=null && package_idArr.size()>0){ + }else{ + omp.put("Pu", new PageUtil(1,1 , 10)); + omp.put("Data", new ArrayList>()); + return omp;//选择了 资费计划 查询条件 5r未查询到 资费计划时 直接跳出查询返回 null + } + } + + Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0; + Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10; + + Map CountMap = new HashMap<>(); + CountMap.putAll(map); + CountMap.remove("pageNum"); + CountMap.remove("pageSize"); + List CountArr = agentPackageMapper.selMapCount(CountMap); + Integer rowCount = CountArr!=null && CountArr.size()>0?CountArr.size():0; + + PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + List> cardPackageArr = cardPackageMapper.selMap(map); + omp.put("Data", cardPackageArr); + //如果查询到了资费组信息 获取 资费计划 + if(cardPackageArr!=null && cardPackageArr.size()>0){ + List package_id = new ArrayList(); + //获取查询的 资费组 ID + for (int i = 0; i map) { + map.put("package_id","YZ"+ VeDate.getNo(4)); + return cardPackageMapper.add(map)>0; + } + + @Override + public Map find(Map map) { + List> Rarr = cardPackageMapper.find(map); + if(Rarr!=null && Rarr.size()>0){ + return Rarr.get(0); + }else{ + return null ; + } + } + + @Override + public List> findPackage(Map map) { + List agent_id = (List) map.get("agent_id"); + if(Different.Is_existence(agent_id,"100")){ + return cardPackageMapper.find(map); + }else{ + return agentPackageMapper.find(map); + } + } + + @Override + public boolean update(Map map) { + return cardPackageMapper.update(map)>0; + } + + @Override + @Transactional + public String tariffDivision(Map map) { + + boolean bool = false,bool_Package = false,bool_Packet = false; + + String ParentDept_id = map.get("ParentDept_id").toString();//操作人所属集团 id + try { + int isPackageCount = agentPackageMapper.isExist(map); + int isPacketCount = agentPacketMapper.isExist(map); + + if(isPackageCount==0 && isPacketCount==0){//新增 + + if(ParentDept_id.equals("100")){//平台划分到集团 + bool_Package = agentPackageMapper.add(map)>0; + bool_Packet = agentPacketMapper.add(map)>0; + }else{ + //集团 划分到 用户 + bool_Package = agentPackageMapper.addAgent(map)>0; + bool_Packet = agentPacketMapper.addAgent(map)>0; + } + }else if(isPackageCount>0 && isPacketCount==0){ + if(ParentDept_id.equals("100")) {//平台划分到集团 + bool = agentPacketMapper.add(map)>0; + }else{ + bool = agentPacketMapper.addAgent(map)>0; + } + }else if(isPackageCount>0 && isPacketCount>0){//修改 查询系统 现有最新数据 删除 本次更新 必填字段 + String dept_id = map.get("dept_id").toString(); + String user_id = map.get("user_id").toString(); + String agent_id = map.get("agent_id").toString(); + String package_id = map.get("package_id").toString(); + String id = map.get("id").toString(); + + + //修改时 dept_id user_id agent_id 做成 list 数据 作为查询条件 + map.remove("user_id"); + map.remove("dept_id"); + map.remove("agent_id"); + map.remove("id");//查询 资费组 时 把id去掉 是用来 查询 资费计划的 + + /* List dept_idArr = new ArrayList(); + dept_idArr.add(dept_id.toString()); + List agent_idArr = new ArrayList(); + agent_idArr.add(agent_id.toString()); + map.put("dept_id",dept_idArr); + map.put("agent_id", agent_idArr);*/ + List package_idArr = new ArrayList(); + package_idArr.add(package_id); + map.put("package_id",package_idArr);//资费计划 用 + map.put("package_idArr",package_idArr);//资费 组用 + + List> PackagArr = null; + //判断是否为 平台划分到集团 + PackagArr = ParentDept_id.equals("100")? cardPackageMapper.find(map):agentPackageMapper.find(map); + + System.out.println(PackagArr); + Map Package = PackagArr.get(0); + Package.put("dept_id",dept_id); + map.put("id",id); + //删除 获取数据 更新 必要字段 + + //判断是否为 平台划分到集团 + List> PacketArr = null; + PacketArr = ParentDept_id.equals("100")? cardPacketMapper.find(map):agentPacketMapper.find(map); + + System.out.println(PacketArr); + Map Packet = PacketArr.get(0); + + Packet.remove("error_flow"); + Packet.remove("error_so"); + Packet.remove("packet_cost"); + Packet.remove("dept_id"); + Packet.remove("user_id"); + + Packet.put("set_error_so",map.get("set_error_so")); + Packet.put("set_packet_cost",map.get("set_packet_cost")); + Packet.put("dept_id",dept_id); + Packet.put("user_id",user_id); + Packet.put("set_packet_price",map.get("set_packet_price")); + + + bool_Package = agentPackageMapper.updatePackage(Package)>0; + bool_Packet = agentPacketMapper.updatePacket(Packet)>0; + } + if(bool_Package==true && bool_Packet==true){ + bool = true; + } + if(!bool){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + System.out.println("平台划分资费 操作回滚 》 tariffDivision bool_Package : "+bool_Package+" bool_Packet : "+bool_Packet); + }else{ + return ParentDept_id.equals("100")?"平台划分资费 操作成功!":"集团划分资费 操作成功!"; + } + + }catch (Exception e){ + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + System.out.println("平台划分资费 异常 操作回滚 》 tariffDivision "+e.toString()); + } + return "平台划分资费 异常 ! "; + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardPacketServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardPacketServiceImpl.java new file mode 100644 index 0000000..bc87fa0 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardPacketServiceImpl.java @@ -0,0 +1,70 @@ +package com.yunze.system.service.impl.yunze; + + +import com.yunze.common.mapper.yunze.YzAgentPacketMapper; +import com.yunze.common.mapper.yunze.YzCardPacketMapper; +import com.yunze.common.utils.yunze.VeDate; +import com.yunze.system.service.yunze.IYzCardPacketService; +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; + +/** + * 资费计划 业务实现类 + * + * @author root + */ +@Service +public class YzCardPacketServiceImpl implements IYzCardPacketService +{ + + @Autowired + private YzCardPacketMapper cardPacketMapper; + @Autowired + private YzAgentPacketMapper agentPacketMapper; + + + @Override + public boolean add(Map map) { + String package_id = map.get("package_id").toString(); + package_id = package_id.substring(package_id.length()-4,package_id.length());//后四位 作为 资费计划 的 编码头 + map.put("packet_id","YZ"+package_id+ VeDate.getNo(4)); + return cardPacketMapper.add(map)>0; + } + + @Override + public Map find(Map map) { + List> Rarr = cardPacketMapper.find(map); + if(Rarr!=null && Rarr.size()>0){ + return Rarr.get(0); + }else{ + return null ; + } + } + + @Override + public boolean update(Map map) { + return cardPacketMapper.update(map)>0; + } + + @Override + public Map findPacket(Map map) { + String agent_idStr = map.get("agent_idStr").toString(); + List agent_id =new ArrayList<>(); + agent_id.add(agent_idStr); + map.put("agent_id",agent_id); + Map Rmap = new HashMap(); + if(agent_idStr.equals("100")){ + Rmap.put("Packet",cardPacketMapper.findPacket(map)); + Rmap.put("agentPacket",agentPacketMapper.findExistence(map)); + }else{ + Rmap.put("Packet",agentPacketMapper.findPacket(map)); + Rmap.put("agentPacket",agentPacketMapper.findExistence(map)); + } + return Rmap; + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardRouteService_Impl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardRouteService_Impl.java new file mode 100644 index 0000000..5cec237 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardRouteService_Impl.java @@ -0,0 +1,182 @@ +package com.yunze.system.service.impl.yunze; + + +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.common.utils.yunze.WriteCSV; +import com.yunze.system.service.yunze.IYzCardRouteService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * 上游通道 业务实现类 + */ +@Service +public class YzCardRouteService_Impl implements IYzCardRouteService { + + + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private YzExecutionTaskMapper yzExecutionTaskMapper; + @Resource + private WriteCSV writeCSV; + + + @Override + public Map sel_Map(Map map) { + //System.out.println("CardRouteServiceImpl > sel_Map = "); + Map omp=new HashMap(); + Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0; + Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10; + Integer rowCount = yzCardRouteMapper.sel_Map_Count(map); + rowCount=rowCount!=null?rowCount:0; + PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", yzCardRouteMapper.sel_Map(map)); + return omp; + } + @Override + public boolean delete(Map map) { + return yzCardRouteMapper.delete(map)>0; + } + + @Override + public Map find_route(Map map) { + // return yzCardRouteMapper.find_route(map); + return null; + } + + @Override + public boolean update(Map map) { + boolean bool =false,bool_upd = false,bool_upd_index = false; + try { + bool_upd = yzCardRouteMapper.update(map)>0; + //bool_upd_index = updateCardIndex(map); + }catch (Exception e){ + System.out.println("通道更改 操作回滚 》 setRollbackOnly "); + } + return bool_upd; + } + + @Override + public boolean update_cd_status(Map map) { + return yzCardRouteMapper.update_cd_status(map)>0; + } + + @Override + public boolean add(Map map) { + return yzCardRouteMapper.add(map)>0; + } + + @Override + public Map updateControlType(Map map) { + Map Rmap = new HashMap(); + boolean bool = false; + //System.out.println(map.toString()); + List iccids = (List) map.get("iccids"); + + /*List iccidArr= carChangeMapper.findInAgentIccid(map); + if(iccids.size()==iccidArr.size()){ + map.put("iccidArr",iccidArr); + bool = carChangeMapper.updateControlType(map)>0; + }else{ + Rmap.put("msg","更改号码总数: [ "+iccids.size()+" ] 其中您所属号码 总数 :[ "+iccidArr.size()+" ] ; 请核实您的号码信息后重试!"); + }*/ + Rmap.put("bool",bool); + return Rmap; + } + + @Override + public List> find_route_list(Map map) { + return yzCardRouteMapper.find_route_list(map); + } + + @Override + public List> find_sp() { + return yzCardRouteMapper.find_sp(); + } + + @Override + public List> find_cr() { + return yzCardRouteMapper.find_cr(); + } + + @Override + public Map find(Map map) { + return yzCardRouteMapper.find(map); + } + + @Override + public String exportData(Map map, SysUser User) { + + map.remove("pageNum"); + map.remove("pageSize"); + + String create_by = " [ "+User.getDept().getDeptName()+" ] - "+" [ "+User.getUserName()+" ] "; + String newName = UUID.randomUUID().toString().replace("-","")+"_ChannelOut"; + String agent_id = User.getDept().getDeptId().toString(); + + String task_name = create_by+"-上游通道 [导出] "; + String SaveUrl = "/getcsv/"+newName+".csv"; + + Map task_map = new HashMap(); + task_map.put("auth",create_by); + task_map.put("task_name",task_name); + task_map.put("url",SaveUrl); + task_map.put("agent_id", agent_id); + task_map.put("type","4"); + yzExecutionTaskMapper.add(task_map);//添加执行 任务表 + List> outChannelArr = yzCardRouteMapper.outChannel(map); + + //1.判断 是否查询到数据 + if(outChannelArr.size()>0) { + String Outcolumns[] = {"id","通道编号","通道名称","通道注册用户名","通道用户登录密码","通道key码","通道url","运营商类型1移动2联通3电信4全网通","线程数","是否轮训:0否1是","控制类型","达量断网阈值","创建时间","修改时间","删除时间","代理商id","通道状态 1 启用 2 停用 3 已删除","通道别名"}; + String keys[] = {"cd_id","cd_code","cd_name","cd_username","cd_pwd","cd_key","cd_url","cd_operator_type","cd_concurrency","cd_lunxun","cd_control_type","cd_max_use","createTime","updateTime","cd_delete","cd_agent_id","cd_status","cd_alias"}; + writeCSV.Write(newName,outChannelArr,Outcolumns,null,keys); + yzExecutionTaskMapper.set_end_time(task_map);//任务结束 + return "已下发执行任务可在【设备管理】》【执行任务管理】查看"; + }else{ + return "您当前的筛选的查询条件 未找到数据!导出任务取消!"; + } + } + + /*public boolean updateCardIndex(Map map){ + Map ParMap = new HashMap(); + int cd_control_type = Integer.parseInt(map.get("cd_control_type").toString());//控制类型 + String is_max_use = map.get("is_max_use")!=null?map.get("is_max_use").toString():"";//达量断网阈值 + String is_limit_rules = map.get("is_limit_rules")!=null?map.get("is_limit_rules").toString():"";//限速规则 + + String is_speed_limit = "0";//是否限速 0 无 1 是 + String is_disconnected = "0";//是否断网 0 无 1 是 + + if(cd_control_type ==1){// 限速 + is_speed_limit = "1"; + }else if(cd_control_type ==2) {// 达量断网 + is_disconnected = "1"; + } + ParMap.put("is_max_use",is_max_use); + ParMap.put("is_limit_rules",is_limit_rules); + ParMap.put("is_speed_limit",is_speed_limit); + ParMap.put("is_disconnected",is_disconnected); + + ParMap.put("related_cd_id",map.get("cd_id")); + ParMap.put("agent_id",map.get("cd_agent_id")); + //System.out.println(map.toString()); + //System.out.println(ParMap.toString()); + //return carChangeMapper.update(ParMap)>0; + return false; + }*/ + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardServiceImpl.java new file mode 100644 index 0000000..287120f --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCardServiceImpl.java @@ -0,0 +1,908 @@ +package com.yunze.system.service.impl.yunze; + + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.redis.RedisCache; +import com.yunze.common.mapper.yunze.YzCardFlowMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.apiCommon.mapper.YzCardRouteMapper; +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.*; +import com.yunze.system.mapper.SysDeptMapper; +import com.yunze.system.mapper.SysDictDataMapper; +import com.yunze.system.mapper.SysUserMapper; +import com.yunze.system.service.yunze.IYzCardService; +import com.yunze.system.service.yunze.IYzUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.File; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * 卡信息 业务实现类 + * + * @author root + */ +@Service +public class YzCardServiceImpl implements IYzCardService { + private static final Logger log = LoggerFactory.getLogger(YzCardServiceImpl.class); + + @Resource + private YzCardMapper yzCardMapper; + @Autowired + private SysDeptMapper deptMapper; + @Autowired + private YzExecutionTaskMapper executionTaskMapper; + @Autowired + private YzCardFlowMapper cardFlowMapper; + @Autowired + private SysDictDataMapper dictDataMapper; + @Autowired + private SysUserMapper userMapper; + @Resource + private YzCardRouteMapper yzCardRouteMapper; + @Resource + private IYzUserService iYzUserService; + @Resource + private RabbitTemplate rabbitTemplate; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RedisCache redisCache; + + + @Override + public Map selMap(Map map) { + Map omp = new HashMap(); + Integer currenPage = map.get("pageNum") != null ? Integer.parseInt(map.get("pageNum").toString()) : 0; + Integer pageSize = map.get("pageSize") != null ? Integer.parseInt(map.get("pageSize").toString()) : 10; + + Map CountMap = new HashMap<>(); + CountMap.putAll(map); + CountMap.remove("queryParams"); + boolean is_Internal = false; + //System.out.println(CountMap.remove("queryParams")); + //权限过滤 + if (map.get("agent_id") != null) { + List agent_id = (List) map.get("agent_id"); + if (!Different.Is_existence(agent_id, 100)) { + List user_id = iYzUserService.getUserID(CountMap); + map.put("user_id", user_id); + CountMap.put("user_id", user_id); + } else { + is_Internal = true;//内部人员 部门是 100 的 可看字段增加 + } + } else { + is_Internal = true;//内部人员 部门是 100 的 可看字段增加 + } + map.put("is_Internal", is_Internal); + map = getChannelIdArr(map); + CountMap.put("channel_id", map.get("channel_id")); + PageUtil pu = null; + List> Rlist = null; + boolean selLianTong = (boolean) map.get("selLianTong"); + + Integer rowCount = null; + //同查询条件 缓存 查询总数 120 S + Object isExecute = redisCache.getCacheObject(JSON.toJSONString(CountMap)); + if (isExecute == null) { + if (selLianTong) { + rowCount = yzCardMapper.selMapLianTongCount(CountMap); + } else { + rowCount = yzCardMapper.selMapCount(CountMap); + } + //redis 存储 + redisCache.setCacheObject(JSON.toJSONString(CountMap), rowCount, 120, TimeUnit.SECONDS);//120 秒缓存 + } else { + rowCount = Integer.parseInt(isExecute.toString()); + } + + rowCount = rowCount != null ? rowCount : 0; + pu = new PageUtil(rowCount, currenPage, pageSize);//初始化分页工具类 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + if (selLianTong) { + Rlist = yzCardMapper.selMapLianTong(map); + } else { + Rlist = yzCardMapper.selMap(map); + } + //数据打包' + //System.out.println(map); + //System.out.println(yzCardMapper.selMap(map)); + omp.put("Pu", pu); + omp.put("Data", Rlist); + omp.put("Pmap", map); + return omp; + + } + + @Override + public Map find(Map map) { + + Map findMap = yzCardMapper.find(map); + if (findMap == null) { + findMap = yzCardMapper.findNotRoute(map); + } + return findMap; + } + + + @Override + public String uploadCard(MultipartFile file, boolean updateSupport, SysUser User) throws IOException { + String filename = file.getOriginalFilename(); + String ReadName = UUID.randomUUID().toString().replace("-", "") + filename; + String newName = UUID.randomUUID().toString().replace("-", "") + "_CardImport"; + + try { + /** + * 获取当前项目的工作路径 + */ + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + File newFile = new File(filePath + "/upload/uploadCard/" + ReadName); + File Url = new File(filePath + "/upload/uploadCard/1.txt");//tomcat 生成路径 + Upload.mkdirsmy(Url); + file.transferTo(newFile); + + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_saveCard_queue"; + String polling_routingKey = "admin.saveCard.queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.put("type", "importCardData");//启动类型 + start_type.put("filePath", filePath);//项目根目录 + start_type.put("ReadName", ReadName);//上传新文件名 + start_type.put("newName", newName);//输出文件名 + start_type.put("User", User);//登录用户信息 + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("导入 卡号 失败 " + e.getMessage().toString()); + return ("连接管理 导入 操作失败!"); + } + + + /*String path = filePath + "/upload/uploadCard/" + ReadName; + ExcelConfig excelConfig = new ExcelConfig(); + String columns[] = {"msisdn","iccid","imsi","open_date","activate_date","agent_id","channel_id","is_pool","batch_date","remarks","status_id","package_id","imei","type","network_type","is_sms","sms_number","gprs","user_id"}; + String maxVid = yzCardMapper.findMaxVid(); + maxVid = maxVid!=null?maxVid:"16800000000"; + Long maxVidInt = Long.parseLong(maxVid); + List> list = excelConfig.getExcelListMap(path,columns,maxVidInt); + String create_by = " [ "+User.getDept().getDeptName()+" ] - "+" [ "+User.getUserName()+" ] "; + + + + if(list!=null && list.size()>0){ + //筛选出 vid msisdn iccid imsi 的 卡号 重复项 + HashMap map = new HashMap<>(); + map.put("card_arrs",list); + map.put("type","3"); + List iccidarr = yzCardMapper.isExistence(map); + + String SaveUrl = "/getcsv/"+newName+".csv"; + String task_name = create_by+"-连接管理上传 [导入] "; + Map task_map = new HashMap(); + task_map.put("auth",create_by); + task_map.put("task_name",task_name); + task_map.put("url",SaveUrl); + task_map.put("agent_id", User.getDept().getDeptId()); + + executionTaskMapper.add(task_map);//添加执行 任务表 + + //1.判断上传数据与数据库现有数据做对比 大于 0 证明有 以存在数据 + if(iccidarr.size()>0){ + //上传数据>数据库查询 赛选出 + List list1 = new ArrayList<>(); + for (int i = 0; i > Out_list_Different = Different.getIdentical(list1,iccidarr,"iccid"); + if(Out_list_Different.size()>0){ + OutCSV(Out_list_Different,newName,"ICCID重复导入失败!",create_by,"导入失败"); + } + + list = Different.delIdentical(list,iccidarr,"iccid");//删除相同的数据 进行批量上传 + } + map.put("card_arrs",list);//更新 list + map.put("create_by",create_by); + try { + if(list.size()>0){ + int sInt = yzCardMapper.importCard(map); + if(sInt>0){ + OutCSV(list,newName,"成功导入卡列表数据 ["+sInt+"] 条",create_by,"导入成功"); + executionTaskMapper.set_end_time(task_map);//任务结束 + } + }else{ + executionTaskMapper.set_end_time(task_map);//任务结束 + return " 上传数据已全部在数据库,无需上传卡信息! "; + } + }catch (DuplicateKeyException e){ + System.out.println("=================="+e.getCause().toString()); + String[] solit=e.getCause().toString().split("'"); + OutCSV(list,newName,e.getCause().toString(),create_by,"导入失败"); + executionTaskMapper.set_end_time(task_map);//任务结束 + return "上传excel异常 [插入数据 DuplicateKeyException ] "+e.getCause().toString() ; + }catch (Exception e){ + System.out.println("=================="+e.getCause().toString()); + OutCSV(list,newName,e.getCause().toString(),create_by,"导入失败"); + executionTaskMapper.set_end_time(task_map);//任务结束 + return "上传excel异常 [插入数据 Exception] "+e.getCause().toString() ; + } + + }else{ + return "上传表格数据不能为空!"; + }*/ + } catch (Exception e) { + System.out.println(e); + return "上传excel异常"; + } + + return "连接管理 导入指令 已发送,详细信息请在 【执行任务管理】查询!"; + } + + @Override + public Map findRoute(Map map) { + return yzCardMapper.findRoute(map); + } + + @Override + public List> getDeptName() { + return deptMapper.getDeptName(); + } + + @Override + public String exportData(Map map, SysUser User) { + Object MapAgent_id = map.get("agent_id"); + //导出时 未选中 当前 集团编号时 且登录 部门不是 总平台 赋值部门 + if (MapAgent_id == null && User.getDeptId() != 100) { + List agent_idArr = new ArrayList(); + agent_idArr.add("" + User.getDeptId()); + map.put("agent_id", agent_idArr); + } + map.remove("pageNum"); + map.remove("pageSize"); + map = getChannelIdArr(map); + List outCardIccidArr = null; + //权限过滤 + if (map.get("agent_id") != null) { + List agent_id = (List) map.get("agent_id"); + if (!Different.Is_existence(agent_id, 100)) { + List user_id = iYzUserService.getUserID(map); + map.put("user_id", user_id); + } + } + map = getChannelIdArr(map); + boolean selLianTong = (boolean) map.get("selLianTong"); + if (selLianTong) { + outCardIccidArr = yzCardMapper.outCardIccidLianTong(map); + } else { + outCardIccidArr = yzCardMapper.outCardIccid(map); + } + if (outCardIccidArr != null && outCardIccidArr.size() > 0) { + String create_by = " [ " + User.getDept().getDeptName() + " ] - " + " [ " + User.getUserName() + " ] "; + String newName = UUID.randomUUID().toString().replace("-", "") + "_CardOut"; + + String agent_id = User.getDept().getDeptId().toString(); + String task_name = create_by + "-连接管理 [导出] "; + String SaveUrl = "/getcsv/" + newName + ".csv"; + + Map task_map = new HashMap(); + task_map.put("auth", create_by); + task_map.put("task_name", task_name); + task_map.put("url", SaveUrl); + task_map.put("agent_id", agent_id); + task_map.put("type", "1"); + + //获取字典信息 + List stateOptions = dictDataMapper.selectDictDataByType("yunze_card_status_ShowId");//卡状态 + List card_types = dictDataMapper.selectDictDataByType("yunze_card_card_type");//卡类型 + List customize_whether = dictDataMapper.selectDictDataByType("yunze_customize_whether");//系统是否 + List cardConnection_type = dictDataMapper.selectDictDataByType("yz_cardConnection_type");//断开网状态 + //获取 用户信息 + List> userArr = userMapper.find_simple(); + + + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_OutCard_queue"; + String polling_routingKey = "admin_OutCard_queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.put("type", "importCardData");//启动类型 + start_type.put("newName", newName);//输出文件名 + start_type.put("task_map", task_map);// + start_type.put("create_by", create_by);// + start_type.put("User", User); + start_type.put("outCardIccidArr", outCardIccidArr); + start_type.put("userArr", userArr); + start_type.put("stateOptions", stateOptions); + start_type.put("card_types", card_types); + start_type.put("customize_whether", customize_whether); + start_type.put("cardConnection_type", cardConnection_type); + start_type.put("map", map); + + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("导入 卡号 失败 " + e.getMessage().toString()); + return "连接管理 导入 操作失败!"; + } + } else { + return "您当前的筛选的查询条件 未找到数据!导出任务取消!"; + } + return "已下发执行任务可在【设备管理】》【执行任务管理】查看"; + } + + @Override + public List outCardIccid(Map map) { + Map CountMap = new HashMap<>(); + CountMap.putAll(map); + CountMap.remove("pageNum"); + CountMap.remove("pageSize"); + //权限过滤 + List user_id = iYzUserService.getUserID(CountMap); + map.put("user_id", user_id); + return yzCardMapper.outCardIccid(map); + } + + + @Override + public List selId(Map map, boolean selLianTong) { + Map CountMap = new HashMap<>(); + CountMap.putAll(map); + CountMap.remove("pageNum"); + CountMap.remove("pageSize"); + //权限过滤 + List user_id = iYzUserService.getUserID(CountMap); + map.put("user_id", user_id); + + if (selLianTong) { + return yzCardMapper.selIdLianTong(map); + } else { + return yzCardMapper.selId(map); + } + } + + @Override + public boolean updStatusId(Map map) { + return yzCardMapper.updStatusId(map) > 0; + } + + + @Override + public String dividCard(Map map) { + String Message = ""; + map.remove("pageNum"); + map.remove("pageSize"); + map = getChannelIdArr(map); + //权限过滤 + if (map.get("agent_id") != null) { + List agent_id = (List) map.get("agent_id"); + if (!Different.Is_existence(agent_id, 100)) { + List user_id = iYzUserService.getUserID(map); + map.put("user_id", user_id); + } + } + boolean selLianTong = (boolean) map.get("selLianTong"); + List dividIdArr = selId(map, selLianTong); + + if (dividIdArr != null && dividIdArr.size() > 0) { + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_DistributeCard_queue"; + String polling_routingKey = "admin.DistributeCard.queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.putAll(map); + start_type.put("type", "DistributeCard");//启动类型 + start_type.put("dividIdArr", dividIdArr);//需要划分的数据 + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("划卡 失败 " + e.getMessage().toString()); + return ("连接管理 划卡 操作失败!"); + } + Message = "当前筛选条件下需要划分的数据 [ " + dividIdArr.size() + " ] 条 至 [ " + map.get("set_dept_name") + " ] [ " + map.get("set_user_name") + " ] 指令已下发详情查看 【执行任务管理】 !"; + } else { + Message = "当前筛选条件下未找到需要划分的数据!请核对后重试!"; + } + return Message; + } + + + /** + * 获取 运营商类型 的通道id + * + * @param map + * @return + */ + private Map getChannelIdArr(Map map) { + //判断是否选择 运营商类型 + map.put("selLianTong", false); + Object cd_operator_type = map.get("cd_operator_type"); + if (cd_operator_type != null) { + String Str_cd_operator_type = cd_operator_type.toString(); + if (Str_cd_operator_type != "" && Str_cd_operator_type.length() > 0) { + List> smap = yzCardRouteMapper.find_simple(map); + //添加 【符合 运营类型】 的 通道 查询条件 + List channel_id = new ArrayList(); + if (smap != null && smap.size() > 0) { + for (int i = 0; i < smap.size(); i++) { + channel_id.add(smap.get(i).get("cd_id").toString()); + } + } + //未找到相匹配的通道时 将 通道id传参 -1 使查询不到相对应数据 + if (channel_id.size() == 0) { + channel_id.add("-1"); + } + map.put("channel_id", channel_id); + //如果是联通的查询 条件 且 条件是 卡号 查询长度大于19 或 起止 条件 是 iccid + if (Str_cd_operator_type.equals("2")) { + Object type = map.get("type"); + Object value = map.get("value"); + if (value != null && value.toString().length() > 0 && type != null) { + map.put("selLianTong", true); + } + Object StartAndEndtype = map.get("StartAndEndtype"); + Object StartValue = map.get("StartValue"); + Object EndValue = map.get("EndValue"); + if (StartAndEndtype != null && StartAndEndtype.equals("3") && StartValue != null && EndValue != null) { + map.put("selLianTong", true); + } + } + } else { + Object c_id = map.get("channel_id"); + if (c_id != null) { + String Str_c_id = c_id.toString(); + if (Str_c_id != "" && Str_c_id.length() > 0) { + List channel_id = new ArrayList(); + channel_id.add(c_id.toString()); + map.put("channel_id", channel_id); + } + } + } + } else { + Object c_id = map.get("channel_id"); + if (c_id != null) { + String Str_c_id = c_id.toString(); + if (Str_c_id != "" && Str_c_id.length() > 0) { + List channel_id = new ArrayList(); + channel_id.add(c_id.toString()); + map.put("channel_id", channel_id); + } + } + } + return map; + } + + + @Override + public String importSet(MultipartFile file, Map map) throws IOException { + String filename = file.getOriginalFilename(); + String ReadName = UUID.randomUUID().toString().replace("-", "") + filename; + try { + // 获取当前项目的工作路径 + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + File newFile = new File(filePath + "/upload/importSet/" + ReadName); + File Url = new File(filePath + "/upload/importSet/1.txt");//tomcat 生成路径 + Upload.mkdirsmy(Url); + file.transferTo(newFile); + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_CardImportSet_queue", addOrder_routingKey = "admin.CardImportSet.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + rabbitMQConfig.creatExchangeQueue(addOrder_exchangeName, addOrder_queueName, addOrder_routingKey, addOrder_del_exchangeName, addOrder_del_queueName, addOrder_del_routingKey, null); + Map start_type = new HashMap<>(); + start_type.put("filePath", filePath);//项目根目录 + start_type.put("ReadName", ReadName);//上传新文件名 + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("连接设置 生产指令 失败 " + e.getMessage().toString()); + return ("连接设置 生产指令 操作失败!"); + } + } catch (Exception e) { + System.out.println(e); + return "上传excel异常"; + } + return "连接设置 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + + + @Override + public String importSelImei(MultipartFile file, Map map) throws IOException { + String filename = file.getOriginalFilename(); + String ReadName = UUID.randomUUID().toString().replace("-", "") + filename; + try { + // 获取当前项目的工作路径 + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + File newFile = new File(filePath + "/upload/importSelImei/" + ReadName); + File Url = new File(filePath + "/upload/importSelImei/1.txt");//tomcat 生成路径 + Upload.mkdirsmy(Url); + file.transferTo(newFile); + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_CardImportSelImei_queue", addOrder_routingKey = "admin.CardImportSelImei.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + rabbitMQConfig.creatExchangeQueue(addOrder_exchangeName, addOrder_queueName, addOrder_routingKey, addOrder_del_exchangeName, addOrder_del_queueName, addOrder_del_routingKey, null); + Map start_type = new HashMap<>(); + start_type.put("filePath", filePath);//项目根目录 + start_type.put("ReadName", ReadName);//上传新文件名 + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("特殊操作查询IMEI 生产指令 失败 " + e.getMessage().toString()); + return ("特殊操作查询IMEI 生产指令 操作失败!"); + } + } catch (Exception e) { + System.out.println(e); + return "上传excel异常"; + } + return "特殊操作查询IMEI 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + + @Override + public String status(MultipartFile file, Map map) throws IOException { + { + String filename = file.getOriginalFilename(); + String ReadName = UUID.randomUUID().toString().replace("-", "") + filename; + try { + // 获取当前项目的工作路径 + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + File newFile = new File(filePath + "/upload/importSelImei/" + ReadName); + File Url = new File(filePath + "/upload/importSelImei/1.txt");//tomcat 生成路径 + Upload.mkdirsmy(Url); + file.transferTo(newFile); + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_CardImportBatch_queue", addOrder_routingKey = "admin.CardImportBatch.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + rabbitMQConfig.creatExchangeQueue(addOrder_exchangeName, addOrder_queueName, addOrder_routingKey, addOrder_del_exchangeName, addOrder_del_queueName, addOrder_del_routingKey, null); + Map start_type = new HashMap<>(); + start_type.put("filePath", filePath);//项目根目录 + start_type.put("ReadName", ReadName);//上传新文件名 + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("批量停复机、断开网 生产指令 失败 " + e.getMessage().toString()); + return ("批量停复机、断开网 生产指令 操作失败!"); + } + } catch (Exception e) { + System.out.println(e); + return "上传excel异常"; + } + return "批量停复机、断开网 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + } + + + @Override + public Map CardNumberImport(MultipartFile file, Map map) throws IOException { + String filename = file.getOriginalFilename(); + String ReadName = UUID.randomUUID().toString().replace("-", "") + filename; + try { + // 获取当前项目的工作路径 + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + File newFile = new File(filePath + "/upload/cardNumber/" + ReadName); + File Url = new File(filePath + "/upload/cardNumber/1.txt");//tomcat 生成路径 + Upload.mkdirsmy(Url); + file.transferTo(newFile); + ExcelConfig excelConfig = new ExcelConfig(); + String columns[] = {"cardNumber"}; + List> list = excelConfig.getExcelListMap(filePath + "/upload/cardNumber/" + ReadName, columns); + //System.out.println(list.toString()); + //System.out.println(list); + map.put("UpArr", list); + } catch (Exception e) { + System.out.println(e); + } + return selMap(map); + } + + + @Override + public String importSetCardInfo(MultipartFile file, Map map) throws IOException { + String filename = file.getOriginalFilename(); + String ReadName = UUID.randomUUID().toString().replace("-", "") + filename; + try { + // 获取当前项目的工作路径 + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + File newFile = new File(filePath + "/upload/importSetCardInfo/" + ReadName); + File Url = new File(filePath + "/upload/importSetCardInfo/1.txt");//tomcat 生成路径 + Upload.mkdirsmy(Url); + file.transferTo(newFile); + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_importSetCardInfo_queue", addOrder_routingKey = "admin.importSetCardInfo.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + rabbitMQConfig.creatExchangeQueue(addOrder_exchangeName, addOrder_queueName, addOrder_routingKey, addOrder_del_exchangeName, addOrder_del_queueName, addOrder_del_routingKey, null); + Map start_type = new HashMap<>(); + start_type.put("filePath", filePath);//项目根目录 + start_type.put("ReadName", ReadName);//上传新文件名 + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("特殊操作变更卡分组、备注 生产指令 失败 " + e.getMessage().toString()); + return ("特殊操作变更卡分组、备注 生产指令 操作失败!"); + } + } catch (Exception e) { + System.out.println(e); + return "上传excel异常"; + } + return "特殊操作变更卡分组、备注 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + + @Override + public List getCardGrouping(Map map) { + //查询所属下 分组 + if (map.get("agent_id") != null) { + map.put("agent_id", yzCardMapper.queryChildrenAreaInfo(map)); + } + return yzCardMapper.getCardGrouping(map); + } + + @Override + public boolean updActivate(Map map) { + return yzCardMapper.updActivate(map) > 0; + } + + + @Override + public boolean UpdateFill(Map map) { + return yzCardMapper.UpdateFill(map) > 0; + } + + /***停机*/ + @Override + public String stoppedarr(Map map) { + { + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_Stopped_queue", addOrder_routingKey = "admin.Stopped.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + Map start_type = new HashMap<>(); + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("批量 【停机】 生产指令 失败 " + e.getMessage().toString()); + return ("批量 【停机】 生产指令 操作失败!"); + } + + return "批量 【停机】 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + } + + /***复机*/ + @Override + public String machinearr(Map map) { + { + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_Machine_queue", addOrder_routingKey = "admin.Machine.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + Map start_type = new HashMap<>(); + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("批量 【复机】 生产指令 失败 " + e.getMessage().toString()); + return ("批量 【复机】 生产指令 操作失败!"); + } + + return "批量 【复机】 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + } + + /***断网*/ + @Override + public String disconnectNetworkarr(Map map) { + { + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_DisconnectNetwork_queue", addOrder_routingKey = "admin.DisconnectNetwork.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + Map start_type = new HashMap<>(); + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("批量 【断网】 生产指令 失败 " + e.getMessage().toString()); + return ("批量 【断网】 生产指令 操作失败!"); + } + + return "批量 【断网】 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + } + + /***开网*/ + @Override + public String openNetworkarr(Map map) { + { + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_OpenNetwork_queue", addOrder_routingKey = "admin.OpenNetwork.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + Map start_type = new HashMap<>(); + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("批量 【开网】 生产指令 失败 " + e.getMessage().toString()); + return ("批量 【开网】 生产指令 操作失败!"); + } + + return "批量 【开网】 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + } + + /** + * 批量同步用量 + */ + @Override + public String consumptionarr(Map map) { + { + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_Consumption_queue", addOrder_routingKey = "admin.Consumption.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + Map start_type = new HashMap<>(); + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("批量 【同步用量】 生产指令 失败 " + e.getMessage().toString()); + return ("批量 【同步用量】 生产指令 操作失败!"); + } + + return "批量 【同步用量】 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + } + + /** + * 批量同步状态 + */ + @Override + public String publicmethodarr(Map map) { + { + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_PublicMethod_queue", addOrder_routingKey = "admin.PublicMethod.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + Map start_type = new HashMap<>(); + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("批量 【同步状态】 生产指令 失败 " + e.getMessage().toString()); + return ("批量 【同步状态】 生产指令 操作失败!"); + } + + return "批量 【同步状态】 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + + + } + /**批量 【同步状态和用量】*/ + @Override + public String consumptionandstatearr(Map map) { + { + //1.创建路由 绑定 生产队列 发送消息 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_ConsumptionAndState_queue", addOrder_routingKey = "admin.ConsumptionAndState.queue", + addOrder_del_exchangeName = "dlx_" + addOrder_exchangeName, addOrder_del_queueName = "dlx_" + addOrder_queueName, addOrder_del_routingKey = "dlx_" + addOrder_routingKey; + try { + Map start_type = new HashMap<>(); + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("批量 【同步状态和用量】 生产指令 失败 " + e.getMessage().toString()); + return ("批量 【同步状态和用量】 生产指令 操作失败!"); + } + + return "批量 【同步状态和用量】 指令 已发送,连接设置详细信息请在 【执行任务管理】查询!"; + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCategoryServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCategoryServiceImpl.java new file mode 100644 index 0000000..ddb2520 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCategoryServiceImpl.java @@ -0,0 +1,33 @@ +package com.yunze.system.service.impl.yunze; + +import com.yunze.common.mapper.yunze.YzCategoryMapper; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.service.yunze.YzCategoryService; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; +@Service +public class YzCategoryServiceImpl implements YzCategoryService { + + @Resource + private YzCategoryMapper yzCategoryMapper; + + @Override + public Map CategoryList(Map map) { + //System.out.println("CardRouteServiceImpl > sel_Map = "); + Map omp = new HashMap(); + Integer currenPage = map.get("pageNum") != null ? Integer.parseInt(map.get("pageNum").toString()) : 0; + Integer pageSize = map.get("pageSize") != null ? Integer.parseInt(map.get("pageSize").toString()) : 10; + Integer rowCount = yzCategoryMapper.selMapCount(map); + rowCount = rowCount != null ? rowCount : 0; + PageUtil pu = new PageUtil(rowCount, currenPage, pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", yzCategoryMapper.CategoryList(map)); + return omp; + } + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCcHisServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCcHisServiceImpl.java new file mode 100644 index 0000000..2b31b51 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCcHisServiceImpl.java @@ -0,0 +1,35 @@ +package com.yunze.system.service.impl.yunze; + +import com.yunze.common.mapper.yunze.YzCcHisMapper; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.service.yunze.YzCcHisService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +@Service +public class YzCcHisServiceImpl implements YzCcHisService { + + @Resource + private YzCcHisMapper yzCcHisMapper; + + @Override + public Map ListCcHis (Map map) { + //System.out.println("CardRouteServiceImpl > sel_Map = "); + Map omp = new HashMap(); + Integer currenPage = map.get("pageNum") != null ? Integer.parseInt(map.get("pageNum").toString()) : 0; + Integer pageSize = map.get("pageSize") != null ? Integer.parseInt(map.get("pageSize").toString()) : 10; + Integer rowCount = yzCcHisMapper.selMapCount(map); + rowCount = rowCount != null ? rowCount : 0; + PageUtil pu = new PageUtil(rowCount, currenPage, pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", yzCcHisMapper.ListCcHis(map)); + return omp; + } + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCcServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCcServiceImpl.java new file mode 100644 index 0000000..cfa9af6 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCcServiceImpl.java @@ -0,0 +1,50 @@ +package com.yunze.system.service.impl.yunze; + +import com.yunze.common.mapper.yunze.YzCcMapper; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.service.yunze.YzCcService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +@Service +public class YzCcServiceImpl implements YzCcService { + + @Resource + private YzCcMapper yzCcMapper; + + @Override + public Map ListCc(Map map) { + //System.out.println("CardRouteServiceImpl > sel_Map = "); + Map omp=new HashMap(); + Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0; + Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10; + Integer rowCount = yzCcMapper.selMapCount(map); + rowCount=rowCount!=null?rowCount:0; + PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", yzCcMapper.ListCc(map)); + return omp; + } + + @Override + public boolean YzCcAdd(Map map) { + return yzCcMapper.CcAdd(map)>0; + } + + @Override + public List> NameAdd() { + return yzCcMapper.NameAdd(); + } + + @Override + public boolean UpdateCc(Map map) { + return yzCcMapper.UpdateCc(map)>0; + } + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCcUrlServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCcUrlServiceImpl.java new file mode 100644 index 0000000..516d08d --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCcUrlServiceImpl.java @@ -0,0 +1,92 @@ +package com.yunze.system.service.impl.yunze; +import com.yunze.common.mapper.yunze.YzCcUrlMapper; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.service.yunze.YzCcUrlService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class YzCcUrlServiceImpl implements YzCcUrlService { + + @Resource + private YzCcUrlMapper yzCcUrlMapper; + + @Override + public Map ListCcUrl (Map map) { + //System.out.println("CardRouteServiceImpl > sel_Map = "); + Map omp = new HashMap(); + Integer currenPage = map.get("pageNum") != null ? Integer.parseInt(map.get("pageNum").toString()) : 0; + Integer pageSize = map.get("pageSize") != null ? Integer.parseInt(map.get("pageSize").toString()) : 10; + Integer rowCount = yzCcUrlMapper.selMapCount(map); + rowCount = rowCount != null ? rowCount : 0; + PageUtil pu = new PageUtil(rowCount, currenPage, pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", yzCcUrlMapper.ListCcUrl(map)); + return omp; + } + + @Override + public boolean insertCcUrl(Map map) { + return yzCcUrlMapper.insertCcUrl(map)>0; + } + + @Override + public boolean updateCcUrl(Map map) { + return yzCcUrlMapper.updateCcUrl(map)>0; + } + + @Override + public Map DeleteCcUrl(Map map) { + + Map Rmap = new HashMap<>(); + String Message = ""; boolean bool = false; + + Integer CountId = yzCcUrlMapper.CountId(map); + if(CountId !=null && CountId > 1 ){ + Message = "可以删除"; + bool = yzCcUrlMapper.DeleteCcUrl(map)>0; + if(bool){ + Message = "操作成功"; + } + }else { + Message = "不可以删除"; + } + + Rmap.put("bool",bool); + Rmap.put("Msg",Message); + + return Rmap; + } + +} + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCradFlowHisServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCradFlowHisServiceImpl.java new file mode 100644 index 0000000..df0d419 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzCradFlowHisServiceImpl.java @@ -0,0 +1,171 @@ +package com.yunze.system.service.impl.yunze; + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.core.domain.model.LoginUser; +import com.yunze.common.mapper.yunze.YzCardFlowHisMapper; +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YrootlowHisMapper; +import com.yunze.common.utils.ServletUtils; +import com.yunze.common.utils.spring.SpringUtils; +import com.yunze.common.utils.yunze.Different; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.mapper.SysUserMapper; +import com.yunze.system.service.yunze.IYzUserService; +import com.yunze.system.service.yunze.YzCardFlowHisService; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.*; + + +@Service +public class YzCradFlowHisServiceImpl implements YzCardFlowHisService { + @Resource + private YrootlowHisMapper yrootlowHisMapper; + @Resource + private IYzUserService iYzUserService; + @Resource + private YzCardMapper yzCardMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + @Resource + private RabbitTemplate rabbitTemplate; + @Resource + private YzCardFlowHisMapper yzCardFlowHisMapper; + + + @Override + public Map ListHis(Map map) { + Map omp = new HashMap(); + Integer currenPage = map.get("pageNum") != null ? Integer.parseInt(map.get("pageNum").toString()) : 0; + Integer pageSize = map.get("pageSize") != null ? Integer.parseInt(map.get("pageSize").toString()) : 10; + //权限过滤 + if (map.get("agent_id") != null) { + List agent_id = (List) map.get("agent_id"); + if (!Different.Is_existence(agent_id, 100)) { + List IccidArr = yzCardMapper.findBelongingCard(map); + map.put("IccidArr", IccidArr); + } + } + Integer rowCount = yrootlowHisMapper.selMapHis(map); + rowCount = rowCount != null ? rowCount : 0; + PageUtil pu = new PageUtil(rowCount, currenPage, pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", yrootlowHisMapper.ListHis(map)); + return omp; + } + + @Override + public Map getById(HashMap map) { + return yrootlowHisMapper.getById(map); + } + + @Override + public String FlowHis(Map map, SysUser User) { + + String dept_id = map.get("dept_id").toString(); + boolean IsGeneralGroupbool = dept_id.equals("100")?true:false; + + + Object MapAgent_id = map.get("agent_id"); + //导出时 未选中 当前 集团编号时 且登录 部门不是 总平台 赋值部门 + if (MapAgent_id == null && User.getDeptId() != 100) { + List agent_idArr = new ArrayList(); + agent_idArr.add("" + User.getDeptId()); + map.put("agent_id", agent_idArr); + } + map.remove("pageNum"); + map.remove("pageSize"); + List> outCardIccidArr = null; + + //权限过滤 + if (map.get("agent_id") != null) { + List agent_id = (List) map.get("agent_id"); + if (!Different.Is_existence(agent_id, 100)) { + List user_id = iYzUserService.getUserID(map); + map.put("user_id", user_id); + } + } + + outCardIccidArr = yrootlowHisMapper.exportFlowHis(map);//查询导出内容 用量详情 + + if (outCardIccidArr != null && outCardIccidArr.size() > 0) { + String create_by = " [ " + User.getDept().getDeptName() + " ] - " + " [ " + User.getUserName() + " ] "; + String newName = UUID.randomUUID().toString().replace("-", "") + "_ExportHis"; + + String agent_id = User.getDept().getDeptId().toString(); + String task_name = create_by + "-用量详情导出 [导出] "; + String SaveUrl = "/getcsv/" + newName + ".csv"; + + Map task_map = new HashMap(); + task_map.put("auth", create_by); + task_map.put("task_name", task_name); + task_map.put("url", SaveUrl); + task_map.put("agent_id", agent_id); + task_map.put("type", "11"); + + List HisIccid = yrootlowHisMapper.exportFlowHisIccid(map);//用量详情导出 group by iccid 用到的查询 + map.put("iccids", HisIccid); + List> HisArr = yzCardMapper.hisList(map);//查询主表 分组 、备注、发货时间 + + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_ExportFlowHis_queue"; + String polling_routingKey = "admin.ExportFlowHis.queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.put("type", "importCardData");//启动类型 + start_type.put("newName", newName);//输出文件名 + start_type.put("task_map", task_map);// + start_type.put("create_by", create_by);// + start_type.put("IsGeneralGroupbool", IsGeneralGroupbool); + start_type.put("iccids", HisIccid); + start_type.put("HisArr", HisArr); + start_type.put("User", User); + start_type.put("outCardIccidArr", outCardIccidArr); + start_type.put("map", map); + + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("导出 卡号 失败 " + e.getMessage().toString()); + return "用量详情 导出 操作失败"; + } + + } else { + return "您当前的筛选的查询条件 未找到数据!导出任务取消!"; + } + + return "已下发执行任务可在【设备管理】》【执行任务管理】查看"; + + } +} + + + + + + + + + + + + + + + + diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzExecutionTaskService_Impl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzExecutionTaskService_Impl.java new file mode 100644 index 0000000..91fed0a --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzExecutionTaskService_Impl.java @@ -0,0 +1,43 @@ +package com.yunze.system.service.impl.yunze; + + +import com.yunze.common.mapper.yunze.YzExecutionTaskMapper; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.service.yunze.IYzExecutionTaskService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +/** + * 执行任务 业务实现类 + */ +@Service +public class YzExecutionTaskService_Impl implements IYzExecutionTaskService { + + + @Resource + private YzExecutionTaskMapper dao; + + + + @Override + public Map sel_Map(Map map) { + //System.out.println("CardRouteServiceImpl > sel_Map = "); + Map omp=new HashMap(); + Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0; + Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10; + Integer rowCount = dao.sel_Map_Count(map); + rowCount=rowCount!=null?rowCount:0; + PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", dao.sel_Map(map)); + return omp; + } + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzInfoChangeServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzInfoChangeServiceImpl.java new file mode 100644 index 0000000..8395ef6 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzInfoChangeServiceImpl.java @@ -0,0 +1,53 @@ +package com.yunze.system.service.impl.yunze; + +import com.yunze.common.mapper.yunze.YzCardMapper; +import com.yunze.common.mapper.yunze.YzInfoChangeMapper; +import com.yunze.common.utils.yunze.Different; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.service.yunze.IYzInfoChangeService; +import com.yunze.system.service.yunze.IYzUserService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +@Service +public class YzInfoChangeServiceImpl implements IYzInfoChangeService { + + @Resource + private YzInfoChangeMapper yzInfoChangeMapper; + @Resource + private YzCardMapper yzCardMapper; + + + + @Override + public Map selMap(Map map) { + Map omp=new HashMap(); + Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0; + Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10; + //权限过滤 + if(map.get("agent_id")!=null){ + List agent_id = (List) map.get("agent_id"); + if(!Different.Is_existence(agent_id,100)){ + List IccidArr = yzCardMapper.findBelongingCard(map); + map.put("IccidArr",IccidArr); + } + } + Integer rowCount = yzInfoChangeMapper.selMapCount(map); + rowCount=rowCount!=null?rowCount:0; + PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", yzInfoChangeMapper.ListInfo(map)); + return omp; + } + + @Override + public List> selTime(HashMap map) { + return yzInfoChangeMapper.selTime(map); + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzOrderServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzOrderServiceImpl.java new file mode 100644 index 0000000..d775279 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzOrderServiceImpl.java @@ -0,0 +1,286 @@ +package com.yunze.system.service.impl.yunze; + + +import com.alibaba.fastjson.JSON; +import com.rabbitmq.client.BuiltinExchangeType; +import com.yunze.common.config.RabbitMQConfig; +import com.yunze.common.core.domain.entity.SysDictData; +import com.yunze.common.core.domain.entity.SysUser; +import com.yunze.common.mapper.yunze.*; +import com.yunze.common.utils.yunze.Different; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.common.utils.yunze.Upload; +import com.yunze.system.mapper.SysDictDataMapper; +import com.yunze.system.mapper.SysUserMapper; +import com.yunze.system.service.yunze.IYzOrderService; +import com.yunze.system.service.yunze.IYzUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.File; +import java.io.IOException; +import java.util.*; + +/** + * 卡信息 业务实现类 + * + * @author root + */ +@Service +public class YzOrderServiceImpl implements IYzOrderService +{ + private static final Logger log = LoggerFactory.getLogger(YzOrderServiceImpl.class); + + @Resource + private IYzUserService iYzUserService; + @Resource + private YzOrderMapper yzOrderMapper; + @Autowired + private RabbitTemplate rabbitTemplate; + @Autowired + private RabbitMQConfig mQConfig; + @Resource + private YzCardFlowMapper cardFlowMapper; + @Resource + private SysDictDataMapper dictDataMapper; + @Autowired + private SysUserMapper userMapper; + @Resource + private RabbitMQConfig rabbitMQConfig; + + @Override + public Map selMap(Map map) { + Map omp=new HashMap(); + Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0; + Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10; + //权限过滤 + if(map.get("agent_id")!=null){ + List agent_id = (List) map.get("agent_id"); + if(!Different.Is_existence(agent_id,100)){ + List user_id = iYzUserService.getUserID(map); + map.put("user_id",user_id); + } + } + PageUtil pu = null; + List> Rlist = null; + Integer rowCount = yzOrderMapper.selMapCount(map); + rowCount=rowCount!=null?rowCount:0; + pu = new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + Rlist = yzOrderMapper.selMap(map); + omp.put("Pu", pu); + omp.put("Data",Rlist ); + return omp; + } + + @Override + public Map find(Map map) { + + return null; + } + + @Override + public List outOrder(Map map) { + return null; + } + + @Override + public Map findOrder(Map map) { + return yzOrderMapper.findOrder(map); + } + + + + @Override + public String importRecharge(MultipartFile file,Map map) throws IOException { + String filename=file.getOriginalFilename(); + String ReadName = UUID.randomUUID().toString().replace("-","")+filename; + String newName = UUID.randomUUID().toString().replace("-","")+"_importRecharge"; + try { + // 获取当前项目的工作路径 + File file2 = new File(""); + String filePath = file2.getCanonicalPath(); + File newFile = new File(filePath+"/upload/importRecharge/"+ReadName); + File Url=new File(filePath+"/upload/importRecharge/1.txt");//tomcat 生成路径 + Upload.mkdirsmy(Url); + file.transferTo(newFile); + //或充值 资费计划信息 + String agent_id = map.get("agent_id").toString(); + Map PacketMap = null; + if(agent_id.equals("100")){ + PacketMap = cardFlowMapper.FindPacket(map); + }else{ + PacketMap = cardFlowMapper.FindPacketAgent(map); + } + if(PacketMap!=null){ + String ord_type = "2"; + //添加订单生成参数 + Map OrderMap = new HashMap<>(); + PacketMap.put("validate_type",map.get("validate_type"));//生效类型 + PacketMap.put("ord_type",ord_type);//订单类型 + + OrderMap.put("add_parameter",JSON.toJSONString(PacketMap));//加包参数 + OrderMap.put("ord_type",ord_type);//订单类型 用量充值 + OrderMap.put("ord_name","平台批量充值");//交易名称 用量充值 + OrderMap.put("wx_ord_no",null);//微信订单号 + OrderMap.put("status","1");//支付状态 支付成功 + OrderMap.put("price",PacketMap.get("packet_price"));//交易金额 + OrderMap.put("account","0");//交易后金额 + OrderMap.put("pay_type","s");//支付方式 平台记录 + OrderMap.put("is_profit","0");//是否需要分润 0否-1是 + OrderMap.put("add_package","0");//是否已经执行过加包 0否 1 是 + OrderMap.put("show_status","0");//是否显示交易记录:0否-1显示 + OrderMap.put("packet_id",map.get("packet_id"));//资费计划 ID + OrderMap.put("validate_type",map.get("validate_type"));//生效类型 + OrderMap.put("open_id",null);//openid 微信支付记录操作人 + OrderMap.put("agent_id",agent_id);// 所属记录集团id + OrderMap.put("profit_type","0");//分润类型 + OrderMap.put("info",null);//备注 + OrderMap.put("cre_type","sys");//生成方式 系统 sys 人工 ai + + map.put("OrderMap",OrderMap); + + //1.创建路由 绑定 生产队列 发送消息 + //路由队列 + String addOrder_exchangeName = "admin_exchange", addOrder_queueName = "admin_OrderImportRecharge_queue", addOrder_routingKey = "admin.OrderImportRecharge.queue", + addOrder_del_exchangeName = "dlx_"+addOrder_exchangeName,addOrder_del_queueName = "dlx_"+addOrder_queueName, addOrder_del_routingKey = "dlx_"+addOrder_routingKey; + try { + mQConfig.creatExchangeQueue(addOrder_exchangeName, addOrder_queueName, addOrder_routingKey, addOrder_del_exchangeName, addOrder_del_queueName, addOrder_del_routingKey,null); + Map start_type = new HashMap<>(); + start_type.put("filePath", filePath);//项目根目录 + start_type.put("ReadName", ReadName);//上传新文件名 + start_type.put("newName", newName);//输出文件名 + start_type.put("map", map);//参数 + rabbitTemplate.convertAndSend(addOrder_exchangeName, addOrder_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 60 分钟 过期 + message.getMessageProperties().setExpiration("" + (60 * 1000 * 60)); + return message; + }); + } catch (Exception e) { + System.out.println("平台导入充值生产指令 失败 " + e.getMessage().toString()); + return ("平台导入充值生产指令 操作失败!"); + } + }else{ + return ("未找到 您的名下 资费计划ID 【"+map.get("packet_id")+"】 充值取消! "); + } + }catch (Exception e){ + System.out.println(e); + return "上传excel异常"; + } + return "资费订购 平台导入充值指令 已发送,充值详细信息请在 【执行任务管理】查询!"; + } + + @Override + public String exportallorders(Map map, SysUser User) { + Object MapAgent_id = map.get("agent_id"); + //导出时 未选中 当前 集团编号时 且登录 部门不是 总平台 赋值部门 + if(MapAgent_id==null && User.getDeptId()!=100){ + List agent_idArr = new ArrayList(); + agent_idArr.add(""+User.getDeptId()); + map.put("agent_id",agent_idArr); + } + map.remove("pageNum"); + map.remove("pageSize"); + List> outCardIccidArr = null; + //权限过滤 + if(map.get("agent_id")!=null){ + List agent_id = (List) map.get("agent_id"); + if(!Different.Is_existence(agent_id,100)){ + List user_id = iYzUserService.getUserID(map); + map.put("user_id",user_id); + } + } + outCardIccidArr = yzOrderMapper.exportallorders(map); + + if(outCardIccidArr!=null && outCardIccidArr.size()>0){ + String create_by = " [ "+User.getDept().getDeptName()+" ] - "+" [ "+User.getUserName()+" ] "; + String newName = UUID.randomUUID().toString().replace("-","")+"_Exportallorders"; + + String agent_id = User.getDept().getDeptId().toString(); + String task_name = create_by+"-订单管理 [导出] "; + String SaveUrl = "/getcsv/"+newName+".csv"; + + Map task_map = new HashMap(); + task_map.put("auth",create_by); + task_map.put("task_name",task_name); + task_map.put("url",SaveUrl); + task_map.put("agent_id", agent_id); + task_map.put("type", "11"); + + //获取字典信息 + List orderArr = dictDataMapper.selectDictDataByType("yunze_order_status");//订单状态 + List pay_type = dictDataMapper.selectDictDataByType("yunze_card_pay_type");//支付方式 + List customize_whether = dictDataMapper.selectDictDataByType("yunze_customize_whether");//自定义是否 + List card_takeEffect = dictDataMapper.selectDictDataByType("yunze_card_takeEffect_type");//资费计划生效类别 + + //获取 集团信息 + List> arrorders = yzOrderMapper.arrorders(map); + List> deptArr = userMapper.find_flow(); + + //1.创建路由 绑定 生产队列 发送消息 + //导卡 路由队列 + String polling_queueName = "admin_Exportallorders_queue"; + String polling_routingKey = "admin.Exportallorders.queue"; + String polling_exchangeName = "admin_exchange";//路由 + try { + rabbitMQConfig.creatExchangeQueue(polling_exchangeName, polling_queueName, polling_routingKey, null, null, null, BuiltinExchangeType.DIRECT); + Map start_type = new HashMap<>(); + start_type.put("type", "importCardData");//启动类型 + start_type.put("newName", newName);//输出文件名 + start_type.put("task_map", task_map);// + start_type.put("create_by", create_by);// + start_type.put("User", User); + start_type.put("outCardIccidArr",outCardIccidArr); + start_type.put("deptArr",deptArr); + start_type.put("arrorders",arrorders); + start_type.put("stateOptions", orderArr); + start_type.put("pay_type",pay_type); + start_type.put("customize_whether",customize_whether); + start_type.put("cardConnection_type",card_takeEffect); + start_type.put("map",map); + + rabbitTemplate.convertAndSend(polling_exchangeName, polling_routingKey, JSON.toJSONString(start_type), message -> { + // 设置消息过期时间 30 分钟 过期 + message.getMessageProperties().setExpiration("" + (30 * 1000 * 60)); + return message; + }); + } catch (Exception e){ + System.out.println("导入 卡号 失败 " + e.getMessage().toString()); + return "全部订单 导入 操作失败!"; + } + }else { + return "您当前的筛选的查询条件 未找到数据!导出任务取消!"; + } + return "已下发执行任务可在【设备管理】》【执行任务管理】查看"; + } + + +} + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzPollingServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzPollingServiceImpl.java new file mode 100644 index 0000000..0e37ef6 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzPollingServiceImpl.java @@ -0,0 +1,32 @@ +package com.yunze.system.service.impl.yunze; + +import com.yunze.common.mapper.yunze.PollingMapper; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.service.yunze.IYPollingService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; +@Service +public class YzPollingServiceImpl implements IYPollingService { + + @Resource + private PollingMapper pollingMapper; + + @Override + public Map getList(Map map) { + Map omp=new HashMap(); + Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0; + Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10; + Integer rowCount = pollingMapper.MapCount(map); + rowCount=rowCount!=null?rowCount:0; + PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", pollingMapper.getList(map)); + return omp; + } +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzSysLogsServiceImpl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzSysLogsServiceImpl.java new file mode 100644 index 0000000..9856a69 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzSysLogsServiceImpl.java @@ -0,0 +1,86 @@ +package com.yunze.system.service.impl.yunze; + +import com.yunze.common.mapper.yunze.YzSysLogsMapper; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.service.yunze.IYzLogsService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +@Service +public class YzSysLogsServiceImpl implements IYzLogsService { + + @Resource + private YzSysLogsMapper yzSysLogsMapper; + + + @Override + public Map selMap(Map map) { + //System.out.println("CardRouteServiceImpl > sel_Map = "); + Map omp=new HashMap(); + Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0; + Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10; + Integer rowCount = yzSysLogsMapper.selMapCount(map); + rowCount=rowCount!=null?rowCount:0; + PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", yzSysLogsMapper.selMap(map)); + return omp; + } + + @Override + public Map getById(HashMap map) { + return yzSysLogsMapper.getById(map); + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzUserService_Impl.java b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzUserService_Impl.java new file mode 100644 index 0000000..79e67f4 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/impl/yunze/YzUserService_Impl.java @@ -0,0 +1,56 @@ +package com.yunze.system.service.impl.yunze; + + +import com.yunze.common.annotation.DataScope; +import com.yunze.common.mapper.yunze.YzUserMapper; +import com.yunze.common.utils.yunze.PageUtil; +import com.yunze.system.service.yunze.IYzUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 用户 业务实现类 + */ +@Service +public class YzUserService_Impl implements IYzUserService { + + + @Autowired + private YzUserMapper dao; + + + + @Override + public Map selMap(Map map) { + Map omp=new HashMap(); + Integer currenPage=map.get("pageNum")!=null?Integer.parseInt(map.get("pageNum").toString()):0; + Integer pageSize=map.get("pageSize")!=null?Integer.parseInt(map.get("pageSize").toString()):10; + Integer rowCount = dao.selMapCount(map); + rowCount=rowCount!=null?rowCount:0; + PageUtil pu=new PageUtil(rowCount,currenPage , pageSize);//初始化分页工具类 + //数据打包 + map.put("StarRow", pu.getStarRow()); + map.put("PageSize", pu.getPageSize()); + omp.put("Pu", pu); + omp.put("Data", dao.selMap(map)); + return omp; + } + + @Override + @DataScope(deptAlias = "d" , userAlias = "u" , isMap=true) + public List getUserID(Map map) { + return dao.getUserID(map); + } + + @Override + @DataScope(deptAlias = "d" , userAlias = "u" , isMap=true) + public List getDeptID(Map map) { + return dao.getDeptID(map); + } + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYPollingService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYPollingService.java new file mode 100644 index 0000000..4eab607 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYPollingService.java @@ -0,0 +1,9 @@ +package com.yunze.system.service.yunze; + +import java.util.Map; + +public interface IYPollingService { + + public Map getList(Map map); + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzAgentPackageService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzAgentPackageService.java new file mode 100644 index 0000000..7a9d6bb --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzAgentPackageService.java @@ -0,0 +1,58 @@ +package com.yunze.system.service.yunze; + + +import java.util.List; +import java.util.Map; + +/** + * 资费组 业务层 + * @author root + */ +public interface IYzAgentPackageService +{ + + /** + * 查询当前套餐简要信息 + * @param map + * @return + */ + public Map selMap(Map map); + + + /** + * 新增资费组 + * @param map + * @return + */ + public boolean add(Map map); + + + + /** + * 查询单条 资费组 + * @param map + * @return + */ + public Map find(Map map); + + + /** + * 资费组 + * @param map + * @return + */ + public List> findPackage(Map map); + + + + /** + * 修改 资费组信息 + * @param map + * @return + */ + public boolean update(Map map); + + + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzAgentPacketService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzAgentPacketService.java new file mode 100644 index 0000000..a207e3e --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzAgentPacketService.java @@ -0,0 +1,45 @@ +package com.yunze.system.service.yunze; + + +import java.util.List; +import java.util.Map; + +/** + * 资费组计划 业务层 + * @author root + */ +public interface IYzAgentPacketService +{ + + + /** + * 新增资费组 + * @param map + * @return + */ + public boolean add(Map map); + + + /** + * 查询单条 资费计划 + * @param map + * @return + */ + public Map find(Map map); + + + /** + * 修改 资费计划 + * @param map + * @return + */ + public boolean update(Map map); + + + /** + *查询 资费计划 划分信息 + * @param map + * @return + */ + public List> findPacket(Map map); +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardFlowService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardFlowService.java new file mode 100644 index 0000000..75d529b --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardFlowService.java @@ -0,0 +1,72 @@ +package com.yunze.system.service.yunze; + + +import com.yunze.common.core.domain.entity.SysUser; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 卡板信息 业务层 + * + * @author root + */ +public interface IYzCardFlowService +{ + /** + *查询套餐数据 + * @param map + * @return + */ + public List> queryflow(Map map); + + + + /** + * 查询当前套餐简要信息 + * @param map + * @return + */ + public Map queryflow_simple(Map map); + + /** + * 获取资费组简要信息 + * @param map + * @return + */ + public List> queryPackage_simple(Map map); + + + /** + * 查询 资费计划 简要信息 + * @param map + * @return + */ + public List> queryPacket_simple(Map map); + + + + + /** + * 查询 资费计划 简要信息 [单条] + * @param map + * @return + */ + public Map FindPacket(Map map); + + + /** + * 查询 订购资费查询 */ + public Map getList(Map map); + + /**查询 到期时间*/ + public List> sleTime(Map map); + + + /**订购资费导出*/ + public String exportflow(Map map, SysUser User); + + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardPackageService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardPackageService.java new file mode 100644 index 0000000..153b4e7 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardPackageService.java @@ -0,0 +1,63 @@ +package com.yunze.system.service.yunze; + + +import java.util.List; +import java.util.Map; + +/** + * 资费组 业务层 + * @author root + */ +public interface IYzCardPackageService +{ + + /** + * 查询当前套餐简要信息 + * @param map + * @return + */ + public Map selMap(Map map); + + + /** + * 新增资费组 + * @param map + * @return + */ + public boolean add(Map map); + + + + /** + * 查询单条 资费组 + * @param map + * @return + */ + public Map find(Map map); + + + /** + * 资费组 + * @param map + * @return + */ + public List> findPackage(Map map); + + + + /** + * 修改 资费组信息 + * @param map + * @return + */ + public boolean update(Map map); + + + /** + * 划分资费数据 + * @param map + * @return + */ + public String tariffDivision(Map map); + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardPacketService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardPacketService.java new file mode 100644 index 0000000..b7d82e4 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardPacketService.java @@ -0,0 +1,45 @@ +package com.yunze.system.service.yunze; + + +import java.util.List; +import java.util.Map; + +/** + * 资费组计划 业务层 + * @author root + */ +public interface IYzCardPacketService +{ + + + /** + * 新增资费组 + * @param map + * @return + */ + public boolean add(Map map); + + + /** + * 查询单条 资费计划 + * @param map + * @return + */ + public Map find(Map map); + + + /** + * 修改 资费计划 + * @param map + * @return + */ + public boolean update(Map map); + + + /** + *查询 资费计划 划分信息 + * @param map + * @return + */ + public Map findPacket(Map map); +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardRouteService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardRouteService.java new file mode 100644 index 0000000..58a26af --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardRouteService.java @@ -0,0 +1,116 @@ +package com.yunze.system.service.yunze; + + +import com.yunze.common.core.domain.entity.SysUser; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public interface IYzCardRouteService { + + + + /** + * 查询 + * @param map + * @return + * @throws Exception + */ + public Map sel_Map(Map map); + + + /** + * 删除记录 + * + * @param map 表字段 map 对象 + */ + public boolean delete(Map map); + + /** + * 查询 单卡所属通道信息 + * @param map + * @return + * @throws Exception + */ + public Map find_route(Map map); + + + + /** + * 修改记录 + * + * @param map 表字段 map 对象 + */ + public boolean update(Map map); + + + /** + * 修改 通道状态 + * + * @param map 表字段 map 对象 + */ + public boolean update_cd_status(Map map); + + + + /** + * 新增 + * + * @param map 表字段 map 对象 + */ + public boolean add(Map map); + + + + + /** + * 更改 用户所属 id 下的 卡号 控制类型 + * @param map + * @return + */ + public Map updateControlType(Map map); + + + + /** + * 查询 用户 创建 通道信息 + * + * @param map 表字段 map 对象 + * @return + */ + public List> find_route_list(Map map); + + + /** + * 查询 简要信息 + * @return + */ + public List> find_sp(); + + /** + * 查询 通道简要信息 状态为 正常 划分通道用 + */ + public List> find_cr(); + + /** + * 查询 通道信息 + * @return + */ + public Map find(Map map); + + + /** + * 查询 卡号 分配 通道 状态 + * @param map + * @return + */ + public String exportData(Map map, SysUser User); + + + + + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardService.java new file mode 100644 index 0000000..75e0c81 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzCardService.java @@ -0,0 +1,219 @@ +package com.yunze.system.service.yunze; + + +import com.yunze.common.core.domain.entity.SysUser; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * 卡板信息 业务层 + * @author root + */ +public interface IYzCardService +{ + /** + *查询 + * @param map + * @return + */ + public Map selMap(Map map); + + + /** + * 获取单卡详情 + * @param map + * @return + */ + public Map find(Map map); + + /** + * 导入卡信息 + * @param file + * @param updateSupport + * @return + * @throws IOException + */ + public String uploadCard(MultipartFile file, boolean updateSupport, SysUser User) throws IOException ; + + + + + /** + * 查询 卡号 分配 通道 状态 + * @param map + * @return + */ + public Map findRoute(Map map); + + /** + * 获取部门名称 + * @return + */ + public List> getDeptName(); + + + + /** + * 查询 卡号 分配 通道 状态 + * @param map + * @return + */ + public String exportData(Map map,SysUser User); + + + /** + *按当前赛选条件获取导出数据 iccid + * @param map + * @return + */ + public List outCardIccid(Map map); + + + /** + * 卡所属划分 + * @param map + * @return + */ + public String dividCard(Map map); + + + /** + * 获取匹配筛选条件下的卡板id + * @param map + * @param selLianTong + * @return + */ + public List selId(Map map,boolean selLianTong); + + + + + + /** + * 修改卡状态 + * @param map + * @return + */ + public boolean updStatusId(Map map); + + + + /** + * 连接管理设置 + * @param file + * @return + * @throws IOException + */ + public String importSet(MultipartFile file, Map map) throws IOException ; + + /** + * 卡号导入查询 + * @param file + * @return + * @throws IOException + */ + public Map CardNumberImport(MultipartFile file, Map map) throws IOException ; + + /** + * 特殊操作查询IMEI + * @param file + * @return + * @throws IOException + */ + public String importSelImei(MultipartFile file, Map map) throws IOException ; + + /** + * 批量停复机、断开网 + * @param file + * @return + * @throws IOException + */ + public String status (MultipartFile file, Map map) throws IOException ; + + + /** + * 特殊操作变更卡分组、备注 + * @param file + * @return + * @throws IOException + */ + public String importSetCardInfo(MultipartFile file, Map map) throws IOException ; + + + + + /** + * 获取 所属代理下 卡分组 + * @param map + * @return + */ + public List getCardGrouping(Map map); + + /** 修改 备注 分组*/ + public boolean UpdateFill(Map map); + + + /** + * 修改 激活时间 + * @param map + * @return + */ + public boolean updActivate(Map map); + + + /** + * 批量 停机 + * @return + */ + public String stoppedarr(Map map); + + /** + * 批量 复机 + * @return + */ + public String machinearr(Map map); + + /** + * 批量 断网 + * @return + */ + public String disconnectNetworkarr(Map map); + + /** + * 批量 开网 + * @return + */ + public String openNetworkarr(Map map); + + /** + * 批量 同步用量 + * @return + */ + public String consumptionarr(Map map); + + /** + * 批量 同步用量 + * @return + */ + public String publicmethodarr(Map map); + + /** + * 批量 同步用量 + * @return + */ + public String consumptionandstatearr(Map map); + + + + + + + + + + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzExecutionTaskService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzExecutionTaskService.java new file mode 100644 index 0000000..5b049d3 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzExecutionTaskService.java @@ -0,0 +1,27 @@ +package com.yunze.system.service.yunze; + + +import com.yunze.common.core.domain.entity.SysUser; + +import java.util.List; +import java.util.Map; + +/** + * 执行任务 业务层 + */ +public interface IYzExecutionTaskService { + + + + /** + * 查询 + * @param map + * @return + * @throws Exception + */ + public Map sel_Map(Map map); + + + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzInfoChangeService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzInfoChangeService.java new file mode 100644 index 0000000..fd1d074 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzInfoChangeService.java @@ -0,0 +1,14 @@ +package com.yunze.system.service.yunze; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public interface IYzInfoChangeService { + + public Map selMap(Map map); + + + public List> selTime(HashMap map); + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzLogsService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzLogsService.java new file mode 100644 index 0000000..6cb83a8 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzLogsService.java @@ -0,0 +1,23 @@ +package com.yunze.system.service.yunze; + +import java.util.HashMap; +import java.util.Map; + +public interface IYzLogsService { + + /** + * 查询 + * @param map + * @return + * @throws Exception + */ + public Map selMap(Map map); + + public Map getById(HashMap map); + + + + + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzOrderService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzOrderService.java new file mode 100644 index 0000000..7abf4b9 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzOrderService.java @@ -0,0 +1,70 @@ +package com.yunze.system.service.yunze; + + +import com.yunze.common.core.domain.entity.SysUser; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 卡板信息 业务层 + * @author root + */ +public interface IYzOrderService +{ + /** + *查询 + * @param map + * @return + */ + public Map selMap(Map map); + + + /** + * 获取单卡详情 + * @param map + * @return + */ + public Map find(Map map); + + + + + /** + *按当前赛选条件获取导出数据 iccid + * @param map + * @return + */ + public List outOrder(Map map); + + + + + /** + * 查询订单加包参数 + * @param map + * @return + */ + public Map findOrder(Map map); + + + + /** + * 平台导入充值 + * @param file + * @return + * @throws IOException + */ + public String importRecharge(MultipartFile file, Map map) throws IOException ; + + + /**导出*/ + public String exportallorders(Map map,SysUser User); + + + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzUserService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzUserService.java new file mode 100644 index 0000000..716363e --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/IYzUserService.java @@ -0,0 +1,40 @@ +package com.yunze.system.service.yunze; + + +import java.util.List; +import java.util.Map; + +/** + * 用户 业务层 + */ +public interface IYzUserService { + + + + /** + * 查询 + * @param map + * @return + * @throws Exception + */ + public Map selMap(Map map); + + + /* 获取用户 权限过滤 + * @param map + * @return + */ + public List getUserID(Map map); + + + /* 获取部门id + * @param map + * @return + */ + public List getDeptID(Map map); + + + + + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCardFlowHisService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCardFlowHisService.java new file mode 100644 index 0000000..12a44f5 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCardFlowHisService.java @@ -0,0 +1,23 @@ +package com.yunze.system.service.yunze; + +import com.yunze.common.core.domain.entity.SysUser; + +import java.util.HashMap; +import java.util.Map; + +public interface YzCardFlowHisService { + + /** + * 查询 + * @param map + * @return + * @throws Exception + */ + public Map ListHis(Map map); + + public Map getById(HashMap map); + + /**用量详情*/ + public String FlowHis(Map map, SysUser User); + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCategoryService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCategoryService.java new file mode 100644 index 0000000..27478b9 --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCategoryService.java @@ -0,0 +1,9 @@ +package com.yunze.system.service.yunze; + +import java.util.Map; + +public interface YzCategoryService { + + public Map CategoryList(Map map); + +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCcHisService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCcHisService.java new file mode 100644 index 0000000..ea6e67b --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCcHisService.java @@ -0,0 +1,7 @@ +package com.yunze.system.service.yunze; + +import java.util.Map; + +public interface YzCcHisService { + public Map ListCcHis(Map map); +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCcService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCcService.java new file mode 100644 index 0000000..6c9e29d --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCcService.java @@ -0,0 +1,18 @@ +package com.yunze.system.service.yunze; + +import java.util.List; +import java.util.Map; + +public interface YzCcService { + + public Map ListCc(Map map); + + public boolean YzCcAdd(Map map); + + /** + * 查询 通道简要信息 状态为 正常 划分通道用 + */ + public List> NameAdd(); + + public boolean UpdateCc(Map map); +} diff --git a/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCcUrlService.java b/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCcUrlService.java new file mode 100644 index 0000000..3815efb --- /dev/null +++ b/yunze-system/src/main/java/com/yunze/system/service/yunze/YzCcUrlService.java @@ -0,0 +1,19 @@ +package com.yunze.system.service.yunze; + + + +import java.util.List; +import java.util.Map; + +public interface YzCcUrlService { + + public Map ListCcUrl (Map map); + + + public boolean insertCcUrl(Map map); + + public boolean updateCcUrl(Map map); + + public Map DeleteCcUrl(Map map); + +} diff --git a/yunze-system/src/main/resources/mapper/system/SysConfigMapper.xml b/yunze-system/src/main/resources/mapper/system/SysConfigMapper.xml new file mode 100644 index 0000000..997981a --- /dev/null +++ b/yunze-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}, + sysdate() + ) + + + + update sys_config + + config_name = #{configName}, + config_key = #{configKey}, + config_value = #{configValue}, + config_type = #{configType}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = sysdate() + + 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/yunze-system/src/main/resources/mapper/system/SysDeptMapper.xml b/yunze-system/src/main/resources/mapper/system/SysDeptMapper.xml new file mode 100644 index 0000000..aff9df3 --- /dev/null +++ b/yunze-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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,d.dname + from sys_dept d + + + + + + + + + + + + + + + + + + + + insert into sys_dept( + dept_id, + parent_id, + dept_name, + ancestors, + order_num, + leader, + phone, + email, + status, + create_by, + dname, + create_time + )values( + #{deptId}, + #{parentId}, + #{deptName}, + #{ancestors}, + #{orderNum}, + #{leader}, + #{phone}, + #{email}, + #{status}, + #{createBy}, + #{dname}, + sysdate() + ) + + + + 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}, + dname = #{dname}, + update_time = sysdate() + + where dept_id = #{deptId} + + + + update sys_dept set ancestors = + + when #{item.deptId} then #{item.ancestors} + + where dept_id in + + #{item.deptId} + + + + + update sys_dept + + status = #{status}, + update_by = #{updateBy}, + update_time = sysdate() + + where find_in_set(#{deptId}, ancestors) + + + + update sys_dept set del_flag = '2' where dept_id = #{deptId} + + + + + + \ No newline at end of file diff --git a/yunze-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/yunze-system/src/main/resources/mapper/system/SysDictDataMapper.xml new file mode 100644 index 0000000..d03c905 --- /dev/null +++ b/yunze-system/src/main/resources/mapper/system/SysDictDataMapper.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + 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 = sysdate() + + 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}, + sysdate() + ) + + + \ No newline at end of file diff --git a/yunze-system/src/main/resources/mapper/system/SysDictTypeMapper.xml b/yunze-system/src/main/resources/mapper/system/SysDictTypeMapper.xml new file mode 100644 index 0000000..9327f1e --- /dev/null +++ b/yunze-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 = sysdate() + + 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}, + sysdate() + ) + + + \ No newline at end of file diff --git a/yunze-system/src/main/resources/mapper/system/SysLogininforMapper.xml b/yunze-system/src/main/resources/mapper/system/SysLogininforMapper.xml new file mode 100644 index 0000000..88518c7 --- /dev/null +++ b/yunze-system/src/main/resources/mapper/system/SysLogininforMapper.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time) + values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate()) + + + + + + delete from sys_logininfor where info_id in + + #{infoId} + + + + + truncate table sys_logininfor + + + \ No newline at end of file diff --git a/yunze-system/src/main/resources/mapper/system/SysMenuMapper.xml b/yunze-system/src/main/resources/mapper/system/SysMenuMapper.xml new file mode 100644 index 0000000..d970ff4 --- /dev/null +++ b/yunze-system/src/main/resources/mapper/system/SysMenuMapper.xml @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + select menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, ifnull(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}, + is_frame = #{isFrame}, + is_cache = #{isCache}, + menu_type = #{menuType}, + visible = #{visible}, + status = #{status}, + perms = #{perms}, + icon = #{icon}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where menu_id = #{menuId} + + + + insert into sys_menu( + menu_id, + parent_id, + menu_name, + order_num, + path, + component, + is_frame, + is_cache, + menu_type, + visible, + status, + perms, + icon, + remark, + create_by, + create_time + )values( + #{menuId}, + #{parentId}, + #{menuName}, + #{orderNum}, + #{path}, + #{component}, + #{isFrame}, + #{isCache}, + #{menuType}, + #{visible}, + #{status}, + #{perms}, + #{icon}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + delete from sys_menu where menu_id = #{menuId} + + + \ No newline at end of file diff --git a/yunze-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/yunze-system/src/main/resources/mapper/system/SysNoticeMapper.xml new file mode 100644 index 0000000..e125946 --- /dev/null +++ b/yunze-system/src/main/resources/mapper/system/SysNoticeMapper.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark + from sys_notice + + + + + + + + insert into sys_notice ( + notice_title, + notice_type, + notice_content, + status, + remark, + create_by, + create_time + )values( + #{noticeTitle}, + #{noticeType}, + #{noticeContent}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update sys_notice + + notice_title = #{noticeTitle}, + notice_type = #{noticeType}, + notice_content = #{noticeContent}, + status = #{status}, + update_by = #{updateBy}, + update_time = sysdate() + + where notice_id = #{noticeId} + + + + delete from sys_notice where notice_id = #{noticeId} + + + + delete from sys_notice where notice_id in + + #{noticeId} + + + + \ No newline at end of file diff --git a/yunze-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/yunze-system/src/main/resources/mapper/system/SysOperLogMapper.xml new file mode 100644 index 0000000..5f96bd1 --- /dev/null +++ b/yunze-system/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 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}, sysdate()) + + + + + + delete from sys_oper_log where oper_id in + + #{operId} + + + + + + + truncate table sys_oper_log + + + \ No newline at end of file diff --git a/yunze-system/src/main/resources/mapper/system/SysPostMapper.xml b/yunze-system/src/main/resources/mapper/system/SysPostMapper.xml new file mode 100644 index 0000000..47485a4 --- /dev/null +++ b/yunze-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 = sysdate() + + where post_id = #{postId} + + + + insert into sys_post( + post_id, + post_code, + post_name, + post_sort, + status, + remark, + create_by, + create_time + )values( + #{postId}, + #{postCode}, + #{postName}, + #{postSort}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + 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/yunze-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml b/yunze-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml new file mode 100644 index 0000000..cd15a42 --- /dev/null +++ b/yunze-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/yunze-system/src/main/resources/mapper/system/SysRoleMapper.xml b/yunze-system/src/main/resources/mapper/system/SysRoleMapper.xml new file mode 100644 index 0000000..992d940 --- /dev/null +++ b/yunze-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + 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.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_id, + role_name, + role_key, + role_sort, + data_scope, + menu_check_strictly, + dept_check_strictly, + status, + remark, + create_by, + create_time + )values( + #{roleId}, + #{roleName}, + #{roleKey}, + #{roleSort}, + #{dataScope}, + #{menuCheckStrictly}, + #{deptCheckStrictly}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + 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 = sysdate() + + 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/yunze-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/yunze-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml new file mode 100644 index 0000000..e716ba6 --- /dev/null +++ b/yunze-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/yunze-system/src/main/resources/mapper/system/SysUserMapper.xml b/yunze-system/src/main/resources/mapper/system/SysUserMapper.xml new file mode 100644 index 0000000..2094ac0 --- /dev/null +++ b/yunze-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select u.user_id, u.dept_id, u.user_name, u.nick_name, 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, + d.dept_id, d.parent_id, 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 + 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 + + + + + + + + + + + + + + + + insert into sys_user( + user_id, + dept_id, + user_name, + nick_name, + email, + avatar, + phonenumber, + sex, + password, + status, + create_by, + remark, + create_time + )values( + #{userId}, + #{deptId}, + #{userName}, + #{nickName}, + #{email}, + #{avatar}, + #{phonenumber}, + #{sex}, + #{password}, + #{status}, + #{createBy}, + #{remark}, + sysdate() + ) + + + + update sys_user + + dept_id = #{deptId}, + user_name = #{userName}, + nick_name = #{nickName}, + email = #{email}, + phonenumber = #{phonenumber}, + sex = #{sex}, + avatar = #{avatar}, + password = #{password}, + status = #{status}, + login_ip = #{loginIp}, + login_date = #{loginDate}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = sysdate() + + 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/yunze-system/src/main/resources/mapper/system/SysUserPostMapper.xml b/yunze-system/src/main/resources/mapper/system/SysUserPostMapper.xml new file mode 100644 index 0000000..21330c8 --- /dev/null +++ b/yunze-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/yunze-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/yunze-system/src/main/resources/mapper/system/SysUserRoleMapper.xml new file mode 100644 index 0000000..1acfd41 --- /dev/null +++ b/yunze-system/src/main/resources/mapper/system/SysUserRoleMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + 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/yunze-system/yunze-system.iml b/yunze-system/yunze-system.iml new file mode 100644 index 0000000..1088345 --- /dev/null +++ b/yunze-system/yunze-system.iml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-ui/.editorconfig b/yunze-ui/.editorconfig new file mode 100644 index 0000000..7034f9b --- /dev/null +++ b/yunze-ui/.editorconfig @@ -0,0 +1,22 @@ +# 告诉EditorConfig插件,这是根文件,不用继续往上查找 +root = true + +# 匹配全部文件 +[*] +# 设置字符集 +charset = utf-8 +# 缩进风格,可选space、tab +indent_style = space +# 缩进的空格数 +indent_size = 2 +# 结尾换行符,可选lf、cr、crlf +end_of_line = lf +# 在文件结尾插入新行 +insert_final_newline = true +# 删除一行中的前后空格 +trim_trailing_whitespace = true + +# 匹配md结尾的文件 +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false diff --git a/yunze-ui/.env.development b/yunze-ui/.env.development new file mode 100644 index 0000000..3e249ce --- /dev/null +++ b/yunze-ui/.env.development @@ -0,0 +1,8 @@ +# 开发环境配置 +ENV = 'development' + +# IOT综合业务支撑平台/开发环境 +VUE_APP_BASE_API = '/dev-api' + +# 路由懒加载 +VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/yunze-ui/.env.production b/yunze-ui/.env.production new file mode 100644 index 0000000..07bc77a --- /dev/null +++ b/yunze-ui/.env.production @@ -0,0 +1,5 @@ +# 生产环境配置 +ENV = 'production' + +# IOT综合业务支撑平台/生产环境 +VUE_APP_BASE_API = '/prod-api' diff --git a/yunze-ui/.env.staging b/yunze-ui/.env.staging new file mode 100644 index 0000000..618b62d --- /dev/null +++ b/yunze-ui/.env.staging @@ -0,0 +1,7 @@ +NODE_ENV = production + +# 测试环境配置 +ENV = 'staging' + +# IOT综合业务支撑平台/测试环境 +VUE_APP_BASE_API = '/stage-api' diff --git a/yunze-ui/.eslintignore b/yunze-ui/.eslintignore new file mode 100644 index 0000000..89be6f6 --- /dev/null +++ b/yunze-ui/.eslintignore @@ -0,0 +1,10 @@ +# 忽略build目录下类型为js的文件的语法检查 +build/*.js +# 忽略src/assets目录下文件的语法检查 +src/assets +# 忽略public目录下文件的语法检查 +public +# 忽略当前目录下为js的文件的语法检查 +*.js +# 忽略当前目录下为vue的文件的语法检查 +*.vue \ No newline at end of file diff --git a/yunze-ui/.eslintrc.js b/yunze-ui/.eslintrc.js new file mode 100644 index 0000000..82bbdee --- /dev/null +++ b/yunze-ui/.eslintrc.js @@ -0,0 +1,199 @@ +// ESlint 检查配置 +module.exports = { + root: true, + parserOptions: { + parser: 'babel-eslint', + sourceType: 'module' + }, + env: { + browser: true, + node: true, + es6: true, + }, + extends: ['plugin:vue/recommended', 'eslint:recommended'], + + // add your custom rules here + //it is base on https://github.com/vuejs/eslint-config-vue + rules: { + "vue/max-attributes-per-line": [2, { + "singleline": 10, + "multiline": { + "max": 1, + "allowFirstLine": false + } + }], + "vue/singleline-html-element-content-newline": "off", + "vue/multiline-html-element-content-newline":"off", + "vue/name-property-casing": ["error", "PascalCase"], + "vue/no-v-html": "off", + 'accessor-pairs': 2, + 'arrow-spacing': [2, { + 'before': true, + 'after': true + }], + 'block-spacing': [2, 'always'], + 'brace-style': [2, '1tbs', { + 'allowSingleLine': true + }], + 'camelcase': [0, { + 'properties': 'always' + }], + 'comma-dangle': [2, 'never'], + 'comma-spacing': [2, { + 'before': false, + 'after': true + }], + 'comma-style': [2, 'last'], + 'constructor-super': 2, + 'curly': [2, 'multi-line'], + 'dot-location': [2, 'property'], + 'eol-last': 2, + 'eqeqeq': ["error", "always", {"null": "ignore"}], + 'generator-star-spacing': [2, { + 'before': true, + 'after': true + }], + 'handle-callback-err': [2, '^(err|error)$'], + 'indent': [2, 2, { + 'SwitchCase': 1 + }], + 'jsx-quotes': [2, 'prefer-single'], + 'key-spacing': [2, { + 'beforeColon': false, + 'afterColon': true + }], + 'keyword-spacing': [2, { + 'before': true, + 'after': true + }], + 'new-cap': [2, { + 'newIsCap': true, + 'capIsNew': false + }], + 'new-parens': 2, + 'no-array-constructor': 2, + 'no-caller': 2, + 'no-console': 'off', + 'no-class-assign': 2, + 'no-cond-assign': 2, + 'no-const-assign': 2, + 'no-control-regex': 0, + 'no-delete-var': 2, + 'no-dupe-args': 2, + 'no-dupe-class-members': 2, + 'no-dupe-keys': 2, + 'no-duplicate-case': 2, + 'no-empty-character-class': 2, + 'no-empty-pattern': 2, + 'no-eval': 2, + 'no-ex-assign': 2, + 'no-extend-native': 2, + 'no-extra-bind': 2, + 'no-extra-boolean-cast': 2, + 'no-extra-parens': [2, 'functions'], + 'no-fallthrough': 2, + 'no-floating-decimal': 2, + 'no-func-assign': 2, + 'no-implied-eval': 2, + 'no-inner-declarations': [2, 'functions'], + 'no-invalid-regexp': 2, + 'no-irregular-whitespace': 2, + 'no-iterator': 2, + 'no-label-var': 2, + 'no-labels': [2, { + 'allowLoop': false, + 'allowSwitch': false + }], + 'no-lone-blocks': 2, + 'no-mixed-spaces-and-tabs': 2, + 'no-multi-spaces': 2, + 'no-multi-str': 2, + 'no-multiple-empty-lines': [2, { + 'max': 1 + }], + 'no-native-reassign': 2, + 'no-negated-in-lhs': 2, + 'no-new-object': 2, + 'no-new-require': 2, + 'no-new-symbol': 2, + 'no-new-wrappers': 2, + 'no-obj-calls': 2, + 'no-octal': 2, + 'no-octal-escape': 2, + 'no-path-concat': 2, + 'no-proto': 2, + 'no-redeclare': 2, + 'no-regex-spaces': 2, + 'no-return-assign': [2, 'except-parens'], + 'no-self-assign': 2, + 'no-self-compare': 2, + 'no-sequences': 2, + 'no-shadow-restricted-names': 2, + 'no-spaced-func': 2, + 'no-sparse-arrays': 2, + 'no-this-before-super': 2, + 'no-throw-literal': 2, + 'no-trailing-spaces': 2, + 'no-undef': 2, + 'no-undef-init': 2, + 'no-unexpected-multiline': 2, + 'no-unmodified-loop-condition': 2, + 'no-unneeded-ternary': [2, { + 'defaultAssignment': false + }], + 'no-unreachable': 2, + 'no-unsafe-finally': 2, + 'no-unused-vars': [2, { + 'vars': 'all', + 'args': 'none' + }], + 'no-useless-call': 2, + 'no-useless-computed-key': 2, + 'no-useless-constructor': 2, + 'no-useless-escape': 0, + 'no-whitespace-before-property': 2, + 'no-with': 2, + 'one-var': [2, { + 'initialized': 'never' + }], + 'operator-linebreak': [2, 'after', { + 'overrides': { + '?': 'before', + ':': 'before' + } + }], + 'padded-blocks': [2, 'never'], + 'quotes': [2, 'single', { + 'avoidEscape': true, + 'allowTemplateLiterals': true + }], + 'semi': [2, 'never'], + 'semi-spacing': [2, { + 'before': false, + 'after': true + }], + 'space-before-blocks': [2, 'always'], + 'space-before-function-paren': [2, 'never'], + 'space-in-parens': [2, 'never'], + 'space-infix-ops': 2, + 'space-unary-ops': [2, { + 'words': true, + 'nonwords': false + }], + 'spaced-comment': [2, 'always', { + 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] + }], + 'template-curly-spacing': [2, 'never'], + 'use-isnan': 2, + 'valid-typeof': 2, + 'wrap-iife': [2, 'any'], + 'yield-star-spacing': [2, 'both'], + 'yoda': [2, 'never'], + 'prefer-const': 2, + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, + 'object-curly-spacing': [2, 'always', { + objectsInObjects: false + }], + 'array-bracket-spacing': [2, 'never'] + } +} diff --git a/yunze-ui/.gitignore b/yunze-ui/.gitignore new file mode 100644 index 0000000..78a752d --- /dev/null +++ b/yunze-ui/.gitignore @@ -0,0 +1,23 @@ +.DS_Store +node_modules/ +dist/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +**/*.log + +tests/**/coverage/ +tests/e2e/reports +selenium-debug.log + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.local + +package-lock.json +yarn.lock diff --git a/yunze-ui/README.md b/yunze-ui/README.md new file mode 100644 index 0000000..8be500d --- /dev/null +++ b/yunze-ui/README.md @@ -0,0 +1,32 @@ +## 开发 + +```bash +# 克隆项目 +git clone https://gitee.com/sdyunze/yun-ze-iot + +# 进入项目目录 +cd yunze-ui + +# 安装依赖 + +. +npm install + +# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 +npm install --registry=https://registry.npm.taobao.org + +# 启动服务 +npm run dev +``` +npm i nrm -g --registry=https://registry.npm.taobao.org +浏览器访问 http://localhost:80 + +## 发布 + +```bash +# 构建测试环境 +npm run build:stage + +# 构建生产环境 +npm run build:prod +``` \ No newline at end of file diff --git a/yunze-ui/babel.config.js b/yunze-ui/babel.config.js new file mode 100644 index 0000000..b99f001 --- /dev/null +++ b/yunze-ui/babel.config.js @@ -0,0 +1,13 @@ +module.exports = { + presets: [ + // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app + '@vue/cli-plugin-babel/preset' + ], + 'env': { + 'development': { + // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). + // This plugin can significantly increase the speed of hot updates, when you have a large number of pages. + 'plugins': ['dynamic-import-node'] + } + } +} diff --git a/yunze-ui/bin/build.bat b/yunze-ui/bin/build.bat new file mode 100644 index 0000000..dda590d --- /dev/null +++ b/yunze-ui/bin/build.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [Ϣ] Weḅdistļ +echo. + +%~d0 +cd %~dp0 + +cd .. +npm run build:prod + +pause \ No newline at end of file diff --git a/yunze-ui/bin/package.bat b/yunze-ui/bin/package.bat new file mode 100644 index 0000000..8281749 --- /dev/null +++ b/yunze-ui/bin/package.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [Ϣ] װWeḅnode_modulesļ +echo. + +%~d0 +cd %~dp0 + +cd .. +npm install --registry=https://registry.npm.taobao.org + +pause \ No newline at end of file diff --git a/yunze-ui/bin/run-web.bat b/yunze-ui/bin/run-web.bat new file mode 100644 index 0000000..a938e89 --- /dev/null +++ b/yunze-ui/bin/run-web.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [Ϣ] ʹ Vue Web ̡ +echo. + +%~d0 +cd %~dp0 + +cd .. +npm run dev + +pause \ No newline at end of file diff --git a/yunze-ui/build/index.js b/yunze-ui/build/index.js new file mode 100644 index 0000000..30278b1 --- /dev/null +++ b/yunze-ui/build/index.js @@ -0,0 +1,35 @@ +const { run } = require('runjs') +const chalk = require('chalk') +const config = require('../vue.config.js') +const rawArgv = process.argv.slice(2) +const args = rawArgv.join(' ') + +if (process.env.npm_config_preview || rawArgv.includes('--preview')) { + const report = rawArgv.includes('--report') + + run(`vue-cli-service build ${args}`) + + const port = 9526 + const publicPath = config.publicPath + + var connect = require('connect') + var serveStatic = require('serve-static') + const app = connect() + + app.use( + publicPath, + serveStatic('./dist', { + index: ['index.html', '/'] + }) + ) + + app.listen(port, function () { + //console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`)) + if (report) { + //console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`)) + } + + }) +} else { + run(`vue-cli-service build ${args}`) +} diff --git a/yunze-ui/package.json b/yunze-ui/package.json new file mode 100644 index 0000000..15b9c7c --- /dev/null +++ b/yunze-ui/package.json @@ -0,0 +1,97 @@ +{ + "name": "yunze", + "version": "0.5.0", + "description": "云则物理管理系统", + "author": "YunZe", + "license": "MIT", + "scripts": { + "dev": "vue-cli-service serve", + "build:prod": "vue-cli-service build", + "build:stage": "vue-cli-service build --mode staging", + "preview": "node build/index.js --preview", + "lint": "eslint --ext .js,.vue src" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "src/**/*.{js,vue}": [ + "eslint --fix", + "git add" + ] + }, + "keywords": [ + "vue", + "admin", + "dashboard", + "element-ui", + "boilerplate", + "admin-template", + "management-system" + ], + "repository": { + "type": "git", + "url": "https://gitee.com/sdyunze/yun-ze-iot.git" + }, + "dependencies": { + "@riophae/vue-treeselect": "0.4.0", + "axios": "0.21.0", + "clipboard": "2.0.6", + "core-js": "^3.8.1", + "cos-js-sdk-v5": "^1.2.18", + "crypto-js": "^4.0.0", + "echarts": "4.9.0", + "element-china-area-data": "^5.0.2", + "element-ui": "2.15.0", + "file-saver": "2.0.4", + "fuse.js": "6.4.3", + "highlight.js": "9.18.5", + "js-beautify": "1.13.0", + "js-cookie": "2.2.1", + "jsencrypt": "3.0.0-rc.1", + "node-sass": "^6.0.1", + "nprogress": "0.2.0", + "quill": "1.3.7", + "screenfull": "5.0.2", + "scss": "^0.2.4", + "sortablejs": "1.10.2", + "style-loader": "^3.3.0", + "vue": "2.6.12", + "vue-count-to": "1.0.13", + "vue-cropper": "0.5.5", + "vue-layer": "^1.2.5", + "vue-router": "3.4.9", + "vuedraggable": "^2.24.3", + "vuex": "3.6.0" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "4.4.6", + "@vue/cli-plugin-eslint": "4.4.6", + "@vue/cli-service": "4.4.6", + "babel-eslint": "10.1.0", + "chalk": "4.1.0", + "connect": "3.6.6", + "eslint": "7.15.0", + "eslint-plugin-vue": "7.2.0", + "jquery": "^3.6.0", + "less": "^4.1.1", + "less-loader": "^10.0.1", + "lint-staged": "10.5.3", + "runjs": "4.4.2", + "sass": "1.32.0", + "sass-loader": "^10.1.0", + "script-ext-html-webpack-plugin": "2.1.5", + "svg-sprite-loader": "5.1.1", + "vue-template-compiler": "2.6.12" + }, + "engines": { + "node": ">=8.9", + "npm": ">= 3.0.0" + }, + "browserslist": [ + "> 1%", + "last 2 versions" + ] +} diff --git a/yunze-ui/public/YunYeQiyeWeiXin.jpg b/yunze-ui/public/YunYeQiyeWeiXin.jpg new file mode 100644 index 0000000..d505fc8 Binary files /dev/null and b/yunze-ui/public/YunYeQiyeWeiXin.jpg differ diff --git a/yunze-ui/public/YunZeIot (1).png b/yunze-ui/public/YunZeIot (1).png new file mode 100644 index 0000000..13ac3e3 Binary files /dev/null and b/yunze-ui/public/YunZeIot (1).png differ diff --git a/yunze-ui/public/favicon.ico b/yunze-ui/public/favicon.ico new file mode 100644 index 0000000..381f102 Binary files /dev/null and b/yunze-ui/public/favicon.ico differ diff --git a/yunze-ui/public/html/ie.html b/yunze-ui/public/html/ie.html new file mode 100644 index 0000000..fee2a61 --- /dev/null +++ b/yunze-ui/public/html/ie.html @@ -0,0 +1,46 @@ + + + + + + 请升级您的浏览器 + + + + + + +

请升级您的浏览器,以便我们更好的为您提供服务!

+

您正在使用 Internet Explorer 的早期版本(IE11以下版本或使用该内核的浏览器)。这意味着在升级浏览器前,您将无法访问此网站。

+
+

请注意:微软公司对Windows XP 及 Internet Explorer 早期版本的支持已经结束

+

自 2016 年 1 月 12 日起,Microsoft 不再为 IE 11 以下版本提供相应支持和更新。没有关键的浏览器安全更新,您的电脑可能易受有害病毒、间谍软件和其他恶意软件的攻击,它们可以窃取或损害您的业务数据和信息。请参阅 微软对 Internet Explorer 早期版本的支持将于 2016 年 1 月 12 日结束的说明

+
+

您可以选择更先进的浏览器

+

推荐使用以下浏览器的最新版本。如果您的电脑已有以下浏览器的最新版本则直接使用该浏览器访问即可。

+ +
+ + diff --git a/yunze-ui/public/index.html b/yunze-ui/public/index.html new file mode 100644 index 0000000..925455c --- /dev/null +++ b/yunze-ui/public/index.html @@ -0,0 +1,208 @@ + + + + + + + + + <%= webpackConfig.name %> + + + + +
+
+
+
+
+
正在加载系统资源,请耐心等待
+
+
+ + diff --git a/yunze-ui/public/robots.txt b/yunze-ui/public/robots.txt new file mode 100644 index 0000000..77470cb --- /dev/null +++ b/yunze-ui/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / \ No newline at end of file diff --git a/yunze-ui/public/wxgzh.jpg b/yunze-ui/public/wxgzh.jpg new file mode 100644 index 0000000..f47a95d Binary files /dev/null and b/yunze-ui/public/wxgzh.jpg differ diff --git a/yunze-ui/src/App.vue b/yunze-ui/src/App.vue new file mode 100644 index 0000000..e448b11 --- /dev/null +++ b/yunze-ui/src/App.vue @@ -0,0 +1,11 @@ + + + diff --git a/yunze-ui/src/api/login.js b/yunze-ui/src/api/login.js new file mode 100644 index 0000000..9ddd1c1 --- /dev/null +++ b/yunze-ui/src/api/login.js @@ -0,0 +1,40 @@ +import request from '@/utils/request' + +// 登录方法 +export function login(username, password, code, uuid) { + const data = { + username, + password, + code, + uuid + } + return request({ + url: '/login', + method: 'post', + data: data + }) +} + +// 获取用户详细信息 +export function getInfo() { + return request({ + url: '/getInfo', + method: 'get' + }) +} + +// 退出方法 +export function logout() { + return request({ + url: '/logout', + method: 'post' + }) +} + +// 获取验证码 +export function getCodeImg() { + return request({ + url: '/captchaImage', + method: 'get' + }) +} diff --git a/yunze-ui/src/api/menu.js b/yunze-ui/src/api/menu.js new file mode 100644 index 0000000..95aaa17 --- /dev/null +++ b/yunze-ui/src/api/menu.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +// 获取路由 +export const getRouters = () => { + return request({ + url: '/getRouters', + method: 'get' + }) +} diff --git a/yunze-ui/src/api/monitor/cache.js b/yunze-ui/src/api/monitor/cache.js new file mode 100644 index 0000000..59d3505 --- /dev/null +++ b/yunze-ui/src/api/monitor/cache.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +// 查询缓存详细 +export function getCache() { + return request({ + url: '/monitor/cache', + method: 'get' + }) +} diff --git a/yunze-ui/src/api/monitor/job.js b/yunze-ui/src/api/monitor/job.js new file mode 100644 index 0000000..af728bf --- /dev/null +++ b/yunze-ui/src/api/monitor/job.js @@ -0,0 +1,80 @@ +import request from '@/utils/request' + +// 查询定时任务调度列表 +export function listJob(query) { + return request({ + url: '/monitor/job/list', + method: 'get', + params: query + }) +} + +// 查询定时任务调度详细 +export function getJob(jobId) { + return request({ + url: '/monitor/job/' + jobId, + method: 'get' + }) +} + +// 新增定时任务调度 +export function addJob(data) { + return request({ + url: '/monitor/job', + method: 'post', + data: data + }) +} + +// 修改定时任务调度 +export function updateJob(data) { + return request({ + url: '/monitor/job', + method: 'put', + data: data + }) +} + +// 删除定时任务调度 +export function delJob(jobId) { + return request({ + url: '/monitor/job/' + jobId, + method: 'delete' + }) +} + +// 导出定时任务调度 +export function exportJob(query) { + return request({ + url: '/monitor/job/export', + method: 'get', + params: query + }) +} + +// 任务状态修改 +export function changeJobStatus(jobId, status) { + const data = { + jobId, + status + } + return request({ + url: '/monitor/job/changeStatus', + method: 'put', + data: data + }) +} + + +// 定时任务立即执行一次 +export function runJob(jobId, jobGroup) { + const data = { + jobId, + jobGroup + } + return request({ + url: '/monitor/job/run', + method: 'put', + data: data + }) +} diff --git a/yunze-ui/src/api/monitor/jobLog.js b/yunze-ui/src/api/monitor/jobLog.js new file mode 100644 index 0000000..f5d3a07 --- /dev/null +++ b/yunze-ui/src/api/monitor/jobLog.js @@ -0,0 +1,35 @@ +import request from '@/utils/request' + +// 查询调度日志列表 +export function listJobLog(query) { + return request({ + url: '/monitor/jobLog/list', + method: 'get', + params: query + }) +} + +// 删除调度日志 +export function delJobLog(jobLogId) { + return request({ + url: '/monitor/jobLog/' + jobLogId, + method: 'delete' + }) +} + +// 清空调度日志 +export function cleanJobLog() { + return request({ + url: '/monitor/jobLog/clean', + method: 'delete' + }) +} + +// 导出调度日志 +export function exportJobLog(query) { + return request({ + url: '/monitor/jobLog/export', + method: 'get', + params: query + }) +} diff --git a/yunze-ui/src/api/monitor/logininfor.js b/yunze-ui/src/api/monitor/logininfor.js new file mode 100644 index 0000000..7ff412d --- /dev/null +++ b/yunze-ui/src/api/monitor/logininfor.js @@ -0,0 +1,35 @@ +import request from '@/utils/request' + +// 查询登录日志列表 +export function list(query) { + return request({ + url: '/monitor/logininfor/list', + method: 'get', + params: query + }) +} + +// 删除登录日志 +export function delLogininfor(infoId) { + return request({ + url: '/monitor/logininfor/' + infoId, + method: 'delete' + }) +} + +// 清空登录日志 +export function cleanLogininfor() { + return request({ + url: '/monitor/logininfor/clean', + method: 'delete' + }) +} + +// 导出登录日志 +export function exportLogininfor(query) { + return request({ + url: '/monitor/logininfor/export', + method: 'get', + params: query + }) +} diff --git a/yunze-ui/src/api/monitor/online.js b/yunze-ui/src/api/monitor/online.js new file mode 100644 index 0000000..bd22137 --- /dev/null +++ b/yunze-ui/src/api/monitor/online.js @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +// 查询在线用户列表 +export function list(query) { + return request({ + url: '/monitor/online/list', + method: 'get', + params: query + }) +} + +// 强退用户 +export function forceLogout(tokenId) { + return request({ + url: '/monitor/online/' + tokenId, + method: 'delete' + }) +} diff --git a/yunze-ui/src/api/monitor/operlog.js b/yunze-ui/src/api/monitor/operlog.js new file mode 100644 index 0000000..07e27ab --- /dev/null +++ b/yunze-ui/src/api/monitor/operlog.js @@ -0,0 +1,35 @@ +import request from '@/utils/request' + +// 查询操作日志列表 +export function list(query) { + return request({ + url: '/monitor/operlog/list', + method: 'get', + params: query + }) +} + +// 删除操作日志 +export function delOperlog(operId) { + return request({ + url: '/monitor/operlog/' + operId, + method: 'delete' + }) +} + +// 清空操作日志 +export function cleanOperlog() { + return request({ + url: '/monitor/operlog/clean', + method: 'delete' + }) +} + +// 导出操作日志 +export function exportOperlog(query) { + return request({ + url: '/monitor/operlog/export', + method: 'get', + params: query + }) +} diff --git a/yunze-ui/src/api/monitor/server.js b/yunze-ui/src/api/monitor/server.js new file mode 100644 index 0000000..bdcc62b --- /dev/null +++ b/yunze-ui/src/api/monitor/server.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +// 查询服务器详细 +export function getServer() { + return request({ + url: '/monitor/server', + method: 'get' + }) +} diff --git a/yunze-ui/src/api/system/config.js b/yunze-ui/src/api/system/config.js new file mode 100644 index 0000000..4c5cb6b --- /dev/null +++ b/yunze-ui/src/api/system/config.js @@ -0,0 +1,69 @@ +import request from '@/utils/request' + +// 查询参数列表 +export function listConfig(query) { + return request({ + url: '/system/config/list', + method: 'get', + params: query + }) +} + +// 查询参数详细 +export function getConfig(configId) { + return request({ + url: '/system/config/' + configId, + method: 'get' + }) +} + +// 根据参数键名查询参数值 +export function getConfigKey(configKey) { + return request({ + url: '/system/config/configKey/' + configKey, + method: 'get' + }) +} + +// 新增参数配置 +export function addConfig(data) { + return request({ + url: '/system/config', + method: 'post', + data: data + }) +} + +// 修改参数配置 +export function updateConfig(data) { + return request({ + url: '/system/config', + method: 'put', + data: data + }) +} + +// 删除参数配置 +export function delConfig(configId) { + return request({ + url: '/system/config/' + configId, + method: 'delete' + }) +} + +// 刷新参数缓存 +export function refreshCache() { + return request({ + url: '/system/config/refreshCache', + method: 'delete' + }) +} + +// 导出参数 +export function exportConfig(query) { + return request({ + url: '/system/config/export', + method: 'get', + params: query + }) +} diff --git a/yunze-ui/src/api/system/dept.js b/yunze-ui/src/api/system/dept.js new file mode 100644 index 0000000..c4dbafc --- /dev/null +++ b/yunze-ui/src/api/system/dept.js @@ -0,0 +1,68 @@ +import request from '@/utils/request' + +// 查询部门列表 +export function listDept(query) { + return request({ + url: '/system/dept/list', + method: 'get', + params: query + }) +} + +// 查询部门列表(排除节点) +export function listDeptExcludeChild(deptId) { + return request({ + url: '/system/dept/list/exclude/' + deptId, + method: 'get' + }) +} + +// 查询部门详细 +export function getDept(deptId) { + return request({ + url: '/system/dept/' + deptId, + method: 'get' + }) +} + +// 查询部门下拉树结构 +export function treeselect() { + return request({ + url: '/system/dept/treeselect', + method: 'get' + }) +} + +// 根据角色ID查询部门树结构 +export function roleDeptTreeselect(roleId) { + return request({ + url: '/system/dept/roleDeptTreeselect/' + roleId, + method: 'get' + }) +} + +// 新增部门 +export function addDept(data) { + return request({ + url: '/system/dept', + method: 'post', + data: data + }) +} + +// 修改部门 +export function updateDept(data) { + return request({ + url: '/system/dept', + method: 'put', + data: data + }) +} + +// 删除部门 +export function delDept(deptId) { + return request({ + url: '/system/dept/' + deptId, + method: 'delete' + }) +} diff --git a/yunze-ui/src/api/system/dict/data.js b/yunze-ui/src/api/system/dict/data.js new file mode 100644 index 0000000..4997e58 --- /dev/null +++ b/yunze-ui/src/api/system/dict/data.js @@ -0,0 +1,61 @@ +import request from '@/utils/request' + +// 查询字典数据列表 +export function listData(query) { + return request({ + url: '/system/dict/data/list', + method: 'get', + params: query + }) +} + +// 查询字典数据详细 +export function getData(dictCode) { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'get' + }) +} + +// 根据字典类型查询字典数据信息 +export function getDicts(dictType) { + return request({ + url: '/system/dict/data/type/' + dictType, + method: 'get' + }) +} + +// 新增字典数据 +export function addData(data) { + return request({ + url: '/system/dict/data', + method: 'post', + data: data + }) +} + +// 修改字典数据 +export function updateData(data) { + return request({ + url: '/system/dict/data', + method: 'put', + data: data + }) +} + +// 删除字典数据 +export function delData(dictCode) { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'delete' + }) +} + +// 导出字典数据 +export function exportData(query) { + return request({ + url: '/system/dict/data/export', + method: 'get', + params: query + }) +} diff --git a/yunze-ui/src/api/system/dict/type.js b/yunze-ui/src/api/system/dict/type.js new file mode 100644 index 0000000..2f0532d --- /dev/null +++ b/yunze-ui/src/api/system/dict/type.js @@ -0,0 +1,69 @@ +import request from '@/utils/request' + +// 查询字典类型列表 +export function listType(query) { + return request({ + url: '/system/dict/type/list', + method: 'get', + params: query + }) +} + +// 查询字典类型详细 +export function getType(dictId) { + return request({ + url: '/system/dict/type/' + dictId, + method: 'get' + }) +} + +// 新增字典类型 +export function addType(data) { + return request({ + url: '/system/dict/type', + method: 'post', + data: data + }) +} + +// 修改字典类型 +export function updateType(data) { + return request({ + url: '/system/dict/type', + method: 'put', + data: data + }) +} + +// 删除字典类型 +export function delType(dictId) { + return request({ + url: '/system/dict/type/' + dictId, + method: 'delete' + }) +} + +// 刷新字典缓存 +export function refreshCache() { + return request({ + url: '/system/dict/type/refreshCache', + method: 'delete' + }) +} + +// 导出字典类型 +export function exportType(query) { + return request({ + url: '/system/dict/type/export', + method: 'get', + params: query + }) +} + +// 获取字典选择框列表 +export function optionselect() { + return request({ + url: '/system/dict/type/optionselect', + method: 'get' + }) +} diff --git a/yunze-ui/src/api/system/menu.js b/yunze-ui/src/api/system/menu.js new file mode 100644 index 0000000..87af6c3 --- /dev/null +++ b/yunze-ui/src/api/system/menu.js @@ -0,0 +1,60 @@ +import request from '@/utils/request' + +// 查询菜单列表 +export function listMenu(query) { + return request({ + url: '/system/menu/list', + method: 'get', + params: query + }) +} + +// 查询菜单详细 +export function getMenu(menuId) { + return request({ + url: '/system/menu/' + menuId, + method: 'get' + }) +} + +// 查询菜单下拉树结构 +export function treeselect() { + return request({ + url: '/system/menu/treeselect', + method: 'get' + }) +} + +// 根据角色ID查询菜单下拉树结构 +export function roleMenuTreeselect(roleId) { + return request({ + url: '/system/menu/roleMenuTreeselect/' + roleId, + method: 'get' + }) +} + +// 新增菜单 +export function addMenu(data) { + return request({ + url: '/system/menu', + method: 'post', + data: data + }) +} + +// 修改菜单 +export function updateMenu(data) { + return request({ + url: '/system/menu', + method: 'put', + data: data + }) +} + +// 删除菜单 +export function delMenu(menuId) { + return request({ + url: '/system/menu/' + menuId, + method: 'delete' + }) +} diff --git a/yunze-ui/src/api/system/notice.js b/yunze-ui/src/api/system/notice.js new file mode 100644 index 0000000..d61a810 --- /dev/null +++ b/yunze-ui/src/api/system/notice.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询公告列表 +export function listNotice(query) { + return request({ + url: '/system/notice/list', + method: 'get', + params: query + }) +} + +// 查询公告详细 +export function getNotice(noticeId) { + return request({ + url: '/system/notice/' + noticeId, + method: 'get' + }) +} + +// 新增公告 +export function addNotice(data) { + return request({ + url: '/system/notice', + method: 'post', + data: data + }) +} + +// 修改公告 +export function updateNotice(data) { + return request({ + url: '/system/notice', + method: 'put', + data: data + }) +} + +// 删除公告 +export function delNotice(noticeId) { + return request({ + url: '/system/notice/' + noticeId, + method: 'delete' + }) +} diff --git a/yunze-ui/src/api/system/post.js b/yunze-ui/src/api/system/post.js new file mode 100644 index 0000000..4dce216 --- /dev/null +++ b/yunze-ui/src/api/system/post.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询岗位列表 +export function listPost(query) { + return request({ + url: '/system/post/list', + method: 'get', + params: query + }) +} + +// 查询岗位详细 +export function getPost(postId) { + return request({ + url: '/system/post/' + postId, + method: 'get' + }) +} + +// 新增岗位 +export function addPost(data) { + return request({ + url: '/system/post', + method: 'post', + data: data + }) +} + +// 修改岗位 +export function updatePost(data) { + return request({ + url: '/system/post', + method: 'put', + data: data + }) +} + +// 删除岗位 +export function delPost(postId) { + return request({ + url: '/system/post/' + postId, + method: 'delete' + }) +} + +// 导出岗位 +export function exportPost(query) { + return request({ + url: '/system/post/export', + method: 'get', + params: query + }) +} diff --git a/yunze-ui/src/api/system/role.js b/yunze-ui/src/api/system/role.js new file mode 100644 index 0000000..397609c --- /dev/null +++ b/yunze-ui/src/api/system/role.js @@ -0,0 +1,75 @@ +import request from '@/utils/request' + +// 查询角色列表 +export function listRole(query) { + return request({ + url: '/system/role/list', + method: 'get', + params: query + }) +} + +// 查询角色详细 +export function getRole(roleId) { + return request({ + url: '/system/role/' + roleId, + method: 'get' + }) +} + +// 新增角色 +export function addRole(data) { + return request({ + url: '/system/role', + method: 'post', + data: data + }) +} + +// 修改角色 +export function updateRole(data) { + return request({ + url: '/system/role', + method: 'put', + data: data + }) +} + +// 角色数据权限 +export function dataScope(data) { + return request({ + url: '/system/role/dataScope', + method: 'put', + data: data + }) +} + +// 角色状态修改 +export function changeRoleStatus(roleId, status) { + const data = { + roleId, + status + } + return request({ + url: '/system/role/changeStatus', + method: 'put', + data: data + }) +} + +// 删除角色 +export function delRole(roleId) { + return request({ + url: '/system/role/' + roleId, + method: 'delete' + }) +} + +// 导出角色 +export function exportRole(query) { + return request({ + url: '/system/role/export', + method: 'get', + params: query + }) +} diff --git a/yunze-ui/src/api/system/user.js b/yunze-ui/src/api/system/user.js new file mode 100644 index 0000000..3b9a776 --- /dev/null +++ b/yunze-ui/src/api/system/user.js @@ -0,0 +1,127 @@ +import request from '@/utils/request' +import { praseStrEmpty } from "@/utils/ruoyi"; + +// 查询用户列表 +export function listUser(query) { + return request({ + url: '/system/user/list', + method: 'get', + params: query + }) +} + +// 查询用户详细 +export function getUser(userId) { + return request({ + url: '/system/user/' + praseStrEmpty(userId), + method: 'get' + }) +} + +// 新增用户 +export function addUser(data) { + return request({ + url: '/system/user', + method: 'post', + data: data + }) +} + +// 修改用户 +export function updateUser(data) { + return request({ + url: '/system/user', + method: 'put', + data: data + }) +} + +// 删除用户 +export function delUser(userId) { + return request({ + url: '/system/user/' + userId, + method: 'delete' + }) +} + +// 导出用户 +export function exportUser(query) { + return request({ + url: '/system/user/export', + method: 'get', + params: query + }) +} + +// 用户密码重置 +export function resetUserPwd(userId, password) { + const data = { + userId, + password + } + return request({ + url: '/system/user/resetPwd', + method: 'put', + data: data + }) +} + +// 用户状态修改 +export function changeUserStatus(userId, status) { + const data = { + userId, + status + } + return request({ + url: '/system/user/changeStatus', + method: 'put', + data: data + }) +} + +// 查询用户个人信息 +export function getUserProfile() { + return request({ + url: '/system/user/profile', + method: 'get' + }) +} + +// 修改用户个人信息 +export function updateUserProfile(data) { + return request({ + url: '/system/user/profile', + method: 'put', + data: data + }) +} + +// 用户密码重置 +export function updateUserPwd(oldPassword, newPassword) { + const data = { + oldPassword, + newPassword + } + return request({ + url: '/system/user/profile/updatePwd', + method: 'put', + params: data + }) +} + +// 用户头像上传 +export function uploadAvatar(data) { + return request({ + url: '/system/user/profile/avatar', + method: 'post', + data: data + }) +} + +// 下载用户导入模板 +export function importTemplate() { + return request({ + url: '/system/user/importTemplate', + method: 'get' + }) +} diff --git a/yunze-ui/src/api/tool/gen.js b/yunze-ui/src/api/tool/gen.js new file mode 100644 index 0000000..4506927 --- /dev/null +++ b/yunze-ui/src/api/tool/gen.js @@ -0,0 +1,76 @@ +import request from '@/utils/request' + +// 查询生成表数据 +export function listTable(query) { + return request({ + url: '/tool/gen/list', + method: 'get', + params: query + }) +} +// 查询db数据库列表 +export function listDbTable(query) { + return request({ + url: '/tool/gen/db/list', + method: 'get', + params: query + }) +} + +// 查询表详细信息 +export function getGenTable(tableId) { + return request({ + url: '/tool/gen/' + tableId, + method: 'get' + }) +} + +// 修改代码生成信息 +export function updateGenTable(data) { + return request({ + url: '/tool/gen', + method: 'put', + data: data + }) +} + +// 导入表 +export function importTable(data) { + return request({ + url: '/tool/gen/importTable', + method: 'post', + params: data + }) +} + +// 预览生成代码 +export function previewTable(tableId) { + return request({ + url: '/tool/gen/preview/' + tableId, + method: 'get' + }) +} + +// 删除表数据 +export function delTable(tableId) { + return request({ + url: '/tool/gen/' + tableId, + method: 'delete' + }) +} + +// 生成代码(自定义路径) +export function genCode(tableName) { + return request({ + url: '/tool/gen/genCode/' + tableName, + method: 'get' + }) +} + +// 同步数据库 +export function synchDb(tableName) { + return request({ + url: '/tool/gen/synchDb/' + tableName, + method: 'get' + }) +} diff --git a/yunze-ui/src/api/yunze/API/Channel.js b/yunze-ui/src/api/yunze/API/Channel.js new file mode 100644 index 0000000..c798ec9 --- /dev/null +++ b/yunze-ui/src/api/yunze/API/Channel.js @@ -0,0 +1,75 @@ +import request from '@/utils/request' + +// 查询API通道列表 +export function listCardRoute(query) { + return request({ + url: '/yunze/cardRoute/list', + method: 'post', + data: query + }) +} + +// 查询API通道详细 +export function getCardRoute(map) { + return request({ + url: '/yunze/cardRoute/find', + method: 'post', + data: map + }) +} + + +// 新增 API通道信息 +export function addCardRoute(map) { + return request({ + url: '/yunze/cardRoute/add' , + method: 'post', + data: map + }) +} + + + +// 编辑 API通道信息 +export function editCardRoute(data) { + return request({ + url: '/yunze/cardRoute/edit', + method: 'post', + data: data + }) +} + +// 编辑 API通道信息 +export function queryflowData(map) { + return request({ + url: '/yunze/cardRouteFlow/queryflow' , + method: 'post', + data: map + }) +} + +// 导出API通道信息 +export function exportcardRoute(map) { + return request({ + url: '/yunze/cardRoute/exportData', + method: 'post', + data: map + }) +} + + + + +// 删除 API通道信息 +export function delCardRoute(map) { + return request({ + url: '/yunze/cardRoute/delRoute', + method: 'post', + data: map + }) +} + + + + + diff --git a/yunze-ui/src/api/yunze/automation/cc.js b/yunze-ui/src/api/yunze/automation/cc.js new file mode 100644 index 0000000..bbc6d78 --- /dev/null +++ b/yunze-ui/src/api/yunze/automation/cc.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询API通道列表 +export function listCc(query) { + return request({ + url: '/yunze/cc/list', + method: 'post', + data: query + }) +} +export function AddCc(query) { + return request({ + url: '/yunze/cc/add', + method: 'post', + data: query + }) +} + +// 查询 +export function NameAdd(map) { + return request({ + url: '/yunze/cc/nameadd', + method: 'post', + data: map + }) +} +// 修改 +export function UpdateCc(query) { + return request({ + url: '/yunze/cc/ccupdate', + method: 'post', + data: query + }) +} + + + + + + + + + + diff --git a/yunze-ui/src/api/yunze/automation/cchis.js b/yunze-ui/src/api/yunze/automation/cchis.js new file mode 100644 index 0000000..7b73ab8 --- /dev/null +++ b/yunze-ui/src/api/yunze/automation/cchis.js @@ -0,0 +1,10 @@ +import request from '@/utils/request' + +// 查询API通道列表 +export function listCcHis(query) { + return request({ + url: '/yunze/cchis/list', + method: 'post', + data: query + }) +} diff --git a/yunze-ui/src/api/yunze/automation/ccurl.js b/yunze-ui/src/api/yunze/automation/ccurl.js new file mode 100644 index 0000000..f5c6155 --- /dev/null +++ b/yunze-ui/src/api/yunze/automation/ccurl.js @@ -0,0 +1,50 @@ +import request from '@/utils/request' + +// 查询API通道列表 +export function listCcUrl(query) { + return request({ + url: '/yunze/ccurl/list', + method: 'post', + data: query + }) +} + +export function AddCcUrl(query) { + return request({ + url: '/yunze/ccurl/add', + method: 'post', + data: query + }) +} + +export function UpdateCcUrl(query) { + return request({ + url: '/yunze/ccurl/update', + method: 'post', + data: query + }) +} + +export function deleteUrl(query) { + return request({ + url: '/yunze/ccurl/deleteurl', + method: 'post', + data: query + }) +} + + + + + + + + + + + + + + + + diff --git a/yunze-ui/src/api/yunze/flowcard/ExecutionTask.js b/yunze-ui/src/api/yunze/flowcard/ExecutionTask.js new file mode 100644 index 0000000..f6c177a --- /dev/null +++ b/yunze-ui/src/api/yunze/flowcard/ExecutionTask.js @@ -0,0 +1,10 @@ +import request from '@/utils/request' + +// 查询API通道列表 +export function listExecutionTask(query) { + return request({ + url: '/yunze/ExecutionTask/list', + method: 'post', + data: query + }) +} diff --git a/yunze-ui/src/api/yunze/flowcard/TariffGroup.js b/yunze-ui/src/api/yunze/flowcard/TariffGroup.js new file mode 100644 index 0000000..1135fe8 --- /dev/null +++ b/yunze-ui/src/api/yunze/flowcard/TariffGroup.js @@ -0,0 +1,42 @@ +import request from '@/utils/request' + +// 查询资费组列表 +export function listTariffGroup(query) { + return request({ + url: '/yunze/tariffGroup/list', + method: 'post', + data: query + }) +} + + +// 新增 资费组 +export function addtariffGroup(query) { + return request({ + url: '/yunze/tariffGroup/add', + method: 'post', + data: query + }) +} + + +// 详情 资费组 +export function findTariffGroup(query) { + return request({ + url: '/yunze/tariffGroup/find', + method: 'post', + data: query + }) +} + + +// 编辑 资费组 +export function editTariffGroup(query) { + return request({ + url: '/yunze/tariffGroup/edit', + method: 'post', + data: query + }) +} + + diff --git a/yunze-ui/src/api/yunze/flowcard/TariffPlan.js b/yunze-ui/src/api/yunze/flowcard/TariffPlan.js new file mode 100644 index 0000000..ae7c74f --- /dev/null +++ b/yunze-ui/src/api/yunze/flowcard/TariffPlan.js @@ -0,0 +1,33 @@ +import request from '@/utils/request' + + + +// 新增 资费计划 +export function AddtariffPlan(query) { + return request({ + url: '/yunze/tariffPlan/add', + method: 'post', + data: query + }) +} + + + + +// 详情 资费计划 +export function findTariffPlan(query) { + return request({ + url: '/yunze/tariffPlan/find', + method: 'post', + data: query + }) +} + +// 编辑 资费计划 +export function editTariffPlan(query) { + return request({ + url: '/yunze/tariffPlan/edit', + method: 'post', + data: query + }) +} diff --git a/yunze-ui/src/api/yunze/flowcard/agentTariffGroup.js b/yunze-ui/src/api/yunze/flowcard/agentTariffGroup.js new file mode 100644 index 0000000..76e43c1 --- /dev/null +++ b/yunze-ui/src/api/yunze/flowcard/agentTariffGroup.js @@ -0,0 +1,42 @@ +import request from '@/utils/request' + +// 查询资费组列表 +export function listagentTariffGroup(query) { + return request({ + url: '/yunze/agentTariffGroup/list', + method: 'post', + data: query + }) +} + + +// 新增 资费组 +export function addagentTariffGroup(query) { + return request({ + url: '/yunze/agentTariffGroup/add', + method: 'post', + data: query + }) +} + + +// 详情 资费组 +export function findagentTariffGroup(query) { + return request({ + url: '/yunze/agentTariffGroup/find', + method: 'post', + data: query + }) +} + + +// 编辑 资费组 +export function editagentTariffGroup(query) { + return request({ + url: '/yunze/agentTariffGroup/edit', + method: 'post', + data: query + }) +} + + diff --git a/yunze-ui/src/api/yunze/flowcard/agentTariffPlan.js b/yunze-ui/src/api/yunze/flowcard/agentTariffPlan.js new file mode 100644 index 0000000..caae0a0 --- /dev/null +++ b/yunze-ui/src/api/yunze/flowcard/agentTariffPlan.js @@ -0,0 +1,33 @@ +import request from '@/utils/request' + + + +// 新增 资费计划 +export function AddagentTariffPlan(query) { + return request({ + url: '/yunze/agentTariffPlan/add', + method: 'post', + data: query + }) +} + + + + +// 详情 资费计划 +export function findagentTariffPlan(query) { + return request({ + url: '/yunze/agentTariffPlan/find', + method: 'post', + data: query + }) +} + +// 编辑 资费计划 +export function editagentTariffPlan(query) { + return request({ + url: '/yunze/agentTariffPlan/edit', + method: 'post', + data: query + }) +} diff --git a/yunze-ui/src/api/yunze/flowcard/card/card.js b/yunze-ui/src/api/yunze/flowcard/card/card.js new file mode 100644 index 0000000..cfb5ab3 --- /dev/null +++ b/yunze-ui/src/api/yunze/flowcard/card/card.js @@ -0,0 +1,294 @@ +import request from '@/utils/request' + +// 查询连接管理 +export function listCard(query) { + return request({ + url: '/yunze/card/list', + method: 'post', + data: query + }) +} + +// 查询卡板详细 +export function getCard(map) { + return request({ + url: '/yunze/card/find', + method: 'post', + data: map + }) +} + + +// 查询当前套餐简要信息 +export function queryflowSimple(map) { + return request({ + url: '/yunze/cardFlow/queryflowSimple' , + method: 'post', + data: map + }) +} + + +// 查询在线信息 +export function queryOnlineStatus(map) { + return request({ + url: '/yunze/card/queryOnlineStatus' , + method: 'post', + data: map + }) +} + + + +// 获取资费组名称 +export function queryPackageSimple() { + return request({ + url: '/yunze/cardFlow/queryPackageSimple', + method: 'post' + }) +} + + + +// 获取公司名称 +export function getDeptName(data) { + return request({ + url: '/yunze/card/getDeptName', + method: 'post', + data: data + }) +} + +// 获取套餐信息 +export function queryflowData(map) { + return request({ + url: '/yunze/cardFlow/queryflow' , + method: 'post', + data: map + }) +} + +// 导出卡板信息 +export function exportCard(map) { + return request({ + url: '/yunze/card/exportData', + method: 'post', + data: map + }) +} + +// 查询 集团下所属人员 +export function findDeptUser(map) { + return request({ + url: '/yunze/card/findDeptUser', + method: 'post', + data: map + }) +} + +export function DivideCard(map) { + return request({ + url: '/yunze/card/divide', + method: 'post', + data: map + }) +} + + + +// 查询简要 通道信息 +export function findSp(map) { + return request({ + url: '/yunze/cardRoute/findSp', + method: 'post', + data: map + }) +} + + +// 查询 通道简要信息 状态为 正常 划分通道用 +export function findCr(map) { + return request({ + url: '/yunze/cardRoute/findCr', + method: 'post', + data: map + }) +} + + + +// 下载卡板导入模板 +export function importTemplate() { + return request({ + url: '/yunze/card/importTemplate', + method: 'get' + }) +} + + + +// 查询卡板详细 +export function SynCarStatus(map) { + return request({ + url: '/yunze/card/SynStatus', + method: 'post', + data: map + }) +} + + +// 查询卡板详细 +export function SynCarFlow(map) { + return request({ + url: '/yunze/card/SynFlow', + method: 'post', + data: map + }) +} + + +// 机卡解绑 +export function CarUntie(map) { + return request({ + url: '/yunze/card/CardBinding', + method: 'post', + data: map + }) +} + +// 获取 所属代理下 卡分组 +export function getCardGrouping(map) { + return request({ + url: '/yunze/card/getCardGrouping', + method: 'post', + data: map + }) +} + +// 修改 备注 分组 +export function UpdateFill(map) { + return request({ + url: '/yunze/card/updatefill', + method: 'post', + data: map + }) +} + +// 同步 激活时间 +export function SynCardActivateDate(map) { + return request({ + url: '/yunze/card/SynActivateDate', + method: 'post', + data: map + }) +} + +// 批量 【停机】 +export function StoppedArr(map) { + return request({ + url: '/yunze/card/stopped', + method: 'post', + data: map + }) +} +// 批量 【复机】 +export function MachineArr(map) { + return request({ + url: '/yunze/card/machine', + method: 'post', + data: map + }) +} +// 批量 【断网】 +export function DisconnectNetworkArr(map) { + return request({ + url: '/yunze/card/disconnectNetwork', + method: 'post', + data: map + }) +} +// 批量 【开网】 +export function OpenNetworkArr(map) { + return request({ + url: '/yunze/card/openNetwork', + method: 'post', + data: map + }) +} +// 批量 【同步用量】 +export function ConsumptionArr(map) { + return request({ + url: '/yunze/card/consumption', + method: 'post', + data: map + }) +} +// 批量 【同步状态】 +export function PublicMethodArr(map) { + return request({ + url: '/yunze/card/publicmethod', + method: 'post', + data: map + }) +} +// 批量 【同步状态和用量】 +export function ConsumptionAndStateArr(map) { + return request({ + url: '/yunze/card/consumptionandstate', + method: 'post', + data: map + }) +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/yunze-ui/src/api/yunze/flowcard/card/change.js b/yunze-ui/src/api/yunze/flowcard/card/change.js new file mode 100644 index 0000000..d9b9ba2 --- /dev/null +++ b/yunze-ui/src/api/yunze/flowcard/card/change.js @@ -0,0 +1,17 @@ +import request from '@/utils/request' + +// 查询API通道列表 +export function listChange(query) { + return request({ + url: '/yunze/change/list', + method: 'post', + data: query + }) +} +export function getselTime(query) { + return request({ + url: 'yunze/change/info', + method: 'post', + data: query + }) +} diff --git a/yunze-ui/src/api/yunze/flowcard/card/flow.js b/yunze-ui/src/api/yunze/flowcard/card/flow.js new file mode 100644 index 0000000..ff878c7 --- /dev/null +++ b/yunze-ui/src/api/yunze/flowcard/card/flow.js @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 查询API通道列表 +export function listflow(query) { + return request({ + url: '/yunze/cardFlow/list', + method: 'post', + data: query + }) +} +// 订购资费导出 +export function exportFlow(query) { + return request({ + url: '/yunze/cardFlow/exportflow', + method: 'post', + data: query + }) +} +// 订购资费导出 +export function ExportCardFlow(map) { + return request({ + url: '/yunze/cardFlow/exportflow', + method: 'post', + data: map + }) +} diff --git a/yunze-ui/src/api/yunze/flowcard/card/flowhis.js b/yunze-ui/src/api/yunze/flowcard/card/flowhis.js new file mode 100644 index 0000000..0701bcf --- /dev/null +++ b/yunze-ui/src/api/yunze/flowcard/card/flowhis.js @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 查询API通道列表 +export function listSysLog(query) { + return request({ + url: '/yunze/flowhis/list', + method: 'post', + data: query + }) +} +export function listgetbyid(query) { + return request({ + url: '/yunze/flowhis/find', + method: 'post', + data: query + }) +} + +// 用量详情导出 (同步导出 分组 、备注、发货时间) +export function ExportCardFlowHis(map) { + return request({ + url: '/yunze/flowhis/exportflowhis', + method: 'post', + data: map + }) +} diff --git a/yunze-ui/src/api/yunze/flowcard/rechargeTariff.js b/yunze-ui/src/api/yunze/flowcard/rechargeTariff.js new file mode 100644 index 0000000..7876002 --- /dev/null +++ b/yunze-ui/src/api/yunze/flowcard/rechargeTariff.js @@ -0,0 +1,19 @@ +import request from '@/utils/request' + + + + +// 查询单条 资费计划 简要 +export function FindPacket(query) { + return request({ + url: '/yunze/cardFlow/FindPacket', + method: 'post', + data: query + }) +} + + + + + + diff --git a/yunze-ui/src/api/yunze/order/order.js b/yunze-ui/src/api/yunze/order/order.js new file mode 100644 index 0000000..b89eeb9 --- /dev/null +++ b/yunze-ui/src/api/yunze/order/order.js @@ -0,0 +1,71 @@ +import request from '@/utils/request' + +// 查询 +export function listOrder(query) { + return request({ + url: '/yunze/order/list', + method: 'post', + data: query + }) +} + + +// 查询 资费计划 信息 +export function queryPacketSimple(query) { + return request({ + url: '/yunze/order/queryPacketSimple', + method: 'post', + data: query + }) +} + +// 查询 订单详情 +export function findOrder(query) { + return request({ + url: '/yunze/order/findOrder', + method: 'post', + data: query + }) +} + + +// 获取商品 名称 +export function findName(query) { + return request({ + url: '/yunze/productInfo/findName', + method: 'post', + data: query + }) +} + + +// 查询发货订单 +export function findWxOrder(query) { + return request({ + url: '/yunze/WxByOrder/findWxOrder', + method: 'post', + data: query + }) +} + +// 全部导出 +export function Exportallorders(map) { + return request({ + url: '/yunze/order/outOrder', + method: 'post', + data: map + }) +} + +// 购物订单导出 +export function Shoppingexport(query) { + return request({ + url: '/yunze/WxByOrder/shoppingexport', + method: 'post', + data: query + }) +} + + + + diff --git a/yunze-ui/src/api/yunze/passageway/polling.js b/yunze-ui/src/api/yunze/passageway/polling.js new file mode 100644 index 0000000..a9bbdfb --- /dev/null +++ b/yunze-ui/src/api/yunze/passageway/polling.js @@ -0,0 +1,10 @@ +import request from '@/utils/request' + +// 查询API通道列表 +export function listSysLog(query) { + return request({ + url: '/yunze/polling/list', + method: 'post', + data: query + }) +} diff --git a/yunze-ui/src/api/yunze/system/sysLog.js b/yunze-ui/src/api/yunze/system/sysLog.js new file mode 100644 index 0000000..ea3a032 --- /dev/null +++ b/yunze-ui/src/api/yunze/system/sysLog.js @@ -0,0 +1,17 @@ +import request from '@/utils/request' + +// 查询API通道列表 +export function listSysLog(query) { + return request({ + url: '/yunze/sysLog/list', + method: 'post', + data: query + }) +} +export function getByIds(query) { + return request({ + url: 'yunze/sysLog/findSys', + method: 'post', + data: query + }) +} diff --git a/yunze-ui/src/api/yunze/user/agent.js b/yunze-ui/src/api/yunze/user/agent.js new file mode 100644 index 0000000..c39d5e0 --- /dev/null +++ b/yunze-ui/src/api/yunze/user/agent.js @@ -0,0 +1,181 @@ +import request from '@/utils/request' +import { praseStrEmpty } from "@/utils/ruoyi"; + + +// 新增 资费计划 +export function AddtariffPlan(query) { + return request({ + url: '/yunze/tariffPlan/add', + method: 'post', + data: query + }) +} + + + +// 划分资费组查询 简要 +export function findPackage(query) { + return request({ + url: '/yunze/tariffGroup/findPackage', + method: 'post', + data: query + }) +} + + + + +// 划分资费计划查询 简要 +export function findPacket(query) { + return request({ + url: '/yunze/tariffPlan/findPacket', + method: 'post', + data: query + }) +} + + +// 平台资费组 划分 +export function tariffDivision(query) { + return request({ + url: '/yunze/tariffGroup/tariffDivision', + method: 'post', + data: query + }) +} + + +// 集团 资费组 划分 +export function agentTariffDivision(query) { + return request({ + url: '/yunze/tariffGroup/agentTariffDivision', + method: 'post', + data: query + }) +} + + +// 查询用户列表 +export function listUser(query) { + return request({ + url: '/yunze/agent/list', + method: 'post', + data: query + }) +} + +// 查询用户详细 +export function getUser(userId) { + return request({ + url: '/yunze/agent/' + praseStrEmpty(userId), + method: 'get' + }) +} + +// 新增用户 +export function addUser(data) { + return request({ + url: '/yunze/agent', + method: 'post', + data: data + }) +} + +// 修改用户 +export function updateUser(data) { + return request({ + url: '/yunze/agent', + method: 'put', + data: data + }) +} + +// 删除用户 +export function delUser(userId) { + return request({ + url: '/yunze/agent/' + userId, + method: 'delete' + }) +} + +// 导出用户 +export function exportUser(query) { + return request({ + url: '/yunze/agent/export', + method: 'get', + params: query + }) +} + +// 用户密码重置 +export function resetUserPwd(userId, password) { + const data = { + userId, + password + } + return request({ + url: '/yunze/agent/resetPwd', + method: 'put', + data: data + }) +} + +// 用户状态修改 +export function changeUserStatus(userId, status) { + const data = { + userId, + status + } + return request({ + url: '/yunze/agent/changeStatus', + method: 'put', + data: data + }) +} + +// 查询用户个人信息 +export function getUserProfile() { + return request({ + url: '/yunze/agent/profile', + method: 'get' + }) +} + +// 修改用户个人信息 +export function updateUserProfile(data) { + return request({ + url: '/yunze/agent/profile', + method: 'put', + data: data + }) +} + +// 用户密码重置 +export function updateUserPwd(oldPassword, newPassword) { + const data = { + oldPassword, + newPassword + } + return request({ + url: '/yunze/agent/profile/updatePwd', + method: 'put', + params: data + }) +} + +// 用户头像上传 +export function uploadAvatar(data) { + return request({ + url: '/yunze/agent/profile/avatar', + method: 'post', + data: data + }) +} + +// 下载用户导入模板 +export function importTemplate() { + return request({ + url: '/yunze/agent/importTemplate', + method: 'get' + }) +} diff --git a/yunze-ui/src/assets/401_images/401.gif b/yunze-ui/src/assets/401_images/401.gif new file mode 100644 index 0000000..cd6e0d9 Binary files /dev/null and b/yunze-ui/src/assets/401_images/401.gif differ diff --git a/yunze-ui/src/assets/404_images/404.png b/yunze-ui/src/assets/404_images/404.png new file mode 100644 index 0000000..3d8e230 Binary files /dev/null and b/yunze-ui/src/assets/404_images/404.png differ diff --git a/yunze-ui/src/assets/404_images/404_cloud.png b/yunze-ui/src/assets/404_images/404_cloud.png new file mode 100644 index 0000000..c6281d0 Binary files /dev/null and b/yunze-ui/src/assets/404_images/404_cloud.png differ diff --git a/yunze-ui/src/assets/icons/index.js b/yunze-ui/src/assets/icons/index.js new file mode 100644 index 0000000..2c6b309 --- /dev/null +++ b/yunze-ui/src/assets/icons/index.js @@ -0,0 +1,9 @@ +import Vue from 'vue' +import SvgIcon from '@/components/SvgIcon'// svg component + +// register globally +Vue.component('svg-icon', SvgIcon) + +const req = require.context('./svg', false, /\.svg$/) +const requireAll = requireContext => requireContext.keys().map(requireContext) +requireAll(req) diff --git a/yunze-ui/src/assets/icons/svg/404.svg b/yunze-ui/src/assets/icons/svg/404.svg new file mode 100644 index 0000000..6df5019 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/404.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/bug.svg b/yunze-ui/src/assets/icons/svg/bug.svg new file mode 100644 index 0000000..05a150d --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/bug.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/build.svg b/yunze-ui/src/assets/icons/svg/build.svg new file mode 100644 index 0000000..97c4688 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/build.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/button.svg b/yunze-ui/src/assets/icons/svg/button.svg new file mode 100644 index 0000000..904fddc --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/button.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/cascader.svg b/yunze-ui/src/assets/icons/svg/cascader.svg new file mode 100644 index 0000000..e256024 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/cascader.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/chart.svg b/yunze-ui/src/assets/icons/svg/chart.svg new file mode 100644 index 0000000..27728fb --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/chart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/checkbox.svg b/yunze-ui/src/assets/icons/svg/checkbox.svg new file mode 100644 index 0000000..013fd3a --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/checkbox.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/clipboard.svg b/yunze-ui/src/assets/icons/svg/clipboard.svg new file mode 100644 index 0000000..90923ff --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/clipboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/code.svg b/yunze-ui/src/assets/icons/svg/code.svg new file mode 100644 index 0000000..ed4d23c --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/code.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/color.svg b/yunze-ui/src/assets/icons/svg/color.svg new file mode 100644 index 0000000..44a81aa --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/color.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/component.svg b/yunze-ui/src/assets/icons/svg/component.svg new file mode 100644 index 0000000..29c3458 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/component.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/dashboard.svg b/yunze-ui/src/assets/icons/svg/dashboard.svg new file mode 100644 index 0000000..5317d37 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/dashboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/date-range.svg b/yunze-ui/src/assets/icons/svg/date-range.svg new file mode 100644 index 0000000..fda571e --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/date-range.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/date.svg b/yunze-ui/src/assets/icons/svg/date.svg new file mode 100644 index 0000000..52dc73e --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/date.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/dict.svg b/yunze-ui/src/assets/icons/svg/dict.svg new file mode 100644 index 0000000..4849377 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/dict.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/documentation.svg b/yunze-ui/src/assets/icons/svg/documentation.svg new file mode 100644 index 0000000..7043122 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/documentation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/download.svg b/yunze-ui/src/assets/icons/svg/download.svg new file mode 100644 index 0000000..c896951 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/drag.svg b/yunze-ui/src/assets/icons/svg/drag.svg new file mode 100644 index 0000000..4185d3c --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/drag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/druid.svg b/yunze-ui/src/assets/icons/svg/druid.svg new file mode 100644 index 0000000..a2b4b4e --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/druid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/edit.svg b/yunze-ui/src/assets/icons/svg/edit.svg new file mode 100644 index 0000000..d26101f --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/education.svg b/yunze-ui/src/assets/icons/svg/education.svg new file mode 100644 index 0000000..7bfb01d --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/education.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/email.svg b/yunze-ui/src/assets/icons/svg/email.svg new file mode 100644 index 0000000..74d25e2 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/email.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/example.svg b/yunze-ui/src/assets/icons/svg/example.svg new file mode 100644 index 0000000..46f42b5 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/example.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/excel.svg b/yunze-ui/src/assets/icons/svg/excel.svg new file mode 100644 index 0000000..74d97b8 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/excel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/exit-fullscreen.svg b/yunze-ui/src/assets/icons/svg/exit-fullscreen.svg new file mode 100644 index 0000000..485c128 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/exit-fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/eye-open.svg b/yunze-ui/src/assets/icons/svg/eye-open.svg new file mode 100644 index 0000000..88dcc98 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/eye-open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/eye.svg b/yunze-ui/src/assets/icons/svg/eye.svg new file mode 100644 index 0000000..16ed2d8 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/form.svg b/yunze-ui/src/assets/icons/svg/form.svg new file mode 100644 index 0000000..dcbaa18 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/form.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/fullscreen.svg b/yunze-ui/src/assets/icons/svg/fullscreen.svg new file mode 100644 index 0000000..0e86b6f --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/github.svg b/yunze-ui/src/assets/icons/svg/github.svg new file mode 100644 index 0000000..db0a0d4 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/guide.svg b/yunze-ui/src/assets/icons/svg/guide.svg new file mode 100644 index 0000000..b271001 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/guide.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/icon.svg b/yunze-ui/src/assets/icons/svg/icon.svg new file mode 100644 index 0000000..82be8ee --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/input.svg b/yunze-ui/src/assets/icons/svg/input.svg new file mode 100644 index 0000000..ab91381 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/input.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/international.svg b/yunze-ui/src/assets/icons/svg/international.svg new file mode 100644 index 0000000..e9b56ee --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/international.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/job.svg b/yunze-ui/src/assets/icons/svg/job.svg new file mode 100644 index 0000000..2a93a25 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/job.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/language.svg b/yunze-ui/src/assets/icons/svg/language.svg new file mode 100644 index 0000000..0082b57 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/language.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/link.svg b/yunze-ui/src/assets/icons/svg/link.svg new file mode 100644 index 0000000..48197ba --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/list.svg b/yunze-ui/src/assets/icons/svg/list.svg new file mode 100644 index 0000000..20259ed --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/list.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/lock.svg b/yunze-ui/src/assets/icons/svg/lock.svg new file mode 100644 index 0000000..74fee54 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/log.svg b/yunze-ui/src/assets/icons/svg/log.svg new file mode 100644 index 0000000..d879d33 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/log.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/logininfor.svg b/yunze-ui/src/assets/icons/svg/logininfor.svg new file mode 100644 index 0000000..267f844 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/logininfor.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/message.svg b/yunze-ui/src/assets/icons/svg/message.svg new file mode 100644 index 0000000..14ca817 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/message.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/money.svg b/yunze-ui/src/assets/icons/svg/money.svg new file mode 100644 index 0000000..c1580de --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/money.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/monitor.svg b/yunze-ui/src/assets/icons/svg/monitor.svg new file mode 100644 index 0000000..bc308cb --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/monitor.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/nested.svg b/yunze-ui/src/assets/icons/svg/nested.svg new file mode 100644 index 0000000..06713a8 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/nested.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/number.svg b/yunze-ui/src/assets/icons/svg/number.svg new file mode 100644 index 0000000..ad5ce9a --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/number.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/online.svg b/yunze-ui/src/assets/icons/svg/online.svg new file mode 100644 index 0000000..330a202 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/online.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/password.svg b/yunze-ui/src/assets/icons/svg/password.svg new file mode 100644 index 0000000..6c64def --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/password.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/pdf.svg b/yunze-ui/src/assets/icons/svg/pdf.svg new file mode 100644 index 0000000..957aa0c --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/pdf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/people.svg b/yunze-ui/src/assets/icons/svg/people.svg new file mode 100644 index 0000000..2bd54ae --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/people.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/peoples.svg b/yunze-ui/src/assets/icons/svg/peoples.svg new file mode 100644 index 0000000..aab852e --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/peoples.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/phone.svg b/yunze-ui/src/assets/icons/svg/phone.svg new file mode 100644 index 0000000..ab8e8c4 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/phone.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/post.svg b/yunze-ui/src/assets/icons/svg/post.svg new file mode 100644 index 0000000..2922c61 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/post.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/qq.svg b/yunze-ui/src/assets/icons/svg/qq.svg new file mode 100644 index 0000000..ee13d4e --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/qq.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/question.svg b/yunze-ui/src/assets/icons/svg/question.svg new file mode 100644 index 0000000..cf75bd4 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/question.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/radio.svg b/yunze-ui/src/assets/icons/svg/radio.svg new file mode 100644 index 0000000..0cde345 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/radio.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/rate.svg b/yunze-ui/src/assets/icons/svg/rate.svg new file mode 100644 index 0000000..aa3b14d --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/rate.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/redis.svg b/yunze-ui/src/assets/icons/svg/redis.svg new file mode 100644 index 0000000..2f1d62d --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/redis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/row.svg b/yunze-ui/src/assets/icons/svg/row.svg new file mode 100644 index 0000000..0780992 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/row.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/search.svg b/yunze-ui/src/assets/icons/svg/search.svg new file mode 100644 index 0000000..84233dd --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/select.svg b/yunze-ui/src/assets/icons/svg/select.svg new file mode 100644 index 0000000..d628382 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/select.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/server.svg b/yunze-ui/src/assets/icons/svg/server.svg new file mode 100644 index 0000000..ca37b00 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/server.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/shopping.svg b/yunze-ui/src/assets/icons/svg/shopping.svg new file mode 100644 index 0000000..87513e7 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/shopping.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/size.svg b/yunze-ui/src/assets/icons/svg/size.svg new file mode 100644 index 0000000..ddb25b8 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/size.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/skill.svg b/yunze-ui/src/assets/icons/svg/skill.svg new file mode 100644 index 0000000..a3b7312 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/skill.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/slider.svg b/yunze-ui/src/assets/icons/svg/slider.svg new file mode 100644 index 0000000..fbe4f39 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/slider.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/star.svg b/yunze-ui/src/assets/icons/svg/star.svg new file mode 100644 index 0000000..6cf86e6 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/star.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/swagger.svg b/yunze-ui/src/assets/icons/svg/swagger.svg new file mode 100644 index 0000000..05d4e7b --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/swagger.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/switch.svg b/yunze-ui/src/assets/icons/svg/switch.svg new file mode 100644 index 0000000..0ba61e3 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/switch.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/system.svg b/yunze-ui/src/assets/icons/svg/system.svg new file mode 100644 index 0000000..dba28cf --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/system.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/tab.svg b/yunze-ui/src/assets/icons/svg/tab.svg new file mode 100644 index 0000000..b4b48e4 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/tab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/table.svg b/yunze-ui/src/assets/icons/svg/table.svg new file mode 100644 index 0000000..0e3dc9d --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/textarea.svg b/yunze-ui/src/assets/icons/svg/textarea.svg new file mode 100644 index 0000000..2709f29 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/textarea.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/theme.svg b/yunze-ui/src/assets/icons/svg/theme.svg new file mode 100644 index 0000000..5982a2f --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/theme.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/time-range.svg b/yunze-ui/src/assets/icons/svg/time-range.svg new file mode 100644 index 0000000..13c1202 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/time-range.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/time.svg b/yunze-ui/src/assets/icons/svg/time.svg new file mode 100644 index 0000000..b376e32 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/time.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/tool.svg b/yunze-ui/src/assets/icons/svg/tool.svg new file mode 100644 index 0000000..c813067 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/tool.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/tree-table.svg b/yunze-ui/src/assets/icons/svg/tree-table.svg new file mode 100644 index 0000000..8aafdb8 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/tree-table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/tree.svg b/yunze-ui/src/assets/icons/svg/tree.svg new file mode 100644 index 0000000..dd4b7dd --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/upload.svg b/yunze-ui/src/assets/icons/svg/upload.svg new file mode 100644 index 0000000..bae49c0 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/user.svg b/yunze-ui/src/assets/icons/svg/user.svg new file mode 100644 index 0000000..0ba0716 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/validCode.svg b/yunze-ui/src/assets/icons/svg/validCode.svg new file mode 100644 index 0000000..cfb1021 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/validCode.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/wechat.svg b/yunze-ui/src/assets/icons/svg/wechat.svg new file mode 100644 index 0000000..c586e55 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/wechat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svg/zip.svg b/yunze-ui/src/assets/icons/svg/zip.svg new file mode 100644 index 0000000..f806fc4 --- /dev/null +++ b/yunze-ui/src/assets/icons/svg/zip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yunze-ui/src/assets/icons/svgo.yml b/yunze-ui/src/assets/icons/svgo.yml new file mode 100644 index 0000000..d11906a --- /dev/null +++ b/yunze-ui/src/assets/icons/svgo.yml @@ -0,0 +1,22 @@ +# replace default config + +# multipass: true +# full: true + +plugins: + + # - name + # + # or: + # - name: false + # - name: true + # + # or: + # - name: + # param1: 1 + # param2: 2 + +- removeAttrs: + attrs: + - 'fill' + - 'fill-rule' diff --git a/yunze-ui/src/assets/images/dark.svg b/yunze-ui/src/assets/images/dark.svg new file mode 100644 index 0000000..f646bd7 --- /dev/null +++ b/yunze-ui/src/assets/images/dark.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-ui/src/assets/images/light.svg b/yunze-ui/src/assets/images/light.svg new file mode 100644 index 0000000..ab7cc08 --- /dev/null +++ b/yunze-ui/src/assets/images/light.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yunze-ui/src/assets/images/login-background.jpg b/yunze-ui/src/assets/images/login-background.jpg new file mode 100644 index 0000000..82c22d3 Binary files /dev/null and b/yunze-ui/src/assets/images/login-background.jpg differ diff --git a/yunze-ui/src/assets/images/profile.jpg b/yunze-ui/src/assets/images/profile.jpg new file mode 100644 index 0000000..b3a940b Binary files /dev/null and b/yunze-ui/src/assets/images/profile.jpg differ diff --git a/yunze-ui/src/assets/logo/logo.png b/yunze-ui/src/assets/logo/logo.png new file mode 100644 index 0000000..6542ed0 Binary files /dev/null and b/yunze-ui/src/assets/logo/logo.png differ diff --git a/yunze-ui/src/assets/styles/btn.scss b/yunze-ui/src/assets/styles/btn.scss new file mode 100644 index 0000000..e6ba1a8 --- /dev/null +++ b/yunze-ui/src/assets/styles/btn.scss @@ -0,0 +1,99 @@ +@import './variables.scss'; + +@mixin colorBtn($color) { + background: $color; + + &:hover { + color: $color; + + &:before, + &:after { + background: $color; + } + } +} + +.blue-btn { + @include colorBtn($blue) +} + +.light-blue-btn { + @include colorBtn($light-blue) +} + +.red-btn { + @include colorBtn($red) +} + +.pink-btn { + @include colorBtn($pink) +} + +.green-btn { + @include colorBtn($green) +} + +.tiffany-btn { + @include colorBtn($tiffany) +} + +.yellow-btn { + @include colorBtn($yellow) +} + +.pan-btn { + font-size: 14px; + color: #fff; + padding: 14px 36px; + border-radius: 8px; + border: none; + outline: none; + transition: 600ms ease all; + position: relative; + display: inline-block; + + &:hover { + background: #fff; + + &:before, + &:after { + width: 100%; + transition: 600ms ease all; + } + } + + &:before, + &:after { + content: ''; + position: absolute; + top: 0; + right: 0; + height: 2px; + width: 0; + transition: 400ms ease all; + } + + &::after { + right: inherit; + top: inherit; + left: 0; + bottom: 0; + } +} + +.custom-button { + display: inline-block; + line-height: 1; + white-space: nowrap; + cursor: pointer; + background: #fff; + color: #fff; + -webkit-appearance: none; + text-align: center; + box-sizing: border-box; + outline: 0; + margin: 0; + padding: 10px 15px; + font-size: 14px; + border-radius: 4px; +} diff --git a/yunze-ui/src/assets/styles/element-ui.scss b/yunze-ui/src/assets/styles/element-ui.scss new file mode 100644 index 0000000..363092a --- /dev/null +++ b/yunze-ui/src/assets/styles/element-ui.scss @@ -0,0 +1,92 @@ +// cover some element-ui styles + +.el-breadcrumb__inner, +.el-breadcrumb__inner a { + font-weight: 400 !important; +} + +.el-upload { + input[type="file"] { + display: none !important; + } +} + +.el-upload__input { + display: none; +} + +.cell { + .el-tag { + margin-right: 0px; + } +} + +.small-padding { + .cell { + padding-left: 5px; + padding-right: 5px; + } +} + +.fixed-width { + .el-button--mini { + padding: 7px 10px; + width: 60px; + } +} + +.status-col { + .cell { + padding: 0 10px; + text-align: center; + + .el-tag { + margin-right: 0px; + } + } +} + +// to fixed https://github.com/ElemeFE/element/issues/2461 +.el-dialog { + transform: none; + left: 0; + position: relative; + margin: 0 auto; +} + +// refine element ui upload +.upload-container { + .el-upload { + width: 100%; + + .el-upload-dragger { + width: 100%; + height: 200px; + } + } +} + +// dropdown +.el-dropdown-menu { + a { + display: block + } +} + +// fix date-picker ui bug in filter-item +.el-range-editor.el-input__inner { + display: inline-flex !important; +} + +// to fix el-date-picker css style +.el-range-separator { + box-sizing: content-box; +} + +.el-menu--collapse + > div + > .el-submenu + > .el-submenu__title + .el-submenu__icon-arrow { + display: none; +} \ No newline at end of file diff --git a/yunze-ui/src/assets/styles/element-variables.scss b/yunze-ui/src/assets/styles/element-variables.scss new file mode 100644 index 0000000..8b7a48e --- /dev/null +++ b/yunze-ui/src/assets/styles/element-variables.scss @@ -0,0 +1,31 @@ +/** +* I think element-ui's default theme color is too light for long-term use. +* So I modified the default color and you can modify it to your liking. +**/ + +/* theme color */ +$--color-primary: #1890ff; +$--color-success: #13ce66; +$--color-warning: #ffba00; +$--color-danger: #ff4949; +// $--color-info: #1E1E1E; + +$--button-font-weight: 400; + +// $--color-text-regular: #1f2d3d; + +$--border-color-light: #dfe4ed; +$--border-color-lighter: #e6ebf5; + +$--table-border:1px solid#dfe6ec; + +/* icon font path, required */ +$--font-path: '~element-ui/lib/theme-chalk/fonts'; + +@import "~element-ui/packages/theme-chalk/src/index"; + +// the :export directive is the magic sauce for webpack +// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass +:export { + theme: $--color-primary; +} diff --git a/yunze-ui/src/assets/styles/index.scss b/yunze-ui/src/assets/styles/index.scss new file mode 100644 index 0000000..96095ef --- /dev/null +++ b/yunze-ui/src/assets/styles/index.scss @@ -0,0 +1,191 @@ +@import './variables.scss'; +@import './mixin.scss'; +@import './transition.scss'; +@import './element-ui.scss'; +@import './sidebar.scss'; +@import './btn.scss'; + +body { + height: 100%; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; +} + +label { + font-weight: 700; +} + +html { + height: 100%; + box-sizing: border-box; +} + +#app { + height: 100%; +} + +*, +*:before, +*:after { + box-sizing: inherit; +} + +.no-padding { + padding: 0px !important; +} + +.padding-content { + padding: 4px 0; +} + +a:focus, +a:active { + outline: none; +} + +a, +a:focus, +a:hover { + cursor: pointer; + color: inherit; + text-decoration: none; +} + +div:focus { + outline: none; +} + +.fr { + float: right; +} + +.fl { + float: left; +} + +.pr-5 { + padding-right: 5px; +} + +.pl-5 { + padding-left: 5px; +} + +.block { + display: block; +} + +.pointer { + cursor: pointer; +} + +.inlineBlock { + display: block; +} + +.clearfix { + &:after { + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; + } +} + +aside { + background: #eef1f6; + padding: 8px 24px; + margin-bottom: 20px; + border-radius: 2px; + display: block; + line-height: 32px; + font-size: 16px; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; + color: #2c3e50; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + a { + color: #337ab7; + cursor: pointer; + + &:hover { + color: rgb(32, 160, 255); + } + } +} + +//main-container全局样式 +.app-container { + padding: 20px; +} + +.components-container { + margin: 30px 50px; + position: relative; +} + +.pagination-container { + margin-top: 30px; +} + +.text-center { + text-align: center +} + +.sub-navbar { + height: 50px; + line-height: 50px; + position: relative; + width: 100%; + text-align: right; + padding-right: 20px; + transition: 600ms ease position; + background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%); + + .subtitle { + font-size: 20px; + color: #fff; + } + + &.draft { + background: #d0d0d0; + } + + &.deleted { + background: #d0d0d0; + } +} + +.link-type, +.link-type:focus { + color: #337ab7; + cursor: pointer; + + &:hover { + color: rgb(32, 160, 255); + } +} + +.filter-container { + padding-bottom: 10px; + + .filter-item { + display: inline-block; + vertical-align: middle; + margin-bottom: 10px; + } +} + +//refine vue-multiselect plugin +.multiselect { + line-height: 16px; +} + +.multiselect--active { + z-index: 1000 !important; +} diff --git a/yunze-ui/src/assets/styles/mixin.scss b/yunze-ui/src/assets/styles/mixin.scss new file mode 100644 index 0000000..06fa061 --- /dev/null +++ b/yunze-ui/src/assets/styles/mixin.scss @@ -0,0 +1,66 @@ +@mixin clearfix { + &:after { + content: ""; + display: table; + clear: both; + } +} + +@mixin scrollBar { + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } +} + +@mixin relative { + position: relative; + width: 100%; + height: 100%; +} + +@mixin pct($pct) { + width: #{$pct}; + position: relative; + margin: 0 auto; +} + +@mixin triangle($width, $height, $color, $direction) { + $width: $width/2; + $color-border-style: $height solid $color; + $transparent-border-style: $width solid transparent; + height: 0; + width: 0; + + @if $direction==up { + border-bottom: $color-border-style; + border-left: $transparent-border-style; + border-right: $transparent-border-style; + } + + @else if $direction==right { + border-left: $color-border-style; + border-top: $transparent-border-style; + border-bottom: $transparent-border-style; + } + + @else if $direction==down { + border-top: $color-border-style; + border-left: $transparent-border-style; + border-right: $transparent-border-style; + } + + @else if $direction==left { + border-right: $color-border-style; + border-top: $transparent-border-style; + border-bottom: $transparent-border-style; + } +} diff --git a/yunze-ui/src/assets/styles/ruoyi.scss b/yunze-ui/src/assets/styles/ruoyi.scss new file mode 100644 index 0000000..355bf1f --- /dev/null +++ b/yunze-ui/src/assets/styles/ruoyi.scss @@ -0,0 +1,239 @@ + /** + * 通用css样式布局处理 + * Copyright (c) 2019 yunze + */ + + /** 基础通用 **/ +.pt5 { + padding-top: 5px; +} +.pr5 { + padding-right: 5px; +} +.pb5 { + padding-bottom: 5px; +} +.mt5 { + margin-top: 5px; +} +.mr5 { + margin-right: 5px; +} +.mb5 { + margin-bottom: 5px; +} +.mb8 { + margin-bottom: 8px; +} +.ml5 { + margin-left: 5px; +} +.mt10 { + margin-top: 10px; +} +.mr10 { + margin-right: 10px; +} +.mb10 { + margin-bottom: 10px; +} +.ml0 { + margin-left: 10px; +} +.mt20 { + margin-top: 20px; +} +.mr20 { + margin-right: 20px; +} +.mb20 { + margin-bottom: 20px; +} +.m20 { + margin-left: 20px; +} + +.el-dialog:not(.is-fullscreen){ + margin-top: 6vh !important; +} + +.el-table { + .el-table__header-wrapper, .el-table__fixed-header-wrapper { + th { + word-break: break-word; + background-color: #f8f8f9; + color: #515a6e; + height: 40px; + font-size: 13px; + } + } + .el-table__body-wrapper { + .el-button [class*="el-icon-"] + span { + margin-left: 1px; + } + } +} + +/** 表单布局 **/ +.form-header { + font-size:15px; + color:#6379bb; + border-bottom:1px solid #ddd; + margin:8px 10px 25px 10px; + padding-bottom:5px +} + +/** 表格布局 **/ +.pagination-container { + position: relative; + height: 25px; + margin-bottom: 10px; + margin-top: 15px; + padding: 10px 20px !important; +} + +/* tree border */ +.tree-border { + margin-top: 5px; + border: 1px solid #e5e6e7; + background: #FFFFFF none; + border-radius:4px; +} + +.pagination-container .el-pagination { + right: 0; + position: absolute; +} + +.el-table .fixed-width .el-button--mini { + padding-left: 0; + padding-right: 0; + width: inherit; +} + +.el-tree-node__content > .el-checkbox { + margin-right: 8px; +} + +.list-group-striped > .list-group-item { + border-left: 0; + border-right: 0; + border-radius: 0; + padding-left: 0; + padding-right: 0; +} + +.list-group { + padding-left: 0px; + list-style: none; +} + +.list-group-item { + border-bottom: 1px solid #e7eaec; + border-top: 1px solid #e7eaec; + margin-bottom: -1px; + padding: 11px 0px; + font-size: 13px; +} + +.pull-right { + float: right !important; +} + +.el-card__header { + padding: 14px 15px 7px; + min-height: 40px; +} + +.el-card__body { + padding: 15px 20px 20px 20px; +} + +.card-box { + padding-right: 15px; + padding-left: 15px; + margin-bottom: 10px; +} + +/* button color */ +.el-button--cyan.is-active, +.el-button--cyan:active { + background: #20B2AA; + border-color: #20B2AA; + color: #FFFFFF; +} + +.el-button--cyan:focus, +.el-button--cyan:hover { + background: #48D1CC; + border-color: #48D1CC; + color: #FFFFFF; +} + +.el-button--cyan { + background-color: #20B2AA; + border-color: #20B2AA; + color: #FFFFFF; +} + +/* text color */ +.text-navy { + color: #1ab394; +} + +.text-primary { + color: inherit; +} + +.text-success { + color: #1c84c6; +} + +.text-info { + color: #23c6c8; +} + +.text-warning { + color: #f8ac59; +} + +.text-danger { + color: #ed5565; +} + +.text-muted { + color: #888888; +} + +/* image */ +.img-circle { + border-radius: 50%; +} + +.img-lg { + width: 120px; + height: 120px; +} + +.avatar-upload-preview { + position: absolute; + top: 50%; + transform: translate(50%, -50%); + width: 200px; + height: 200px; + border-radius: 50%; + box-shadow: 0 0 4px #ccc; + overflow: hidden; +} + +/* 拖拽列样式 */ +.sortable-ghost{ + opacity: .8; + color: #fff!important; + background: #42b983!important; +} + +.top-right-btn { + position: relative; + float: right; +} diff --git a/yunze-ui/src/assets/styles/sidebar.scss b/yunze-ui/src/assets/styles/sidebar.scss new file mode 100644 index 0000000..2f368c3 --- /dev/null +++ b/yunze-ui/src/assets/styles/sidebar.scss @@ -0,0 +1,223 @@ +#app { + + .main-container { + min-height: 100%; + transition: margin-left .28s; + margin-left: $sideBarWidth; + position: relative; + } + + .sidebar-container { + -webkit-transition: width .28s; + transition: width 0.28s; + width: $sideBarWidth !important; + background-color: $menuBg; + height: 100%; + position: fixed; + font-size: 0px; + top: 0; + bottom: 0; + left: 0; + z-index: 1001; + overflow: hidden; + -webkit-box-shadow: 2px 0 6px rgba(0,21,41,.35); + box-shadow: 2px 0 6px rgba(0,21,41,.35); + + // reset element-ui css + .horizontal-collapse-transition { + transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; + } + + .scrollbar-wrapper { + overflow-x: hidden !important; + } + + .el-scrollbar__bar.is-vertical { + right: 0px; + } + + .el-scrollbar { + height: 100%; + } + + &.has-logo { + .el-scrollbar { + height: calc(100% - 50px); + } + } + + .is-horizontal { + display: none; + } + + a { + display: inline-block; + width: 100%; + overflow: hidden; + } + + .svg-icon { + margin-right: 16px; + } + + .el-menu { + border: none; + height: 100%; + width: 100% !important; + } + + .el-menu-item, .el-submenu__title { + overflow: hidden !important; + text-overflow: ellipsis !important; + white-space: nowrap !important; + } + + // menu hover + .submenu-title-noDropdown, + .el-submenu__title { + &:hover { + background-color: rgba(0, 0, 0, 0.06) !important; + } + } + + & .theme-dark .is-active > .el-submenu__title { + color: $subMenuActiveText !important; + } + + & .nest-menu .el-submenu>.el-submenu__title, + & .el-submenu .el-menu-item { + min-width: $sideBarWidth !important; + + &:hover { + background-color: rgba(0, 0, 0, 0.06) !important; + } + } + + & .theme-dark .nest-menu .el-submenu>.el-submenu__title, + & .theme-dark .el-submenu .el-menu-item { + background-color: $subMenuBg !important; + + &:hover { + background-color: $subMenuHover !important; + } + } + } + + .hideSidebar { + .sidebar-container { + width: 54px !important; + } + + .main-container { + margin-left: 54px; + } + + .submenu-title-noDropdown { + padding: 0 !important; + position: relative; + + .el-tooltip { + padding: 0 !important; + + .svg-icon { + margin-left: 20px; + } + } + } + + .el-submenu { + overflow: hidden; + + &>.el-submenu__title { + padding: 0 !important; + + .svg-icon { + margin-left: 20px; + } + + } + } + + .el-menu--collapse { + .el-submenu { + &>.el-submenu__title { + &>span { + height: 0; + width: 0; + overflow: hidden; + visibility: hidden; + display: inline-block; + } + } + } + } + } + + .el-menu--collapse .el-menu .el-submenu { + min-width: $sideBarWidth !important; + } + + // mobile responsive + .mobile { + .main-container { + margin-left: 0px; + } + + .sidebar-container { + transition: transform .28s; + width: $sideBarWidth !important; + } + + &.hideSidebar { + .sidebar-container { + pointer-events: none; + transition-duration: 0.3s; + transform: translate3d(-$sideBarWidth, 0, 0); + } + } + } + + .withoutAnimation { + + .main-container, + .sidebar-container { + transition: none; + } + } +} + +// when menu collapsed +.el-menu--vertical { + &>.el-menu { + .svg-icon { + margin-right: 16px; + } + } + + .nest-menu .el-submenu>.el-submenu__title, + .el-menu-item { + &:hover { + // you can use $subMenuHover + background-color: rgba(0, 0, 0, 0.06) !important; + } + } + + // the scroll bar appears when the subMenu is too long + >.el-menu--popup { + max-height: 100vh; + overflow-y: auto; + + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } + } +} diff --git a/yunze-ui/src/assets/styles/transition.scss b/yunze-ui/src/assets/styles/transition.scss new file mode 100644 index 0000000..4cb27cc --- /dev/null +++ b/yunze-ui/src/assets/styles/transition.scss @@ -0,0 +1,48 @@ +// global transition css + +/* fade */ +.fade-enter-active, +.fade-leave-active { + transition: opacity 0.28s; +} + +.fade-enter, +.fade-leave-active { + opacity: 0; +} + +/* fade-transform */ +.fade-transform-leave-active, +.fade-transform-enter-active { + transition: all .5s; +} + +.fade-transform-enter { + opacity: 0; + transform: translateX(-30px); +} + +.fade-transform-leave-to { + opacity: 0; + transform: translateX(30px); +} + +/* breadcrumb transition */ +.breadcrumb-enter-active, +.breadcrumb-leave-active { + transition: all .5s; +} + +.breadcrumb-enter, +.breadcrumb-leave-active { + opacity: 0; + transform: translateX(20px); +} + +.breadcrumb-move { + transition: all .5s; +} + +.breadcrumb-leave-active { + position: absolute; +} diff --git a/yunze-ui/src/assets/styles/variables.scss b/yunze-ui/src/assets/styles/variables.scss new file mode 100644 index 0000000..452a1ec --- /dev/null +++ b/yunze-ui/src/assets/styles/variables.scss @@ -0,0 +1,44 @@ +// base color +$blue:#324157; +$light-blue:#3A71A8; +$red:#C03639; +$pink: #E65D6E; +$green: #30B08F; +$tiffany: #4AB7BD; +$yellow:#FEC171; +$panGreen: #30B08F; + +// sidebar +$menuText:#bfcbd9; +$menuActiveText:#409EFF; +$subMenuActiveText:#f4f4f5; // https://github.com/ElemeFE/element/issues/12951 + +$menuBg:#304156; +$menuHover:#263445; +$sidebarTitle: #ffffff; + +$menuLightBg:#ffffff; +$menuLightHover:#f0f1f5; +$sidebarLightTitle: #001529; + +$subMenuBg:#1f2d3d; +$subMenuHover:#001528; + +$sideBarWidth: 200px; + +// the :export directive is the magic sauce for webpack +// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass +:export { + menuText: $menuText; + menuActiveText: $menuActiveText; + subMenuActiveText: $subMenuActiveText; + menuBg: $menuBg; + menuHover: $menuHover; + menuLightBg: $menuLightBg; + menuLightHover: $menuLightHover; + subMenuBg: $subMenuBg; + subMenuHover: $subMenuHover; + sideBarWidth: $sideBarWidth; + sidebarTitle: $sidebarTitle; + sidebarLightTitle: $sidebarLightTitle +} diff --git a/yunze-ui/src/components/Breadcrumb/index.vue b/yunze-ui/src/components/Breadcrumb/index.vue new file mode 100644 index 0000000..b313fdd --- /dev/null +++ b/yunze-ui/src/components/Breadcrumb/index.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/yunze-ui/src/components/Editor/index.vue b/yunze-ui/src/components/Editor/index.vue new file mode 100644 index 0000000..ad4da7e --- /dev/null +++ b/yunze-ui/src/components/Editor/index.vue @@ -0,0 +1,262 @@ + + + + + diff --git a/yunze-ui/src/components/FileUpload/index.vue b/yunze-ui/src/components/FileUpload/index.vue new file mode 100644 index 0000000..ea58e17 --- /dev/null +++ b/yunze-ui/src/components/FileUpload/index.vue @@ -0,0 +1,179 @@ + + + + + diff --git a/yunze-ui/src/components/Hamburger/index.vue b/yunze-ui/src/components/Hamburger/index.vue new file mode 100644 index 0000000..368b002 --- /dev/null +++ b/yunze-ui/src/components/Hamburger/index.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/yunze-ui/src/components/HeaderSearch/index.vue b/yunze-ui/src/components/HeaderSearch/index.vue new file mode 100644 index 0000000..ce9f305 --- /dev/null +++ b/yunze-ui/src/components/HeaderSearch/index.vue @@ -0,0 +1,188 @@ + + + + + diff --git a/yunze-ui/src/components/IconSelect/index.vue b/yunze-ui/src/components/IconSelect/index.vue new file mode 100644 index 0000000..b0ec9fa --- /dev/null +++ b/yunze-ui/src/components/IconSelect/index.vue @@ -0,0 +1,68 @@ + + + + + + diff --git a/yunze-ui/src/components/IconSelect/requireIcons.js b/yunze-ui/src/components/IconSelect/requireIcons.js new file mode 100644 index 0000000..99e5c54 --- /dev/null +++ b/yunze-ui/src/components/IconSelect/requireIcons.js @@ -0,0 +1,11 @@ + +const req = require.context('../../assets/icons/svg', false, /\.svg$/) +const requireAll = requireContext => requireContext.keys() + +const re = /\.\/(.*)\.svg/ + +const icons = requireAll(req).map(i => { + return i.match(re)[1] +}) + +export default icons diff --git a/yunze-ui/src/components/ImageUpload/index.vue b/yunze-ui/src/components/ImageUpload/index.vue new file mode 100644 index 0000000..defcec9 --- /dev/null +++ b/yunze-ui/src/components/ImageUpload/index.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/yunze-ui/src/components/Pagination/index.vue b/yunze-ui/src/components/Pagination/index.vue new file mode 100644 index 0000000..c815e13 --- /dev/null +++ b/yunze-ui/src/components/Pagination/index.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/yunze-ui/src/components/PanThumb/index.vue b/yunze-ui/src/components/PanThumb/index.vue new file mode 100644 index 0000000..1bcf417 --- /dev/null +++ b/yunze-ui/src/components/PanThumb/index.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/yunze-ui/src/components/ParentView/index.vue b/yunze-ui/src/components/ParentView/index.vue new file mode 100644 index 0000000..7bf6148 --- /dev/null +++ b/yunze-ui/src/components/ParentView/index.vue @@ -0,0 +1,3 @@ + diff --git a/yunze-ui/src/components/RightPanel/index.vue b/yunze-ui/src/components/RightPanel/index.vue new file mode 100644 index 0000000..fbf27eb --- /dev/null +++ b/yunze-ui/src/components/RightPanel/index.vue @@ -0,0 +1,149 @@ + + + + + + + diff --git a/yunze-ui/src/components/RightToolbar/index.vue b/yunze-ui/src/components/RightToolbar/index.vue new file mode 100644 index 0000000..e3e1286 --- /dev/null +++ b/yunze-ui/src/components/RightToolbar/index.vue @@ -0,0 +1,87 @@ + + + diff --git a/yunze-ui/src/components/RuoYi/Doc/index.vue b/yunze-ui/src/components/RuoYi/Doc/index.vue new file mode 100644 index 0000000..e793b2d --- /dev/null +++ b/yunze-ui/src/components/RuoYi/Doc/index.vue @@ -0,0 +1,21 @@ + + + diff --git a/yunze-ui/src/components/RuoYi/Git/index.vue b/yunze-ui/src/components/RuoYi/Git/index.vue new file mode 100644 index 0000000..523cefd --- /dev/null +++ b/yunze-ui/src/components/RuoYi/Git/index.vue @@ -0,0 +1,21 @@ + + + diff --git a/yunze-ui/src/components/Screenfull/index.vue b/yunze-ui/src/components/Screenfull/index.vue new file mode 100644 index 0000000..d4e539c --- /dev/null +++ b/yunze-ui/src/components/Screenfull/index.vue @@ -0,0 +1,57 @@ + + + + + diff --git a/yunze-ui/src/components/SizeSelect/index.vue b/yunze-ui/src/components/SizeSelect/index.vue new file mode 100644 index 0000000..e88065b --- /dev/null +++ b/yunze-ui/src/components/SizeSelect/index.vue @@ -0,0 +1,57 @@ + + + diff --git a/yunze-ui/src/components/SvgIcon/index.vue b/yunze-ui/src/components/SvgIcon/index.vue new file mode 100644 index 0000000..e4bf5ad --- /dev/null +++ b/yunze-ui/src/components/SvgIcon/index.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/yunze-ui/src/components/ThemePicker/index.vue b/yunze-ui/src/components/ThemePicker/index.vue new file mode 100644 index 0000000..81bebcc --- /dev/null +++ b/yunze-ui/src/components/ThemePicker/index.vue @@ -0,0 +1,174 @@ + + + + + diff --git a/yunze-ui/src/components/TopNav/index.vue b/yunze-ui/src/components/TopNav/index.vue new file mode 100644 index 0000000..d89930a --- /dev/null +++ b/yunze-ui/src/components/TopNav/index.vue @@ -0,0 +1,182 @@ + + + + + diff --git a/yunze-ui/src/directive/permission/hasPermi.js b/yunze-ui/src/directive/permission/hasPermi.js new file mode 100644 index 0000000..12eb8d5 --- /dev/null +++ b/yunze-ui/src/directive/permission/hasPermi.js @@ -0,0 +1,28 @@ + /** + * 操作权限处理 + * Copyright (c) 2019 yunze + */ + +import store from '@/store' + +export default { + inserted(el, binding, vnode) { + const { value } = binding + const all_permission = "*:*:*"; + const permissions = store.getters && store.getters.permissions + + if (value && value instanceof Array && value.length > 0) { + const permissionFlag = value + + const hasPermissions = permissions.some(permission => { + return all_permission === permission || permissionFlag.includes(permission) + }) + + if (!hasPermissions) { + el.parentNode && el.parentNode.removeChild(el) + } + } else { + throw new Error(`请设置操作权限标签值`) + } + } +} diff --git a/yunze-ui/src/directive/permission/hasRole.js b/yunze-ui/src/directive/permission/hasRole.js new file mode 100644 index 0000000..c6ab2a6 --- /dev/null +++ b/yunze-ui/src/directive/permission/hasRole.js @@ -0,0 +1,28 @@ + /** + * 角色权限处理 + * Copyright (c) 2019 yunze + */ + +import store from '@/store' + +export default { + inserted(el, binding, vnode) { + const { value } = binding + const super_admin = "admin"; + const roles = store.getters && store.getters.roles + + if (value && value instanceof Array && value.length > 0) { + const roleFlag = value + + const hasRole = roles.some(role => { + return super_admin === role || roleFlag.includes(role) + }) + + if (!hasRole) { + el.parentNode && el.parentNode.removeChild(el) + } + } else { + throw new Error(`请设置角色权限标签值"`) + } + } +} diff --git a/yunze-ui/src/directive/permission/index.js b/yunze-ui/src/directive/permission/index.js new file mode 100644 index 0000000..e3d76d3 --- /dev/null +++ b/yunze-ui/src/directive/permission/index.js @@ -0,0 +1,15 @@ +import hasRole from './hasRole' +import hasPermi from './hasPermi' + +const install = function(Vue) { + Vue.directive('hasRole', hasRole) + Vue.directive('hasPermi', hasPermi) +} + +if (window.Vue) { + window['hasRole'] = hasRole + window['hasPermi'] = hasPermi + Vue.use(install); // eslint-disable-line +} + +export default install diff --git a/yunze-ui/src/layout/components/AppMain.vue b/yunze-ui/src/layout/components/AppMain.vue new file mode 100644 index 0000000..a897638 --- /dev/null +++ b/yunze-ui/src/layout/components/AppMain.vue @@ -0,0 +1,57 @@ + + + + + + + diff --git a/yunze-ui/src/layout/components/Navbar.vue b/yunze-ui/src/layout/components/Navbar.vue new file mode 100644 index 0000000..f366f50 --- /dev/null +++ b/yunze-ui/src/layout/components/Navbar.vue @@ -0,0 +1,200 @@ + + + + + diff --git a/yunze-ui/src/layout/components/Settings/index.vue b/yunze-ui/src/layout/components/Settings/index.vue new file mode 100644 index 0000000..245135f --- /dev/null +++ b/yunze-ui/src/layout/components/Settings/index.vue @@ -0,0 +1,251 @@ + + + + + diff --git a/yunze-ui/src/layout/components/Sidebar/FixiOSBug.js b/yunze-ui/src/layout/components/Sidebar/FixiOSBug.js new file mode 100644 index 0000000..6823726 --- /dev/null +++ b/yunze-ui/src/layout/components/Sidebar/FixiOSBug.js @@ -0,0 +1,25 @@ +export default { + computed: { + device() { + return this.$store.state.app.device + } + }, + mounted() { + // In order to fix the click on menu on the ios device will trigger the mouseleave bug + this.fixBugIniOS() + }, + methods: { + fixBugIniOS() { + const $subMenu = this.$refs.subMenu + if ($subMenu) { + const handleMouseleave = $subMenu.handleMouseleave + $subMenu.handleMouseleave = (e) => { + if (this.device === 'mobile') { + return + } + handleMouseleave(e) + } + } + } + } +} diff --git a/yunze-ui/src/layout/components/Sidebar/Item.vue b/yunze-ui/src/layout/components/Sidebar/Item.vue new file mode 100644 index 0000000..b515f61 --- /dev/null +++ b/yunze-ui/src/layout/components/Sidebar/Item.vue @@ -0,0 +1,29 @@ + diff --git a/yunze-ui/src/layout/components/Sidebar/Link.vue b/yunze-ui/src/layout/components/Sidebar/Link.vue new file mode 100644 index 0000000..530b3d5 --- /dev/null +++ b/yunze-ui/src/layout/components/Sidebar/Link.vue @@ -0,0 +1,43 @@ + + + diff --git a/yunze-ui/src/layout/components/Sidebar/Logo.vue b/yunze-ui/src/layout/components/Sidebar/Logo.vue new file mode 100644 index 0000000..acabdcc --- /dev/null +++ b/yunze-ui/src/layout/components/Sidebar/Logo.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/yunze-ui/src/layout/components/Sidebar/SidebarItem.vue b/yunze-ui/src/layout/components/Sidebar/SidebarItem.vue new file mode 100644 index 0000000..c4febee --- /dev/null +++ b/yunze-ui/src/layout/components/Sidebar/SidebarItem.vue @@ -0,0 +1,96 @@ + + + diff --git a/yunze-ui/src/layout/components/Sidebar/index.vue b/yunze-ui/src/layout/components/Sidebar/index.vue new file mode 100644 index 0000000..9e5d2bb --- /dev/null +++ b/yunze-ui/src/layout/components/Sidebar/index.vue @@ -0,0 +1,57 @@ + + + diff --git a/yunze-ui/src/layout/components/TagsView/ScrollPane.vue b/yunze-ui/src/layout/components/TagsView/ScrollPane.vue new file mode 100644 index 0000000..bb753a1 --- /dev/null +++ b/yunze-ui/src/layout/components/TagsView/ScrollPane.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/yunze-ui/src/layout/components/TagsView/index.vue b/yunze-ui/src/layout/components/TagsView/index.vue new file mode 100644 index 0000000..6caf350 --- /dev/null +++ b/yunze-ui/src/layout/components/TagsView/index.vue @@ -0,0 +1,318 @@ + + + + + + + diff --git a/yunze-ui/src/layout/components/index.js b/yunze-ui/src/layout/components/index.js new file mode 100644 index 0000000..104bd3a --- /dev/null +++ b/yunze-ui/src/layout/components/index.js @@ -0,0 +1,5 @@ +export { default as AppMain } from './AppMain' +export { default as Navbar } from './Navbar' +export { default as Settings } from './Settings' +export { default as Sidebar } from './Sidebar/index.vue' +export { default as TagsView } from './TagsView/index.vue' diff --git a/yunze-ui/src/layout/index.vue b/yunze-ui/src/layout/index.vue new file mode 100644 index 0000000..d490771 --- /dev/null +++ b/yunze-ui/src/layout/index.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/yunze-ui/src/layout/mixin/ResizeHandler.js b/yunze-ui/src/layout/mixin/ResizeHandler.js new file mode 100644 index 0000000..e8d0df8 --- /dev/null +++ b/yunze-ui/src/layout/mixin/ResizeHandler.js @@ -0,0 +1,45 @@ +import store from '@/store' + +const { body } = document +const WIDTH = 992 // refer to Bootstrap's responsive design + +export default { + watch: { + $route(route) { + if (this.device === 'mobile' && this.sidebar.opened) { + store.dispatch('app/closeSideBar', { withoutAnimation: false }) + } + } + }, + beforeMount() { + window.addEventListener('resize', this.$_resizeHandler) + }, + beforeDestroy() { + window.removeEventListener('resize', this.$_resizeHandler) + }, + mounted() { + const isMobile = this.$_isMobile() + if (isMobile) { + store.dispatch('app/toggleDevice', 'mobile') + store.dispatch('app/closeSideBar', { withoutAnimation: true }) + } + }, + methods: { + // use $_ for mixins properties + // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential + $_isMobile() { + const rect = body.getBoundingClientRect() + return rect.width - 1 < WIDTH + }, + $_resizeHandler() { + if (!document.hidden) { + const isMobile = this.$_isMobile() + store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop') + + if (isMobile) { + store.dispatch('app/closeSideBar', { withoutAnimation: true }) + } + } + } + } +} diff --git a/yunze-ui/src/main.js b/yunze-ui/src/main.js new file mode 100644 index 0000000..d9d1301 --- /dev/null +++ b/yunze-ui/src/main.js @@ -0,0 +1,78 @@ +import Vue from 'vue' + +import Cookies from 'js-cookie' + +import Element from 'element-ui' +import './assets/styles/element-variables.scss' + +import '@/assets/styles/index.scss' // global css +import '@/assets/styles/ruoyi.scss' // ruoyi css +import App from './App' +import store from './store' +import router from './router' +import permission from './directive/permission' + +import './assets/icons' // icon +import './permission' // permission control +import { getDicts } from "@/api/system/dict/data"; +import { getDeptName, findSp } from "@/api/yunze/flowcard/card/card"; +import { getConfigKey } from "@/api/system/config"; +import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi"; +import Pagination from "@/components/Pagination"; +// 自定义表格工具扩展 +import RightToolbar from "@/components/RightToolbar" + + + +// 全局方法挂载 +Vue.prototype.getDicts = getDicts +Vue.prototype.getDeptName = getDeptName +Vue.prototype.findSp = findSp +Vue.prototype.getConfigKey = getConfigKey +Vue.prototype.parseTime = parseTime +Vue.prototype.resetForm = resetForm +Vue.prototype.addDateRange = addDateRange +Vue.prototype.selectDictLabel = selectDictLabel +Vue.prototype.selectDictLabels = selectDictLabels +Vue.prototype.download = download +Vue.prototype.handleTree = handleTree + +Vue.prototype.msgSuccess = function (msg) { + this.$message({ showClose: true, message: msg, type: "success" }); +} + +Vue.prototype.msgError = function (msg) { + this.$message({ showClose: true, message: msg, type: "error" }); +} + +Vue.prototype.msgInfo = function (msg) { + this.$message.info(msg); +} + +// 全局组件挂载 +Vue.component('Pagination', Pagination) +Vue.component('RightToolbar', RightToolbar) + +Vue.use(permission) + +/** + * If you don't want to use mock-server + * you want to use MockJs for mock api + * you can execute: mockXHR() + * + * Currently MockJs will be used in the production environment, + * please remove it before going online! ! ! + */ + +Vue.use(Element, { + size: Cookies.get('size') || 'medium' // set element-ui default size +}) + +Vue.config.productionTip = false + +new Vue({ + el: '#app', + router, + store, + render: h => h(App) +}) diff --git a/yunze-ui/src/permission.js b/yunze-ui/src/permission.js new file mode 100644 index 0000000..5632e7d --- /dev/null +++ b/yunze-ui/src/permission.js @@ -0,0 +1,52 @@ +import router from './router' +import store from './store' +import { Message } from 'element-ui' +import NProgress from 'nprogress' +import 'nprogress/nprogress.css' +import { getToken } from '@/utils/auth' + +NProgress.configure({ showSpinner: false }) + +const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] + +router.beforeEach((to, from, next) => { + NProgress.start() + if (getToken()) { + /* has token*/ + if (to.path === '/login') { + next({ path: '/' }) + NProgress.done() + } else { + if (store.getters.roles.length === 0) { + // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(() => { + store.dispatch('GenerateRoutes').then(accessRoutes => { + // 根据roles权限生成可访问的路由表 + router.addRoutes(accessRoutes) // 动态添加可访问路由表 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 + }) + }).catch(err => { + store.dispatch('LogOut').then(() => { + Message.error(err) + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + // 没有token + if (whiteList.indexOf(to.path) !== -1) { + // 在免登录白名单,直接进入 + next() + } else { + next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 + NProgress.done() + } + } +}) + +router.afterEach(() => { + NProgress.done() +}) diff --git a/yunze-ui/src/router/index.js b/yunze-ui/src/router/index.js new file mode 100644 index 0000000..970d65b --- /dev/null +++ b/yunze-ui/src/router/index.js @@ -0,0 +1,236 @@ +import Vue from 'vue' +import Router from 'vue-router' + +Vue.use(Router) + +/* Layout */ +import Layout from '@/layout' +import ParentView from '@/components/ParentView'; + +/** + * Note: 路由配置项 + * + * hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1 + * alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 + * // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面 + * // 若你想不管路由下面的 children 声明的个数都显示你的根路由 + * // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由 + * redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 + * name:'router-name' // 设定路由的名字,一定要填写不然使用时会出现各种问题 + * meta : { + noCache: true // 如果设置为true,则不会被 缓存(默认 false) + title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字 + icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg + breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示 + } + */ + +// 公共路由 +export const constantRoutes = [ + { + path: '/redirect', + component: Layout, + hidden: true, + children: [ + { + path: '/redirect/:path(.*)', + component: (resolve) => require(['@/views/redirect'], resolve) + } + ] + }, + { + path: '/login', + component: (resolve) => require(['@/views/login'], resolve), + hidden: true + }, + { + path: '/404', + component: (resolve) => require(['@/views/error/404'], resolve), + hidden: true + }, + { + path: '/401', + component: (resolve) => require(['@/views/error/401'], resolve), + hidden: true + }, + { + path: '', + component: Layout, + redirect: 'index', + children: [ + { + path: 'index', + component: (resolve) => require(['@/views/index'], resolve), + name: '首页', + meta: { title: '首页', icon: 'dashboard', noCache: true, affix: true } + } + ] + }, + { + path: '/user', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: 'profile', + component: (resolve) => require(['@/views/system/user/profile/index'], resolve), + name: 'Profile', + meta: { title: '个人中心', icon: 'user' } + } + ] + }, + { + path: '/dict', + component: Layout, + hidden: true, + children: [ + { + path: 'type/data/:dictId(\\d+)', + component: (resolve) => require(['@/views/system/dict/data'], resolve), + name: 'Data', + meta: { title: '字典数据', icon: '' } + } + ] + }, + { + path: '/job', + component: Layout, + hidden: true, + children: [ + { + path: 'log', + component: (resolve) => require(['@/views/monitor/job/log'], resolve), + name: 'JobLog', + meta: { title: '调度日志' } + } + ] + }, + /** + * polling*/ + { + path: '/polling', + component: Layout, + hidden: true, + children: [ + { + path: 'type/index/:cd_id(\\d+)', + component: (resolve) => require(['@/views/yunze/API/polling/index'], resolve), + name: 'polling', + meta: { title: '轮序进度查询', icon: '' } + } + ] + }, + + + + { + path: '/card', + component: Layout, + hidden: true, + children: [ + { + path: 'type/cardFlow/:iccid(.*)', + component: (resolve) => require(['@/views/yunze/flowcard/card/cardFlow'], resolve), + name: 'CardFlow', + meta: { title: '订购资费查询', icon: '' } + }, + { + path: 'type/cardFlowHis/:iccid(.*)', + component: (resolve) => require(['@/views/yunze/flowcard/card/cardFlowHis'], resolve), + name: 'CardFlowHis', + meta: { title: '用量详情', icon: '' } + }, + { + path: 'type/cardChange/:iccid(.*)', + component: (resolve) => require(['@/views/yunze/flowcard/card/cardChange'], resolve), + name: 'CardChange', + meta: { title: '卡信息变更查询', icon: '' } + } + ] + }, + + + + { + path: '/specialOperation', + component: Layout, + hidden: true, + children: [ + {/*** 修改分组及备注 操作 */ + path: 'type/cardInfoEdit', + component: (resolve) => require(['@/views/yunze/specialOperation/cardInfoEdit'], resolve), + name: 'cardInfoEdit', + meta: { title: '变更卡分组备注', icon: '' } + }, + {/*** 批量停复机、断开网 操作 */ + path: 'type/Selbatch', + component: (resolve) => require(['@/views/yunze/specialOperation/Selbatch'], resolve), + name: 'Selbatch', + meta: { title: '批量停复机、断开网' } + }, + {/*** 查询IMEI 操作 */ + path: 'type/selImei', + component: (resolve) => require(['@/views/yunze/specialOperation/selImei'], resolve), + name: 'selImei', + meta: { title: '查询IMEI' } + } + + ] + }, + + +/** + * 自动化推送 + * */ + { + path: '/ccurl', + component: Layout, + hidden: true, + children: [ + { + path: 'type/index:channel_id(.*)', + component: (resolve) => require(['@/views/yunze/automation/ccurl/index'], resolve), + name: 'ccurl', + meta: { title: '自动化推送', icon: ''} + } + ] + }, + /** + * 推送记录 + * */ + { + path: '/cchis', + component: Layout, + hidden: true, + children: [ + { + path: 'type/index:channel_id(.*)', + component: (resolve) => require(['@/views/yunze/automation/cchis/index'], resolve), + name: 'cchis', + meta: { title: '推送记录', icon: ''} + } + ] + }, + + + { + path: '/gen', + component: Layout, + hidden: true, + children: [ + { + path: 'edit/:tableId(\\d+)', + component: (resolve) => require(['@/views/tool/gen/editTable'], resolve), + name: 'GenEdit', + meta: { title: '修改生成配置' } + } + ] + } +] + +export default new Router({ + mode: 'history', // 去掉url中的# + scrollBehavior: () => ({ y: 0 }), + routes: constantRoutes +}) diff --git a/yunze-ui/src/settings.js b/yunze-ui/src/settings.js new file mode 100644 index 0000000..a435a9b --- /dev/null +++ b/yunze-ui/src/settings.js @@ -0,0 +1,41 @@ +module.exports = { + title: 'IOT综合业务支撑平台', + + /** + * 侧边栏主题 深色主题theme-dark,浅色主题theme-light + */ + sideTheme: 'theme-dark', + + /** + * 是否系统布局配置 + */ + showSettings: false, + + /** + * 是否显示顶部导航 + */ + topNav: false, + + /** + * 是否显示 tagsView + */ + tagsView: true, + + /** + * 是否固定头部 + */ + fixedHeader: false, + + /** + * 是否显示logo + */ + sidebarLogo: true, + + /** + * @type {string | array} 'production' | ['production', 'development'] + * @description Need show err logs component. + * The default is only used in the production env + * If you want to also use it in dev, you can pass ['production', 'development'] + */ + errorLog: 'production' +} diff --git a/yunze-ui/src/store/getters.js b/yunze-ui/src/store/getters.js new file mode 100644 index 0000000..da6ab39 --- /dev/null +++ b/yunze-ui/src/store/getters.js @@ -0,0 +1,18 @@ +const getters = { + sidebar: state => state.app.sidebar, + size: state => state.app.size, + device: state => state.app.device, + visitedViews: state => state.tagsView.visitedViews, + cachedViews: state => state.tagsView.cachedViews, + token: state => state.user.token, + avatar: state => state.user.avatar, + name: state => state.user.name, + introduction: state => state.user.introduction, + roles: state => state.user.roles, + permissions: state => state.user.permissions, + permission_routes: state => state.permission.routes, + topbarRouters:state => state.permission.topbarRouters, + defaultRoutes:state => state.permission.defaultRoutes, + sidebarRouters:state => state.permission.sidebarRouters, +} +export default getters diff --git a/yunze-ui/src/store/index.js b/yunze-ui/src/store/index.js new file mode 100644 index 0000000..53b8437 --- /dev/null +++ b/yunze-ui/src/store/index.js @@ -0,0 +1,23 @@ +import Vue from 'vue' +import Vuex from 'vuex' +import app from './modules/app' +import user from './modules/user' +import tagsView from './modules/tagsView' +import permission from './modules/permission' +import settings from './modules/settings' +import getters from './getters' + +Vue.use(Vuex) + +const store = new Vuex.Store({ + modules: { + app, + user, + tagsView, + permission, + settings + }, + getters +}) + +export default store diff --git a/yunze-ui/src/store/modules/app.js b/yunze-ui/src/store/modules/app.js new file mode 100644 index 0000000..45d89bb --- /dev/null +++ b/yunze-ui/src/store/modules/app.js @@ -0,0 +1,56 @@ +import Cookies from 'js-cookie' + +const state = { + sidebar: { + opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, + withoutAnimation: false + }, + device: 'desktop', + size: Cookies.get('size') || 'medium' +} + +const mutations = { + TOGGLE_SIDEBAR: state => { + state.sidebar.opened = !state.sidebar.opened + state.sidebar.withoutAnimation = false + if (state.sidebar.opened) { + Cookies.set('sidebarStatus', 1) + } else { + Cookies.set('sidebarStatus', 0) + } + }, + CLOSE_SIDEBAR: (state, withoutAnimation) => { + Cookies.set('sidebarStatus', 0) + state.sidebar.opened = false + state.sidebar.withoutAnimation = withoutAnimation + }, + TOGGLE_DEVICE: (state, device) => { + state.device = device + }, + SET_SIZE: (state, size) => { + state.size = size + Cookies.set('size', size) + } +} + +const actions = { + toggleSideBar({ commit }) { + commit('TOGGLE_SIDEBAR') + }, + closeSideBar({ commit }, { withoutAnimation }) { + commit('CLOSE_SIDEBAR', withoutAnimation) + }, + toggleDevice({ commit }, device) { + commit('TOGGLE_DEVICE', device) + }, + setSize({ commit }, size) { + commit('SET_SIZE', size) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} diff --git a/yunze-ui/src/store/modules/permission.js b/yunze-ui/src/store/modules/permission.js new file mode 100644 index 0000000..aacfc8c --- /dev/null +++ b/yunze-ui/src/store/modules/permission.js @@ -0,0 +1,110 @@ +import { constantRoutes } from '@/router' +import { getRouters } from '@/api/menu' +import Layout from '@/layout/index' +import ParentView from '@/components/ParentView'; + +const permission = { + state: { + routes: [], + addRoutes: [], + defaultRoutes: [], + topbarRouters: [], + sidebarRouters: [] + }, + mutations: { + SET_ROUTES: (state, routes) => { + state.addRoutes = routes + state.routes = constantRoutes.concat(routes) + }, + SET_DEFAULT_ROUTES: (state, routes) => { + state.defaultRoutes = constantRoutes.concat(routes) + }, + SET_TOPBAR_ROUTES: (state, routes) => { + // 顶部导航菜单默认添加统计报表栏指向首页 + const index = [{ + path: 'index', + meta: { title: '统计报表', icon: 'dashboard'} + }] + state.topbarRouters = routes.concat(index); + }, + SET_SIDEBAR_ROUTERS: (state, routes) => { + state.sidebarRouters = routes + }, + }, + actions: { + // 生成路由 + GenerateRoutes({ commit }) { + return new Promise(resolve => { + // 向后端请求路由数据 + getRouters().then(res => { + const sdata = JSON.parse(JSON.stringify(res.data)) + const rdata = JSON.parse(JSON.stringify(res.data)) + const sidebarRoutes = filterAsyncRouter(sdata) + const rewriteRoutes = filterAsyncRouter(rdata, false, true) + rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true }) + commit('SET_ROUTES', rewriteRoutes) + commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes)) + commit('SET_DEFAULT_ROUTES', sidebarRoutes) + commit('SET_TOPBAR_ROUTES', sidebarRoutes) + resolve(rewriteRoutes) + }) + }) + } + } +} + +// 遍历后台传来的路由字符串,转换为组件对象 +function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { + return asyncRouterMap.filter(route => { + if (type && route.children) { + route.children = filterChildren(route.children) + } + if (route.component) { + // Layout ParentView 组件特殊处理 + if (route.component === 'Layout') { + route.component = Layout + } else if (route.component === 'ParentView') { + route.component = ParentView + } else { + route.component = loadView(route.component) + } + } + if (route.children != null && route.children && route.children.length) { + route.children = filterAsyncRouter(route.children, route, type) + } else { + delete route['children'] + delete route['redirect'] + } + return true + }) +} + +function filterChildren(childrenMap, lastRouter = false) { + var children = [] + childrenMap.forEach((el, index) => { + if (el.children && el.children.length) { + if (el.component === 'ParentView') { + el.children.forEach(c => { + c.path = el.path + '/' + c.path + if (c.children && c.children.length) { + children = children.concat(filterChildren(c.children, c)) + return + } + children.push(c) + }) + return + } + } + if (lastRouter) { + el.path = lastRouter.path + '/' + el.path + } + children = children.concat(el) + }) + return children +} + +export const loadView = (view) => { // 路由懒加载 + return (resolve) => require([`@/views/${view}`], resolve) +} + +export default permission diff --git a/yunze-ui/src/store/modules/settings.js b/yunze-ui/src/store/modules/settings.js new file mode 100644 index 0000000..93f7c04 --- /dev/null +++ b/yunze-ui/src/store/modules/settings.js @@ -0,0 +1,36 @@ +import variables from '@/assets/styles/element-variables.scss' +import defaultSettings from '@/settings' + +const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo } = defaultSettings + +const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || '' +const state = { + theme: storageSetting.theme || variables.theme, + sideTheme: storageSetting.sideTheme || sideTheme, + showSettings: showSettings, + topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav, + tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView, + fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader, + sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo +} +const mutations = { + CHANGE_SETTING: (state, { key, value }) => { + if (state.hasOwnProperty(key)) { + state[key] = value + } + } +} + +const actions = { + changeSetting({ commit }, data) { + commit('CHANGE_SETTING', data) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} + diff --git a/yunze-ui/src/store/modules/tagsView.js b/yunze-ui/src/store/modules/tagsView.js new file mode 100644 index 0000000..68bb81d --- /dev/null +++ b/yunze-ui/src/store/modules/tagsView.js @@ -0,0 +1,183 @@ +const state = { + visitedViews: [], + cachedViews: [] +} + +const mutations = { + ADD_VISITED_VIEW: (state, view) => { + if (state.visitedViews.some(v => v.path === view.path)) return + state.visitedViews.push( + Object.assign({}, view, { + title: view.meta.title || 'no-name' + }) + ) + }, + ADD_CACHED_VIEW: (state, view) => { + if (state.cachedViews.includes(view.name)) return + if (!view.meta.noCache) { + state.cachedViews.push(view.name) + } + }, + + DEL_VISITED_VIEW: (state, view) => { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } + } + }, + DEL_CACHED_VIEW: (state, view) => { + const index = state.cachedViews.indexOf(view.name) + index > -1 && state.cachedViews.splice(index, 1) + }, + + DEL_OTHERS_VISITED_VIEWS: (state, view) => { + state.visitedViews = state.visitedViews.filter(v => { + return v.meta.affix || v.path === view.path + }) + }, + DEL_OTHERS_CACHED_VIEWS: (state, view) => { + const index = state.cachedViews.indexOf(view.name) + if (index > -1) { + state.cachedViews = state.cachedViews.slice(index, index + 1) + } else { + state.cachedViews = [] + } + }, + + DEL_ALL_VISITED_VIEWS: state => { + // keep affix tags + const affixTags = state.visitedViews.filter(tag => tag.meta.affix) + state.visitedViews = affixTags + }, + DEL_ALL_CACHED_VIEWS: state => { + state.cachedViews = [] + }, + + UPDATE_VISITED_VIEW: (state, view) => { + for (let v of state.visitedViews) { + if (v.path === view.path) { + v = Object.assign(v, view) + break + } + } + }, + + DEL_RIGHT_VIEWS: (state, view) => { + const index = state.visitedViews.findIndex(v => v.path === view.path) + if (index === -1) { + return + } + state.visitedViews = state.visitedViews.filter((item, idx) => { + if (idx <= index || (item.meta && item.meta.affix)) { + return true + } + const i = state.cachedViews.indexOf(item.name) + if (i > -1) { + state.cachedViews.splice(i, 1) + } + return false + }) + } +} + +const actions = { + addView({ dispatch }, view) { + dispatch('addVisitedView', view) + dispatch('addCachedView', view) + }, + addVisitedView({ commit }, view) { + commit('ADD_VISITED_VIEW', view) + }, + addCachedView({ commit }, view) { + commit('ADD_CACHED_VIEW', view) + }, + + delView({ dispatch, state }, view) { + return new Promise(resolve => { + dispatch('delVisitedView', view) + dispatch('delCachedView', view) + resolve({ + visitedViews: [...state.visitedViews], + cachedViews: [...state.cachedViews] + }) + }) + }, + delVisitedView({ commit, state }, view) { + return new Promise(resolve => { + commit('DEL_VISITED_VIEW', view) + resolve([...state.visitedViews]) + }) + }, + delCachedView({ commit, state }, view) { + return new Promise(resolve => { + commit('DEL_CACHED_VIEW', view) + resolve([...state.cachedViews]) + }) + }, + + delOthersViews({ dispatch, state }, view) { + return new Promise(resolve => { + dispatch('delOthersVisitedViews', view) + dispatch('delOthersCachedViews', view) + resolve({ + visitedViews: [...state.visitedViews], + cachedViews: [...state.cachedViews] + }) + }) + }, + delOthersVisitedViews({ commit, state }, view) { + return new Promise(resolve => { + commit('DEL_OTHERS_VISITED_VIEWS', view) + resolve([...state.visitedViews]) + }) + }, + delOthersCachedViews({ commit, state }, view) { + return new Promise(resolve => { + commit('DEL_OTHERS_CACHED_VIEWS', view) + resolve([...state.cachedViews]) + }) + }, + + delAllViews({ dispatch, state }, view) { + return new Promise(resolve => { + dispatch('delAllVisitedViews', view) + dispatch('delAllCachedViews', view) + resolve({ + visitedViews: [...state.visitedViews], + cachedViews: [...state.cachedViews] + }) + }) + }, + delAllVisitedViews({ commit, state }) { + return new Promise(resolve => { + commit('DEL_ALL_VISITED_VIEWS') + resolve([...state.visitedViews]) + }) + }, + delAllCachedViews({ commit, state }) { + return new Promise(resolve => { + commit('DEL_ALL_CACHED_VIEWS') + resolve([...state.cachedViews]) + }) + }, + + updateVisitedView({ commit }, view) { + commit('UPDATE_VISITED_VIEW', view) + }, + + delRightTags({ commit }, view) { + return new Promise(resolve => { + commit('DEL_RIGHT_VIEWS', view) + resolve([...state.visitedViews]) + }) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} diff --git a/yunze-ui/src/store/modules/user.js b/yunze-ui/src/store/modules/user.js new file mode 100644 index 0000000..0e45157 --- /dev/null +++ b/yunze-ui/src/store/modules/user.js @@ -0,0 +1,96 @@ +import { login, logout, getInfo } from '@/api/login' +import { getToken, setToken, removeToken } from '@/utils/auth' + +const user = { + state: { + token: getToken(), + name: '', + avatar: '', + roles: [], + permissions: [] + }, + + mutations: { + SET_TOKEN: (state, token) => { + state.token = token + }, + SET_NAME: (state, name) => { + state.name = name + }, + SET_AVATAR: (state, avatar) => { + state.avatar = avatar + }, + SET_ROLES: (state, roles) => { + state.roles = roles + }, + SET_PERMISSIONS: (state, permissions) => { + state.permissions = permissions + } + }, + + actions: { + // 登录 + Login({ commit }, userInfo) { + const username = userInfo.username.trim() + const password = userInfo.password + const code = userInfo.code + const uuid = userInfo.uuid + return new Promise((resolve, reject) => { + login(username, password, code, uuid).then(res => { + setToken(res.token) + commit('SET_TOKEN', res.token) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, + + // 获取用户信息 + GetInfo({ commit, state }) { + return new Promise((resolve, reject) => { + getInfo().then(res => { + const user = res.user + const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; + if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLES', res.roles) + commit('SET_PERMISSIONS', res.permissions) + } else { + commit('SET_ROLES', ['ROLE_DEFAULT']) + } + commit('SET_NAME', user.userName) + commit('SET_AVATAR', avatar) + resolve(res) + }).catch(error => { + reject(error) + }) + }) + }, + + // 退出系统 + LogOut({ commit, state }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + commit('SET_PERMISSIONS', []) + removeToken() + resolve() + }).catch(error => { + reject(error) + }) + }) + }, + + // 前端 登出 + FedLogOut({ commit }) { + return new Promise(resolve => { + commit('SET_TOKEN', '') + removeToken() + resolve() + }) + } + } +} + +export default user diff --git a/yunze-ui/src/utils/auth.js b/yunze-ui/src/utils/auth.js new file mode 100644 index 0000000..08a43d6 --- /dev/null +++ b/yunze-ui/src/utils/auth.js @@ -0,0 +1,15 @@ +import Cookies from 'js-cookie' + +const TokenKey = 'Admin-Token' + +export function getToken() { + return Cookies.get(TokenKey) +} + +export function setToken(token) { + return Cookies.set(TokenKey, token) +} + +export function removeToken() { + return Cookies.remove(TokenKey) +} diff --git a/yunze-ui/src/utils/errorCode.js b/yunze-ui/src/utils/errorCode.js new file mode 100644 index 0000000..d2111ee --- /dev/null +++ b/yunze-ui/src/utils/errorCode.js @@ -0,0 +1,6 @@ +export default { + '401': '认证失败,无法访问系统资源', + '403': '当前操作没有权限', + '404': '访问资源不存在', + 'default': '系统未知错误,请反馈给管理员' +} diff --git a/yunze-ui/src/utils/generator/config.js b/yunze-ui/src/utils/generator/config.js new file mode 100644 index 0000000..7abf227 --- /dev/null +++ b/yunze-ui/src/utils/generator/config.js @@ -0,0 +1,438 @@ +export const formConf = { + formRef: 'elForm', + formModel: 'formData', + size: 'medium', + labelPosition: 'right', + labelWidth: 100, + formRules: 'rules', + gutter: 15, + disabled: false, + span: 24, + formBtns: true +} + +export const inputComponents = [ + { + label: '单行文本', + tag: 'el-input', + tagIcon: 'input', + placeholder: '请输入', + defaultValue: undefined, + span: 24, + labelWidth: null, + style: { width: '100%' }, + clearable: true, + prepend: '', + append: '', + 'prefix-icon': '', + 'suffix-icon': '', + maxlength: null, + 'show-word-limit': false, + readonly: false, + disabled: false, + required: true, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/input' + }, + { + label: '多行文本', + tag: 'el-input', + tagIcon: 'textarea', + type: 'textarea', + placeholder: '请输入', + defaultValue: undefined, + span: 24, + labelWidth: null, + autosize: { + minRows: 4, + maxRows: 4 + }, + style: { width: '100%' }, + maxlength: null, + 'show-word-limit': false, + readonly: false, + disabled: false, + required: true, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/input' + }, + { + label: '密码', + tag: 'el-input', + tagIcon: 'password', + placeholder: '请输入', + defaultValue: undefined, + span: 24, + 'show-password': true, + labelWidth: null, + style: { width: '100%' }, + clearable: true, + prepend: '', + append: '', + 'prefix-icon': '', + 'suffix-icon': '', + maxlength: null, + 'show-word-limit': false, + readonly: false, + disabled: false, + required: true, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/input' + }, + { + label: '计数器', + tag: 'el-input-number', + tagIcon: 'number', + placeholder: '', + defaultValue: undefined, + span: 24, + labelWidth: null, + min: undefined, + max: undefined, + step: undefined, + 'step-strictly': false, + precision: undefined, + 'controls-position': '', + disabled: false, + required: true, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/input-number' + } +] + +export const selectComponents = [ + { + label: '下拉选择', + tag: 'el-select', + tagIcon: 'select', + placeholder: '请选择', + defaultValue: undefined, + span: 24, + labelWidth: null, + style: { width: '100%' }, + clearable: true, + disabled: false, + required: true, + filterable: false, + multiple: false, + options: [{ + label: '选项一', + value: 1 + }, { + label: '选项二', + value: 2 + }], + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/select' + }, + { + label: '级联选择', + tag: 'el-cascader', + tagIcon: 'cascader', + placeholder: '请选择', + defaultValue: [], + span: 24, + labelWidth: null, + style: { width: '100%' }, + props: { + props: { + multiple: false + } + }, + 'show-all-levels': true, + disabled: false, + clearable: true, + filterable: false, + required: true, + options: [{ + id: 1, + value: 1, + label: '选项1', + children: [{ + id: 2, + value: 2, + label: '选项1-1' + }] + }], + dataType: 'dynamic', + labelKey: 'label', + valueKey: 'value', + childrenKey: 'children', + separator: '/', + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/cascader' + }, + { + label: '单选框组', + tag: 'el-radio-group', + tagIcon: 'radio', + defaultValue: undefined, + span: 24, + labelWidth: null, + style: {}, + optionType: 'default', + border: false, + size: 'medium', + disabled: false, + required: true, + options: [{ + label: '选项一', + value: 1 + }, { + label: '选项二', + value: 2 + }], + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/radio' + }, + { + label: '多选框组', + tag: 'el-checkbox-group', + tagIcon: 'checkbox', + defaultValue: [], + span: 24, + labelWidth: null, + style: {}, + optionType: 'default', + border: false, + size: 'medium', + disabled: false, + required: true, + options: [{ + label: '选项一', + value: 1 + }, { + label: '选项二', + value: 2 + }], + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/checkbox' + }, + { + label: '开关', + tag: 'el-switch', + tagIcon: 'switch', + defaultValue: false, + span: 24, + labelWidth: null, + style: {}, + disabled: false, + required: true, + 'active-text': '', + 'inactive-text': '', + 'active-color': null, + 'inactive-color': null, + 'active-value': true, + 'inactive-value': false, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/switch' + }, + { + label: '滑块', + tag: 'el-slider', + tagIcon: 'slider', + defaultValue: null, + span: 24, + labelWidth: null, + disabled: false, + required: true, + min: 0, + max: 100, + step: 1, + 'show-stops': false, + range: false, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/slider' + }, + { + label: '时间选择', + tag: 'el-time-picker', + tagIcon: 'time', + placeholder: '请选择', + defaultValue: null, + span: 24, + labelWidth: null, + style: { width: '100%' }, + disabled: false, + clearable: true, + required: true, + 'picker-options': { + selectableRange: '00:00:00-23:59:59' + }, + format: 'HH:mm:ss', + 'value-format': 'HH:mm:ss', + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/time-picker' + }, + { + label: '时间范围', + tag: 'el-time-picker', + tagIcon: 'time-range', + defaultValue: null, + span: 24, + labelWidth: null, + style: { width: '100%' }, + disabled: false, + clearable: true, + required: true, + 'is-range': true, + 'range-separator': '至', + 'start-placeholder': '开始时间', + 'end-placeholder': '结束时间', + format: 'HH:mm:ss', + 'value-format': 'HH:mm:ss', + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/time-picker' + }, + { + label: '日期选择', + tag: 'el-date-picker', + tagIcon: 'date', + placeholder: '请选择', + defaultValue: null, + type: 'date', + span: 24, + labelWidth: null, + style: { width: '100%' }, + disabled: false, + clearable: true, + required: true, + format: 'yyyy-MM-dd', + 'value-format': 'yyyy-MM-dd', + readonly: false, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/date-picker' + }, + { + label: '日期范围', + tag: 'el-date-picker', + tagIcon: 'date-range', + defaultValue: null, + span: 24, + labelWidth: null, + style: { width: '100%' }, + type: 'daterange', + 'range-separator': '至', + 'start-placeholder': '开始日期', + 'end-placeholder': '结束日期', + disabled: false, + clearable: true, + required: true, + format: 'yyyy-MM-dd', + 'value-format': 'yyyy-MM-dd', + readonly: false, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/date-picker' + }, + { + label: '评分', + tag: 'el-rate', + tagIcon: 'rate', + defaultValue: 0, + span: 24, + labelWidth: null, + style: {}, + max: 5, + 'allow-half': false, + 'show-text': false, + 'show-score': false, + disabled: false, + required: true, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/rate' + }, + { + label: '颜色选择', + tag: 'el-color-picker', + tagIcon: 'color', + defaultValue: null, + labelWidth: null, + 'show-alpha': false, + 'color-format': '', + disabled: false, + required: true, + size: 'medium', + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/color-picker' + }, + { + label: '上传', + tag: 'el-upload', + tagIcon: 'upload', + action: 'https://jsonplaceholder.typicode.com/posts/', + defaultValue: null, + labelWidth: null, + disabled: false, + required: true, + accept: '', + name: 'file', + 'auto-upload': true, + showTip: false, + buttonText: '点击上传', + fileSize: 2, + sizeUnit: 'MB', + 'list-type': 'text', + multiple: false, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/upload' + } +] + +export const layoutComponents = [ + { + layout: 'rowFormItem', + tagIcon: 'row', + type: 'default', + justify: 'start', + align: 'top', + label: '行容器', + layoutTree: true, + children: [], + document: 'https://element.eleme.cn/#/zh-CN/component/layout' + }, + { + layout: 'colFormItem', + label: '按钮', + changeTag: true, + labelWidth: null, + tag: 'el-button', + tagIcon: 'button', + span: 24, + default: '主要按钮', + type: 'primary', + icon: 'el-icon-search', + size: 'medium', + disabled: false, + document: 'https://element.eleme.cn/#/zh-CN/component/button' + } +] + +// 组件rule的触发方式,无触发方式的组件不生成rule +export const trigger = { + 'el-input': 'blur', + 'el-input-number': 'blur', + 'el-select': 'change', + 'el-radio-group': 'change', + 'el-checkbox-group': 'change', + 'el-cascader': 'change', + 'el-time-picker': 'change', + 'el-date-picker': 'change', + 'el-rate': 'change' +} diff --git a/yunze-ui/src/utils/generator/css.js b/yunze-ui/src/utils/generator/css.js new file mode 100644 index 0000000..c1c62e6 --- /dev/null +++ b/yunze-ui/src/utils/generator/css.js @@ -0,0 +1,18 @@ +const styles = { + 'el-rate': '.el-rate{display: inline-block; vertical-align: text-top;}', + 'el-upload': '.el-upload__tip{line-height: 1.2;}' +} + +function addCss(cssList, el) { + const css = styles[el.tag] + css && cssList.indexOf(css) === -1 && cssList.push(css) + if (el.children) { + el.children.forEach(el2 => addCss(cssList, el2)) + } +} + +export function makeUpCss(conf) { + const cssList = [] + conf.fields.forEach(el => addCss(cssList, el)) + return cssList.join('\n') +} diff --git a/yunze-ui/src/utils/generator/drawingDefalut.js b/yunze-ui/src/utils/generator/drawingDefalut.js new file mode 100644 index 0000000..09f133c --- /dev/null +++ b/yunze-ui/src/utils/generator/drawingDefalut.js @@ -0,0 +1,29 @@ +export default [ + { + layout: 'colFormItem', + tagIcon: 'input', + label: '手机号', + vModel: 'mobile', + formId: 6, + tag: 'el-input', + placeholder: '请输入手机号', + defaultValue: '', + span: 24, + style: { width: '100%' }, + clearable: true, + prepend: '', + append: '', + 'prefix-icon': 'el-icon-mobile', + 'suffix-icon': '', + maxlength: 11, + 'show-word-limit': true, + readonly: false, + disabled: false, + required: true, + changeTag: true, + regList: [{ + pattern: '/^1(3|4|5|7|8|9)\\d{9}$/', + message: '手机号格式错误' + }] + } +] diff --git a/yunze-ui/src/utils/generator/html.js b/yunze-ui/src/utils/generator/html.js new file mode 100644 index 0000000..ebf628d --- /dev/null +++ b/yunze-ui/src/utils/generator/html.js @@ -0,0 +1,359 @@ +/* eslint-disable max-len */ +import { trigger } from './config' + +let confGlobal +let someSpanIsNot24 + +export function dialogWrapper(str) { + return ` + ${str} +
+ 取消 + 确定 +
+
` +} + +export function vueTemplate(str) { + return `` +} + +export function vueScript(str) { + return `` +} + +export function cssStyle(cssStr) { + return `` +} + +function buildFormTemplate(conf, child, type) { + let labelPosition = '' + if (conf.labelPosition !== 'right') { + labelPosition = `label-position="${conf.labelPosition}"` + } + const disabled = conf.disabled ? `:disabled="${conf.disabled}"` : '' + let str = ` + ${child} + ${buildFromBtns(conf, type)} + ` + if (someSpanIsNot24) { + str = ` + ${str} + ` + } + return str +} + +function buildFromBtns(conf, type) { + let str = '' + if (conf.formBtns && type === 'file') { + str = ` + 提交 + 重置 + ` + if (someSpanIsNot24) { + str = ` + ${str} + ` + } + } + return str +} + +// span不为24的用el-col包裹 +function colWrapper(element, str) { + if (someSpanIsNot24 || element.span !== 24) { + return ` + ${str} + ` + } + return str +} + +const layouts = { + colFormItem(element) { + let labelWidth = '' + if (element.labelWidth && element.labelWidth !== confGlobal.labelWidth) { + labelWidth = `label-width="${element.labelWidth}px"` + } + const required = !trigger[element.tag] && element.required ? 'required' : '' + const tagDom = tags[element.tag] ? tags[element.tag](element) : null + let str = ` + ${tagDom} + ` + str = colWrapper(element, str) + return str + }, + rowFormItem(element) { + const type = element.type === 'default' ? '' : `type="${element.type}"` + const justify = element.type === 'default' ? '' : `justify="${element.justify}"` + const align = element.type === 'default' ? '' : `align="${element.align}"` + const gutter = element.gutter ? `gutter="${element.gutter}"` : '' + const children = element.children.map(el => layouts[el.layout](el)) + let str = ` + ${children.join('\n')} + ` + str = colWrapper(element, str) + return str + } +} + +const tags = { + 'el-button': el => { + const { + tag, disabled + } = attrBuilder(el) + const type = el.type ? `type="${el.type}"` : '' + const icon = el.icon ? `icon="${el.icon}"` : '' + const size = el.size ? `size="${el.size}"` : '' + let child = buildElButtonChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${type} ${icon} ${size} ${disabled}>${child}` + }, + 'el-input': el => { + const { + disabled, vModel, clearable, placeholder, width + } = attrBuilder(el) + const maxlength = el.maxlength ? `:maxlength="${el.maxlength}"` : '' + const showWordLimit = el['show-word-limit'] ? 'show-word-limit' : '' + const readonly = el.readonly ? 'readonly' : '' + const prefixIcon = el['prefix-icon'] ? `prefix-icon='${el['prefix-icon']}'` : '' + const suffixIcon = el['suffix-icon'] ? `suffix-icon='${el['suffix-icon']}'` : '' + const showPassword = el['show-password'] ? 'show-password' : '' + const type = el.type ? `type="${el.type}"` : '' + const autosize = el.autosize && el.autosize.minRows + ? `:autosize="{minRows: ${el.autosize.minRows}, maxRows: ${el.autosize.maxRows}}"` + : '' + let child = buildElInputChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${vModel} ${type} ${placeholder} ${maxlength} ${showWordLimit} ${readonly} ${disabled} ${clearable} ${prefixIcon} ${suffixIcon} ${showPassword} ${autosize} ${width}>${child}` + }, + 'el-input-number': el => { + const { disabled, vModel, placeholder } = attrBuilder(el) + const controlsPosition = el['controls-position'] ? `controls-position=${el['controls-position']}` : '' + const min = el.min ? `:min='${el.min}'` : '' + const max = el.max ? `:max='${el.max}'` : '' + const step = el.step ? `:step='${el.step}'` : '' + const stepStrictly = el['step-strictly'] ? 'step-strictly' : '' + const precision = el.precision ? `:precision='${el.precision}'` : '' + + return `<${el.tag} ${vModel} ${placeholder} ${step} ${stepStrictly} ${precision} ${controlsPosition} ${min} ${max} ${disabled}>` + }, + 'el-select': el => { + const { + disabled, vModel, clearable, placeholder, width + } = attrBuilder(el) + const filterable = el.filterable ? 'filterable' : '' + const multiple = el.multiple ? 'multiple' : '' + let child = buildElSelectChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${vModel} ${placeholder} ${disabled} ${multiple} ${filterable} ${clearable} ${width}>${child}` + }, + 'el-radio-group': el => { + const { disabled, vModel } = attrBuilder(el) + const size = `size="${el.size}"` + let child = buildElRadioGroupChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${vModel} ${size} ${disabled}>${child}` + }, + 'el-checkbox-group': el => { + const { disabled, vModel } = attrBuilder(el) + const size = `size="${el.size}"` + const min = el.min ? `:min="${el.min}"` : '' + const max = el.max ? `:max="${el.max}"` : '' + let child = buildElCheckboxGroupChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${vModel} ${min} ${max} ${size} ${disabled}>${child}` + }, + 'el-switch': el => { + const { disabled, vModel } = attrBuilder(el) + const activeText = el['active-text'] ? `active-text="${el['active-text']}"` : '' + const inactiveText = el['inactive-text'] ? `inactive-text="${el['inactive-text']}"` : '' + const activeColor = el['active-color'] ? `active-color="${el['active-color']}"` : '' + const inactiveColor = el['inactive-color'] ? `inactive-color="${el['inactive-color']}"` : '' + const activeValue = el['active-value'] !== true ? `:active-value='${JSON.stringify(el['active-value'])}'` : '' + const inactiveValue = el['inactive-value'] !== false ? `:inactive-value='${JSON.stringify(el['inactive-value'])}'` : '' + + return `<${el.tag} ${vModel} ${activeText} ${inactiveText} ${activeColor} ${inactiveColor} ${activeValue} ${inactiveValue} ${disabled}>` + }, + 'el-cascader': el => { + const { + disabled, vModel, clearable, placeholder, width + } = attrBuilder(el) + const options = el.options ? `:options="${el.vModel}Options"` : '' + const props = el.props ? `:props="${el.vModel}Props"` : '' + const showAllLevels = el['show-all-levels'] ? '' : ':show-all-levels="false"' + const filterable = el.filterable ? 'filterable' : '' + const separator = el.separator === '/' ? '' : `separator="${el.separator}"` + + return `<${el.tag} ${vModel} ${options} ${props} ${width} ${showAllLevels} ${placeholder} ${separator} ${filterable} ${clearable} ${disabled}>` + }, + 'el-slider': el => { + const { disabled, vModel } = attrBuilder(el) + const min = el.min ? `:min='${el.min}'` : '' + const max = el.max ? `:max='${el.max}'` : '' + const step = el.step ? `:step='${el.step}'` : '' + const range = el.range ? 'range' : '' + const showStops = el['show-stops'] ? `:show-stops="${el['show-stops']}"` : '' + + return `<${el.tag} ${min} ${max} ${step} ${vModel} ${range} ${showStops} ${disabled}>` + }, + 'el-time-picker': el => { + const { + disabled, vModel, clearable, placeholder, width + } = attrBuilder(el) + const startPlaceholder = el['start-placeholder'] ? `start-placeholder="${el['start-placeholder']}"` : '' + const endPlaceholder = el['end-placeholder'] ? `end-placeholder="${el['end-placeholder']}"` : '' + const rangeSeparator = el['range-separator'] ? `range-separator="${el['range-separator']}"` : '' + const isRange = el['is-range'] ? 'is-range' : '' + const format = el.format ? `format="${el.format}"` : '' + const valueFormat = el['value-format'] ? `value-format="${el['value-format']}"` : '' + const pickerOptions = el['picker-options'] ? `:picker-options='${JSON.stringify(el['picker-options'])}'` : '' + + return `<${el.tag} ${vModel} ${isRange} ${format} ${valueFormat} ${pickerOptions} ${width} ${placeholder} ${startPlaceholder} ${endPlaceholder} ${rangeSeparator} ${clearable} ${disabled}>` + }, + 'el-date-picker': el => { + const { + disabled, vModel, clearable, placeholder, width + } = attrBuilder(el) + const startPlaceholder = el['start-placeholder'] ? `start-placeholder="${el['start-placeholder']}"` : '' + const endPlaceholder = el['end-placeholder'] ? `end-placeholder="${el['end-placeholder']}"` : '' + const rangeSeparator = el['range-separator'] ? `range-separator="${el['range-separator']}"` : '' + const format = el.format ? `format="${el.format}"` : '' + const valueFormat = el['value-format'] ? `value-format="${el['value-format']}"` : '' + const type = el.type === 'date' ? '' : `type="${el.type}"` + const readonly = el.readonly ? 'readonly' : '' + + return `<${el.tag} ${type} ${vModel} ${format} ${valueFormat} ${width} ${placeholder} ${startPlaceholder} ${endPlaceholder} ${rangeSeparator} ${clearable} ${readonly} ${disabled}>` + }, + 'el-rate': el => { + const { disabled, vModel } = attrBuilder(el) + const max = el.max ? `:max='${el.max}'` : '' + const allowHalf = el['allow-half'] ? 'allow-half' : '' + const showText = el['show-text'] ? 'show-text' : '' + const showScore = el['show-score'] ? 'show-score' : '' + + return `<${el.tag} ${vModel} ${allowHalf} ${showText} ${showScore} ${disabled}>` + }, + 'el-color-picker': el => { + const { disabled, vModel } = attrBuilder(el) + const size = `size="${el.size}"` + const showAlpha = el['show-alpha'] ? 'show-alpha' : '' + const colorFormat = el['color-format'] ? `color-format="${el['color-format']}"` : '' + + return `<${el.tag} ${vModel} ${size} ${showAlpha} ${colorFormat} ${disabled}>` + }, + 'el-upload': el => { + const disabled = el.disabled ? ':disabled=\'true\'' : '' + const action = el.action ? `:action="${el.vModel}Action"` : '' + const multiple = el.multiple ? 'multiple' : '' + const listType = el['list-type'] !== 'text' ? `list-type="${el['list-type']}"` : '' + const accept = el.accept ? `accept="${el.accept}"` : '' + const name = el.name !== 'file' ? `name="${el.name}"` : '' + const autoUpload = el['auto-upload'] === false ? ':auto-upload="false"' : '' + const beforeUpload = `:before-upload="${el.vModel}BeforeUpload"` + const fileList = `:file-list="${el.vModel}fileList"` + const ref = `ref="${el.vModel}"` + let child = buildElUploadChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${ref} ${fileList} ${action} ${autoUpload} ${multiple} ${beforeUpload} ${listType} ${accept} ${name} ${disabled}>${child}` + } +} + +function attrBuilder(el) { + return { + vModel: `v-model="${confGlobal.formModel}.${el.vModel}"`, + clearable: el.clearable ? 'clearable' : '', + placeholder: el.placeholder ? `placeholder="${el.placeholder}"` : '', + width: el.style && el.style.width ? ':style="{width: \'100%\'}"' : '', + disabled: el.disabled ? ':disabled=\'true\'' : '' + } +} + +// el-buttin 子级 +function buildElButtonChild(conf) { + const children = [] + if (conf.default) { + children.push(conf.default) + } + return children.join('\n') +} + +// el-input innerHTML +function buildElInputChild(conf) { + const children = [] + if (conf.prepend) { + children.push(``) + } + if (conf.append) { + children.push(``) + } + return children.join('\n') +} + +function buildElSelectChild(conf) { + const children = [] + if (conf.options && conf.options.length) { + children.push(``) + } + return children.join('\n') +} + +function buildElRadioGroupChild(conf) { + const children = [] + if (conf.options && conf.options.length) { + const tag = conf.optionType === 'button' ? 'el-radio-button' : 'el-radio' + const border = conf.border ? 'border' : '' + children.push(`<${tag} v-for="(item, index) in ${conf.vModel}Options" :key="index" :label="item.value" :disabled="item.disabled" ${border}>{{item.label}}`) + } + return children.join('\n') +} + +function buildElCheckboxGroupChild(conf) { + const children = [] + if (conf.options && conf.options.length) { + const tag = conf.optionType === 'button' ? 'el-checkbox-button' : 'el-checkbox' + const border = conf.border ? 'border' : '' + children.push(`<${tag} v-for="(item, index) in ${conf.vModel}Options" :key="index" :label="item.value" :disabled="item.disabled" ${border}>{{item.label}}`) + } + return children.join('\n') +} + +function buildElUploadChild(conf) { + const list = [] + if (conf['list-type'] === 'picture-card') list.push('') + else list.push(`${conf.buttonText}`) + if (conf.showTip) list.push(`
只能上传不超过 ${conf.fileSize}${conf.sizeUnit} 的${conf.accept}文件
`) + return list.join('\n') +} + +export function makeUpHtml(conf, type) { + const htmlList = [] + confGlobal = conf + someSpanIsNot24 = conf.fields.some(item => item.span !== 24) + conf.fields.forEach(el => { + htmlList.push(layouts[el.layout](el)) + }) + const htmlStr = htmlList.join('\n') + + let temp = buildFormTemplate(conf, htmlStr, type) + if (type === 'dialog') { + temp = dialogWrapper(temp) + } + confGlobal = null + return temp +} diff --git a/yunze-ui/src/utils/generator/icon.json b/yunze-ui/src/utils/generator/icon.json new file mode 100644 index 0000000..873aefb --- /dev/null +++ b/yunze-ui/src/utils/generator/icon.json @@ -0,0 +1 @@ +["platform-eleme","eleme","delete-solid","delete","s-tools","setting","user-solid","user","phone","phone-outline","more","more-outline","star-on","star-off","s-goods","goods","warning","warning-outline","question","info","remove","circle-plus","success","error","zoom-in","zoom-out","remove-outline","circle-plus-outline","circle-check","circle-close","s-help","help","minus","plus","check","close","picture","picture-outline","picture-outline-round","upload","upload2","download","camera-solid","camera","video-camera-solid","video-camera","message-solid","bell","s-cooperation","s-order","s-platform","s-fold","s-unfold","s-operation","s-promotion","s-home","s-release","s-ticket","s-management","s-open","s-shop","s-marketing","s-flag","s-comment","s-finance","s-claim","s-custom","s-opportunity","s-data","s-check","s-grid","menu","share","d-caret","caret-left","caret-right","caret-bottom","caret-top","bottom-left","bottom-right","back","right","bottom","top","top-left","top-right","arrow-left","arrow-right","arrow-down","arrow-up","d-arrow-left","d-arrow-right","video-pause","video-play","refresh","refresh-right","refresh-left","finished","sort","sort-up","sort-down","rank","loading","view","c-scale-to-original","date","edit","edit-outline","folder","folder-opened","folder-add","folder-remove","folder-delete","folder-checked","tickets","document-remove","document-delete","document-copy","document-checked","document","document-add","printer","paperclip","takeaway-box","search","monitor","attract","mobile","scissors","umbrella","headset","brush","mouse","coordinate","magic-stick","reading","data-line","data-board","pie-chart","data-analysis","collection-tag","film","suitcase","suitcase-1","receiving","collection","files","notebook-1","notebook-2","toilet-paper","office-building","school","table-lamp","house","no-smoking","smoking","shopping-cart-full","shopping-cart-1","shopping-cart-2","shopping-bag-1","shopping-bag-2","sold-out","sell","present","box","bank-card","money","coin","wallet","discount","price-tag","news","guide","male","female","thumb","cpu","link","connection","open","turn-off","set-up","chat-round","chat-line-round","chat-square","chat-dot-round","chat-dot-square","chat-line-square","message","postcard","position","turn-off-microphone","microphone","close-notification","bangzhu","time","odometer","crop","aim","switch-button","full-screen","copy-document","mic","stopwatch","medal-1","medal","trophy","trophy-1","first-aid-kit","discover","place","location","location-outline","location-information","add-location","delete-location","map-location","alarm-clock","timer","watch-1","watch","lock","unlock","key","service","mobile-phone","bicycle","truck","ship","basketball","football","soccer","baseball","wind-power","light-rain","lightning","heavy-rain","sunrise","sunrise-1","sunset","sunny","cloudy","partly-cloudy","cloudy-and-sunny","moon","moon-night","dish","dish-1","food","chicken","fork-spoon","knife-fork","burger","tableware","sugar","dessert","ice-cream","hot-water","water-cup","coffee-cup","cold-drink","goblet","goblet-full","goblet-square","goblet-square-full","refrigerator","grape","watermelon","cherry","apple","pear","orange","coffee","ice-tea","ice-drink","milk-tea","potato-strips","lollipop","ice-cream-square","ice-cream-round"] diff --git a/yunze-ui/src/utils/generator/js.js b/yunze-ui/src/utils/generator/js.js new file mode 100644 index 0000000..c6c06a9 --- /dev/null +++ b/yunze-ui/src/utils/generator/js.js @@ -0,0 +1,236 @@ +import { isArray } from 'util' +import { exportDefault, titleCase } from '@/utils/index' +import { trigger } from './config' + +const units = { + KB: '1024', + MB: '1024 / 1024', + GB: '1024 / 1024 / 1024' +} +let confGlobal +const inheritAttrs = { + file: '', + dialog: 'inheritAttrs: false,' +} + + +export function makeUpJs(conf, type) { + confGlobal = conf = JSON.parse(JSON.stringify(conf)) + const dataList = [] + const ruleList = [] + const optionsList = [] + const propsList = [] + const methodList = mixinMethod(type) + const uploadVarList = [] + + conf.fields.forEach(el => { + buildAttributes(el, dataList, ruleList, optionsList, methodList, propsList, uploadVarList) + }) + + const script = buildexport( + conf, + type, + dataList.join('\n'), + ruleList.join('\n'), + optionsList.join('\n'), + uploadVarList.join('\n'), + propsList.join('\n'), + methodList.join('\n') + ) + confGlobal = null + return script +} + +function buildAttributes(el, dataList, ruleList, optionsList, methodList, propsList, uploadVarList) { + buildData(el, dataList) + buildRules(el, ruleList) + + if (el.options && el.options.length) { + buildOptions(el, optionsList) + if (el.dataType === 'dynamic') { + const model = `${el.vModel}Options` + const options = titleCase(model) + buildOptionMethod(`get${options}`, model, methodList) + } + } + + if (el.props && el.props.props) { + buildProps(el, propsList) + } + + if (el.action && el.tag === 'el-upload') { + uploadVarList.push( + `${el.vModel}Action: '${el.action}', + ${el.vModel}fileList: [],` + ) + methodList.push(buildBeforeUpload(el)) + if (!el['auto-upload']) { + methodList.push(buildSubmitUpload(el)) + } + } + + if (el.children) { + el.children.forEach(el2 => { + buildAttributes(el2, dataList, ruleList, optionsList, methodList, propsList, uploadVarList) + }) + } +} + +function mixinMethod(type) { + const list = []; const + minxins = { + file: confGlobal.formBtns ? { + submitForm: `submitForm() { + this.$refs['${confGlobal.formRef}'].validate(valid => { + if(!valid) return + // TODO 提交表单 + }) + },`, + resetForm: `resetForm() { + this.$refs['${confGlobal.formRef}'].resetFields() + },` + } : null, + dialog: { + onOpen: 'onOpen() {},', + onClose: `onClose() { + this.$refs['${confGlobal.formRef}'].resetFields() + },`, + close: `close() { + this.$emit('update:visible', false) + },`, + handelConfirm: `handelConfirm() { + this.$refs['${confGlobal.formRef}'].validate(valid => { + if(!valid) return + this.close() + }) + },` + } + } + + const methods = minxins[type] + if (methods) { + Object.keys(methods).forEach(key => { + list.push(methods[key]) + }) + } + + return list +} + +function buildData(conf, dataList) { + if (conf.vModel === undefined) return + let defaultValue + if (typeof (conf.defaultValue) === 'string' && !conf.multiple) { + defaultValue = `'${conf.defaultValue}'` + } else { + defaultValue = `${JSON.stringify(conf.defaultValue)}` + } + dataList.push(`${conf.vModel}: ${defaultValue},`) +} + +function buildRules(conf, ruleList) { + if (conf.vModel === undefined) return + const rules = [] + if (trigger[conf.tag]) { + if (conf.required) { + const type = isArray(conf.defaultValue) ? 'type: \'array\',' : '' + let message = isArray(conf.defaultValue) ? `请至少选择一个${conf.vModel}` : conf.placeholder + if (message === undefined) message = `${conf.label}不能为空` + rules.push(`{ required: true, ${type} message: '${message}', trigger: '${trigger[conf.tag]}' }`) + } + if (conf.regList && isArray(conf.regList)) { + conf.regList.forEach(item => { + if (item.pattern) { + rules.push(`{ pattern: ${eval(item.pattern)}, message: '${item.message}', trigger: '${trigger[conf.tag]}' }`) + } + }) + } + ruleList.push(`${conf.vModel}: [${rules.join(',')}],`) + } +} + +function buildOptions(conf, optionsList) { + if (conf.vModel === undefined) return + if (conf.dataType === 'dynamic') { conf.options = [] } + const str = `${conf.vModel}Options: ${JSON.stringify(conf.options)},` + optionsList.push(str) +} + +function buildProps(conf, propsList) { + if (conf.dataType === 'dynamic') { + conf.valueKey !== 'value' && (conf.props.props.value = conf.valueKey) + conf.labelKey !== 'label' && (conf.props.props.label = conf.labelKey) + conf.childrenKey !== 'children' && (conf.props.props.children = conf.childrenKey) + } + const str = `${conf.vModel}Props: ${JSON.stringify(conf.props.props)},` + propsList.push(str) +} + +function buildBeforeUpload(conf) { + const unitNum = units[conf.sizeUnit]; let rightSizeCode = ''; let acceptCode = ''; const + returnList = [] + if (conf.fileSize) { + rightSizeCode = `let isRightSize = file.size / ${unitNum} < ${conf.fileSize} + if(!isRightSize){ + this.$message.error('文件大小超过 ${conf.fileSize}${conf.sizeUnit}') + }` + returnList.push('isRightSize') + } + if (conf.accept) { + acceptCode = `let isAccept = new RegExp('${conf.accept}').test(file.type) + if(!isAccept){ + this.$message.error('应该选择${conf.accept}类型的文件') + }` + returnList.push('isAccept') + } + const str = `${conf.vModel}BeforeUpload(file) { + ${rightSizeCode} + ${acceptCode} + return ${returnList.join('&&')} + },` + return returnList.length ? str : '' +} + +function buildSubmitUpload(conf) { + const str = `submitUpload() { + this.$refs['${conf.vModel}'].submit() + },` + return str +} + +function buildOptionMethod(methodName, model, methodList) { + const str = `${methodName}() { + // TODO 发起请求获取数据 + this.${model} + },` + methodList.push(str) +} + +function buildexport(conf, type, data, rules, selectOptions, uploadVar, props, methods) { + const str = `${exportDefault}{ + ${inheritAttrs[type]} + components: {}, + props: [], + data () { + return { + ${conf.formModel}: { + ${data} + }, + ${conf.formRules}: { + ${rules} + }, + ${uploadVar} + ${selectOptions} + ${props} + } + }, + computed: {}, + watch: {}, + created () {}, + mounted () {}, + methods: { + ${methods} + } +}` + return str +} diff --git a/yunze-ui/src/utils/generator/render.js b/yunze-ui/src/utils/generator/render.js new file mode 100644 index 0000000..e8640f0 --- /dev/null +++ b/yunze-ui/src/utils/generator/render.js @@ -0,0 +1,126 @@ +import { makeMap } from '@/utils/index' + +// 参考https://github.com/vuejs/vue/blob/v2.6.10/src/platforms/web/server/util.js +const isAttr = makeMap( + 'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' + + 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' + + 'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,' + + 'name,contenteditable,contextmenu,controls,coords,data,datetime,default,' + + 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,' + + 'form,formaction,headers,height,hidden,high,href,hreflang,http-equiv,' + + 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' + + 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' + + 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' + + 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' + + 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' + + 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' + + 'target,title,type,usemap,value,width,wrap' +) + +function vModel(self, dataObject, defaultValue) { + dataObject.props.value = defaultValue + + dataObject.on.input = val => { + self.$emit('input', val) + } +} + +const componentChild = { + 'el-button': { + default(h, conf, key) { + return conf[key] + }, + }, + 'el-input': { + prepend(h, conf, key) { + return + }, + append(h, conf, key) { + return + } + }, + 'el-select': { + options(h, conf, key) { + const list = [] + conf.options.forEach(item => { + list.push() + }) + return list + } + }, + 'el-radio-group': { + options(h, conf, key) { + const list = [] + conf.options.forEach(item => { + if (conf.optionType === 'button') list.push({item.label}) + else list.push({item.label}) + }) + return list + } + }, + 'el-checkbox-group': { + options(h, conf, key) { + const list = [] + conf.options.forEach(item => { + if (conf.optionType === 'button') { + list.push({item.label}) + } else { + list.push({item.label}) + } + }) + return list + } + }, + 'el-upload': { + 'list-type': (h, conf, key) => { + const list = [] + if (conf['list-type'] === 'picture-card') { + list.push() + } else { + list.push({conf.buttonText}) + } + if (conf.showTip) { + list.push(
只能上传不超过 {conf.fileSize}{conf.sizeUnit} 的{conf.accept}文件
) + } + return list + } + } +} + +export default { + render(h) { + const dataObject = { + attrs: {}, + props: {}, + on: {}, + style: {} + } + const confClone = JSON.parse(JSON.stringify(this.conf)) + const children = [] + + const childObjs = componentChild[confClone.tag] + if (childObjs) { + Object.keys(childObjs).forEach(key => { + const childFunc = childObjs[key] + if (confClone[key]) { + children.push(childFunc(h, confClone, key)) + } + }) + } + + Object.keys(confClone).forEach(key => { + const val = confClone[key] + if (key === 'vModel') { + vModel(this, dataObject, confClone.defaultValue) + } else if (dataObject[key]) { + dataObject[key] = val + } else if (!isAttr(key)) { + dataObject.props[key] = val + } else { + dataObject.attrs[key] = val + } + }) + return h(this.conf.tag, dataObject, children) + }, + props: ['conf'] +} diff --git a/yunze-ui/src/utils/index.js b/yunze-ui/src/utils/index.js new file mode 100644 index 0000000..7cb4d8d --- /dev/null +++ b/yunze-ui/src/utils/index.js @@ -0,0 +1,390 @@ +import { parseTime } from './ruoyi' + +/** + * 表格时间格式化 + */ +export function formatDate(cellValue) { + if (cellValue == null || cellValue == "") return ""; + var date = new Date(cellValue) + var year = date.getFullYear() + var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 + var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() + var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() + var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() + var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() + return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds +} + +/** + * @param {number} time + * @param {string} option + * @returns {string} + */ +export function formatTime(time, option) { + if (('' + time).length === 10) { + time = parseInt(time) * 1000 + } else { + time = +time + } + const d = new Date(time) + const now = Date.now() + + const diff = (now - d) / 1000 + + if (diff < 30) { + return '刚刚' + } else if (diff < 3600) { + // less 1 hour + return Math.ceil(diff / 60) + '分钟前' + } else if (diff < 3600 * 24) { + return Math.ceil(diff / 3600) + '小时前' + } else if (diff < 3600 * 24 * 2) { + return '1天前' + } + if (option) { + return parseTime(time, option) + } else { + return ( + d.getMonth() + + 1 + + '月' + + d.getDate() + + '日' + + d.getHours() + + '时' + + d.getMinutes() + + '分' + ) + } +} + +/** + * @param {string} url + * @returns {Object} + */ +export function getQueryObject(url) { + url = url == null ? window.location.href : url + const search = url.substring(url.lastIndexOf('?') + 1) + const obj = {} + const reg = /([^?&=]+)=([^?&=]*)/g + search.replace(reg, (rs, $1, $2) => { + const name = decodeURIComponent($1) + let val = decodeURIComponent($2) + val = String(val) + obj[name] = val + return rs + }) + return obj +} + +/** + * @param {string} input value + * @returns {number} output value + */ +export function byteLength(str) { + // returns the byte length of an utf8 string + let s = str.length + for (var i = str.length - 1; i >= 0; i--) { + const code = str.charCodeAt(i) + if (code > 0x7f && code <= 0x7ff) s++ + else if (code > 0x7ff && code <= 0xffff) s += 2 + if (code >= 0xDC00 && code <= 0xDFFF) i-- + } + return s +} + +/** + * @param {Array} actual + * @returns {Array} + */ +export function cleanArray(actual) { + const newArray = [] + for (let i = 0; i < actual.length; i++) { + if (actual[i]) { + newArray.push(actual[i]) + } + } + return newArray +} + +/** + * @param {Object} json + * @returns {Array} + */ +export function param(json) { + if (!json) return '' + return cleanArray( + Object.keys(json).map(key => { + if (json[key] === undefined) return '' + return encodeURIComponent(key) + '=' + encodeURIComponent(json[key]) + }) + ).join('&') +} + +/** + * @param {string} url + * @returns {Object} + */ +export function param2Obj(url) { + const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') + if (!search) { + return {} + } + const obj = {} + const searchArr = search.split('&') + searchArr.forEach(v => { + const index = v.indexOf('=') + if (index !== -1) { + const name = v.substring(0, index) + const val = v.substring(index + 1, v.length) + obj[name] = val + } + }) + return obj +} + +/** + * @param {string} val + * @returns {string} + */ +export function html2Text(val) { + const div = document.createElement('div') + div.innerHTML = val + return div.textContent || div.innerText +} + +/** + * Merges two objects, giving the last one precedence + * @param {Object} target + * @param {(Object|Array)} source + * @returns {Object} + */ +export function objectMerge(target, source) { + if (typeof target !== 'object') { + target = {} + } + if (Array.isArray(source)) { + return source.slice() + } + Object.keys(source).forEach(property => { + const sourceProperty = source[property] + if (typeof sourceProperty === 'object') { + target[property] = objectMerge(target[property], sourceProperty) + } else { + target[property] = sourceProperty + } + }) + return target +} + +/** + * @param {HTMLElement} element + * @param {string} className + */ +export function toggleClass(element, className) { + if (!element || !className) { + return + } + let classString = element.className + const nameIndex = classString.indexOf(className) + if (nameIndex === -1) { + classString += '' + className + } else { + classString = + classString.substr(0, nameIndex) + + classString.substr(nameIndex + className.length) + } + element.className = classString +} + +/** + * @param {string} type + * @returns {Date} + */ +export function getTime(type) { + if (type === 'start') { + return new Date().getTime() - 3600 * 1000 * 24 * 90 + } else { + return new Date(new Date().toDateString()) + } +} + +/** + * @param {Function} func + * @param {number} wait + * @param {boolean} immediate + * @return {*} + */ +export function debounce(func, wait, immediate) { + let timeout, args, context, timestamp, result + + const later = function() { + // 据上一次触发时间间隔 + const last = +new Date() - timestamp + + // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait + if (last < wait && last > 0) { + timeout = setTimeout(later, wait - last) + } else { + timeout = null + // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 + if (!immediate) { + result = func.apply(context, args) + if (!timeout) context = args = null + } + } + } + + return function(...args) { + context = this + timestamp = +new Date() + const callNow = immediate && !timeout + // 如果延时不存在,重新设定延时 + if (!timeout) timeout = setTimeout(later, wait) + if (callNow) { + result = func.apply(context, args) + context = args = null + } + + return result + } +} + +/** + * This is just a simple version of deep copy + * Has a lot of edge cases bug + * If you want to use a perfect deep copy, use lodash's _.cloneDeep + * @param {Object} source + * @returns {Object} + */ +export function deepClone(source) { + if (!source && typeof source !== 'object') { + throw new Error('error arguments', 'deepClone') + } + const targetObj = source.constructor === Array ? [] : {} + Object.keys(source).forEach(keys => { + if (source[keys] && typeof source[keys] === 'object') { + targetObj[keys] = deepClone(source[keys]) + } else { + targetObj[keys] = source[keys] + } + }) + return targetObj +} + +/** + * @param {Array} arr + * @returns {Array} + */ +export function uniqueArr(arr) { + return Array.from(new Set(arr)) +} + +/** + * @returns {string} + */ +export function createUniqueString() { + const timestamp = +new Date() + '' + const randomNum = parseInt((1 + Math.random()) * 65536) + '' + return (+(randomNum + timestamp)).toString(32) +} + +/** + * Check if an element has a class + * @param {HTMLElement} elm + * @param {string} cls + * @returns {boolean} + */ +export function hasClass(ele, cls) { + return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')) +} + +/** + * Add class to element + * @param {HTMLElement} elm + * @param {string} cls + */ +export function addClass(ele, cls) { + if (!hasClass(ele, cls)) ele.className += ' ' + cls +} + +/** + * Remove class from element + * @param {HTMLElement} elm + * @param {string} cls + */ +export function removeClass(ele, cls) { + if (hasClass(ele, cls)) { + const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)') + ele.className = ele.className.replace(reg, ' ') + } +} + +export function makeMap(str, expectsLowerCase) { + const map = Object.create(null) + const list = str.split(',') + for (let i = 0; i < list.length; i++) { + map[list[i]] = true + } + return expectsLowerCase + ? val => map[val.toLowerCase()] + : val => map[val] +} + +export const exportDefault = 'export default ' + +export const beautifierConf = { + html: { + indent_size: '2', + indent_char: ' ', + max_preserve_newlines: '-1', + preserve_newlines: false, + keep_array_indentation: false, + break_chained_methods: false, + indent_scripts: 'separate', + brace_style: 'end-expand', + space_before_conditional: true, + unescape_strings: false, + jslint_happy: false, + end_with_newline: true, + wrap_line_length: '110', + indent_inner_html: true, + comma_first: false, + e4x: true, + indent_empty_lines: true + }, + js: { + indent_size: '2', + indent_char: ' ', + max_preserve_newlines: '-1', + preserve_newlines: false, + keep_array_indentation: false, + break_chained_methods: false, + indent_scripts: 'normal', + brace_style: 'end-expand', + space_before_conditional: true, + unescape_strings: false, + jslint_happy: true, + end_with_newline: true, + wrap_line_length: '110', + indent_inner_html: true, + comma_first: false, + e4x: true, + indent_empty_lines: true + } +} + +// 首字母大小 +export function titleCase(str) { + return str.replace(/( |^)[a-z]/g, L => L.toUpperCase()) +} + +// 下划转驼峰 +export function camelCase(str) { + return str.replace(/-[a-z]/g, str1 => str1.substr(-1).toUpperCase()) +} + +export function isNumberStr(str) { + return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str) +} + diff --git a/yunze-ui/src/utils/jsencrypt.js b/yunze-ui/src/utils/jsencrypt.js new file mode 100644 index 0000000..20ea1a2 --- /dev/null +++ b/yunze-ui/src/utils/jsencrypt.js @@ -0,0 +1,53 @@ +import JSEncrypt from 'jsencrypt/bin/jsencrypt.min' + +// 密钥对生成 http://web.chacuo.net/netrsakeypair + +/*const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n' + + 'nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==' + +const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyrootSsYourNxaY\n' + + '7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXc123123u5xxB38SMSyP2KvuKN\n' + + 'PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n' + + 'kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n' + + 'cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n' + + 'DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n' + + 'YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflrootCKY7u3\n' + + 'UP8iWi1Qw0Y='*/ + +const publicKey ='MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCcHDbDfxkaicAgW+K5vo0fcjrK\n'+ + 'P3G/6dtDpAeycLof4ZdtThnGUiXqvTbZ63vJ+kccm/mnoPaOe9QvyqHWC+z3jooM\n'+ + 'hSlPSDSqSkCOJyD+Kd/4+YbpJd310EqSHso7CTF2rIVxD1dYTOfqB7pfqgGT8+a+\n'+ + 'friCBSwbcSbr9gD20wIDAQAB'; + + +const privateKey = 'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJwcNsN/GRqJwCBb\n'+ + '4rm+jR9yOso/cb/p20OkB7Jwuh/hl21OGcZSJeq9Ntnre8n6Rxyb+aeg9o571C/K\n'+ + 'odYL7PeOigyFKU9INKpKQI4nIP4p3/j5hukl3fXQSpIeyjsJMXashXEPV1hM5+oH\n'+ + 'ul+qAZPz5r5+uIIFLBtxJuv2APbTAgMBAAECgYEAhkC5VA004J7AjNOYu1bFdNq+\n'+ + '9nnzcDFEsPoa6HmLh6lxmb4F6olxNFv/FRAwCDZl+5Oj82Y5Q7X4eBVScosVAUUz\n'+ + '2CGQf4V9kGZuY2Mc7F624NCDqkfZIAyoF28lEbYfFILKfIfT4iUrRI1c7HWipwQB\n'+ + 'xDsiKoaY/1s2QIL75wECQQDMgFd78MEW/oJtp2lETL8ynbkzMICHzBAqgjtZyz7m\n'+ + '7BH4g+u9vf2qTHbXWYZj0upUnVLgfPEreMyWOMqMyWxTAkEAw2w5j3c9wWEBv6JH\n'+ + 'd7p2aLF5juTWdTh0sJ1tyb2D2QxM3Kv7STZc0wLSSPn3IIzRf9Cz4AKgg0ZL86n6\n'+ + 'EgT7gQJBAK9RxC6cW12UOks5v/Ru+2ewckrhZP+GwcE/vxQfO8ELV+i/aEZV8Hek\n'+ + 'cCn1NVK1SnHaImgUlUmYmYScEYIbWMMCQDrXWlmFSNXyNImT/jrhrQeG8JgC9UPk\n'+ + 'VNZdAJKu+oUe/AGx0v7PXJG4lsKcaTmmzOnUWGTJxbThNLtQYdiNIYECQFOseGzj\n'+ + 'jGc01DRsmBZvxXpHzYT/9jDCD69u1iT5DAf8Yyd7LTOZ7bBrGUgtTcWjghn8XXLR\n'+ + '6OhLTmvpgt9DIHY='; + + + +// 加密 +export function encrypt(txt) { + const encryptor = new JSEncrypt() + encryptor.setPublicKey(publicKey) // 设置公钥 + return encryptor.encrypt(txt) // 对数据进行加密 +} + +// 解密 +export function decrypt(txt) { + const encryptor = new JSEncrypt() + encryptor.setPrivateKey(privateKey) // 设置私钥 + return encryptor.decrypt(txt) // 对数据进行解密 +} + diff --git a/yunze-ui/src/utils/permission.js b/yunze-ui/src/utils/permission.js new file mode 100644 index 0000000..bd4c066 --- /dev/null +++ b/yunze-ui/src/utils/permission.js @@ -0,0 +1,51 @@ +import store from '@/store' + +/** + * 字符权限校验 + * @param {Array} value 校验值 + * @returns {Boolean} + */ +export function checkPermi(value) { + if (value && value instanceof Array && value.length > 0) { + const permissions = store.getters && store.getters.permissions + const permissionDatas = value + const all_permission = "*:*:*"; + + const hasPermission = permissions.some(permission => { + return all_permission === permission || permissionDatas.includes(permission) + }) + + if (!hasPermission) { + return false + } + return true + } else { + console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`) + return false + } +} + +/** + * 角色权限校验 + * @param {Array} value 校验值 + * @returns {Boolean} + */ +export function checkRole(value) { + if (value && value instanceof Array && value.length > 0) { + const roles = store.getters && store.getters.roles + const permissionRoles = value + const super_admin = "admin"; + + const hasRole = roles.some(role => { + return super_admin === role || permissionRoles.includes(role) + }) + + if (!hasRole) { + return false + } + return true + } else { + console.error(`need roles! Like checkRole="['admin','editor']"`) + return false + } +} diff --git a/yunze-ui/src/utils/request.js b/yunze-ui/src/utils/request.js new file mode 100644 index 0000000..789a0d4 --- /dev/null +++ b/yunze-ui/src/utils/request.js @@ -0,0 +1,103 @@ +import axios from 'axios' +import { Notification, MessageBox, Message } from 'element-ui' +import store from '@/store' +import { getToken } from '@/utils/auth' +import errorCode from '@/utils/errorCode' + +axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' +// 创建axios实例 +const service = axios.create({ + // axios中请求配置有baseURL选项,表示请求URL公共部分 + baseURL: process.env.VUE_APP_BASE_API, + // 超时 + timeout: 10000 +}) +// request拦截器 +service.interceptors.request.use(config => { + // 是否需要设置 token + const isToken = (config.headers || {}).isToken === false + if (getToken() && !isToken) { + config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + } + // get请求映射params参数 + if (config.method === 'get' && config.params) { + let url = config.url + '?'; + for (const propName of Object.keys(config.params)) { + const value = config.params[propName]; + var part = encodeURIComponent(propName) + "="; + if (value !== null && typeof(value) !== "undefined") { + if (typeof value === 'object') { + for (const key of Object.keys(value)) { + let params = propName + '[' + key + ']'; + var subPart = encodeURIComponent(params) + "="; + url += subPart + encodeURIComponent(value[key]) + "&"; + } + } else { + url += part + encodeURIComponent(value) + "&"; + } + } + } + url = url.slice(0, -1); + config.params = {}; + config.url = url; + } + return config +}, error => { + //console.log(error) + Promise.reject(error) +}) + +// 响应拦截器 +service.interceptors.response.use(res => { + // 未设置状态码则默认成功状态 + const code = res.data.code || 200; + // 获取错误信息 + const msg = errorCode[code] || res.data.msg || errorCode['default'] + if (code === 401) { + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { + confirmButtonText: '重新登录', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + store.dispatch('LogOut').then(() => { + location.href = '/index'; + }) + }).catch(() => {}); + } else if (code === 500) { + Message({ + message: msg, + type: 'error' + }) + return Promise.reject(new Error(msg)) + } else if (code !== 200) { + Notification.error({ + title: msg + }) + return Promise.reject('error') + } else { + return res.data + } + }, + error => { + //console.log('err' + error) + let { message } = error; + if (message == "Network Error") { + message = "后端接口连接异常"; + } + else if (message.includes("timeout")) { + message = "系统接口请求超时"; + } + else if (message.includes("Request failed with status code")) { + message = "系统接口" + message.substr(message.length - 3) + "异常"; + } + Message({ + message: message, + type: 'error', + duration: 5 * 1000 + }) + return Promise.reject(error) + } +) + +export default service diff --git a/yunze-ui/src/utils/ruoyi.js b/yunze-ui/src/utils/ruoyi.js new file mode 100644 index 0000000..cc2eb6b --- /dev/null +++ b/yunze-ui/src/utils/ruoyi.js @@ -0,0 +1,175 @@ +/** + * 通用js方法封装处理 + * Copyright (c) 2019 yunze + */ + +const baseURL = process.env.VUE_APP_BASE_API + +// 日期格式化 +export function parseTime(time, pattern) { + if (arguments.length === 0 || !time) { + return null + } + const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } else if (typeof time === 'string') { + time = time.replace(new RegExp(/-/gm), '/'); + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} + +// 表单重置 +export function resetForm(refName) { + if (this.$refs[refName]) { + this.$refs[refName].resetFields(); + } +} + +// 添加日期范围 +export function addDateRange(params, dateRange, propName) { + var search = params; + search.params = {}; + if (null != dateRange && '' != dateRange) { + if (typeof (propName) === "undefined") { + search.params["beginTime"] = dateRange[0]; + search.params["endTime"] = dateRange[1]; + } else { + search.params["begin" + propName] = dateRange[0]; + search.params["end" + propName] = dateRange[1]; + } + } + return search; +} + +// 回显数据字典 +export function selectDictLabel(datas, value) { + var actions = []; + Object.keys(datas).some((key) => { + if (datas[key].dictValue == ('' + value)) { + actions.push(datas[key].dictLabel); + return true; + } + }) + return actions.join(''); +} + +// 回显数据字典(字符串数组) +export function selectDictLabels(datas, value, separator) { + var actions = []; + var currentSeparator = undefined === separator ? "," : separator; + var temp = value.split(currentSeparator); + Object.keys(value.split(currentSeparator)).some((val) => { + Object.keys(datas).some((key) => { + if (datas[key].dictValue == ('' + temp[val])) { + actions.push(datas[key].dictLabel + currentSeparator); + } + }) + }) + return actions.join('').substring(0, actions.join('').length - 1); +} + +// 通用下载方法 +export function download(fileName) { + window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true; +} + +// 字符串格式化(%s ) +export function sprintf(str) { + var args = arguments, flag = true, i = 1; + str = str.replace(/%s/g, function () { + var arg = args[i++]; + if (typeof arg === 'undefined') { + flag = false; + return ''; + } + return arg; + }); + return flag ? str : ''; +} + +// 转换字符串,undefined,null等转化为"" +export function praseStrEmpty(str) { + if (!str || str == "undefined" || str == "null") { + return ""; + } + return str; +} + +/** + * 构造树型结构数据 + * @param {*} data 数据源 + * @param {*} id id字段 默认 'id' + * @param {*} parentId 父节点字段 默认 'parentId' + * @param {*} children 孩子节点字段 默认 'children' + */ +export function handleTree(data, id, parentId, children) { + let config = { + id: id || 'id', + parentId: parentId || 'parentId', + childrenList: children || 'children' + }; + + var childrenListMap = {}; + var nodeIds = {}; + var tree = []; + + for (let d of data) { + let parentId = d[config.parentId]; + if (childrenListMap[parentId] == null) { + childrenListMap[parentId] = []; + } + nodeIds[d[config.id]] = d; + childrenListMap[parentId].push(d); + } + + for (let d of data) { + let parentId = d[config.parentId]; + if (nodeIds[parentId] == null) { + tree.push(d); + } + } + + for (let t of tree) { + adaptToChildrenList(t); + } + + function adaptToChildrenList(o) { + if (childrenListMap[o[config.id]] !== null) { + o[config.childrenList] = childrenListMap[o[config.id]]; + } + if (o[config.childrenList]) { + for (let c of o[config.childrenList]) { + adaptToChildrenList(c); + } + } + } + return tree; +} diff --git a/yunze-ui/src/utils/scroll-to.js b/yunze-ui/src/utils/scroll-to.js new file mode 100644 index 0000000..c5d8e04 --- /dev/null +++ b/yunze-ui/src/utils/scroll-to.js @@ -0,0 +1,58 @@ +Math.easeInOutQuad = function(t, b, c, d) { + t /= d / 2 + if (t < 1) { + return c / 2 * t * t + b + } + t-- + return -c / 2 * (t * (t - 2) - 1) + b +} + +// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts +var requestAnimFrame = (function() { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) } +})() + +/** + * Because it's so fucking difficult to detect the scrolling element, just move them all + * @param {number} amount + */ +function move(amount) { + document.documentElement.scrollTop = amount + document.body.parentNode.scrollTop = amount + document.body.scrollTop = amount +} + +function position() { + return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop +} + +/** + * @param {number} to + * @param {number} duration + * @param {Function} callback + */ +export function scrollTo(to, duration, callback) { + const start = position() + const change = to - start + const increment = 20 + let currentTime = 0 + duration = (typeof (duration) === 'undefined') ? 500 : duration + var animateScroll = function() { + // increment the time + currentTime += increment + // find the value with the quadratic in-out easing function + var val = Math.easeInOutQuad(currentTime, start, change, duration) + // move the document.body + move(val) + // do the animation unless its over + if (currentTime < duration) { + requestAnimFrame(animateScroll) + } else { + if (callback && typeof (callback) === 'function') { + // the animation is done so lets callback + callback() + } + } + } + animateScroll() +} diff --git a/yunze-ui/src/utils/validate.js b/yunze-ui/src/utils/validate.js new file mode 100644 index 0000000..adfa254 --- /dev/null +++ b/yunze-ui/src/utils/validate.js @@ -0,0 +1,83 @@ +/** + * @param {string} path + * @returns {Boolean} + */ +export function isExternal(path) { + return /^(https?:|mailto:|tel:)/.test(path) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validUsername(str) { + const valid_map = ['admin', 'editor'] + return valid_map.indexOf(str.trim()) >= 0 +} + +/** + * @param {string} url + * @returns {Boolean} + */ +export function validURL(url) { + const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/ + return reg.test(url) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validLowerCase(str) { + const reg = /^[a-z]+$/ + return reg.test(str) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validUpperCase(str) { + const reg = /^[A-Z]+$/ + return reg.test(str) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validAlphabets(str) { + const reg = /^[A-Za-z]+$/ + return reg.test(str) +} + +/** + * @param {string} email + * @returns {Boolean} + */ +export function validEmail(email) { + const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ + return reg.test(email) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function isString(str) { + if (typeof str === 'string' || str instanceof String) { + return true + } + return false +} + +/** + * @param {Array} arg + * @returns {Boolean} + */ +export function isArray(arg) { + if (typeof Array.isArray === 'undefined') { + return Object.prototype.toString.call(arg) === '[object Array]' + } + return Array.isArray(arg) +} diff --git a/yunze-ui/src/utils/yunze/tools.js b/yunze-ui/src/utils/yunze/tools.js new file mode 100644 index 0000000..66745bb --- /dev/null +++ b/yunze-ui/src/utils/yunze/tools.js @@ -0,0 +1,1392 @@ +/** + * 基于 VUE + Element 的常用 函数 封装 + * @Data 2020-12-12 ~ 至今 + * @Author:root; + * @mailbox:546558392@qq.com; + */ +import CryptoJS from 'crypto-js/crypto-js' +import "crypto-js/aes" +import "crypto-js/pad-zeropadding" +import $ from "jquery"; + + + + +let tools = {} + + + + +//-----[Element 表格编辑()] 2021-10-13 +tools.Element_edit = function (){ + //数据可编辑 + $(".cell .MyEl_edit").on("toggle",function(){ + console.log(text); + var text=$(this).html(); + $(this).html(''); + $(this).children("input").val("").focus().val(text); + },function(){ + $(this).html($(this).children("input").val()); + } + ) + $(".cell .MyEl_edit").on("click",function(){ + console.log("click"+text); + var text=$(this).html(); + $(this).html(''); + $(this).children("input").val("").focus().val(text); + } ) + $(".cell .MyEl_edit").click(function(){ + console.log("click"+text); + var text=$(this).html(); + $(this).html(''); + $(this).children("input").val("").focus().val(text); + } ) + + + $(".cell .MyEl_edit").toggle(function(){ + var text=$(this).html(); + console.log(text); + $(this).html(''); + $(this).children("input").val("").focus().val(text); + },function(){ + $(this).html($(this).children("input").val()); + }) + //数据编辑失去焦点失效 + $(".Myel-table-edit").on("blur",function(){ + var text=$(this).val(); + $(this).parent().html(text); + }) +} +//-----[Element 表格编辑END] + + + + + + + + + + +/** + * 查询当前用户是否有操作权限 + */ +tools.hasResource=function(id){ + let _this=this + let requests =JSON.parse(sessionStorage.getItem("loginUser")) + if(requests.account===null){ + return false + } + for(let i=0;i0; + if (bool == false) { + tools.open(_this, Message) + } + return bool; +} +/** + * 判断是否为空值 + * @param val + * @returns + */ +tools.Is_null = function (val) { + //console.log(val) + //console.log(Object.is(val, NaN)) + if(Object.is(val, NaN)){ + //console.log("fffffff") + return false; + }else{ + val = tools.isNumber(val) == true ? val + "" : val;//如果是一个数字类型过滤成字符串 && isNaN(val)==false + return val != undefined && val != null && val != "" && val.trim() != "" && val != "undefined" && val != "null" && val != 'NaN' ? true : false;// + } +} + + +/** + * 通道接口调用时 计算 Sign + * @param _this + * @param map + * @param key + * @returns {string} + */ +tools.getSign = function (_this,map, key) { + // console.log("getSign====") + let signstr = ""; + let key_arr = []; + $.each(map, function (key, val) { + key_arr.push(key) + }) + //console.log(key_arr) + key_arr.sort(); + //console.log(key_arr) + $.each(key_arr, function (i, o) { + signstr += o + "=" + map.o + "&"; + }) + signstr = "key=" + key; + //console.log(signstr); + let sign = _this.$md5(signstr).toUpperCase(); + // console.log(sign); + return sign; +} + +/** + * obj 判断是否是一个数(number) + * @param obj + * @returns + */ +tools.isNumber = function (obj) { + return typeof obj === 'number' && !isNaN(obj); +} + + + + +/** + * 询问对话框 + * @param: _this = this + * @param: _type = 提示类型 【success,error,info,warning】 + * @param: Message = 消息主体 + * @param: TrueFun = 确定时 执行 函数 例【this.add】 前提是 add 必须有 + * @param: TrunPar = 确定时 执行 函数 参数 + * @param: FalseFun = 取消时 执行 函数 例【this.add】 前提是 add 必须有 + * @param: FalsePar = 取消时 执行 函数 参数 + */ +tools.openAsk = function (_this,_type, Message, TrueFun, TrunPar, FalseFun, FalsePar) { + _type = tools.Is_null(_type)?_type:"info"; + _this.$confirm(Message, { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: _type + }).then(() => { + TrueFun(TrunPar) + }).catch(() => { + if(FalseFun!=null){ + FalseFun(FalsePar); + } + }); +} + + + + + + + + + + + +/** + * 获取一个double值 + * @param P_number 传入值【任意字符】 + * @param De_val 【默认值】选参 + * @returns + */ +tools.set_double = function(val,De_val){ + //console.log(val); + //console.log(De_val); + De_val=tools.Is_null(De_val)==true?De_val:1;//默认值为空时给 1 + let reg_Tow = /^(?!0{2,})(?:\d{1,9}(\.\d+)?|10{9})$/; + let map={}; + if(val!=undefined && val!=null && val.trim()!=""){ + val=parseFloat(val); + val=tools.toFixed(val,2);//保留两位小数数据格式化 + val = reg_Tow.test(val)?val:De_val;//单价 + val = val =="0.00"? De_val:val; + }else{//默认单价 + val=De_val; + } + return val; +} + + + +/** + * toFixed(四舍五入重写) + * @param number + * @param decimal + * @returns + */ +tools.toFixed = function (number, decimal) { + decimal = decimal || 0; + let s = String(number); + let decimalIndex = s.indexOf('.'); + if (decimalIndex < 0) { + let fraction = ''; + for (let i = 0; i < decimal; i++) { + fraction += '0'; + } + return s + '.' + fraction; + } + let numDigits = s.length - 1 - decimalIndex; + if (numDigits <= decimal) { + let fraction = ''; + for (let i = 0; i < decimal - numDigits; i++) { + fraction += '0'; + } + return s + fraction; + } + let digits = s.split(''); + let pos = decimalIndex + decimal; + let roundDigit = digits[pos + 1]; + if (roundDigit > 4) { + //跳过小数点 + if (pos == decimalIndex) { + --pos; + } + digits[pos] = Number(digits[pos] || 0) + 1; + //循环进位 + while (digits[pos] == 10) { + digits[pos] = 0; + --pos; + if (pos == decimalIndex) { + --pos; + } + digits[pos] = Number(digits[pos] || 0) + 1; + } + } + //避免包含末尾的.符号 + if (decimal == 0) { + decimal--; + } + return digits.slice(0, decimalIndex + decimal + 1).join(''); +} + + +/** + * 针对文本域 换行符切割 过滤前后空格获取数组 + * @param lets + */ +tools.textareaGet = function (vars){ + vars = vars.split(/[\s\n]/); + //console.log(vars); + vars = $.grep(vars, function (x) { return $.trim(x).length > 0; }); + //console.log(vars); + return vars; +} + + + +//-----[获取当前时间] +tools.getTime =function () { + let myDate = new Date(); + let h = myDate.getHours(); //获取当前小时数(0-23) + let m = myDate.getMinutes(); //获取当前分钟数(0-59) + let s = myDate.getSeconds(); + let now = tools.p(h) + ':' + tools.p(m) + ":" + tools.p(s); + return now; +} + + +//-----[获取当前时间] +tools.getdatetime =function () { + let myDate = new Date(); + //获取当前年 + let year = myDate.getFullYear(); + //获取当前月 + let month = myDate.getMonth() + 1; + //获取当前日 + let date = myDate.getDate(); + let h = myDate.getHours(); //获取当前小时数(0-23) + let m = myDate.getMinutes(); //获取当前分钟数(0-59) + let s = myDate.getSeconds(); + let now = year + '-' +tools.p(month) + "-" + tools.p(date) + " " + tools.p(h) + ':' + tools.p(m) + ":" + tools.p(s); + + return now; +} + +tools.p =function (s) { + return s < 10 ? '0' + s : s; +} + + +//-----[获取前n天的日期] +tools.getBeforeDate =function (n) { + + let d = new Date(); + let year = d.getFullYear(); + let mon = d.getMonth() + 1; + let day = d.getDate(); + if(day <= n) { + if(mon > 1) { + mon = mon - 1; + } else { + year = year - 1; + mon = 12; + } + } + d.setDate(d.getDate() - n); + year = d.getFullYear(); + mon = d.getMonth() + 1; + day = d.getDate(); + let s = year + "-" + (mon < 10 ? ('0' + mon) : mon) + "-" + (day < 10 ? ('0' + day) : day); + return s; +} + + + +//-- 获取两个日期之间所有日期 +Date.prototype.format = function() { + let s = ''; + let mouth = (this.getMonth() + 1) >= 10 ? (this.getMonth() + 1) : ('0' + (this.getMonth() + 1)); + let day = this.getDate() >= 10 ? this.getDate() : ('0' + this.getDate()); + s += this.getFullYear() + '-'; // 获取年份。 + s += mouth + "-"; // 获取月份。 + s += day; // 获取日。 + return(s); // 返回日期。 +}; + +tools.getdateAll =function (begin, end) { + let $resdata = []; + let ab = begin.split("-"); + let ae = end.split("-"); + let db = new Date(); + db.setUTCFullYear(ab[0], ab[1] - 1, ab[2]); + let de = new Date(); + de.setUTCFullYear(ae[0], ae[1] - 1, ae[2]); + let unixDb = db.getTime(); + let unixDe = de.getTime(); + for(let k = unixDb; k <= unixDe;) { + $resdata.push(new Date(parseInt(k)).format()); + k = k + 24 * 60 * 60 * 1000; + } + return $resdata; +} + + + +//----[获取当前日期] +tools.gitData =function () { + function p(s) { + return s < 10 ? '0' + s : s; + } + let myDate = new Date(); + //获取当前年 + let year = myDate.getFullYear(); + //获取当前月 + let month = myDate.getMonth() + 1; + //获取当前日 + let date = myDate.getDate(); + return(year + '-' + p(month) + "-" + p(date)); +} + + +/** + * 格式化 数字每三位加逗号的方法(包含小数) + * @param str + * @returns {string} + */ +tools.formatNum =function (str) { + let newStr = ""; + let count = 0; + str = str+""; + //console.log(str) + // 当数字是整数 + if (str.indexOf(".") == -1) { + for (let i = str.length - 1; i >= 0; i--) { + if (count % 3 == 0 && count != 0) { + newStr = str.charAt(i) + "," + newStr; + } else { + newStr = str.charAt(i) + newStr; + } + count++; + } + str = newStr ; //自动补小数点后两位 + return str; + } + // 当数字带有小数 + else { + for (let i = str.indexOf(".") - 1; i >= 0; i--) { + if (count % 3 == 0 && count != 0) { + newStr = str.charAt(i) + "," + newStr; + } else { + newStr = str.charAt(i) + newStr; //逐个字符相接起来 + } + count++; + } + str = newStr + (str + "00").substr((str + "00").indexOf("."), 3); + return str; + } +} + + +/** + * 获取增长百分比 + * @param val1 + * @param val2 + * @returns {{}} + */ +tools.getPercentage =function (val1,val2) { + let map ={}; + + //let percentage = tools.NumberMul(tools.NumberSub((val1/val2),'1'),'100'); + //let percentage = tools.NumberMul(((val1/val2)-1),'100'); + //let percentage = ((val1/val2)-1)*100; + + let percentage = tools.NumberMul(tools.NumberSub(tools.NumberDiv(val1,val2,4),'1'),'100'); + //console.log("percentage = "+percentage); + //let percentage = ((180/80)-1)*100; + //console.log(percentage>0); + // console.log(parseFloat(percentage)>0); + percentage =parseFloat(percentage); + // console.log(percentage>0); + // console.log(percentage); + + if(percentage>0){ + map.type="up"; + map.percentage = percentage+"%"; + }else { + percentage = tools.Is_null(percentage)?percentage:0; + map.type="down"; + map.percentage = Math.abs(percentage)+"%"; + } + return map; +} + +/** + * 乘法 + * @param arg1 + * @param arg2 + * @returns {number} + * @constructor + */ +tools.NumberMul = function(arg1, arg2) { + var m = 0; + var s1 = arg1.toString(); + var s2 = arg2.toString(); + try { + m += s1.split(".")[1].length; + } catch (e) {} + try { + m += s2.split(".")[1].length; + } catch (e) {} + + return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m); +} + +/** + * 加法 + * @param arg1 + * @param arg2 + * @returns {string} + * @constructor + */ +tools.NumberAdd = function(arg1, arg2) { + var r1, r2, m, n; + arg1 = arg1+""; + arg2 = arg2+""; + try { + r1 = arg1.toString().split(".")[1].length + } catch (e) { + r1 = 0 + } + try { + r2 = arg2.toString().split(".")[1].length + } catch (e) { + r2 = 0 + } + m = Math.pow(10, Math.max(r1, r2)) + n = (r1 >= r2) ? r1 : r2; + return Number(((arg1 * m + arg2 * m) / m).toFixed(n)); +} + + +/** + * 减法 + * @param arg1 + * @param arg2 + * @returns {string} + * @constructor + */ +tools.NumberSub = function(arg1, arg2) { + var re1, re2, m, n; + arg1 = arg1+""; + arg2 = arg2+""; + try { + re1 = arg1.toString().split(".")[1].length; + } catch (e) { + re1 = 0; + } + try { + re2 = arg2.toString().split(".")[1].length; + } catch (e) { + re2 = 0; + } + m = Math.pow(10, Math.max(re1, re2)); + n = (re1 >= re2) ? re1 : re2; + return Number(((arg1 * m - arg2 * m) / m).toFixed(n)); +} + + +/** + * 除法 + * @param arg1 除数 + * @param arg2 被除数 + * @param digit 保留的小数点后的位数 + * @returns {number} + * @constructor + */ +tools.NumberDiv = function (arg1,arg2,digit){ + arg1 = arg1+""; + arg2 = arg2+""; + var t1=0,t2=0,r1,r2; + try{t1=arg1.toString().split(".")[1].length}catch(e){} + try{t2=arg2.toString().split(".")[1].length}catch(e){} + r1=Number(arg1.toString().replace(".","")) + r2=Number(arg2.toString().replace(".","")) + //获取小数点后的计算值 + var result= ((r1/r2)*Math.pow(10,t2-t1)).toString() + var result2=result.split(".")[1]; + result2 = result2+""; + result2=result2.substring(0,digit>result2.length?result2.length:digit); + + return Number(result.split(".")[0]+"."+result2); +} + + +/** + * 消息提示 + * @param _this + * @param _message + * @param _type + * @constructor + */ +tools.MessageShow = function (_this,_message,_type){ + _type = tools.Is_null(_type)?_type:""; + if(_type !='error'){ + _this.$notify.warning(_message) + }else { + _this.$notify.error(_message) + } +} + + +/* +tools.set_double = function (val,Defaults_val){ + Defaults_val=tools.Is_null(Defaults_val)==true?Defaults_val:1;//默认值为空时给 1 + let reg_Tow = /^(?!0{2,})(?:\d{1,9}(\.\d+)?|10{9})$/; + let map={}; + if(val!=undefined && val!=null && val.trim()!=""){ + val=parseFloat(val); + val=tools.toFixed(val,2);//保留两位小数数据格式化 + val = reg_Tow.test(val)?val:Defaults_val;//单价 + val = val =="0.00"? Defaults_val:val; + }else{//默认单价 + val=Defaults_val; + } + return val; +}*/ + + + +/** + * 获取一个整数值 + * @param P_number 传入值【任意字符】 + * @param Defaults_val 【默认值】选参 + * @returns + */ +tools.set_number = function (P_number,Defaults_val){ + Defaults_val=tools.Is_null(Defaults_val)==true?Defaults_val:1;//默认值为空时给 1 + let reg_Tow = /^(?!0{2,})(?:\d{1,9}(\.\d+)?|10{9})$/; + if(P_number!=undefined && P_number!=null && P_number.trim()!=""){ + P_number =parseInt(P_number); + P_number = reg_Tow.test(P_number)?P_number:Defaults_val;//数量 + P_number = P_number =="0"? Defaults_val:P_number; + }else{//默认 值 赋值 + P_number=Defaults_val; + } + return P_number; +} + + + +//----[多少毫秒后刷新界面] +tools.loadSX = function (s) { + setTimeout(function() { + window.location.reload(); + }, s); +} +//----[多少毫秒后刷新界面] + + +/** + * 减法运算 + * @param num1 + * @param num2 + * @returns + */ +tools.numSub = function (num1, num2) { + var baseNum, baseNum1, baseNum2; + try { + baseNum1 = num1.toString().split(".")[1].length; + } catch (e) { + baseNum1 = 0; + } + try { + baseNum2 = num2.toString().split(".")[1].length; + } catch (e) { + baseNum2 = 0; + } + baseNum = Math.pow(10, Math.max(baseNum1, baseNum2)); + var precision = (baseNum1 >= baseNum2) ? baseNum1 : baseNum2; + return ((num1 * baseNum - num2 * baseNum) / baseNum).toFixed(precision); +}; + +/** + * 除法运算,避免数据相除小数点后产生多位数和计算精度损失。 + * @param num1 + * @param num2 + * @data 2019-01-14 + * @returns + */ +tools.numDiv = function (num1, num2) { + var baseNum1 = 0, baseNum2 = 0; + var baseNum3, baseNum4; + try { + baseNum1 = num1.toString().split(".")[1].length; + } catch (e) { + baseNum1 = 0; + } + try { + baseNum2 = num2.toString().split(".")[1].length; + } catch (e) { + baseNum2 = 0; + } + // with (Math) { + baseNum3 = Number(num1.toString().replace(".", "")); + baseNum4 = Number(num2.toString().replace(".", "")); + return (baseNum3 / baseNum4) * Math.pow(10, baseNum2 - baseNum1); + //} +}; + +//-----[加法函数,用来得到精确的加法结果]2018-12-23 +tools.accAdd = function (arg1,arg2){ + + var r1,r2,m; + + try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0} + + try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0} + + m=Math.pow(10,Math.max(r1,r2)); + + return (tools.accMul(arg1,m)+tools.accMul(arg2,m))/m; + +} +//-----[加法函数,用来得到精确的加法结果END] +//-----[乘法]2018-12-23 +tools.accMul = function (arg1,arg2){ + var m=0,s1=arg1.toString(),s2=arg2.toString(); + try{m+=s1.split(".")[1].length}catch(e){} + try{m+=s2.split(".")[1].length}catch(e){} + return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m) +} +//-----[乘法end] + + +/** + * 获取值 为空时获取null + * @param val + * @returns + */ +tools.not_null_Get_value = function (val){ + return val!=undefined && val!=null && val!=""?val:null; +} + + + +/** + * obj 判断是否是一个数(number) + * @param obj + * @returns + */ +tools.isNumber = function (obj){ + return typeof obj === 'number' && !isNaN(obj); +} + +//-----[计算时间差] +tools.GetDateDiff = function (startTime, endTime, diffType) { + //将xxxx-xx-xx的时间格式,转换为 xxxx/xx/xx的格式 + //startTime = startTime.replace(/\-/g, "/"); + startTime.replace(RegExp("-", "g"), "/"); + //endTime = endTime.replace(/\-/g, "/"); + endTime.replace(RegExp("-", "g"), "/"); + //将计算间隔类性字符转换为小写 + diffType = diffType.toLowerCase(); + var sTime = new Date(startTime); //开始时间 + var eTime = new Date(endTime); //结束时间 + //作为除数的数字 + var timeType = 1; + switch(diffType) { + case "second": + timeType = 1000; + break; + case "minute": + timeType = 1000 * 60; + break; + case "hour": + timeType = 1000 * 3600; + break; + case "day": + timeType = 1000 * 3600 * 24; + break; + default: + break; + } + return parseInt((eTime.getTime() - sTime.getTime()) / parseInt(timeType)); +} +//-----[END][计算时间差] + + + + +//-----[清除特殊字符并提示element: 元素,df_val:默认值,MaxLeng 最大长度]2019-01-04 +tools.KeyUP_Cler = function (_this,$val,df_val,MaxLeng,Msg) { + var $bool = tools.RegeMatch($val) ? false : true; + MaxLeng = tools.Is_null(MaxLeng)?MaxLeng:50; + //console.log($bool) + if(!$bool){ + Msg = tools.Is_null(Msg)?Msg:"不能有特殊字符哦~"; + _this.msgError(Msg); + $val = window["df_val"]; + } + else{window["df_val"]=$val;}//赋值默认val + if(tools.Is_null($val) && $val.length>MaxLeng ){ + _this.msgError("最大长度为["+MaxLeng+"] !"); + $val = $val.substring(0,MaxLeng); + } + return $bool; +} +//-----[END][清除特殊字符并提示] + +//-----[过滤特殊字符] +tools.RegeMatch = function ($name) { + var pattern = new RegExp("[-` ~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()—+|{}【】‘;:”“’。,、?《》]"); + if($name != undefined && $name != null && $name != "" && $name.length > 0) { + if(pattern.test($name)) { + return true; + } else { + return false; + } + } +} +//-----[END][过滤特殊字符] + + + +//-----[过滤特殊字符] +tools.Textfilter = function(element,df_val){ + // 键盘按下过滤 + element.on("keyup",function(){ + tools.KeyUP_Cler(element,df_val); + }) + // 编辑文本框 失焦过滤 + element.on("blur",function(){ + tools.KeyUP_Cler(element,df_val); + }) +} + + + +/** + * 设置 编辑值为 int 或者 double 类型 + * @param element 【元素】如: $("#A") + * @param type 获取数类型 int or double + * @param Defaults_val 默认值 选填 + * @param maxlength 最大长度 + * @returns + */ +tools.val_number = function (element,type,Defaults_val,maxlength){ + //焦时获取元素 当前行,当前td + element.live("focus",function(data){ + window["_parent"]=$(this).parent().parent(); + window["_e"]=$(this).parent(); + }) + + // 键盘按下过滤 + element.live("keyup",function(data){ + $(this).attr("maxlength",maxlength); + var value=num_value($(this).val());//只能输入两位数小数和整数 + $(this).val(value); + }) + // 编辑文本框 失焦过滤 + element.live("blur",function(data){ + var _parent=window["_parent"]; + var _this=window["_e"]; + var val=_this.html(); + if("int"==type.toLowerCase()){ + val=set_number(val,Defaults_val) + }else if("double"==type.toLowerCase()){ + val=set_double(val,Defaults_val) + } + //延迟赋值 【解决动态编辑赋值的bug】 + setTimeout(function(){ + _this.html(val); + },10); + }) + +} + +//格式化 Double 保留后两位 +tools.handleInput2 = function (e) { + // 通过正则过滤小数点后两位 + e.target.value = (e.target.value.match(/^\d*(\.?\d{0,1})/g)[0]) || null +}, + + +//获取cookie + tools.getCookie = function (cname){ + var name = cname + "="; + var ca = document.cookie.split(';'); + //console.log("获取cookie,现在循环") + for (var i = 0; i < ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') c = c.substring(1); + if (c.indexOf(name) != -1){ + return c.substring(name.length, c.length); + } + } + return ""; + } + + +/*获取字典数据中的匹对key value*/ +tools.getDkeyValue = function(arr,key){ + /*let value = ''; + key = ""+key+""; + for (let i = 0; i < arr.length; i++) { + let map = arr[i]; + if(map.dictValue==key){ + value = map.dictLabel; + break; + } + } + return value;*/ + return tools.getkeyValue(arr,key,"dictValue","dictLabel"); +} + + +/*获取字典数据中的匹对key value 部门数据*/ +tools.getDeptNamekeyValue = function (arr,key){ + /*let value = ''; + key = ""+key+""; + for (let i = 0; i < arr.length; i++) { + let map = arr[i]; + if(map.dept_id==key){ + value = map.dept_name; + break; + } + } + return value;*/ + return tools.getkeyValue(arr,key,"dept_id","dept_name"); +} + + +/*获取字典数据中的匹对key value 用户数据*/ +tools.getUserNamekeyValue = function (arr,key){ + /* let value = ''; + key = ""+key+""; + for (let i = 0; i < arr.length; i++) { + let map = arr[i]; + if(map.user_id==key){ + value = map.nick_name; + break; + } + }*/ + //return value; + return tools.getkeyValue(arr,key,"user_id","nick_name"); +} + + +/*获取 资费组 中的匹对key value 用户数据*/ +tools.getPackageNNamekeyValue = function (arr,key){ + /*let value = ''; + key = ""+key+""; + for (let i = 0; i < arr.length; i++) { + let map = arr[i]; + if(map.package_id==key){ + value = map.package_agentname; + break; + } + }*/ + return tools.getkeyValue(arr,key,"package_id","package_agentname"); +} + + + + +/*获取 arr 中的匹对 keyVlue Rvalue 数据*/ +tools.getkeyValue = function (arr,key,keyVlue,Rvalue){ + let value = ''; + key = ""+key+""; + for (let i = 0; i < arr.length; i++) { + let map = arr[i]; + if(map[keyVlue]==key){ + value = map[Rvalue]; + break; + } + } + return value; +} + + + +/*获取 判断 key 是否在 arr 中*/ +tools.IsArrInside = function (arr,key,keyVlue){ + let bool = false; + key = ""+key+""; + for (let i = 0; i < arr.length; i++) { + let map = arr[i]; + if(map[key]==keyVlue){ + bool = true; + break; + } + } + return bool; +} + + + +// 格式方法 +// 公共方法 +tools.transitionJsonToString = function(jsonObj, callback) { + // 转换后的jsonObj受体对象 + var _jsonObj = null; + // 判断传入的jsonObj对象是不是字符串,如果是字符串需要先转换为对象,再转换为字符串,这样做是为了保证转换后的字符串为双引号 + if (Object.prototype.toString.call(jsonObj) !== "[object String]") { + try { + _jsonObj = JSON.stringify(jsonObj); + } catch (error) { + // 转换失败错误信息 + //callback(error); + console.error(error); + } + } else { + try { + jsonObj = jsonObj.replace(/(\')/g, '\"'); + _jsonObj = JSON.stringify(JSON.parse(jsonObj)); + } catch (error) { + // 转换失败错误信息 + //callback(error); + console.error(error); + } + } + return _jsonObj; +} +// callback为数据格式化错误的时候处理函数 +tools.formatJson = function (jsonObj, callback) { + // 正则表达式匹配规则变量 + var reg = null; + // 转换后的字符串变量 + var formatted = ''; + // 换行缩进位数 + var pad = 0; + // 一个tab对应空格位数 + var PADDING = ' '; + // json对象转换为字符串变量 + var jsonString = tools.transitionJsonToString(jsonObj, callback); + if (!jsonString) { + return jsonString; + } + // 存储需要特殊处理的字符串段 + var _index = []; + // 存储需要特殊处理的“再数组中的开始位置变量索引 + var _indexStart = null; + // 存储需要特殊处理的“再数组中的结束位置变量索引 + var _indexEnd = null; + // 将jsonString字符串内容通过\r\n符分割成数组 + var jsonArray = []; + // 正则匹配到{,}符号则在两边添加回车换行 + jsonString = jsonString.replace(/([\{\}])/g, '\r\n$1\r\n'); + // 正则匹配到[,]符号则在两边添加回车换行 + jsonString = jsonString.replace(/([\[\]])/g, '\r\n$1\r\n'); + // 正则匹配到,符号则在两边添加回车换行 + jsonString = jsonString.replace(/(\,)/g, '$1\r\n'); + // 正则匹配到要超过一行的换行需要改为一行 + jsonString = jsonString.replace(/(\r\n\r\n)/g, '\r\n'); + // 正则匹配到单独处于一行的,符号时需要去掉换行,将,置于同行 + jsonString = jsonString.replace(/\r\n\,/g, ','); + // 特殊处理双引号中的内容 + jsonArray = jsonString.split('\r\n'); + jsonArray.forEach(function (node, index) { + // 获取当前字符串段中"的数量 + var num = node.match(/\"/g) ? node.match(/\"/g).length : 0; + // 判断num是否为奇数来确定是否需要特殊处理 + if (num % 2 && !_indexStart) { + _indexStart = index + } + if (num % 2 && _indexStart && _indexStart != index) { + _indexEnd = index + } + // 将需要特殊处理的字符串段的其实位置和结束位置信息存入,并对应重置开始时和结束变量 + if (_indexStart && _indexEnd) { + _index.push({ + start: _indexStart, + end: _indexEnd + }) + _indexStart = null + _indexEnd = null + } + }) + // 开始处理双引号中的内容,将多余的"去除 + _index.reverse().forEach(function (item, index) { + var newArray = jsonArray.slice(item.start, item.end + 1) + jsonArray.splice(item.start, item.end + 1 - item.start, newArray.join('')) + }) + // 奖处理后的数组通过\r\n连接符重组为字符串 + jsonString = jsonArray.join('\r\n'); + // 将匹配到:后为回车换行加大括号替换为冒号加大括号 + jsonString = jsonString.replace(/\:\r\n\{/g, ':{'); + // 将匹配到:后为回车换行加中括号替换为冒号加中括号 + jsonString = jsonString.replace(/\:\r\n\[/g, ':['); + // 将上述转换后的字符串再次以\r\n分割成数组 + jsonArray = jsonString.split('\r\n'); + // 将转换完成的字符串根据PADDING值来组合成最终的形态 + jsonArray.forEach(function (item, index) { + //console.log(item) + var i = 0; + // 表示缩进的位数,以tab作为计数单位 + var indent = 0; + // 表示缩进的位数,以空格作为计数单位 + var padding = ''; + if (item.match(/\{$/) || item.match(/\[$/)) { + // 匹配到以{和[结尾的时候indent加1 + indent += 1 + } else if (item.match(/\}$/) || item.match(/\]$/) || item.match(/\},$/) || item.match(/\],$/)) { + // 匹配到以}和]结尾的时候indent减1 + if (pad !== 0) { + pad -= 1 + } + } else { + indent = 0 + } + for (i = 0; i < pad; i++) { + padding += PADDING + } + formatted += padding + item + '\r\n' + pad += indent + }) + // 返回的数据需要去除两边的空格 + return formatted.trim(); +} + + +/** + * 时间格式化 + */ +tools.dateFormat = function (fmt, date) { + let ret; + const opt = { + "Y+": date.getFullYear().toString(), // 年 + "m+": (date.getMonth() + 1).toString(), // 月 + "D+": date.getDate().toString(), // 日 + "H+": date.getHours().toString(), // 时 + "M+": date.getMinutes().toString(), // 分 + "S+": date.getSeconds().toString() // 秒 + // 有其他格式化字符需求可以继续添加,必须转化成字符串 + }; + for (let k in opt) { + ret = new RegExp("(" + k + ")").exec(fmt); + if (ret) { + fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "1"))) + }; + }; + return fmt; +} + + +/** + *推算月日期 + * @param mothSize 推算月日期 如 获取 近三个月 日期 传入 3 + * @returns {string} + */ +tools.getDateMonth = function (mothSize) { + var date1 = new Date(); + date1.setMonth(date1.getMonth()- mothSize); + var year1=date1.getFullYear(); + var month1=date1.getMonth()+1; + var day1=date1.getDay(); + month1 =(month1<10 ? '0'+month1:month1); + day1 =(day1<10 ? '0'+day1:day1); + var sDate = (year1.toString()+'-'+month1.toString()+'-'+day1); + return sDate; +} + +/** + * 创建唯一的字符串 + * @return {string} ojgdvbvaua40 + */ +tools.createUniqueString = function () { + const timestamp = +new Date() + '' + const randomNum = parseInt((1 + Math.random()) * 65536) + '' + return (+(randomNum + timestamp)).toString(32) +} + +/** + * 数字存储大小格式化 + * @param {number} num 存储大小 单位:Byte + * @param {number} digits 保留几位小数 + * @return {string} 2MB + */ +tools.toStorage = function (num, digits) { + digits = digits || 2 + if (num < 1024) { + return num + 'B' + } + num = (num * 1000 / 1024) + const si = [ + { value: 1E18, symbol: 'E' }, + { value: 1E15, symbol: 'P' }, + { value: 1E12, symbol: 'T' }, + { value: 1E9, symbol: 'G' }, + { value: 1E6, symbol: 'M' }, + { value: 1E3, symbol: 'K' } + ] + for (let i = 0; i < si.length; i++) { + if (num >= si[i].value) { + return (num / si[i].value).toFixed(digits).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + + si[i].symbol + 'B' + } + } +} + + + +tools.validImgUpload = function(file, size){ + size = +size || 10240; + const isSizeOut = file.size / 1024 > size; + if (isSizeOut) { + Message.error('上传图片大小不能超过' + tools.toStorage(size * 1024)) + } + return !isSizeOut +} + + + + + + + + +/* + * @Name: [Layui打开子窗体] + * @param: map-子窗体传递数据 + * @param: $URL-打开界面URl访问路径 + * @param: title-窗口标题 + * @param: R_fn-子窗返回参数执行函数名函数(选填) + * @param: area-窗口宽,高(选填,默认最大化) + * @param: btn-按钮组如['确认','取消'](选填) + * @param: btnAlign-按钮排序 + * @param: getParameter - 获取参数函数 (用于回调时获取父界面的执行函数参数获取 的函数) + * @author zf + * @date 2018-12-23 + * */ +tools.OpenView = function (_this,map,$URL,title,R_fn,area,btn,btnAlign,getParameter){ + area=area!=undefined && area!=null && area!=""?area:[''+$(window).width()+'px',''+$(window).height()+'px'];//默认宽高 + btn=area!=undefined && area!=null && area!=""?btn:[];//按钮默认无 + btnAlign=btnAlign!=undefined && btnAlign!=null && btnAlign!=""?btnAlign:"r";//按钮排列 l c r:左 中 右 + var Rmap={}; + _this.$layer.open({ + type: 2, //此处以iframe举例 + title: ''+title, + area: area, + shade: 0, + maxmin: true, + content: window.open($URL), + btn: btn, + btnAlign: btnAlign, + zIndex: _this.$layer.zIndex,//重点1 + success: function(layero, index){ + console.log($URL) + console.log(layero) + console.log(index) + // 获取子页面的iframe + var iframe = window['layui-layer-iframe' + index]; + // 向子页面的全局函数child传参 + Rmap=iframe.child(map); + }/*,cancel: function(){ //右上角关闭回调 + console.log("关闭") + //如果父窗体等待子界面传递参数,执行函数名R_fn不为空的请款下,执行函数并传递参数 + if(R_fn!=undefined && R_fn!=null && R_fn!=""){ + if(getParameter!=undefined && getParameter!=null ){//父界面调函数时获取参数定义时,执行父界面执行函数参数获取 + Rmap = Is_null(Rmap)==true?Rmap:getParameter(); + } + R_fn(Rmap);//执行父界面等待参数函数 + } + },yes: function(){//第一个按钮点击事件 + console.log("yes关闭") + if(R_fn!=undefined && R_fn!=null && R_fn!=""){ + if(getParameter!=undefined && getParameter!=null ){//父界面调函数时获取参数定义时,执行父界面执行函数参数获取 + Rmap = Is_null(Rmap)==true?Rmap:getParameter(); + } + R_fn(Rmap);//执行父界面等待参数函数 + } + layer.closeAll();//关闭窗口 + }*/, end: function () { + if(R_fn!=undefined && R_fn!=null && R_fn!=""){ + if(getParameter!=undefined && getParameter!=null ){//父界面调函数时获取参数定义时,执行父界面执行函数参数获取 + Rmap = Is_null(Rmap)==true?Rmap:getParameter(); + } + R_fn(Rmap);//执行父界面等待参数函数 + } + _this.$layer.closeAll();//关闭窗口 + } + }); +} +//-----[打开子窗体(map:传递数据;$URL:打开界面;title:标题;)END]2018-12-13 + + + +//-----[传入数组,值判断这个值是否在这个数组中true:在False:不在][2018-12-14] +tools.VerificationValIsArray = function (arr, val) { + var bool = false; + for(let i = 0; i < arr.length; i++) { + bool = arr[i] == val ? true : false; + if(bool) { + break; + } + } + return bool; +} +//-----[END][传入数组,值判断这个值是否在这个数组中] + + + + +/** + * js日期比较 yyyy-mm-dd + * @param firstDate + * @param lastDate + * @returns {boolean} + * @constructor + */ +tools.DateBiJiao = function (firstDate, lastDate) { + var arr = firstDate.split("-"); + var firsttime = new Date(arr[0], arr[1], arr[2]); + var firsttimes = firsttime.getTime(); + + var arrs = lastDate.split("-"); + var lasttime = new Date(arrs[0], arrs[1], arrs[2]); + var lasttimes = lasttime.getTime(); + + if (firsttimes> lasttimes) { + return false; + } + else + return true; +} + + + +/** + * js时间比较 yyyy-mm-dd hh:mi:ss + * @param firstDate + * @param lastDate + * @returns {string} + */ +tools.comptime = function (firstDate,lastDate) { + var beginTime = firstDate; + var endTime = lastDate; + var beginTimes = beginTime.substring(0, 10).split('-'); + var endTimes = endTime.substring(0, 10).split('-'); + + beginTime = beginTimes[1] + '-' + beginTimes[2] + '-' + beginTimes[0] + ' ' + beginTime.substring(10, 19); + endTime = endTimes[1] + '-' + endTimes[2] + '-' + endTimes[0] + ' ' + endTime.substring(10, 19); + + var a = (Date.parse(endTime) - Date.parse(beginTime)) / 3600 / 1000; + let Rval= ''; + if (a < 0) { + //alert("endTime小!"); + Rval= 'xiao'; + } else if (a > 0) { + //alert("endTime大!"); + Rval= 'da'; + } else if (a == 0) { + //alert("时间相等!"); + Rval= 'deng'; + } else { + Rval = 'exception' + } + return Rval; +} + + + +export default tools diff --git a/yunze-ui/src/utils/yunze/upload.js b/yunze-ui/src/utils/yunze/upload.js new file mode 100644 index 0000000..cb203dd --- /dev/null +++ b/yunze-ui/src/utils/yunze/upload.js @@ -0,0 +1,60 @@ +// An highlighted block +import COS from 'cos-js-sdk-v5' +/*import { getSecret } from '@/api/upload'*/ + +export default function upload(file, config, callback) { + if (typeof config.isPublic === 'undefined') { + config.isPublic = true + } + console.log(config); +/* getSecret({ + type: config.type, + path: config.path, + isPublic: config.isPublic ? config.isPublic : false + }).then(response => { + const data = response.data + const cos = new COS({ + getAuthorization: function(options, callback) { + callback({ + TmpSecretId: data.tmpSecretId, + TmpSecretKey: data.tmpSecretKey, + XCosSecurityToken: data.sessionToken, + ExpiredTime: data.expiredTime + }) + } + }) + + return { + cos: cos, + dir: data.url, + bucket: data.bucket, + region: data.region + } + }).then(data => { + const cos = data.cos + const dir = data.dir + const bucket = data.bucket + const region = data.region + + const url = cos.getObjectUrl({ + Bucket: bucket, + Region: region, + Key: `${dir}/${file.name}`, + Sign: false + }, function(data) { + cos.putObject({ + Bucket: bucket, + Region: region, + Key: `${dir}/${file.name}`, + Body: file + }, function(data) { + if (config.isPublic) { + callback(url.replace(/^http(s)?:\/\/(.*?)\//, 'https://www.baidu.com/')) + } else { + callback(url) + } + }) + }) + })*/ +} + diff --git a/yunze-ui/src/utils/zipdownload.js b/yunze-ui/src/utils/zipdownload.js new file mode 100644 index 0000000..fff4873 --- /dev/null +++ b/yunze-ui/src/utils/zipdownload.js @@ -0,0 +1,40 @@ +import axios from 'axios' +import { getToken } from '@/utils/auth' + +const mimeMap = { + xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + zip: 'application/zip' +} + +const baseUrl = process.env.VUE_APP_BASE_API +export function downLoadZip(str, filename) { + var url = baseUrl + str + axios({ + method: 'get', + url: url, + responseType: 'blob', + headers: { 'Authorization': 'Bearer ' + getToken() } + }).then(res => { + resolveBlob(res, mimeMap.zip) + }) +} +/** + * 解析blob响应内容并下载 + * @param {*} res blob响应内容 + * @param {String} mimeType MIME类型 + */ +export function resolveBlob(res, mimeType) { + const aLink = document.createElement('a') + var blob = new Blob([res.data], { type: mimeType }) + // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名; + var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*') + var contentDisposition = decodeURI(res.headers['content-disposition']) + var result = patt.exec(contentDisposition) + var fileName = result[1] + fileName = fileName.replace(/\"/g, '') + aLink.href = URL.createObjectURL(blob) + aLink.setAttribute('download', fileName) // 设置下载文件名称 + document.body.appendChild(aLink) + aLink.click() + document.body.removeChild(aLink); +} diff --git a/yunze-ui/src/views/components/icons/element-icons.js b/yunze-ui/src/views/components/icons/element-icons.js new file mode 100644 index 0000000..9ea4d63 --- /dev/null +++ b/yunze-ui/src/views/components/icons/element-icons.js @@ -0,0 +1,3 @@ +const elementIcons = ['platform-eleme', 'eleme', 'delete-solid', 'delete', 's-tools', 'setting', 'user-solid', 'user', 'phone', 'phone-outline', 'more', 'more-outline', 'star-on', 'star-off', 's-goods', 'goods', 'warning', 'warning-outline', 'question', 'info', 'remove', 'circle-plus', 'success', 'error', 'zoom-in', 'zoom-out', 'remove-outline', 'circle-plus-outline', 'circle-check', 'circle-close', 's-help', 'help', 'minus', 'plus', 'check', 'close', 'picture', 'picture-outline', 'picture-outline-round', 'upload', 'upload2', 'download', 'camera-solid', 'camera', 'video-camera-solid', 'video-camera', 'message-solid', 'bell', 's-cooperation', 's-order', 's-platform', 's-fold', 's-unfold', 's-operation', 's-promotion', 's-home', 's-release', 's-ticket', 's-management', 's-open', 's-shop', 's-marketing', 's-flag', 's-comment', 's-finance', 's-claim', 's-custom', 's-opportunity', 's-data', 's-check', 's-grid', 'menu', 'share', 'd-caret', 'caret-left', 'caret-right', 'caret-bottom', 'caret-top', 'bottom-left', 'bottom-right', 'back', 'right', 'bottom', 'top', 'top-left', 'top-right', 'arrow-left', 'arrow-right', 'arrow-down', 'arrow-up', 'd-arrow-left', 'd-arrow-right', 'video-pause', 'video-play', 'refresh', 'refresh-right', 'refresh-left', 'finished', 'sort', 'sort-up', 'sort-down', 'rank', 'loading', 'view', 'c-scale-to-original', 'date', 'edit', 'edit-outline', 'folder', 'folder-opened', 'folder-add', 'folder-remove', 'folder-delete', 'folder-checked', 'tickets', 'document-remove', 'document-delete', 'document-copy', 'document-checked', 'document', 'document-add', 'printer', 'paperclip', 'takeaway-box', 'search', 'monitor', 'attract', 'mobile', 'scissors', 'umbrella', 'headset', 'brush', 'mouse', 'coordinate', 'magic-stick', 'reading', 'data-line', 'data-board', 'pie-chart', 'data-analysis', 'collection-tag', 'film', 'suitcase', 'suitcase-1', 'receiving', 'collection', 'files', 'notebook-1', 'notebook-2', 'toilet-paper', 'office-building', 'school', 'table-lamp', 'house', 'no-smoking', 'smoking', 'shopping-cart-full', 'shopping-cart-1', 'shopping-cart-2', 'shopping-bag-1', 'shopping-bag-2', 'sold-out', 'sell', 'present', 'box', 'bank-card', 'money', 'coin', 'wallet', 'discount', 'price-tag', 'news', 'guide', 'male', 'female', 'thumb', 'cpu', 'link', 'connection', 'open', 'turn-off', 'set-up', 'chat-round', 'chat-line-round', 'chat-square', 'chat-dot-round', 'chat-dot-square', 'chat-line-square', 'message', 'postcard', 'position', 'turn-off-microphone', 'microphone', 'close-notification', 'bangzhu', 'time', 'odometer', 'crop', 'aim', 'switch-button', 'full-screen', 'copy-document', 'mic', 'stopwatch', 'medal-1', 'medal', 'trophy', 'trophy-1', 'first-aid-kit', 'discover', 'place', 'location', 'location-outline', 'location-information', 'add-location', 'delete-location', 'map-location', 'alarm-clock', 'timer', 'watch-1', 'watch', 'lock', 'unlock', 'key', 'service', 'mobile-phone', 'bicycle', 'truck', 'ship', 'basketball', 'football', 'soccer', 'baseball', 'wind-power', 'light-rain', 'lightning', 'heavy-rain', 'sunrise', 'sunrise-1', 'sunset', 'sunny', 'cloudy', 'partly-cloudy', 'cloudy-and-sunny', 'moon', 'moon-night', 'dish', 'dish-1', 'food', 'chicken', 'fork-spoon', 'knife-fork', 'burger', 'tableware', 'sugar', 'dessert', 'ice-cream', 'hot-water', 'water-cup', 'coffee-cup', 'cold-drink', 'goblet', 'goblet-full', 'goblet-square', 'goblet-square-full', 'refrigerator', 'grape', 'watermelon', 'cherry', 'apple', 'pear', 'orange', 'coffee', 'ice-tea', 'ice-drink', 'milk-tea', 'potato-strips', 'lollipop', 'ice-cream-square', 'ice-cream-round'] + +export default elementIcons diff --git a/yunze-ui/src/views/components/icons/index.vue b/yunze-ui/src/views/components/icons/index.vue new file mode 100644 index 0000000..d3c9a71 --- /dev/null +++ b/yunze-ui/src/views/components/icons/index.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/yunze-ui/src/views/components/icons/svg-icons.js b/yunze-ui/src/views/components/icons/svg-icons.js new file mode 100644 index 0000000..724cd8e --- /dev/null +++ b/yunze-ui/src/views/components/icons/svg-icons.js @@ -0,0 +1,10 @@ +const req = require.context('../../../assets/icons/svg', false, /\.svg$/) +const requireAll = requireContext => requireContext.keys() + +const re = /\.\/(.*)\.svg/ + +const svgIcons = requireAll(req).map(i => { + return i.match(re)[1] +}) + +export default svgIcons diff --git a/yunze-ui/src/views/dashboard/BarChart.vue b/yunze-ui/src/views/dashboard/BarChart.vue new file mode 100644 index 0000000..be0af34 --- /dev/null +++ b/yunze-ui/src/views/dashboard/BarChart.vue @@ -0,0 +1,102 @@ + + + diff --git a/yunze-ui/src/views/dashboard/LineChart.vue b/yunze-ui/src/views/dashboard/LineChart.vue new file mode 100644 index 0000000..e654168 --- /dev/null +++ b/yunze-ui/src/views/dashboard/LineChart.vue @@ -0,0 +1,135 @@ + + + diff --git a/yunze-ui/src/views/dashboard/PanelGroup.vue b/yunze-ui/src/views/dashboard/PanelGroup.vue new file mode 100644 index 0000000..1a1081f --- /dev/null +++ b/yunze-ui/src/views/dashboard/PanelGroup.vue @@ -0,0 +1,181 @@ + + + + + diff --git a/yunze-ui/src/views/dashboard/PieChart.vue b/yunze-ui/src/views/dashboard/PieChart.vue new file mode 100644 index 0000000..4d2ef32 --- /dev/null +++ b/yunze-ui/src/views/dashboard/PieChart.vue @@ -0,0 +1,79 @@ + + + diff --git a/yunze-ui/src/views/dashboard/RaddarChart.vue b/yunze-ui/src/views/dashboard/RaddarChart.vue new file mode 100644 index 0000000..6823af3 --- /dev/null +++ b/yunze-ui/src/views/dashboard/RaddarChart.vue @@ -0,0 +1,116 @@ + + + diff --git a/yunze-ui/src/views/dashboard/mixins/resize.js b/yunze-ui/src/views/dashboard/mixins/resize.js new file mode 100644 index 0000000..b1e76e9 --- /dev/null +++ b/yunze-ui/src/views/dashboard/mixins/resize.js @@ -0,0 +1,56 @@ +import { debounce } from '@/utils' + +export default { + data() { + return { + $_sidebarElm: null, + $_resizeHandler: null + } + }, + mounted() { + this.initListener() + }, + activated() { + if (!this.$_resizeHandler) { + // avoid duplication init + this.initListener() + } + + // when keep-alive chart activated, auto resize + this.resize() + }, + beforeDestroy() { + this.destroyListener() + }, + deactivated() { + this.destroyListener() + }, + methods: { + // use $_ for mixins properties + // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential + $_sidebarResizeHandler(e) { + if (e.propertyName === 'width') { + this.$_resizeHandler() + } + }, + initListener() { + this.$_resizeHandler = debounce(() => { + this.resize() + }, 100) + window.addEventListener('resize', this.$_resizeHandler) + + this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0] + this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler) + }, + destroyListener() { + window.removeEventListener('resize', this.$_resizeHandler) + this.$_resizeHandler = null + + this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler) + }, + resize() { + const { chart } = this + chart && chart.resize() + } + } +} diff --git a/yunze-ui/src/views/error/401.vue b/yunze-ui/src/views/error/401.vue new file mode 100644 index 0000000..448b6ec --- /dev/null +++ b/yunze-ui/src/views/error/401.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/yunze-ui/src/views/error/404.vue b/yunze-ui/src/views/error/404.vue new file mode 100644 index 0000000..96f075c --- /dev/null +++ b/yunze-ui/src/views/error/404.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/yunze-ui/src/views/index.vue b/yunze-ui/src/views/index.vue new file mode 100644 index 0000000..87a5dbd --- /dev/null +++ b/yunze-ui/src/views/index.vue @@ -0,0 +1,221 @@ + + + + + + diff --git a/yunze-ui/src/views/index_v1.vue b/yunze-ui/src/views/index_v1.vue new file mode 100644 index 0000000..d2d2ec6 --- /dev/null +++ b/yunze-ui/src/views/index_v1.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/yunze-ui/src/views/login.vue b/yunze-ui/src/views/login.vue new file mode 100644 index 0000000..df50e7b --- /dev/null +++ b/yunze-ui/src/views/login.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/yunze-ui/src/views/monitor/cache/index.vue b/yunze-ui/src/views/monitor/cache/index.vue new file mode 100644 index 0000000..df0cb1e --- /dev/null +++ b/yunze-ui/src/views/monitor/cache/index.vue @@ -0,0 +1,153 @@ + + + diff --git a/yunze-ui/src/views/monitor/druid/index.vue b/yunze-ui/src/views/monitor/druid/index.vue new file mode 100644 index 0000000..a1a0bd9 --- /dev/null +++ b/yunze-ui/src/views/monitor/druid/index.vue @@ -0,0 +1,26 @@ +