Bladeren bron

用户物品导出

wxxwjef 2 jaren geleden
bovenliggende
commit
a790a20f80

+ 39 - 0
api/src/main/java/com/wx/application/adapter/controller/BulkController.java

@@ -0,0 +1,39 @@
+package com.wx.application.adapter.controller;
+
+import com.wx.application.adapter.dto.qo.GorseQ;
+import com.wx.application.base.BaseController;
+import com.wx.application.base.ResponseData;
+import com.wx.application.core.service.EntrysService;
+import com.wx.application.core.service.RiskUserService;
+import com.wx.application.gorse4j.GorseService;
+import com.wx.application.gorse4j.Item;
+import com.wx.application.nebula.graph.query.NebulaModel;
+import com.wx.application.nebula.graph.query.NebulaNode;
+import com.wx.application.nebula.graph.service.ImportGraphService;
+import com.wx.application.nebula.graph.service.NebulaOperateService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@RequestMapping("/bulk")
+@Controller("bulkController")
+public class BulkController extends BaseController {
+
+    @Autowired
+    GorseService gorseService;
+
+    @GetMapping(value = "/get_bulk/{type}")
+    public String getBulkUserOrItem(@PathVariable("type") String type) throws Exception {
+        return gorseService.getBulkUserOrItem(type);
+    }
+
+
+}

+ 41 - 1
api/src/main/java/com/wx/application/adapter/controller/GorseController.java

@@ -1,10 +1,13 @@
 package com.wx.application.adapter.controller;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import com.alibaba.fastjson.JSONObject;
+import com.wx.application.gorse4j.GorsePage;
+import com.wx.application.gorse4j.User;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -124,9 +127,46 @@ public class GorseController extends BaseController {
     }
 
     @GetMapping(value = "/get_bulk/{type}")
-    public String getBulkUserOrItem(@PathVariable("type") String type) throws Exception {
+    public String getBulkUserOrItem(@PathVariable("type") String type) {
         return gorseService.getBulkUserOrItem(type);
     }
 
+    @GetMapping(value = "/query_users")
+    public ResponseData queryUsers(@RequestParam("cursor") String cursor) throws Exception {
+        GorsePage page = gorseService.getUserPageByCursor(cursor);
+        if(page.getUsers() == null || page.getUsers().size() == 0) {
+            return success(page);
+        }
+        List<String> ids = new ArrayList<>();
+        for(User user : page.getUsers()) {
+            ids.add(user.getUserId());
+        }
+        Map mQ = new HashMap<>();
+        mQ.put("INS_fid", StringUtils.join(ids, ","));
+
+        JSONObject obj = new JSONObject();
+        obj.put("cursor", page.getCursor());
+        obj.put("users", riskUserService.queryList(mQ));
+        return success(obj);
+    }
+
+    @GetMapping(value = "/query_items")
+    public ResponseData queryItems(@RequestParam("cursor") String cursor) throws Exception {
+        GorsePage page = gorseService.getItemPageByCursor(cursor);
+        if(page.getItems() == null || page.getItems().size() == 0) {
+            return success(page);
+        }
+        List<String> ids = new ArrayList<>();
+        for(Item item : page.getItems()) {
+            ids.add(item.getItemId());
+        }
+        Map mQ = new HashMap<>();
+        mQ.put("INS_fid", StringUtils.join(ids, ","));
+
+        JSONObject obj = new JSONObject();
+        obj.put("cursor", page.getCursor());
+        obj.put("items", entrysService.queryList(mQ));
+        return success(obj);
+    }
 
 }

+ 1 - 1
api/src/main/java/com/wx/application/core/entity/FeedbackType.java

@@ -21,7 +21,7 @@ public class FeedbackType extends BaseEntity<Long> {
 
 	private String name;
 
-
+	private String type;
 
 
 }

+ 23 - 0
api/src/main/java/com/wx/application/gorse4j/GorseService.java

