用户物品导出

This commit is contained in:
2023-11-23 17:26:00 +08:00
parent 55dd565e92
commit a790a20f80
15 changed files with 213 additions and 77 deletions

View File

@@ -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);
}
}

View File

@@ -1,10 +1,13 @@
package com.wx.application.adapter.controller; package com.wx.application.adapter.controller;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.alibaba.fastjson.JSONObject; 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.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -124,9 +127,46 @@ public class GorseController extends BaseController {
} }
@GetMapping(value = "/get_bulk/{type}") @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); 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);
}
} }

View File

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

View File

@@ -89,6 +89,29 @@ public class GorseService {
return Arrays.asList(this.request("GET", this.endpoint + "/api/dashboard/user/" + userId + "/neighbors", null, User[].class)); 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);
}
/** /**
* 洞悉(根据用户获取推荐) * 洞悉(根据用户获取推荐)
*/ */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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