用户物品的查询改成gorse

This commit is contained in:
2023-11-24 00:26:02 +08:00
parent eeb87693d4
commit da3fb87975
8 changed files with 148 additions and 38 deletions

View File

@@ -134,11 +134,11 @@ public class GorseController extends BaseController {
@GetMapping(value = "/query_users") @GetMapping(value = "/query_users")
public ResponseData queryUsers(@RequestParam("cursor") String cursor) throws Exception { public ResponseData queryUsers(@RequestParam("cursor") String cursor) throws Exception {
GorsePage page = gorseService.getUserPageByCursor(cursor); GorsePage page = gorseService.getUserPageByCursor(cursor);
if(page.getUsers() == null || page.getUsers().size() == 0) { if (page.getUsers() == null || page.getUsers().size() == 0) {
return success(page); return success(page);
} }
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
for(User user : page.getUsers()) { for (User user : page.getUsers()) {
ids.add(user.getUserId()); ids.add(user.getUserId());
} }
Map mQ = new HashMap<>(); Map mQ = new HashMap<>();
@@ -150,14 +150,31 @@ public class GorseController extends BaseController {
return success(obj); return success(obj);
} }
@GetMapping(value = "/query_user/{id}")
public ResponseData queryUser(@PathVariable("id") String id) {
User user = null;
try {
user = gorseService.getUserById(id);
} catch (Exception e) {
}
if (user == null) {
return success();
}
Map mQ = new HashMap<>();
mQ.put("EQS_fid", user.getUserId());
return success(riskUserService.queryUnique(mQ));
}
@GetMapping(value = "/query_items") @GetMapping(value = "/query_items")
public ResponseData queryItems(@RequestParam("cursor") String cursor) throws Exception { public ResponseData queryItems(@RequestParam("cursor") String cursor) throws Exception {
GorsePage page = gorseService.getItemPageByCursor(cursor); GorsePage page = gorseService.getItemPageByCursor(cursor);
if(page.getItems() == null || page.getItems().size() == 0) { if (page.getItems() == null || page.getItems().size() == 0) {
return success(page); return success(page);
} }
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
for(Item item : page.getItems()) { for (Item item : page.getItems()) {
ids.add(item.getItemId()); ids.add(item.getItemId());
} }
Map mQ = new HashMap<>(); Map mQ = new HashMap<>();
@@ -169,4 +186,22 @@ public class GorseController extends BaseController {
return success(obj); return success(obj);
} }
@GetMapping(value = "/query_item/{id}")
public ResponseData queryItem(@PathVariable("id") String id) {
Item item = null;
try {
item = gorseService.getItemById(id);
} catch (Exception e) {
}
if (item == null) {
return success();
}
Map mQ = new HashMap<>();
mQ.put("EQS_fid", item.getItemId());
return success(entrysService.queryUnique(mQ));
}
} }

View File

@@ -101,6 +101,13 @@ public class GorseService {
return this.request("GET", baseUrl, null, GorsePage.class); return this.request("GET", baseUrl, null, GorsePage.class);
} }
/**
* 查询用户
*/
public User getUserById(String id) throws IOException {
return this.request("GET", this.endpoint + "/api/dashboard/user/" + id, null, User.class);
}
/** /**
* 分页查询物品 * 分页查询物品
*/ */
@@ -112,6 +119,13 @@ public class GorseService {
return this.request("GET", baseUrl, null, GorsePage.class); return this.request("GET", baseUrl, null, GorsePage.class);
} }
/**
* 查询物品
*/
public Item getItemById(String id) throws IOException {
return this.request("GET", this.endpoint + "/api/item/" + id, null, Item.class);
}
/** /**
* 洞悉(根据用户获取推荐) * 洞悉(根据用户获取推荐)
*/ */

View File

@@ -15,7 +15,7 @@
height="550" height="550"
border border
style="width: 100%"> style="width: 100%">
<el-table-column prop="comment" label="属性名称" :formatter="handleCommentFormater"></el-table-column> <el-table-column prop="comment" label="属性名称"></el-table-column>
<el-table-column prop="type" label="数据类型"></el-table-column> <el-table-column prop="type" label="数据类型"></el-table-column>
<!-- <el-table-column prop="Null" label="允许空值"></el-table-column>--> <!-- <el-table-column prop="Null" label="允许空值"></el-table-column>-->
<!-- <el-table-column prop="Default" label="默认值"></el-table-column>--> <!-- <el-table-column prop="Default" label="默认值"></el-table-column>-->