@@ -89,6 +89,29 @@ public class GorseService {
         return Arrays.asList(this.request("GET", this.endpoint + "/api/dashboard/user/" + userId + "/neighbors", null, User[].class));
     }
 
+
+    /**
+     * 分页查询用户
+     */
+    public GorsePage getUserPageByCursor(String cursor) throws IOException {
+        String baseUrl = this.endpoint + "/api/dashboard/users";
+        if (StringUtils.isNotBlank(cursor)) {
+            baseUrl += ("?cursor=" + cursor);
+        }
+        return this.request("GET", baseUrl, null, GorsePage.class);
+    }
+
+    /**
+     * 分页查询物品
+     */
+    public GorsePage getItemPageByCursor(String cursor) throws IOException {
+        String baseUrl = this.endpoint + "/api/items";
+        if (StringUtils.isNotBlank(cursor)) {
+            baseUrl += ("?cursor=" + cursor);
+        }
+        return this.request("GET", baseUrl, null, GorsePage.class);
+    }
+
     /**
      * 洞悉(根据用户获取推荐)
      */

+ 1 - 0
api/src/main/resources/config.properties

@@ -11,6 +11,7 @@ spring.servlet.multipart.max-file-size=2048MB
 spring.servlet.multipart.max-request-size=2048MB
 server.port=@server_port@
 ignore.urls[0]=/login/**
+ignore.urls[1]=/bulk/get_bulk/**
 
 upload.graph.path=@upload_graph_path@
 zbx.path=@zbx_path@

+ 34 - 22
web/src/components/menus/EntrysManage.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <div class="menu-title">
-      条目管理
+      物类管理
     </div>
     <div class="menu-content">
       <div>
@@ -15,17 +15,23 @@
           <el-form-item>
             <el-button type="primary" icon="el-icon-search" @click="qo.pageNo=1;queryData()">搜 索</el-button>
           </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="queryData(-1)">上一页</el-button>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="queryData(1)">下一页</el-button>
+          </el-form-item>
         </el-form>
       </div>
       <div style="margin: 0px 0 20px 0">
         <el-button type="primary" @click="createRow()" icon="el-icon-plus">添 加</el-button>
-        <el-button type="primary" @click="downloadItem()" icon="el-icon-download">导出条目</el-button>
-        <el-button type="primary" @click="showImportItemPage()" icon="el-icon-upload2">导入条目</el-button>
+        <el-button type="primary" @click="downloadItem()" icon="el-icon-download">导出物类</el-button>
+        <el-button type="primary" @click="showImportItemPage()" icon="el-icon-upload2">导入物类</el-button>
       </div>
       <div>
-        <el-table  :data="result.records" style="width: 100%">
+        <el-table  :data="result.records" style="width: 100%" v-loading="loading">
           <el-table-column type="index" label="行号" width="60"></el-table-column>
-          <el-table-column prop="fid" label="fid"></el-table-column>
+          <el-table-column prop="fid" label="唯一标识"></el-table-column>
           <el-table-column prop="categories" label="种类">
             <div slot-scope="scope">
               <template v-for="(tag,index) in scope.row.categoriesArr">
@@ -68,15 +74,15 @@
           </el-table-column>
         </el-table>
       </div>
-      <div class="page-box">
-        <el-pagination background
-                       @current-change="handleCurrentChange"
-                       :current-page="qo.pageNo"
-                       :page-size="qo.pageSize"
-                       layout="total, prev, pager, next"
-                       :total="result.total">
-        </el-pagination>
-      </div>
+<!--      <div class="page-box">-->
+<!--        <el-pagination background-->
+<!--                       @current-change="handleCurrentChange"-->
+<!--                       :current-page="qo.pageNo"-->
+<!--                       :page-size="qo.pageSize"-->
+<!--                       layout="total, prev, pager, next"-->
+<!--                       :total="result.total">-->
+<!--        </el-pagination>-->
+<!--      </div>-->
     </div>
     <el-dialog
         :title="dialogName"
@@ -162,6 +168,8 @@ export default {
         records: [],
         total: 0
       },
+      loading: false,
+      cursorArr: [''],
       sourceTypeList: [
         {name: '自定义本体', value: 1},
         {name: '标注系统', value: 2}
@@ -192,19 +200,23 @@ export default {
     _this.queryData();
   },
   methods: {
-    queryData() {
+    queryData(index) {
+      this.loading = true;
+      if (index < 0 && this.cursorArr.length >= 2) {
+        this.cursorArr = this.cursorArr.slice(0, this.cursorArr.length - 2);
+        this.cursorArr = this.cursorArr.length === 0 ? [''] : this.cursorArr;
+      }
       request({
-        url: '/entrys/query_pages',
-        method: 'post',
-        data: _this.qo
+        url: '/gorse/query_items?cursor=' + this.cursorArr[this.cursorArr.length - 1],
+        method: 'get',
       }).then(res => {
-        res.data.records.forEach(row => {
+        this.cursorArr.push(res.data.cursor);
+        res.data.items.forEach(row => {
           row.categoriesArr = row.categories ? row.categories.split(',') : [];
           row.labelsArr = row.labels ? row.labels.split(',') : [];
         });
-
-        _this.result.records = res.data.records;
-        _this.result.total = res.data.total;
+        _this.result.records = res.data.items;
+        this.loading = false;
       });
     },
     handleCurrentChange(val) {

+ 22 - 15
web/src/components/menus/FeedbackTypeManage.vue → web/src/components/menus/FeedbackType.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <div class="menu-title">
-      反馈类型管理
+      反馈类型
     </div>
     <div class="menu-content">
       <div>
@@ -14,24 +14,24 @@
           </el-form-item>
         </el-form>
       </div>
-      <div style="margin: 0px 0 20px 0">
-        <el-button type="primary" @click="createRow()" icon="el-icon-plus">添 加</el-button>
-      </div>
+<!--      <div style="margin: 0px 0 20px 0">-->
+<!--        <el-button type="primary" @click="createRow()" icon="el-icon-plus">添 加</el-button>-->
+<!--      </div>-->
       <div>
         <el-table  :data="result.records" style="width: 100%">
           <el-table-column type="index" label="行号" width="60"></el-table-column>
           <el-table-column prop="name" label="名称"></el-table-column>
-          <el-table-column prop="createTime" label="创建时间" width="180"></el-table-column>
-          <el-table-column label="操作" width="100">
-            <template slot-scope="scope">
-              <el-button @click.native.prevent="modifyRow(scope.row)" type="text" size="small">
-                编辑
-              </el-button>
-              <el-button @click.native.prevent="removeRow(scope.row)" type="text" size="small">
-                删除
-              </el-button>
-            </template>
-          </el-table-column>
+          <el-table-column prop="type" label="类型" :formatter="typeFormatter"></el-table-column>
+<!--          <el-table-column label="操作" width="100">-->
+<!--            <template slot-scope="scope">-->
+<!--              <el-button @click.native.prevent="modifyRow(scope.row)" type="text" size="small">-->
+<!--                编辑-->
+<!--              </el-button>-->
+<!--              <el-button @click.native.prevent="removeRow(scope.row)" type="text" size="small">-->
+<!--                删除-->
+<!--              </el-button>-->
+<!--            </template>-->
+<!--          </el-table-column>-->
         </el-table>
       </div>
       <div class="page-box">
@@ -78,6 +78,10 @@ export default {
         records: [],
         total: 0
       },
+      typeMap: {
+        read: '已读反馈',
+        positive: '正向反馈'
+      },
       dialogName: '编辑',
       cmdDialogVisible: false,
       cmd: {},
@@ -103,6 +107,9 @@ export default {
         _this.result.total = res.data.total;
       });
     },
+    typeFormatter(row) {
+      return this.typeMap[row.type] || "";
+    },
     handleCurrentChange(val) {
       _this.qo.pageNo = val;
       _this.queryData();

+ 1 - 1
web/src/components/menus/GraphImport.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <div class="menu-title">
-      知识图谱导入
+      图谱导入
     </div>
     <div class="menu-content">
       <el-tabs v-model="activeName" @tab-click="handleClick">

+ 1 - 1
web/src/components/menus/GraphModel.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <div class="menu-title">
-      知识图谱本体管理
+      本体管理
     </div>
     <div class="menu-content">
       <div>

+ 1 - 1
web/src/components/menus/GraphSpaceManage.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <div class="menu-title">
-      知识图谱管理
+      图谱管理
     </div>
     <div class="menu-content">
       <div>

+ 1 - 1
web/src/components/menus/IntelligenceRecommend.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <div class="menu-title">
-      智能推荐
+      快捷检索
     </div>
     <div class="menu-content">
       <el-tabs type="border-card">

+ 37 - 23
web/src/components/menus/UserManage.vue

@@ -6,12 +6,18 @@
     <div class="menu-content">
       <div>
         <el-form :inline="true" :model="qo" class="demo-form-inline">
-          <el-form-item label="Fid:">
-            <el-input v-model="qo.LIKES_fid" placeholder="请输入Fid" clearable  style="width: 300px"></el-input>
+          <el-form-item label="唯一标识:">
+            <el-input v-model="qo.LIKES_fid" placeholder="请输入唯一标识" clearable style="width: 300px"></el-input>
           </el-form-item>
           <el-form-item>
             <el-button type="primary" icon="el-icon-search" @click="qo.pageNo=1;queryData()">搜 索</el-button>
           </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="queryData(-1)">上一页</el-button>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="queryData(1)">下一页</el-button>
+          </el-form-item>
         </el-form>
       </div>
       <div style="margin: 0px 0 20px 0">
@@ -20,16 +26,16 @@
         <el-button type="primary" @click="showImportUserPage()" icon="el-icon-upload2">导入用户</el-button>
       </div>
       <div>
-        <el-table  :data="result.records" style="width: 100%">
+        <el-table :data="result.records" style="width: 100%" v-loading="loading">
           <el-table-column type="index" label="行号" width="60"></el-table-column>
-          <el-table-column prop="fid" label="fid"></el-table-column>
+          <el-table-column prop="fid" label="唯一标识"></el-table-column>
           <el-table-column prop="realname" label="姓名"></el-table-column>
           <el-table-column prop="labels" label="标签">
             <div slot-scope="scope">
-              <template v-for="(tag,index) in scope.row.labelsArr">
+              <template v-for="(tag,index) in scope.row.labelArr">
                 <el-tag :key="index" v-if="index < 5">{{ tag }}</el-tag>
               </template>
-              <el-tag v-if="scope.row.labelsArr.length > 5">...</el-tag>
+              <el-tag v-if="scope.row.labelArr.length > 5">...</el-tag>
             </div>
           </el-table-column>
           <el-table-column label="操作" width="240">
@@ -53,15 +59,15 @@
           </el-table-column>
         </el-table>
       </div>
-      <div class="page-box">
-        <el-pagination background
-                       @current-change="handleCurrentChange"
-                       :current-page="qo.pageNo"
-                       :page-size="qo.pageSize"
-                       layout="total, prev, pager, next"
-                       :total="result.total">
-        </el-pagination>
-      </div>
+      <!--      <div class="page-box">-->
+      <!--        <el-pagination background-->
+      <!--                       @current-change="handleCurrentChange"-->
+      <!--                       :current-page="qo.pageNo"-->
+      <!--                       :page-size="qo.pageSize"-->
+      <!--                       layout="total, prev, pager, next"-->
+      <!--                       :total="result.total">-->
+      <!--        </el-pagination>-->
+      <!--      </div>-->
     </div>
     <el-dialog
         :title="dialogName"
@@ -84,6 +90,7 @@
 import request, {getBaseUrl} from '@/utils/request';
 
 var _this;
+var _index = 0;
 export default {
   name: "userManage",
   data() {
@@ -97,6 +104,8 @@ export default {
         records: [],
         total: 0
       },
+      loading: false,
+      cursorArr: [''], // 分页游标
       dialogName: '编辑',
       cmdDialogVisible: false,
       cmd: {},
@@ -116,17 +125,22 @@ export default {
     _this.queryData();
   },
   methods: {
-    queryData() {
+    queryData(index) {
+      this.loading = true;
+      if (index < 0 && this.cursorArr.length >= 2) {
+        this.cursorArr = this.cursorArr.slice(0, this.cursorArr.length - 2);
+        this.cursorArr = this.cursorArr.length === 0 ? [''] : this.cursorArr;
+      }
       request({
-        url: '/risk-user/query_pages',
-        method: 'post',
-        data: _this.qo
+        url: '/gorse/query_users?cursor=' + this.cursorArr[this.cursorArr.length - 1],
+        method: 'get',
       }).then(res => {
-        res.data.records.forEach(row => {
-          row.labelsArr = row.labels ? row.labels.split(',') : [];
+        this.cursorArr.push(res.data.cursor);
+        res.data.users.forEach(row => {
+          row.labelArr = row.labels ? row.labels.split(',') : [];
         });
-        _this.result.records = res.data.records;
-        _this.result.total = res.data.total;
+        _this.result.records = res.data.users;
+        this.loading = false;
       });
     },
     handleCurrentChange(val) {

+ 2 - 2
web/src/components/menus/user/LinkUser.vue

@@ -72,12 +72,12 @@ export default {
       });
     },
     getLinkUser() {
-      let space = 'recom_gorse';
+      let space = 'user_relation';
       request({
         url: `/nebula_operate/findonepathbyidwithrelation/${space}/${_this.userId}`,
         method: 'post',
         data: {
-          relations: ['edge_6253525352']
+          relations: ['edge_768395026']
         }
       }).then(res => {
         _this.list = res.data.nodes;

+ 2 - 2
web/src/router/index.js

@@ -60,8 +60,8 @@ export default new Router({
                     component: () => import('@/components/menus/item/ImportItem')
                 },
                 {
-                    path: 'feedbackTypeManage',
-                    component: () => import('@/components/menus/FeedbackTypeManage')
+                    path: 'feedbackType',
+                    component: () => import('@/components/menus/FeedbackType')
                 },
                 {
                     path: 'intelligenceRecommend',

+ 7 - 7
web/src/utils/menu.js

@@ -8,11 +8,11 @@ const menuList = [
     {
         index: "1",
         icon: "el-icon-monitor",
-        name: "知识图谱构建",
+        name: "知识图谱",
         list: [
-            {index: '1-1', name: "知识图谱本体管理", icon: "el-icon-user", url: "/graphModel"},
-            {index: '1-2', name: "知识图谱管理", icon: "el-icon-user", url: "/graphSpaceManage"},
-            {index: '1-3', name: "知识图谱导入", icon: "el-icon-user", url: "/graphImport"},
+            {index: '1-1', name: "图谱本体", icon: "el-icon-user", url: "/graphModel"},
+            {index: '1-2', name: "图谱管理", icon: "el-icon-user", url: "/graphSpaceManage"},
+            {index: '1-3', name: "图谱导入", icon: "el-icon-user", url: "/graphImport"},
         ]
     },
     {
@@ -24,14 +24,14 @@ const menuList = [
     {
         index: "3",
         icon: "el-icon-collection",
-        name: "条目管理",
+        name: "物类管理",
         url: "/entrysManage"
     },
     {
         index: "4",
         icon: "el-icon-headset",
-        name: "反馈类型管理",
-        url: "/feedbackTypeManage"
+        name: "反馈类型",
+        url: "/feedbackType"
     },
     {
         index: "5",