Browse Source

Merge remote-tracking branch 'origin/master'

S0025136190 1 year ago
parent
commit
065a89486b

+ 2 - 1
Backend/sample/src/main/java/com/dji/sample/manage/service/impl/UserServiceImpl.java

@@ -396,7 +396,8 @@ public class UserServiceImpl implements IUserService {
         //用户入库
         QueryWrapper<UserEntity> userWrapper = new QueryWrapper<>();
         userWrapper.lambda().eq(UserEntity::getUserType,UserTypeEnum.WEB.getVal())
-                .eq(UserEntity::getClientId,clientId);
+                .eq(UserEntity::getClientId,clientId)
+                .eq(UserEntity::getUsername,username);
         UserEntity userEntity = mapper.selectOne(userWrapper);
         if(userEntity == null) {
             userEntity = new UserEntity();

+ 21 - 21
Backend/sample/src/main/resources/application-prd.yml

@@ -45,20 +45,20 @@ mqtt:
   # BASIC parameters are required.
   BASIC:
     protocol: MQTT # @see com.dji.sample.component.mqtt.model.MqttProtocolEnum
-    host: xia0miduo.gicp.net
+    host: 49.234.30.234
     port: 1883
-    username: mqttUser
-    password: 123456
+    username: admin
+    password: T1SqDxbdSPVV24
     client-id: testServer
     # If the protocol is ws/wss, this value is required.
     path:
   DRC:
     protocol: WS # @see com.dji.sample.component.mqtt.model.MqttProtocolEnum
-    host: xia0miduo.gicp.net
+    host: 49.234.30.234
     port: 8083
     path: /mqtt
-    username: mqttUser
-    password: 123456
+    username: admin
+    password: T1SqDxbdSPVV24
 
 cloud-sdk:
   mqtt:
@@ -115,9 +115,9 @@ url:
 oss:
   enable: true
   provider: minio
-  endpoint: http://60.204.184.98:39000
-  access-key: dji_minio2
-  secret-key: 12345678
+  endpoint: http://49.234.30.234:9002
+  access-key: admin
+  secret-key: Qwer~123.
   bucket: dji-cloudapi
   expire: 3600
   region: us-east-1
@@ -143,18 +143,18 @@ cloud-api:
 livestream:
   url:
     # It is recommended to use a program to create Token. https://github.com/AgoraIO/Tools/blob/master/DynamicKey/AgoraDynamicKey/java/src/main/java/io/agora/media/RtcTokenBuilder2.java
-    agora:
-      channel: Please enter the agora channel.
-      token: Please enter the agora temporary token.
-      uid:  654321
+#    agora:
+#      channel: Please enter the agora channel.
+#      token: Please enter the agora temporary token.
+#      uid:  654321
 
     # RTMP  Note: This IP is the address of the streaming server. If you want to see livestream on web page, you need to convert the RTMP stream to WebRTC stream.
-    rtmp:
-      url: Please enter the rtmp access address.  # Example: 'rtmp://192.168.1.1/live/'
-    rtsp:
-      username: Please enter the username.
-      password: Please enter the password.
-      port: 8554
+#    rtmp:
+#      url: Please enter the rtmp access address.  # Example: 'rtmp://192.168.1.1/live/'
+#    rtsp:
+#      username: Please enter the username.
+#      password: Please enter the password.
+#      port: 8554
 
     # GB28181 Note:If you don't know what these parameters mean, you can go to Pilot2 and select the GB28181 page in the cloud platform. Where the parameters same as these parameters.
 #    gb28181:
@@ -167,5 +167,5 @@ livestream:
 #      channel: Please enter the channel.
 
     # Webrtc: Only supports using whip standard
-    whip:
-      url: Please enter the rtmp access address. #  Example:http://192.168.1.1:1985/rtc/v1/whip/?app=live&stream=
+#    whip:
+#      url: Please enter the rtmp access address. #  Example:http://192.168.1.1:1985/rtc/v1/whip/?app=live&stream=

+ 8 - 7
Backend/sample/src/main/resources/application.yml

@@ -42,25 +42,26 @@ jwt:
   secret: CloudApiSample
   age: 86400
 
+
 mqtt:
   # @see com.dji.sample.component.mqtt.model.MqttUseEnum
   # BASIC parameters are required.
   BASIC:
     protocol: MQTT # @see com.dji.sample.component.mqtt.model.MqttProtocolEnum
-    host: xia0miduo.gicp.net
+    host: 49.234.30.234
     port: 1883
-    username: mqttUser
-    password: 123456
-    client-id: hqjiang
+    username: admin
+    password: T1SqDxbdSPVV24
+    client-id: testServer
     # If the protocol is ws/wss, this value is required.
     path:
   DRC:
     protocol: WS # @see com.dji.sample.component.mqtt.model.MqttProtocolEnum
-    host: xia0miduo.gicp.net
+    host: 49.234.30.234
     port: 8083
     path: /mqtt
-    username: mqttUser
-    password: 123456
+    username: admin
+    password: T1SqDxbdSPVV24
 
 cloud-sdk:
   mqtt:

+ 27 - 0
Web/src/api/custom/index.ts

@@ -68,6 +68,15 @@ export type FetchTrajectoryListApiParams = Partial<{
     page_size: number,
 }>;
 
+export type AddPilotApiParams = {
+    username: number,
+    password: number,
+};
+
+export type FetchPilotPasswordApiParams = {
+    userId: string,
+};
+
 // Api函数类型
 export type SignLoginApi = (data: SignLoginApiParams) => Promise<any>;
 export type FetchPayloadListApi = () => Promise<any>;
@@ -85,6 +94,8 @@ export type UpdateFileNameApi = (fileId: string, data: { [key: string]: any }) =
 export type BatchDeletePictureApi = (params: BatchDeletePictureApiParams) => Promise<any>;
 export type FetchTrajectoryListApi = (params: FetchTrajectoryListApiParams) => Promise<any>;
 export type FetchTrajectoryMapApi = (taskId: string) => Promise<any>;
+export type AddPilotApi = (data: AddPilotApiParams) => Promise<any>;
+export type FetchPilotPasswordApi = (params: FetchPilotPasswordApiParams) => Promise<any>;
 
 // 密钥登录
 const signLoginApi: SignLoginApi = async (data) => {
@@ -193,6 +204,20 @@ const fetchTrajectoryMapApi: FetchTrajectoryMapApi = async (taskId) => {
     return res.data;
 };
 
+// 添加飞行员
+const addPilotApi: AddPilotApi = async (data) => {
+    const url = `/manage/api/v1/users/${workspaceId}/savePilotUser`
+    const res = await request.post(url, data);
+    return res.data;
+};
+
+// 获取飞行员密码
+const fetchPilotPasswordApi: FetchPilotPasswordApi = async (params) => {
+    const url = `/manage/api/v1/users/getPwd`
+    const res = await request.get(url, { params: params });
+    return res.data;
+};
+
 export const apis = {
     signLogin: signLoginApi,
     fetchPayloadList: fetchPayloadListApi,
@@ -210,4 +235,6 @@ export const apis = {
     batchDeletePicture: batchDeletePictureApi,
     fetchTrajectoryList: fetchTrajectoryListApi,
     fetchTrajectoryMap: fetchTrajectoryMapApi,
+    AddPilot: addPilotApi,
+    fetchPilotPassword: fetchPilotPasswordApi,
 };

+ 1 - 1
Web/src/pages/page-pilot/pilot-index.vue

@@ -53,7 +53,7 @@ onMounted(async () => {
     return
   }
 
-  apiPilot.setPlatformMessage('Cloud Api Platform', '', '')
+  apiPilot.setPlatformMessage('私有云平台', '', '')
 
   const token = localStorage.getItem(ELocalStorageKey.Token)
   if (token) {

+ 1 - 1
Web/src/pages/page-web/projects/media/detail/index.vue

@@ -258,7 +258,7 @@ const onClickBatchDelete = async () => {
     id: canDeleteList.map(item => item.file_id).join(',')
   }
   await apis.batchDeletePicture(data);
-  await fetchList()
+  await fetchList(state.query)
 }
 
 // 点击搜索

+ 44 - 0
Web/src/pages/page-web/projects/member/components/AddModal.vue

@@ -0,0 +1,44 @@
+<template>
+  <a-modal v-model:visible="visible" title="添加飞行员" @ok="handleClickConfirm" @cancel="onClickCancel">
+    <a-form ref="formRef" :colon="false" :model="formModel">
+      <a-form-item label="用户名称" name="username" :rules="[{ required: true, message: '用户名称不能为空', whitespace: true }]">
+        <a-input v-model:value="formModel.username" placeholder="请输入用户名称" />
+      </a-form-item>
+      <a-form-item label="用户密码" name="password" :rules="[{ required: true, message: '用户密码不能为空', whitespace: true }]">
+        <a-input-password v-model:value="formModel.password" placeholder="请输入用户密码" />
+      </a-form-item>
+    </a-form>
+  </a-modal>
+</template>
+
+<script lang="ts" setup>
+import { ref, reactive } from 'vue';
+
+interface Props {
+  visible: boolean,
+  onClickConfirm: (data: any) => Promise<any>,
+  onClickCancel: () => void,
+};
+
+const props = withDefaults(defineProps<Props>(), {
+
+});
+
+const formRef = ref();
+
+const formModel = reactive({
+  username: '',
+  password: '',
+})
+
+// 点击确定
+const handleClickConfirm = () => {
+  formRef.value?.validateFields().then(async (values: any) => {
+    await props.onClickConfirm(values);
+  }).catch((error: any) => {
+    console.error(error);
+  });
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 80 - 13
Web/src/pages/page-web/projects/member/index.vue

@@ -3,35 +3,52 @@
     <Search :onClickAddUser="onClickAddUser" :onClickSearch="onClickSearch" :onClickReset="onClickReset" />
     <div class="mediaList-table">
       <a-table :scroll="{ x: '100%', y: 500 }" rowKey="user_id" :loading="state.listLoading" :columns="columns"
-        @change="refreshData" :rowClassName="rowClassName" :dataSource="state.list" :pagination="paginationConfig" />
+        @change="refreshData" :rowClassName="rowClassName" :dataSource="state.list" :pagination="paginationConfig">
+        <!-- 操作 -->
+        <template #action="{ record }">
+          <a-tooltip title="查看密码">
+            <EyeOutlined style="color: #2d8cf0;" @click="onClickLookPassword(record.user_id)" />
+          </a-tooltip>
+        </template>
+      </a-table>
     </div>
   </div>
+  <AddModal :visible="state.visible" :onClickConfirm="addModalOnClickConfirm" :onClickCancel="addModalOnClickCancel"
+    v-if="state.visible" />
 </template>
 
 <script lang="ts" setup>
-import { onMounted, reactive } from 'vue'
+import { onMounted, reactive } from 'vue';
+import { EyeOutlined } from '@ant-design/icons-vue';
 import Search from './components/Search.vue';
-import { getAllUsersInfo } from '/@/api/manage'
-import { ELocalStorageKey } from '/@/types'
+import AddModal from './components/AddModal.vue';
+import { getAllUsersInfo } from '/@/api/manage';
+import { apis } from '/@/api/custom/index';
+import { ELocalStorageKey } from '/@/types';
 
 export interface Member {
-  user_id: string
-  username: string
-  user_type: string
-  workspace_name: string
-  create_time: string
-  mqtt_username: string
-  mqtt_password: string
+  user_id: string,
+  username: string,
+  user_type: string,
+  workspace_name: string,
+  create_time: string,
+  mqtt_username: string,
+  mqtt_password: string,
+  password: string,
 }
 
 interface State {
+  query: any,
   listLoading: boolean,
   list: Member[],
+  visible: boolean,
 }
 
 const state: State = reactive({
+  query: undefined,
   listLoading: false,
   list: [],
+  visible: false,
 })
 
 const paginationConfig = reactive({
@@ -78,6 +95,13 @@ const columns = [
     title: '用户类型',
     dataIndex: 'user_type',
     width: 150,
+    customRender: ({ text }: any) => {
+      if (text === 'Web') {
+        return '管理员'
+      } else {
+        return '飞行员'
+      }
+    }
   },
   {
     title: '项目名称',
@@ -89,7 +113,23 @@ const columns = [
     dataIndex: 'create_time',
     width: 150,
     sorter: (a: Member, b: Member) => a.create_time.localeCompare(b.create_time),
-  }
+  },
+  {
+    title: '密码',
+    dataIndex: 'password',
+    width: 150,
+    customRender: ({ text }: any) => {
+      return text || '--';
+    }
+  },
+  {
+    title: '操作',
+    dataIndex: 'actions',
+    fixed: 'right',
+    align: 'center',
+    width: 60,
+    slots: { customRender: 'action' },
+  },
 ]
 
 const rowClassName = (record: any, index: number) => {
@@ -106,13 +146,26 @@ const refreshData = async (page: any) => {
   await fetchList();
 }
 
-// 点击添加用户
+// 点击添加飞行员
 const onClickAddUser = () => {
+  state.visible = true;
+}
 
+// 添加飞行员弹出层-点击确定
+const addModalOnClickConfirm = async (data: any) => {
+  state.visible = false;
+  await apis.AddPilot(data);
+  await fetchList(state.query)
+}
+
+// 添加飞行员弹出层-点击取消
+const addModalOnClickCancel = () => {
+  state.visible = false;
 }
 
 // 点击搜索
 const onClickSearch = async (query: any) => {
+  state.query = query;
   await fetchList(query);
 }
 
@@ -120,6 +173,20 @@ const onClickSearch = async (query: any) => {
 const onClickReset = async (query: any) => {
   await fetchList(query);
 }
+
+// 点击查看密码
+const onClickLookPassword = async (id: string) => {
+  try {
+    const res = await apis.fetchPilotPassword({ userId: id });
+    const item = state.list.find((item) => item.user_id === id);
+    if (!item) {
+      return;
+    }
+    item.password = res.data;
+  } catch (e) {
+    console.error(e);
+  }
+}
 </script>
 
 <style lang="scss">