View File

@@ -6,14 +6,17 @@
<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="种类"> <el-form-item label="唯一标识">
<el-input v-model="qo.LIKES_categories" placeholder="请输入种类" 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 label="标签:">
<el-input v-model="qo.LIKES_labels" placeholder="请输入标签" clearable style="width: 300px"></el-input>
</el-form-item> </el-form-item>
<!-- <el-form-item label="种类:">-->
<!-- <el-input v-model="qo.LIKES_categories" placeholder="请输入种类" clearable style="width: 300px"></el-input>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="标签:">-->
<!-- <el-input v-model="qo.LIKES_labels" placeholder="请输入标签" clearable style="width: 300px"></el-input>-->
<!-- </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="queryDataById()"> </el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="queryData(-1)">上一页</el-button> <el-button type="primary" @click="queryData(-1)">上一页</el-button>
@@ -29,7 +32,7 @@
<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%" v-loading="loading"> <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="唯一标识"></el-table-column> <el-table-column prop="fid" label="唯一标识"></el-table-column>
<el-table-column prop="categories" label="种类"> <el-table-column prop="categories" label="种类">
@@ -74,15 +77,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"
@@ -161,6 +164,7 @@ export default {
qo: { qo: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
LIKES_fid: '',
LIKES_categories: '', LIKES_categories: '',
LIKES_labels: '', LIKES_labels: '',
}, },
@@ -200,6 +204,37 @@ export default {
_this.queryData(); _this.queryData();
}, },
methods: { methods: {
queryDataById() {
if (this.qo.LIKES_fid.length > 0) {
this.loading = true;
request({
url: '/gorse/query_item/' + this.qo.LIKES_fid,
method: 'get',
}).then(res => {
let user = res.data;
if (!user) {
_this.result.records = [];
} else {
if (user.categories) {
user.categoriesArr = user.categories.split(',');
} else {
user.categoriesArr = [];
}
if (user.labels) {
user.labelsArr = user.labels.split(',');
} else {
user.labelsArr = [];
}
_this.result.records = [user];
}
this.loading = false;
});
} else {
this.cursorArr = [''];
this.queryData(1);
}
},
queryData(index) { queryData(index) {
this.loading = true; this.loading = true;
if (index < 0 && this.cursorArr.length >= 2) { if (index < 0 && this.cursorArr.length >= 2) {
@@ -258,7 +293,7 @@ export default {
createRow() { createRow() {
_this.dialogName = '新建'; _this.dialogName = '新建';
_this.cmdDialogVisible = true; _this.cmdDialogVisible = true;
_this.$nextTick(_=> { _this.$nextTick(_ => {
_this.$refs['cmd'].clearValidate(); _this.$refs['cmd'].clearValidate();
_this.cmd = { _this.cmd = {
fid: '', fid: '',
@@ -272,7 +307,7 @@ export default {
modifyRow(item) { modifyRow(item) {
_this.dialogName = '编辑'; _this.dialogName = '编辑';
_this.cmdDialogVisible = true; _this.cmdDialogVisible = true;
_this.$nextTick(_=> { _this.$nextTick(_ => {
_this.$refs['cmd'].clearValidate(); _this.$refs['cmd'].clearValidate();
_this.cmd = JSON.parse(JSON.stringify(item)); _this.cmd = JSON.parse(JSON.stringify(item));
}) })
@@ -280,10 +315,10 @@ export default {
submitModify() { submitModify() {
this.$refs.cmd.validate((valid) => { this.$refs.cmd.validate((valid) => {
if (valid) { if (valid) {
if(_this.cmd.categoriesArr) { if (_this.cmd.categoriesArr) {
_this.cmd.categories = _this.cmd.categoriesArr.toString(); _this.cmd.categories = _this.cmd.categoriesArr.toString();
} }
if(_this.cmd.labelsArr) { if (_this.cmd.labelsArr) {
_this.cmd.labels = _this.cmd.labelsArr.toString(); _this.cmd.labels = _this.cmd.labelsArr.toString();
} }
@@ -328,7 +363,7 @@ export default {
}, },
handleInputConfirm(typeName) { handleInputConfirm(typeName) {
let inputValue = _this[typeName + "InputValue"]; let inputValue = _this[typeName + "InputValue"];
if(inputValue) { if (inputValue) {
_this.cmd[typeName + "Arr"].push(inputValue); _this.cmd[typeName + "Arr"].push(inputValue);
} }
_this[typeName + "InputVisible"] = false; _this[typeName + "InputVisible"] = false;

View File

@@ -10,7 +10,7 @@
<el-input v-model="qo.LIKES_fid" placeholder="请输入唯一标识" 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="queryDataById()"> </el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="queryData(-1)">上一页</el-button> <el-button type="primary" @click="queryData(-1)">上一页</el-button>
@@ -41,13 +41,13 @@
<el-table-column label="操作" width="240"> <el-table-column label="操作" width="240">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click.native.prevent="linkUser(scope.row)" type="text" size="small"> <el-button @click.native.prevent="linkUser(scope.row)" type="text" size="small">
注用户
</el-button> </el-button>
<el-button @click.native.prevent="similarUser(scope.row)" type="text" size="small"> <el-button @click.native.prevent="similarUser(scope.row)" type="text" size="small">
相似 相似
</el-button> </el-button>
<el-button @click.native.prevent="recommendItem(scope.row)" type="text" size="small"> <el-button @click.native.prevent="recommendItem(scope.row)" type="text" size="small">
洞悉 查看推荐
</el-button> </el-button>
<el-button @click.native.prevent="modifyRow(scope.row)" type="text" size="small"> <el-button @click.native.prevent="modifyRow(scope.row)" type="text" size="small">
编辑 编辑
@@ -125,6 +125,32 @@ export default {
_this.queryData(); _this.queryData();
}, },
methods: { methods: {
queryDataById() {
if (this.qo.LIKES_fid.length > 0) {
this.loading = true;
request({
url: '/gorse/query_user/' + this.qo.LIKES_fid,
method: 'get',
}).then(res => {
let user = res.data;
if (!user) {
_this.result.records = [];
} else {
if (user.labels) {
user.labelArr = user.labels.split(',');
} else {
user.labelArr = [];
}
_this.result.records = [user];
}
this.loading = false;
});
} else {
this.cursorArr = [''];
this.queryData(1);
}
},
queryData(index) { queryData(index) {
this.loading = true; this.loading = true;
if (index < 0 && this.cursorArr.length >= 2) { if (index < 0 && this.cursorArr.length >= 2) {

View File

@@ -1,13 +1,13 @@
<template> <template>
<div style="height: 100%"> <div style="height: 100%">
<div class="menu-title"> <div class="menu-title">
洞悉{{ gorseQo.userId }} 查看推荐{{ gorseQo.userId }}
<div class="icon icon-back" @click="backBtn"> <div class="icon icon-back" @click="backBtn">
<i title="返回"></i> <i title="返回"></i>
</div> </div>
</div> </div>
<div class="block_box" style="margin-top: 20px"> <div class="block_box">
<div class="title">推荐</div> <!-- <div class="title">推荐</div>-->
<el-form :inline="true" class="demo-form-inline"> <el-form :inline="true" class="demo-form-inline">
<el-form-item> <el-form-item>
<el-select v-model="gorseQo.recommendation" @change="getRecommendItem"> <el-select v-model="gorseQo.recommendation" @change="getRecommendItem">
@@ -114,10 +114,10 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.block_box { .block_box {
margin: 25px; margin: 25px 25px 0 25px;
background: #FFFFFF; background: #FFFFFF;
border-radius: 3px; border-radius: 3px;
height: calc(100% - 160px); height: calc(100% - 120px);
.title { .title {
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
@@ -131,7 +131,7 @@ export default {
} }
.line-item-box { .line-item-box {
height: calc(100% - 140px); height: calc(100% - 88px);
overflow-y: auto; overflow-y: auto;
.line-item { .line-item {

View File

@@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<div class="menu-title"> <div class="menu-title">
用户{{ userId }} 用户{{ userId }}
<div class="icon icon-back" @click="backBtn"> <div class="icon icon-back" @click="backBtn">
<i title="返回"></i> <i title="返回"></i>
</div> </div>
@@ -27,7 +27,7 @@
<el-table-column label="操作" width="210"> <el-table-column label="操作" width="210">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click.native.prevent="recommendItem(scope.row)" type="text" size="small"> <el-button @click.native.prevent="recommendItem(scope.row)" type="text" size="small">
洞悉 查看推荐
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>

View File

@@ -40,7 +40,7 @@
<el-table-column label="操作" width="210"> <el-table-column label="操作" width="210">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click.native.prevent="recommendItem(scope.row)" type="text" size="small"> <el-button @click.native.prevent="recommendItem(scope.row)" type="text" size="small">
洞悉 查看推荐
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>