diff --git a/config/db/V5.7__device_add_table.sql b/config/db/V5.7__device_add_table.sql index 17cc2122..5cab9cc9 100644 --- a/config/db/V5.7__device_add_table.sql +++ b/config/db/V5.7__device_add_table.sql @@ -1,3 +1,6 @@ +DROP TABLE IF EXISTS `tb_device`; +DROP TABLE IF EXISTS `tb_device_attr`; +DROP TABLE IF EXISTS `tb_device_apply`; CREATE TABLE `tb_device` ( `id` bigint NOT NULL AUTO_INCREMENT, @@ -43,15 +46,120 @@ CREATE TABLE `tb_device_apply` `application_area` varchar(255) DEFAULT NULL COMMENT '应用领域', `demand` varchar(4096) DEFAULT NULL COMMENT '需求依据', `creator` bigint DEFAULT NULL COMMENT '创建者', - `creat_date` datetime DEFAULT NULL COMMENT '创建时间', + `create_date` datetime DEFAULT NULL COMMENT '创建时间', + `apply_number` varchar(255) DEFAULT NULL COMMENT '申请单号', `state` int DEFAULT '0' COMMENT '审核状态', `audit_viem` varchar(255) DEFAULT NULL COMMENT '审核意见', `auditor` bigint DEFAULT NULL COMMENT '审核者', - `audit_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '审核时间', + `audit_time` datetime DEFAULT NULL COMMENT '审核时间', `del_flag` int DEFAULT '0' COMMENT '是否删除', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 100 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci - ROW_FORMAT = DYNAMIC COMMENT ='设备申请表'; \ No newline at end of file + ROW_FORMAT = DYNAMIC COMMENT ='设备申请表'; + +INSERT INTO `tb_device` +VALUES (1572757598613598209, '经纬 M300 RTK-1', '经纬 M300 RTK-1', '无人机', 1067246875800000066, 0, 1535157700902572033, + '2022-09-22 09:20:07', 1535157700902572033, '2022-09-22 09:20:07'); +INSERT INTO `tb_device` +VALUES (1572757637394132993, '经纬 M300 RTK-2', '经纬 M300 RTK-2', '无人机', 1067246875800000066, 0, 1535157700902572033, + '2022-09-22 09:20:16', 1535157700902572033, '2022-09-22 09:20:16'); +INSERT INTO `tb_device` +VALUES (1572757693497143298, 'T950天通-1', 'T950天通-1', '单兵设备', 1067246875800000066, 0, 1535157700902572033, + '2022-09-22 09:20:29', 1535157700902572033, '2022-09-22 09:20:29'); +INSERT INTO `tb_device` +VALUES (1572757728397946882, 'T950天通-2', 'T950天通-2', '单兵设备', 1067246875800000066, 0, 1535157700902572033, + '2022-09-22 09:20:38', 1535157700902572033, '2022-09-22 09:20:38'); + +INSERT INTO `tb_device_attr` +VALUES (1572757598705872898, 1572757598613598209, '飞行器', + '{\"尺寸\":\"尺寸(展开,不包含桨叶):810×670×430 mm(长×宽×高);尺寸(折叠,包含桨叶):430×420×430 mm(长×宽×高)\",\"对称电机轴距\":\"895 mm\",\"重量(含下置单云台支架)\":\"空机重量(不含电池):3.6 kg;空机重量(含双电池):6.3 kg\",\"单云台减震球最大负重\":\"930g\",\"最大起飞重量\":\"9 kg\",\"工作频率\":\"2.4000-2.4835 GHz;5.725-5.850 GHz\",\"发射功率(EIRP)\":\"2.4000-2.4835 GHz:29.5 dBm(FCC)、18.5dBm(CE)、18.5 dBm(SRRC)、18.5dBm(MIC);5.725-5.850 GHz:28.5 dBm(FCC)、12.5dBm(CE)、28.5 dBm(SRRC)\",\"悬停精度(P-GPS)\":\"垂直:±0.1 m(视觉定位正常工作时)、±0.5 m(GPS 正常工作时)、±0.1 m(RTK 定位正常工作时);水平:±0.3 m(视觉定位正常工作时)、±1.5 m(GPS 正常工作时)、±0.1 m(RTK 定位正常工作时)\",\"RTK 位置精度\":\"在 RTK FIX 时:1 cm+1 ppm(水平)、1.5 cm + 1 ppm(垂直)\",\"最大旋转角速度\":\"俯仰轴:300°/s、航向轴:100°/s\",\"最大俯仰角度\":\"30° (P模式且前视视觉系统启用:25°)\",\"最大上升速度\":\"S 模式:6 m/s、P 模式:5 m/s\",\"最大下降速度(垂直)\":\"S 模式:5 m/s、P 模式:4 m/s\",\"最大倾斜下降速度\":\"S 模式:7 m/s\",\"最大水平飞行速度\":\"S 模式:23 m/s、P 模式:17 m/s\",\"最大飞行海拔高度\":\"5000 m(2110 桨叶,起飞重量≤7 kg)/ 7000 m(2195 高原静音桨叶,起飞重量≤7 kg)\",\"最大可承受风速\":\"15m/s(起飞及降落阶段为12m/s)\",\"最大飞行时间\":\"55 min\",\"适配 DJI 云台\":\"禅思 XT2、禅思 XT S、禅思 Z30、禅思 H20、禅思 H20T、DJI P1、DJI L1\",\"支持云台安装方式\":\"下置单云台、上置单云台、下置双云台、下置单云台+上置单云台、下置双云台+上置单云台\",\"IP 防护等级\":\"IP45\",\"GNSS\":\"GPS+GLONASS+BeiDou+Galileo\",\"工作环境温度\":\"-20°C 至 50°C\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757598739427329, 1572757598613598209, '遥控器', + '{\"工作频率\":\"2.4000-2.4835 GHz、5.725-5.850 GHz\",\"最大信号有效距离(无干扰、无遮挡)\":\"NCC/FCC:15 km、CE/MIC:8 km、SRRC:8 km\",\"等效全向辐射功率(EIRP)\":\"2.4000-2.4835 GHz:29.5 dBm(FCC);18.5dBm(CE)、18.5 dBm(SRRC);18.5dBm(MIC);5.725-5.850 GHz:28.5 dBm(FCC);12.5dBm(CE)、20.5 dBm(SRRC)\",\"外置电池\":\"名称:WB37 智能电池;容量:4920 mAh;电压:7.6 V;电池类型:LiPo;能量:37.39 Wh;充电时间(使用 BS60 智能电池箱):70 分钟(15°C 至 45°C);130 分钟(0°C 至 15°C)\",\"内置电池\":\"类型:18650 锂离子电池 (5000 mAh @ 7.2 V);充电方式:使用规格为 12V/2A 的 USB 充电器;额定功率:17 W;充电时间:2 小时 15 分钟(使用规格为12V/2A 的 USB 充电器)\",\"续航时间\":\"内置电池:约 2.5 小时内置电池+外置电池:约 4.5 小时\",\"USB-A 接口供电电压/电流\":\"5 V / 1.5 A\",\"工作环境温度\":\"-20° 至 40° C\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757598760398849, 1572757598613598209, '视觉系统', + '{\"障碍物感知范围\":\"前后左右:0.7-40 m、上下:0.6-30 m\",\"FOV\":\"前后下:65°(H),50°(V)、左右上:75°(H),60°(V)\",\"使用环境\":\"表面有丰富纹理,光照条件充足(>15 lux,室内日光灯正常照射环境)\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757598777176065, 1572757598613598209, '红外感知系统', + '{\"障碍物感知范围\":\"0.1-8 m\",\"FOV\":\"30°(±15°)\",\"使用环境\":\"漫反射,大尺寸,高反射率(反射率>10%)障碍物\"}', 0); +INSERT INTO `tb_device_attr` +VALUES (1572757598789758978, 1572757598613598209, '上下补光灯', '{\"有效照明距离\":\"5 m\"}', 0); +INSERT INTO `tb_device_attr` +VALUES (1572757598819119105, 1572757598613598209, 'FPV摄像头', '{\"分辨率\":\"960p\",\"FOV\":\"145°\",\"帧率\":\"30 fps\"}', 0); +INSERT INTO `tb_device_attr` +VALUES (1572757598831702017, 1572757598613598209, '智能飞行电池', + '{\"型号\":\"TB60\",\"容量\":\"5935 mAh\",\"电压\":\"52.8 V\",\"电池类型\":\"LiPo 12S\",\"能量\":\"274 Wh\",\"电池整体重量\":\"约 1.35 kg\",\"工作环境温度\":\"-20℃ 至 50℃\",\"理想存放环境温度\":\"22℃ 至 30℃\",\"充电环境温度\":\"-20°C 至 40°C(当环境温度低于 5°C时,电池会启动自加热功能,在低温环境下充电有可能会降低电池使用寿命)\",\"充电时间\":\"使用 BS60 智能电池箱时,使用 220 V 电源:完全充满两块 TB60 智能飞行电池约需 60 分钟,从 20% 充到 90% 约需 30 分钟;使用 110 V 电源:完全充满两块 TB60 智能飞行电池约需 70 分钟,从 20% 充到 90% 约需 40 分钟\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757598852673538, 1572757598613598209, 'BS60智能电池箱', + '{\"外形尺寸\":\"501×403×252 mm\",\"空箱重量\":\"8.37 kg\",\"可放置物品\":\"TB60 智能飞行电池 8 块、WB37 智能电池 4 块\",\"输入电压\":\"100-120 VAC,50-60 Hz / 220-240 VAC,50-60 Hz\",\"最大输入功率\":\"1070 W\",\"输出功率\":\"100-120 V:750 W、220-240 V:992 W\",\"工作环境温度\":\"-20℃ 至 40℃\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757637419298817, 1572757637394132993, '飞行器', + '{\"尺寸\":\"尺寸(展开,不包含桨叶):810×670×430 mm(长×宽×高);尺寸(折叠,包含桨叶):430×420×430 mm(长×宽×高)\",\"对称电机轴距\":\"895 mm\",\"重量(含下置单云台支架)\":\"空机重量(不含电池):3.6 kg;空机重量(含双电池):6.3 kg\",\"单云台减震球最大负重\":\"930g\",\"最大起飞重量\":\"9 kg\",\"工作频率\":\"2.4000-2.4835 GHz;5.725-5.850 GHz\",\"发射功率(EIRP)\":\"2.4000-2.4835 GHz:29.5 dBm(FCC)、18.5dBm(CE)、18.5 dBm(SRRC)、18.5dBm(MIC);5.725-5.850 GHz:28.5 dBm(FCC)、12.5dBm(CE)、28.5 dBm(SRRC)\",\"悬停精度(P-GPS)\":\"垂直:±0.1 m(视觉定位正常工作时)、±0.5 m(GPS 正常工作时)、±0.1 m(RTK 定位正常工作时);水平:±0.3 m(视觉定位正常工作时)、±1.5 m(GPS 正常工作时)、±0.1 m(RTK 定位正常工作时)\",\"RTK 位置精度\":\"在 RTK FIX 时:1 cm+1 ppm(水平)、1.5 cm + 1 ppm(垂直)\",\"最大旋转角速度\":\"俯仰轴:300°/s、航向轴:100°/s\",\"最大俯仰角度\":\"30° (P模式且前视视觉系统启用:25°)\",\"最大上升速度\":\"S 模式:6 m/s、P 模式:5 m/s\",\"最大下降速度(垂直)\":\"S 模式:5 m/s、P 模式:4 m/s\",\"最大倾斜下降速度\":\"S 模式:7 m/s\",\"最大水平飞行速度\":\"S 模式:23 m/s、P 模式:17 m/s\",\"最大飞行海拔高度\":\"5000 m(2110 桨叶,起飞重量≤7 kg)/ 7000 m(2195 高原静音桨叶,起飞重量≤7 kg)\",\"最大可承受风速\":\"15m/s(起飞及降落阶段为12m/s)\",\"最大飞行时间\":\"55 min\",\"适配 DJI 云台\":\"禅思 XT2、禅思 XT S、禅思 Z30、禅思 H20、禅思 H20T、DJI P1、DJI L1\",\"支持云台安装方式\":\"下置单云台、上置单云台、下置双云台、下置单云台+上置单云台、下置双云台+上置单云台\",\"IP 防护等级\":\"IP45\",\"GNSS\":\"GPS+GLONASS+BeiDou+Galileo\",\"工作环境温度\":\"-20°C 至 50°C\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757637431881730, 1572757637394132993, '遥控器', + '{\"工作频率\":\"2.4000-2.4835 GHz、5.725-5.850 GHz\",\"最大信号有效距离(无干扰、无遮挡)\":\"NCC/FCC:15 km、CE/MIC:8 km、SRRC:8 km\",\"等效全向辐射功率(EIRP)\":\"2.4000-2.4835 GHz:29.5 dBm(FCC);18.5dBm(CE)、18.5 dBm(SRRC);18.5dBm(MIC);5.725-5.850 GHz:28.5 dBm(FCC);12.5dBm(CE)、20.5 dBm(SRRC)\",\"外置电池\":\"名称:WB37 智能电池;容量:4920 mAh;电压:7.6 V;电池类型:LiPo;能量:37.39 Wh;充电时间(使用 BS60 智能电池箱):70 分钟(15°C 至 45°C);130 分钟(0°C 至 15°C)\",\"内置电池\":\"类型:18650 锂离子电池 (5000 mAh @ 7.2 V);充电方式:使用规格为 12V/2A 的 USB 充电器;额定功率:17 W;充电时间:2 小时 15 分钟(使用规格为12V/2A 的 USB 充电器)\",\"续航时间\":\"内置电池:约 2.5 小时内置电池+外置电池:约 4.5 小时\",\"USB-A 接口供电电压/电流\":\"5 V / 1.5 A\",\"工作环境温度\":\"-20° 至 40° C\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757637457047554, 1572757637394132993, '视觉系统', + '{\"障碍物感知范围\":\"前后左右:0.7-40 m、上下:0.6-30 m\",\"FOV\":\"前后下:65°(H),50°(V)、左右上:75°(H),60°(V)\",\"使用环境\":\"表面有丰富纹理,光照条件充足(>15 lux,室内日光灯正常照射环境)\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757637478019074, 1572757637394132993, '红外感知系统', + '{\"障碍物感知范围\":\"0.1-8 m\",\"FOV\":\"30°(±15°)\",\"使用环境\":\"漫反射,大尺寸,高反射率(反射率>10%)障碍物\"}', 0); +INSERT INTO `tb_device_attr` +VALUES (1572757637494796290, 1572757637394132993, '上下补光灯', '{\"有效照明距离\":\"5 m\"}', 0); +INSERT INTO `tb_device_attr` +VALUES (1572757637507379202, 1572757637394132993, 'FPV摄像头', '{\"分辨率\":\"960p\",\"FOV\":\"145°\",\"帧率\":\"30 fps\"}', 0); +INSERT INTO `tb_device_attr` +VALUES (1572757637528350721, 1572757637394132993, '智能飞行电池', + '{\"型号\":\"TB60\",\"容量\":\"5935 mAh\",\"电压\":\"52.8 V\",\"电池类型\":\"LiPo 12S\",\"能量\":\"274 Wh\",\"电池整体重量\":\"约 1.35 kg\",\"工作环境温度\":\"-20℃ 至 50℃\",\"理想存放环境温度\":\"22℃ 至 30℃\",\"充电环境温度\":\"-20°C 至 40°C(当环境温度低于 5°C时,电池会启动自加热功能,在低温环境下充电有可能会降低电池使用寿命)\",\"充电时间\":\"使用 BS60 智能电池箱时,使用 220 V 电源:完全充满两块 TB60 智能飞行电池约需 60 分钟,从 20% 充到 90% 约需 30 分钟;使用 110 V 电源:完全充满两块 TB60 智能飞行电池约需 70 分钟,从 20% 充到 90% 约需 40 分钟\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757637545127938, 1572757637394132993, 'BS60智能电池箱', + '{\"外形尺寸\":\"501×403×252 mm\",\"空箱重量\":\"8.37 kg\",\"可放置物品\":\"TB60 智能飞行电池 8 块、WB37 智能电池 4 块\",\"输入电压\":\"100-120 VAC,50-60 Hz / 220-240 VAC,50-60 Hz\",\"最大输入功率\":\"1070 W\",\"输出功率\":\"100-120 V:750 W、220-240 V:992 W\",\"工作环境温度\":\"-20℃ 至 40℃\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757693522309121, 1572757693497143298, '基本信息', + '{\"外观设计\":\"172X81X15.7(不含天线),336g\",\"操作系统\":\"Android P\",\"CPU\":\"展锐 Makalu T7510;虎贲T710+春藤IVY510\",\"存储\":\"标配:6GB ROM +128G RAM\",\"显示屏\":\"6.52吋水滴屏;HD+,1600*720(20:9)\",\"后置摄像头\":\"后置为4800万主摄+200万微距+200万红外三摄组合,支持闪光灯\",\"前置摄像头\":\"1600万\",\"传感器相关\":\"指纹|光线传感器|距离传感器|加速度传感器|地磁传感器|陀螺仪|气压传感器\",\"WLAN\":\"802.11a/b/g/n/AC 支持MIMO\",\"电池\":\"6000mAh@3.8V,内置不可拆卸,支持18W快充\",\"工作时间\":\"待机时长180h,卫星通话时长16h\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757693539086338, 1572757693497143298, '制式频段', + '{\"卫星频段\":\"天通一号卫星\",\"频段\":\"2G:GSM 850/900/1800/1900;3G:WCDMA850/900/1900/2100;4G:TD-LTE B38/39/40/41;4G:FDD-LTE B1/3/5/7/8;5G: N1,N28,N41, N78,N79\",\"双卡\":\"双nano卡(卫星卡+运营商全网通卡)\",\"CA\":\"B1+B3 下行 2CA(电信);B40/41带内上下行 2CA\",\"VOLTE\":\"支持\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757693560057858, 1572757693497143298, 'IO接口', + '{\"USB接口类型\":\"TYPE-C USB3.0,支持OTG功能\",\"耳机接口\":\"3.5mm,美标\",\"存储卡\":\"支持TF卡扩展\"}', 0); +INSERT INTO `tb_device_attr` +VALUES (1572757693581029377, 1572757693497143298, '其它功能', + '{\"蓝牙\":\"V5.0\",\"定位\":\"GPS、北斗混合定位、单北斗模式\",\"NFC\":\"支持\",\"充电方式\":\"三种充电方式(线充、座充、磁吸充电)\",\"按键\":\"开机键、音量+/-、 SOS(侧面)、PTT按键\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757693602000897, 1572757693497143298, '环境适应性', + '{\"工作温度\":\"-20°~ 60°\",\"存储温度\":\"-40°~ 80°\",\"高温高湿\":\"(95±3)%(≧40°),24小时\",\"防护等级\":\"IP68\"}', 0); +INSERT INTO `tb_device_attr` +VALUES (1572757728427307010, 1572757728397946882, '基本信息', + '{\"外观设计\":\"172X81X15.7(不含天线),336g\",\"操作系统\":\"Android P\",\"CPU\":\"展锐 Makalu T7510;虎贲T710+春藤IVY510\",\"存储\":\"标配:6GB ROM +128G RAM\",\"显示屏\":\"6.52吋水滴屏;HD+,1600*720(20:9)\",\"后置摄像头\":\"后置为4800万主摄+200万微距+200万红外三摄组合,支持闪光灯\",\"前置摄像头\":\"1600万\",\"传感器相关\":\"指纹|光线传感器|距离传感器|加速度传感器|地磁传感器|陀螺仪|气压传感器\",\"WLAN\":\"802.11a/b/g/n/AC 支持MIMO\",\"电池\":\"6000mAh@3.8V,内置不可拆卸,支持18W快充\",\"工作时间\":\"待机时长180h,卫星通话时长16h\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757728439889921, 1572757728397946882, '制式频段', + '{\"卫星频段\":\"天通一号卫星\",\"频段\":\"2G:GSM 850/900/1800/1900;3G:WCDMA850/900/1900/2100;4G:TD-LTE B38/39/40/41;4G:FDD-LTE B1/3/5/7/8;5G: N1,N28,N41, N78,N79\",\"双卡\":\"双nano卡(卫星卡+运营商全网通卡)\",\"CA\":\"B1+B3 下行 2CA(电信);B40/41带内上下行 2CA\",\"VOLTE\":\"支持\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757728460861441, 1572757728397946882, 'IO接口', + '{\"USB接口类型\":\"TYPE-C USB3.0,支持OTG功能\",\"耳机接口\":\"3.5mm,美标\",\"存储卡\":\"支持TF卡扩展\"}', 0); +INSERT INTO `tb_device_attr` +VALUES (1572757728477638658, 1572757728397946882, '其它功能', + '{\"蓝牙\":\"V5.0\",\"定位\":\"GPS、北斗混合定位、单北斗模式\",\"NFC\":\"支持\",\"充电方式\":\"三种充电方式(线充、座充、磁吸充电)\",\"按键\":\"开机键、音量+/-、 SOS(侧面)、PTT按键\"}', + 0); +INSERT INTO `tb_device_attr` +VALUES (1572757728486027266, 1572757728397946882, '环境适应性', + '{\"工作温度\":\"-20°~ 60°\",\"存储温度\":\"-40°~ 80°\",\"高温高湿\":\"(95±3)%(≧40°),24小时\",\"防护等级\":\"IP68\"}', 0); diff --git a/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java b/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java index 74e3514d..b2b8385d 100644 --- a/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java +++ b/renren-admin/src/main/java/io/renren/common/utils/CodeGenerationUtils.java @@ -86,6 +86,10 @@ public class CodeGenerationUtils { case "NLXJ": tableName = "tb_data_resource"; break; + //设备申请 + case "SBSQ": + tableName = "tb_device_apply"; + break; default: break; } diff --git a/renren-admin/src/main/java/io/renren/modules/device/controller/TbDeviceApplyController.java b/renren-admin/src/main/java/io/renren/modules/device/controller/TbDeviceApplyController.java index ccc47a92..4a41371d 100644 --- a/renren-admin/src/main/java/io/renren/modules/device/controller/TbDeviceApplyController.java +++ b/renren-admin/src/main/java/io/renren/modules/device/controller/TbDeviceApplyController.java @@ -1,14 +1,18 @@ package io.renren.modules.device.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.renren.common.annotation.LogOperation; import io.renren.common.constant.Constant; import io.renren.common.page.PageData; +import io.renren.common.utils.CodeGenerationUtils; import io.renren.common.utils.Result; import io.renren.common.validator.ValidatorUtils; import io.renren.common.validator.group.AddGroup; import io.renren.common.validator.group.DefaultGroup; import io.renren.common.validator.group.UpdateGroup; +import io.renren.modules.device.dao.TbDeviceApplyDao; import io.renren.modules.device.dto.TbDeviceApplyDTO; +import io.renren.modules.device.dto.TbDeviceDTO; import io.renren.modules.device.service.TbDeviceApplyService; import io.renren.modules.device.service.TbDeviceService; import io.renren.modules.notice.dto.SysNoticeDTO; @@ -26,9 +30,11 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import java.util.Collections; import java.util.Date; import java.util.Map; @@ -52,6 +58,8 @@ public class TbDeviceApplyController { @Autowired TbDeviceApplyService tbDeviceApplyService; @Autowired + private TbDeviceApplyDao tbDeviceApplyDao; + @Autowired SysNoticeService sysNoticeService; @Autowired SysRoleService sysRoleService; @@ -61,6 +69,10 @@ public class TbDeviceApplyController { SysUserService sysUserService; @Autowired TbDeviceService tbDeviceService; + @Autowired + private JdbcTemplate jdbcTemplate; + + private final CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance(); @GetMapping("{id}") @ApiOperation("查看申请信息") @@ -69,10 +81,21 @@ public class TbDeviceApplyController { return new Result().ok(data); } - + @GetMapping("page") + @ApiOperation("分页查询申请记录(我的申请)") + @ApiImplicitParams({ + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , + @ApiImplicitParam(name = "roomName", value = "设备名称", paramType = "query", dataType="String") , + @ApiImplicitParam(name = "state", value = "申请状态", paramType = "query", dataType="String") + }) + public Result> page(@ApiIgnore @RequestParam Map params){ + PageData page = tbDeviceApplyService.queryList(params); + return new Result>().ok(page); + } @GetMapping("auditPage") - @ApiOperation("分页查询申请记录(管理端)") + @ApiOperation("分页查询申请记录(我的待办)") @ApiImplicitParams({ @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , @@ -91,17 +114,23 @@ public class TbDeviceApplyController { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); dto.setCreator(SecurityUser.getUserId()); - dto.setCreatDate(new Date()); + dto.setCreateDate(new Date()); if(dto.getDeviceName()==null){ dto.setDeviceName(tbDeviceService.get(dto.getDeviceId()).getName()); } + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq( "creator", dto.getCreator()); + wrapper.eq("device_id", dto.getDeviceId()); + if(!tbDeviceApplyDao.selectList(wrapper).isEmpty()){ + return new Result().error("请勿重复申请!"); + } // 发起预约后推送消息 - SysRoleDTO roleDTO = sysRoleService.getByName(roleName); SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(sysDeptService.getByName(bigDateDeptName).getId(), roleDTO.getId()); dto.setAuditor(userDTO==null ? Long.parseLong(defaultAssigneeRoleId) : userDTO.getId()); tbDeviceApplyService.save(dto); + codeGenerationUtils.setApplyNumber("SBSQ", Collections.singletonList(dto.getId()), jdbcTemplate); String content = "【通知】请审核" + dto.getName() + "发起的" + dto.getDeviceName() + "设备申请"; @@ -120,7 +149,8 @@ public class TbDeviceApplyController { sysNoticeService.save(sysNoticeDTO); // 还要发送自己能看到的的谁给我审核的消息 String ownedContent = "【通知】您发起的" + dto.getDeviceName() + - "设备申请,当前审核部门为:" + bigDateDeptName + ",审核负责人:" + userDTO.getRealName(); + "设备申请,当前审核部门为:" + bigDateDeptName + ",审核负责人:" + + (userDTO==null ? sysUserService.get(Long.parseLong(defaultAssigneeRoleId)).getRealName() : userDTO.getRealName()); SysNoticeDTO ownedSysNoticeDTO = new SysNoticeDTO(); ownedSysNoticeDTO.setType(2); ownedSysNoticeDTO.setTitle("设备申请发起通知"); diff --git a/renren-admin/src/main/java/io/renren/modules/device/dao/TbDeviceApplyDao.java b/renren-admin/src/main/java/io/renren/modules/device/dao/TbDeviceApplyDao.java index fa44292c..729bf251 100644 --- a/renren-admin/src/main/java/io/renren/modules/device/dao/TbDeviceApplyDao.java +++ b/renren-admin/src/main/java/io/renren/modules/device/dao/TbDeviceApplyDao.java @@ -17,4 +17,6 @@ public interface TbDeviceApplyDao extends BaseDao { List queryListForAudit(Map params); + List queryList(Map params); + } diff --git a/renren-admin/src/main/java/io/renren/modules/device/dto/TbDeviceApplyDTO.java b/renren-admin/src/main/java/io/renren/modules/device/dto/TbDeviceApplyDTO.java index ab8ed0f4..790290c6 100644 --- a/renren-admin/src/main/java/io/renren/modules/device/dto/TbDeviceApplyDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/device/dto/TbDeviceApplyDTO.java @@ -38,7 +38,9 @@ public class TbDeviceApplyDTO implements Serializable { @ApiModelProperty(value = "创建者") private Long creator; @ApiModelProperty(value = "创建时间") - private Date creatDate; + private Date createDate; + @ApiModelProperty(value = "申请单号") + private String applyNumber; @ApiModelProperty(value = "审核状态") private Integer state; @ApiModelProperty(value = "审核意见") @@ -51,5 +53,4 @@ public class TbDeviceApplyDTO implements Serializable { private Integer delFlag; private String deviceName; - } diff --git a/renren-admin/src/main/java/io/renren/modules/device/entity/TbDeviceApplyEntity.java b/renren-admin/src/main/java/io/renren/modules/device/entity/TbDeviceApplyEntity.java index 21973ac6..cd0d02bb 100644 --- a/renren-admin/src/main/java/io/renren/modules/device/entity/TbDeviceApplyEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/device/entity/TbDeviceApplyEntity.java @@ -73,7 +73,12 @@ public class TbDeviceApplyEntity { * 创建时间 */ @TableField(fill = FieldFill.INSERT) - private Long creatDate; + private Date createDate; + + /** + * 申请单号 + */ + private String applyNumber; /** * 审核状态 diff --git a/renren-admin/src/main/java/io/renren/modules/device/service/Impl/TbDeviceApplyServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/device/service/Impl/TbDeviceApplyServiceImpl.java index 3783c0cc..b581b0d4 100644 --- a/renren-admin/src/main/java/io/renren/modules/device/service/Impl/TbDeviceApplyServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/device/service/Impl/TbDeviceApplyServiceImpl.java @@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -50,4 +51,32 @@ public class TbDeviceApplyServiceImpl extends CrudServiceImpl result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); return new PageData(result, dtoList.size()); } + + @Override + public PageData queryList(Map params) { + //分页参数 + int curPage = 1; + int limit = 10; + if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){ + limit = Integer.parseInt(params.get("limit").toString()); + } + if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){ + curPage = Integer.parseInt(params.get("page").toString()); + } + params.put("userId", SecurityUser.getUserId()); + List stateList=new ArrayList<>(); + if(params.containsKey("state") && StringUtils.isNotBlank(params.get("state").toString())){ + String state=params.get("state").toString(); + if("审核中".equals(state)){ + stateList.add(0); + }else if("审核完成".equals(state)){ + stateList.add(2); + stateList.add(3); + } + } + params.put("states",stateList); + List dtoList = tbDeviceApplyDao.queryList(params); + List result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); + return new PageData(result, dtoList.size()); + } } diff --git a/renren-admin/src/main/java/io/renren/modules/device/service/TbDeviceApplyService.java b/renren-admin/src/main/java/io/renren/modules/device/service/TbDeviceApplyService.java index 4f12a25c..0310cfb2 100644 --- a/renren-admin/src/main/java/io/renren/modules/device/service/TbDeviceApplyService.java +++ b/renren-admin/src/main/java/io/renren/modules/device/service/TbDeviceApplyService.java @@ -16,4 +16,6 @@ public interface TbDeviceApplyService extends CrudService queryAuditList(Map params); + PageData queryList(Map params); + } diff --git a/renren-admin/src/main/resources/mapper/device/TbDeviceApplyDao.xml b/renren-admin/src/main/resources/mapper/device/TbDeviceApplyDao.xml index 0266b4e4..fd1e6727 100644 --- a/renren-admin/src/main/resources/mapper/device/TbDeviceApplyDao.xml +++ b/renren-admin/src/main/resources/mapper/device/TbDeviceApplyDao.xml @@ -14,4 +14,18 @@ + + \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/device/TbDeviceDao.xml b/renren-admin/src/main/resources/mapper/device/TbDeviceDao.xml index 08e3971f..a82cda63 100644 --- a/renren-admin/src/main/resources/mapper/device/TbDeviceDao.xml +++ b/renren-admin/src/main/resources/mapper/device/TbDeviceDao.xml @@ -26,6 +26,7 @@ and type = #{type} + GROUP BY td.id ORDER BY td.create_date desc