Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-09-23 09:49:02 +08:00
commit 8f497f7b29
10 changed files with 207 additions and 11 deletions

View File

@ -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` CREATE TABLE `tb_device`
( (
`id` bigint NOT NULL AUTO_INCREMENT, `id` bigint NOT NULL AUTO_INCREMENT,
@ -43,11 +46,12 @@ CREATE TABLE `tb_device_apply`
`application_area` varchar(255) DEFAULT NULL COMMENT '应用领域', `application_area` varchar(255) DEFAULT NULL COMMENT '应用领域',
`demand` varchar(4096) DEFAULT NULL COMMENT '需求依据', `demand` varchar(4096) DEFAULT NULL COMMENT '需求依据',
`creator` bigint 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 '审核状态', `state` int DEFAULT '0' COMMENT '审核状态',
`audit_viem` varchar(255) DEFAULT NULL COMMENT '审核意见', `audit_viem` varchar(255) DEFAULT NULL COMMENT '审核意见',
`auditor` bigint 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 '是否删除', `del_flag` int DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB ) ENGINE = InnoDB
@ -55,3 +59,107 @@ CREATE TABLE `tb_device_apply`
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COLLATE = utf8mb4_general_ci
ROW_FORMAT = DYNAMIC COMMENT ='设备申请表'; 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 GHz5.725-5.850 GHz\",\"发射功率EIRP\":\"2.4000-2.4835 GHz29.5 dBmFCC、18.5dBmCE、18.5 dBmSRRC、18.5dBmMIC5.725-5.850 GHz28.5 dBmFCC、12.5dBmCE、28.5 dBmSRRC\",\"悬停精度P-GPS\":\"垂直±0.1 m视觉定位正常工作时、±0.5 mGPS 正常工作时、±0.1 mRTK 定位正常工作时水平±0.3 m视觉定位正常工作时、±1.5 mGPS 正常工作时、±0.1 mRTK 定位正常工作时)\",\"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 m2110 桨叶起飞重量≤7 kg/ 7000 m2195 高原静音桨叶起飞重量≤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/FCC15 km、CE/MIC8 km、SRRC8 km\",\"等效全向辐射功率EIRP\":\"2.4000-2.4835 GHz29.5 dBmFCC18.5dBmCE、18.5 dBmSRRC18.5dBmMIC5.725-5.850 GHz28.5 dBmFCC12.5dBmCE、20.5 dBmSRRC\",\"外置电池\":\"名称WB37 智能电池容量4920 mAh电压7.6 V电池类型LiPo能量37.39 Wh充电时间使用 BS60 智能电池箱70 分钟15°C 至 45°C130 分钟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°H50°V、左右上75°H60°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 VAC50-60 Hz / 220-240 VAC50-60 Hz\",\"最大输入功率\":\"1070 W\",\"输出功率\":\"100-120 V750 W、220-240 V992 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 GHz5.725-5.850 GHz\",\"发射功率EIRP\":\"2.4000-2.4835 GHz29.5 dBmFCC、18.5dBmCE、18.5 dBmSRRC、18.5dBmMIC5.725-5.850 GHz28.5 dBmFCC、12.5dBmCE、28.5 dBmSRRC\",\"悬停精度P-GPS\":\"垂直±0.1 m视觉定位正常工作时、±0.5 mGPS 正常工作时、±0.1 mRTK 定位正常工作时水平±0.3 m视觉定位正常工作时、±1.5 mGPS 正常工作时、±0.1 mRTK 定位正常工作时)\",\"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 m2110 桨叶起飞重量≤7 kg/ 7000 m2195 高原静音桨叶起飞重量≤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/FCC15 km、CE/MIC8 km、SRRC8 km\",\"等效全向辐射功率EIRP\":\"2.4000-2.4835 GHz29.5 dBmFCC18.5dBmCE、18.5 dBmSRRC18.5dBmMIC5.725-5.850 GHz28.5 dBmFCC12.5dBmCE、20.5 dBmSRRC\",\"外置电池\":\"名称WB37 智能电池容量4920 mAh电压7.6 V电池类型LiPo能量37.39 Wh充电时间使用 BS60 智能电池箱70 分钟15°C 至 45°C130 分钟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°H50°V、左右上75°H60°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 VAC50-60 Hz / 220-240 VAC50-60 Hz\",\"最大输入功率\":\"1070 W\",\"输出功率\":\"100-120 V750 W、220-240 V992 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: N1N28N41, N78N79\",\"双卡\":\"双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: N1N28N41, N78N79\",\"双卡\":\"双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);

View File

@ -86,6 +86,10 @@ public class CodeGenerationUtils {
case "NLXJ": case "NLXJ":
tableName = "tb_data_resource"; tableName = "tb_data_resource";
break; break;
//设备申请
case "SBSQ":
tableName = "tb_device_apply";
break;
default: default:
break; break;
} }

View File

@ -1,14 +1,18 @@
package io.renren.modules.device.controller; package io.renren.modules.device.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.annotation.LogOperation; import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant; import io.renren.common.constant.Constant;
import io.renren.common.page.PageData; import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result; import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils; import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup; import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup; import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup; 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.TbDeviceApplyDTO;
import io.renren.modules.device.dto.TbDeviceDTO;
import io.renren.modules.device.service.TbDeviceApplyService; import io.renren.modules.device.service.TbDeviceApplyService;
import io.renren.modules.device.service.TbDeviceService; import io.renren.modules.device.service.TbDeviceService;
import io.renren.modules.notice.dto.SysNoticeDTO; import io.renren.modules.notice.dto.SysNoticeDTO;
@ -26,9 +30,11 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@ -52,6 +58,8 @@ public class TbDeviceApplyController {
@Autowired @Autowired
TbDeviceApplyService tbDeviceApplyService; TbDeviceApplyService tbDeviceApplyService;
@Autowired @Autowired
private TbDeviceApplyDao tbDeviceApplyDao;
@Autowired
SysNoticeService sysNoticeService; SysNoticeService sysNoticeService;
@Autowired @Autowired
SysRoleService sysRoleService; SysRoleService sysRoleService;
@ -61,6 +69,10 @@ public class TbDeviceApplyController {
SysUserService sysUserService; SysUserService sysUserService;
@Autowired @Autowired
TbDeviceService tbDeviceService; TbDeviceService tbDeviceService;
@Autowired
private JdbcTemplate jdbcTemplate;
private final CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance();
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("查看申请信息") @ApiOperation("查看申请信息")
@ -69,10 +81,21 @@ public class TbDeviceApplyController {
return new Result<TbDeviceApplyDTO>().ok(data); return new Result<TbDeviceApplyDTO>().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<PageData<TbDeviceApplyDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbDeviceApplyDTO> page = tbDeviceApplyService.queryList(params);
return new Result<PageData<TbDeviceApplyDTO>>().ok(page);
}
@GetMapping("auditPage") @GetMapping("auditPage")
@ApiOperation("分页查询申请记录(管理端)") @ApiOperation("分页查询申请记录(我的待办")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") , @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 = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ -91,17 +114,23 @@ public class TbDeviceApplyController {
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
dto.setCreator(SecurityUser.getUserId()); dto.setCreator(SecurityUser.getUserId());
dto.setCreatDate(new Date()); dto.setCreateDate(new Date());
if(dto.getDeviceName()==null){ if(dto.getDeviceName()==null){
dto.setDeviceName(tbDeviceService.get(dto.getDeviceId()).getName()); dto.setDeviceName(tbDeviceService.get(dto.getDeviceId()).getName());
} }
QueryWrapper wrapper=new QueryWrapper<TbDeviceDTO>();
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); SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(sysDeptService.getByName(bigDateDeptName).getId(), roleDTO.getId()); SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(sysDeptService.getByName(bigDateDeptName).getId(), roleDTO.getId());
dto.setAuditor(userDTO==null ? Long.parseLong(defaultAssigneeRoleId) : userDTO.getId()); dto.setAuditor(userDTO==null ? Long.parseLong(defaultAssigneeRoleId) : userDTO.getId());
tbDeviceApplyService.save(dto); tbDeviceApplyService.save(dto);
codeGenerationUtils.setApplyNumber("SBSQ", Collections.singletonList(dto.getId()), jdbcTemplate);
String content = "【通知】请审核" + dto.getName() + "发起的" + dto.getDeviceName() + String content = "【通知】请审核" + dto.getName() + "发起的" + dto.getDeviceName() +
"设备申请"; "设备申请";
@ -120,7 +149,8 @@ public class TbDeviceApplyController {
sysNoticeService.save(sysNoticeDTO); sysNoticeService.save(sysNoticeDTO);
// 还要发送自己能看到的的谁给我审核的消息 // 还要发送自己能看到的的谁给我审核的消息
String ownedContent = "【通知】您发起的" + dto.getDeviceName() + String ownedContent = "【通知】您发起的" + dto.getDeviceName() +
"设备申请,当前审核部门为:" + bigDateDeptName + ",审核负责人:" + userDTO.getRealName(); "设备申请,当前审核部门为:" + bigDateDeptName + ",审核负责人:" +
(userDTO==null ? sysUserService.get(Long.parseLong(defaultAssigneeRoleId)).getRealName() : userDTO.getRealName());
SysNoticeDTO ownedSysNoticeDTO = new SysNoticeDTO(); SysNoticeDTO ownedSysNoticeDTO = new SysNoticeDTO();
ownedSysNoticeDTO.setType(2); ownedSysNoticeDTO.setType(2);
ownedSysNoticeDTO.setTitle("设备申请发起通知"); ownedSysNoticeDTO.setTitle("设备申请发起通知");

View File

@ -17,4 +17,6 @@ public interface TbDeviceApplyDao extends BaseDao<TbDeviceApplyEntity> {
List queryListForAudit(Map params); List queryListForAudit(Map params);
List queryList(Map params);
} }

View File

@ -38,7 +38,9 @@ public class TbDeviceApplyDTO implements Serializable {
@ApiModelProperty(value = "创建者") @ApiModelProperty(value = "创建者")
private Long creator; private Long creator;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date creatDate; private Date createDate;
@ApiModelProperty(value = "申请单号")
private String applyNumber;
@ApiModelProperty(value = "审核状态") @ApiModelProperty(value = "审核状态")
private Integer state; private Integer state;
@ApiModelProperty(value = "审核意见") @ApiModelProperty(value = "审核意见")
@ -51,5 +53,4 @@ public class TbDeviceApplyDTO implements Serializable {
private Integer delFlag; private Integer delFlag;
private String deviceName; private String deviceName;
} }

View File

@ -73,7 +73,12 @@ public class TbDeviceApplyEntity {
* 创建时间 * 创建时间
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private Long creatDate; private Date createDate;
/**
* 申请单号
*/
private String applyNumber;
/** /**
* 审核状态 * 审核状态

View File

@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -50,4 +51,32 @@ public class TbDeviceApplyServiceImpl extends CrudServiceImpl<TbDeviceApplyDao,
List<TbDeviceApplyDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); List<TbDeviceApplyDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
return new PageData(result, dtoList.size()); return new PageData(result, dtoList.size());
} }
@Override
public PageData<TbDeviceApplyDTO> queryList(Map<String, Object> 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<Integer> 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<TbDeviceApplyDTO> dtoList = tbDeviceApplyDao.queryList(params);
List<TbDeviceApplyDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
return new PageData(result, dtoList.size());
}
} }

View File

@ -16,4 +16,6 @@ public interface TbDeviceApplyService extends CrudService<TbDeviceApplyEntity, T
PageData<TbDeviceApplyDTO> queryAuditList(Map<String, Object> params); PageData<TbDeviceApplyDTO> queryAuditList(Map<String, Object> params);
PageData<TbDeviceApplyDTO> queryList(Map<String, Object> params);
} }

View File

@ -14,4 +14,18 @@
</if> </if>
</select> </select>
<select id="queryList" resultType="io.renren.modules.device.dto.TbDeviceApplyDTO">
select * from tb_device_apply
where 1=1
<if test="userId != null and userId != ''">
and creator = #{userId}
</if>
<if test="null != states and states.size > 0">
AND state IN
<foreach collection="states" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper> </mapper>

View File

@ -26,6 +26,7 @@
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and type = #{type} and type = #{type}
</if> </if>
GROUP BY td.id
ORDER BY td.create_date desc ORDER BY td.create_date desc
</select> </select>