Commit b59fc6fc authored by 姬鋆屾's avatar 姬鋆屾

parents d7b90ff8 65558931
<template>
<div class="header-site">
<a-popover trigger="click" placement="bottomLeft" v-model="visible">
<a class="ant-dropdown-link" @click="visible = true">
<div :trigger="['click']" class="trigger" @click="ontrigger">
<slot>
<a class="ant-dropdown-link" @click="(e) => e.preventDefault()">
{{ siteName }} <a-icon type="down" />
</a>
<template slot="content">
<div class="content" style="min-width: 50vw; min-height: 200px">
<div class="flex_row flex_align_c primary-color name">
<a-icon type="environment" style="margin-right: 10px" />
<span style="">{{ siteName }}</span>
</div>
<div class="site-list">
<span
v-for="(item, index) in sitelist"
:key="index"
:class="{ 'primary-color': item.id == checkid }"
@click="setSite(item)"
>{{ item.label }}</span
>
</div>
<div class="check-site">
<span>您的选择是:</span>
<span
v-for="(item, index) in checkarr"
:key="index"
@click="updataSite(item)"
>{{ index > 0 ? ">" : "" }}{{ item.label }}</span
>
</div>
<div class="site-btn">
<a-button style="margin-right: 10px" @click="visible = false"
>取消</a-button
>
<a-button type="primary" @click="onSucessSite" :disabled="isSite"
>确定</a-button
>
</div>
</div>
</template>
</a-popover>
</slot>
<div
slot="overlay"
class="select-site"
:style="{ left: `${offsetLeft}px` }"
v-if="show"
>
<div class="flex_row flex_align_c primary-color name">
<a-icon type="environment" style="margin-right: 10px" />
<span style="">{{ siteName }}</span>
</div>
<div class="site-list">
<span
v-for="(item, index) in sitelist"
:key="index"
:class="{ 'primary-color': item.id == checkid }"
@click="setSite(item)"
>{{ item.label }}</span
>
</div>
<div class="check-site">
<span>您的选择是:</span>
<span
class="check-item"
v-for="(item, index) in checkarr"
:key="index"
@click="updataSite(item)"
>{{ index > 0 ? ">" : "" }}{{ item.label }}</span
>
</div>
<div class="site-btn">
<a-button @click="show = false" style="margin-right: 10px"
>取消</a-button
>
<a-button type="primary" @click="onSucessSite" :disabled="isSite"
>确定</a-button
>
</div>
</div>
</div>
</template>
<script>
import { getSiteTree } from "@/services/basicsetFun";
import { mapMutations } from "vuex";
import local from "@/utils/local";
// import Cookie from "js-cookie";
export default {
data() {
return {
sitelist: [],
visible: false,
show: false,
offsetLeft: 0,
checkarr: [], //选中站点
checkid: undefined, //最终选中站点
......@@ -62,13 +66,17 @@ export default {
created() {
this.getwaitedListdata();
},
mounted() {},
mounted() {
const { offsetLeft } = this.$el;
this.offsetLeft = offsetLeft;
},
methods: {
...mapMutations("site", ["SET_SITE_ID", "SET_siteName"]),
// 确认站点
onSucessSite() {
if (this.checkarr.length == 0) return;
let obj = this.checkarr[this.checkarr.length - 1];
this.clickSite(obj);
},
// 选中
......@@ -76,16 +84,22 @@ export default {
this.checkid = undefined;
// 为子节点不添加数据
let data = this.checkarr[this.checkarr.length - 1];
if (data && (data.isLeaf || data.children.length == 0)) {
// 如果为子节点更新最后一个数据
this.checkid = obj.id;
this.checkarr[this.checkarr.length - 1] = obj;
// 如果选中数据有子集更新站点列表
if (obj.children && obj.children.length > 0) {
this.sitelist = obj.children;
}
} else {
this.checkarr.push(obj);
if (obj.children && obj.children.length > 0) {
this.sitelist = obj.children;
}
}
if (obj && obj.type == "site") {
this.isSite = false;
} else {
......@@ -136,17 +150,13 @@ export default {
});
},
clickSite(obj) {
// Cookie.set("siteid", obj.id);
// let siteInfo = {
// siteName: obj.label,
// siteid: obj.id,
// };
local.setLocal("siteId", obj.id);
local.setLocal("siteName", obj.label);
this.SET_SITE_ID(obj.id);
this.SET_siteName(obj.label);
this.show = false;
if (location.href.search(/token/gi) >= 0) {
this.$router.push({ path: "/resource/advimg" });
setTimeout(() => {
location.reload();
});
......@@ -163,28 +173,43 @@ export default {
};
</script>
<style lang="less" scoped>
.trigger {
display: inline-block;
position: relative;
}
.ant-dropdown-link {
color: #fff;
padding: 0 20px;
font-size: 16px;
min-width: 200px;
display: inline-block;
color: #fff;
}
.content {
display: flex;
flex-direction: column;
justify-content: space-around;
.select-site {
position: fixed;
left: 0;
top: 65px;
background: #fff;
border-radius: 6px;
padding: 10px;
min-width: 60%;
max-width: 80%;
z-index: 9;
color: rgba(0, 0, 0, 0.8);
font-size: 14px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
.name {
font-size: 20px;
}
.site-list {
// padding: 10px 0;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
display: flex;
flex-wrap: wrap;
overflow: hidden;
span {
float: left;
line-height: 1.5;
padding: 10px 20px;
display: inline-block;
cursor: pointer;
&:hover {
color: #1890ff;
......@@ -195,7 +220,7 @@ export default {
.site-btn {
padding: 0 20px;
}
.check-site {
.check-item {
cursor: pointer;
}
}
......
......@@ -69,6 +69,10 @@
<template slot="sort" slot-scope="text">
{{ text.sort ? text.sort : "--" }}
</template>
<!-- 类型 -->
<template slot="type" slot-scope="text">
{{ text.type ? dict.type[text.type] : "--" }}
</template>
<!-- 创建时间 -->
<template slot="createTime" slot-scope="text">
{{ text.createTime | dateFormat }}
......@@ -148,6 +152,21 @@
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="类型" prop="type">
<a-select v-model="formData.type" placeholder="请选择类型">
<a-select-option
v-for="(v, key) in dict.type"
:key="key"
:value="Number(key)"
>
{{ v }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="12">
<a-form-model-item label="排序" prop="sort">
<a-input-number
......@@ -180,27 +199,6 @@
<div class="ant-upload-text">点击上传</div>
</div>
</a-upload>
<!-- <a-upload
name="file"
list-type="picture-card"
:action="api + 'base/file/commonupload'"
@change="handleUpload"
:before-upload="beforeUpload"
:show-upload-list="false"
:accept="accept"
>
<div v-if="formData.modelIcon">
<div class="svg-box" v-if="isSvg(formData.modelIcon)">
<img :src="api + formData.modelIcon" />
</div>
<img v-else :src="api + formData.modelIcon" />
</div>
<div v-else>
<a-icon :type="loading ? 'loading' : 'plus'" />
<div class="ant-upload-text">点击上传</div>
</div>
</a-upload> -->
</a-form-model-item>
</a-col>
</a-row>
......@@ -275,6 +273,10 @@ const columns = [
width: "5%",
scopedSlots: { customRender: "sort" },
},
{
title: "类型",
scopedSlots: { customRender: "type" },
},
{
title: "创建时间",
width: "12%",
......@@ -317,6 +319,7 @@ export default {
modelUrl: "", // 模块地址
remark: "", // 备注
sort: "", // 排序
type: undefined, // 类型
},
current: 1,
size: 10,
......@@ -336,9 +339,13 @@ export default {
modelIcon: [
{ required: true, message: "模块图标不能为空", trigger: "change" },
],
type: [
{ required: true, message: "模块类型不能为空", trigger: "change" },
],
},
StatementVisible: false,
modelInfo: {},
dict: {},
};
},
created() {
......@@ -354,13 +361,16 @@ export default {
modelName: `%${this.searchValue}%`,
...search,
});
let { pageInfo, data } = res.data.data;
if (!data.length && this.current > 1) {
this.current -= 1;
this.getmodelList();
if (res.data.code == 1) {
let { pageInfo, data, dict } = res.data.data;
if (!data.length && this.current > 1) {
this.current -= 1;
this.getmodelList();
}
this.dict = dict;
this.total = pageInfo.totalResult;
this.modelList = data;
}
this.total = pageInfo.totalResult;
this.modelList = data;
this.loading = false;
},
// 新增按钮
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -21,6 +21,7 @@
"echarts": "^5.3.3",
"element-ui": "^2.15.8",
"font-awesome": "^4.7.0",
"gsap": "^3.12.2",
"heatmap.js": "^2.0.5",
"highlight.js": "^11.5.1",
"js-export-excel": "^1.1.4",
......@@ -29,11 +30,13 @@
"qs": "^6.10.3",
"secure-ls": "^1.2.6",
"swiper": "5",
"three": "^0.155.0",
"v-viewer": "^1.6.4",
"vue": "^2.6.14",
"vue-highlightjs": "^1.3.3",
"vue-lazyload": "1.3.3",
"vue-router": "^3.5.1",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.2",
"vuex-persistedstate": "^4.1.0"
},
......
......@@ -58,6 +58,9 @@ export default {
</script>
<style lang="less" scoped>
.app {
min-width: 1600px;
}
.export {
background-color: rgba(0, 0, 0, 0.3);
}
......
import http from "../request/http";
let baseURL = process.env.VUE_APP_API_BASE_URL
let baseURL = process.env.VUE_APP_API_BASE_URL;
// 1.16.1. 查询站点编排列表
export function appsListInterface(params) {
return http.post(`${baseURL}/zwfw/site/model/list`, params);
return http.post(`${baseURL}/zwfw/site/model/list/group`, params);
}
// 获取收藏
export function getCollect(params) {
return http.post(`${baseURL}/zwfw/user/model/collect/get`, params);
}
// 保存收藏
export function saveCollect(params) {
return http.post(`${baseURL}/zwfw/user/model/collect/save`, params);
}
......@@ -6,6 +6,11 @@ import store from "./store";
import Antd from "ant-design-vue";
import "ant-design-vue/dist/antd.css";
import { message } from "ant-design-vue";
message.config({
duration: 2,
maxCount: 1,
});
Vue.use(Antd);
import GlobalComponents from "./utils/js/globalComponents";
......@@ -24,6 +29,10 @@ import "@/assets/fonts/iconfont.css";
import customComponents from "@/components";
Vue.use(customComponents);
// 拖动插件
import draggable from "vuedraggable";
Vue.component("draggable", draggable);
// 引入注册全局指令
import * as directives from "@/directive";
Object.keys(directives).forEach((name) =>
......
......@@ -2,148 +2,128 @@ import { menuList } from "@/api/menuMgmt.js";
import { deepClone, toTreeData, getItemData } from "@/utils/js/common.js";
import { mapGetters, mapMutations } from "vuex";
export default {
data() {
return {
MenuDict: {},
menuListData: [], //简单结构
menuTreeData: [], //树型结构
tablePagination: {
current: 1,
pageSize: 10,
total: 20,
showQuickJumper: true, //是否可以快速跳转至某页
showSizeChanger: true, //是否可以改变 pageSize
showTotal: (total, range) => `共${total}条`,
pageSizeOptions: ["10", "20", "30"],
},
}
data() {
return {
MenuDict: {},
menuListData: [], //简单结构
menuTreeData: [], //树型结构
tablePagination: {
current: 1,
pageSize: 10,
total: 20,
showQuickJumper: true, //是否可以快速跳转至某页
showSizeChanger: true, //是否可以改变 pageSize
showTotal: (total, range) => `共${total}条`,
pageSizeOptions: ["10", "20", "30"],
},
};
},
computed: {
menuRouterList() {
return this.$router.options.routes
.filter((v) => v.name == "home")[0]
.children.map((k) => {
return {
title: k.meta.title,
routerPath: k.path,
};
});
},
computed: {
menuRouterList() {
return this.$router.options.routes
.filter((v) => v.name == "home")[0]
.children.map((k) => {
return {
title: k.meta.title,
routerPath: k.path,
};
});
},
...mapGetters("menu", ["menuList_X", "menuTree_X"]),
...mapGetters("user", ["censusList_X", "appsList_X"]),
MenuChildren() {
let routerPath = this.$route.path.substr(
this.$route.path.lastIndexOf("/") + 1
)
let result = getItemData(
this.menuTree_X,
'routerPath',
routerPath,
)
return result ? result : { children: [] };
}
...mapGetters("menu", ["menuList_X", "menuTree_X"]),
...mapGetters("user", ["censusList_X", "appsList_X"]),
MenuChildren() {
let routerPath = this.$route.path.substr(
this.$route.path.lastIndexOf("/") + 1
);
let result = getItemData(this.menuTree_X, "routerPath", routerPath);
return result ? result : { children: [] };
},
created() {
},
beforeDestroy() {
},
methods: {
...mapMutations("menu", ["SET_menuList_X", "SET_menuTree_X"]),
getMenuList(isFirst = false) {
let obj = {
page: this.tablePagination.current, //当前页
size: this.tablePagination.pageSize, //每页条数
};
if (isFirst) {
obj = {
page: 1, //-1 全部数据
size: -1, //-1 全部数据
};
}
menuList(obj).then((res) => {
// console.log(res);
let { code, data, dict } = res;
if (code == 1) {
data.data = data.data.map((item) => {
this.menuRouterList.forEach(v => {
if (v['title'] == item.name) {
item["routerPath"] = v['routerPath'];
}
})
item["value"] = item.id;
item["label"] = item.name;
return item;
});
// console.log(data.data);
// this.$message.success(res.msg);
this.tablePagination.current = data.current_page;
this.tablePagination.total = data.total;
this.menuListData = data.data;
this.menuTreeData = toTreeData(data.data, -1, "id", "parentId");
this.SET_menuList_X(deepClone(this.menuListData));
this.SET_menuTree_X(deepClone(this.menuTreeData));
this.MenuDict = dict;
this.MenuDict["MenuTree"] = deepClone(this.menuTreeData);
// console.log(this.menuListData);
// console.log(this.menuTreeData);
// this.getMenuDict(); //弃用
} else {
this.$message.error(res.msg);
}
},
created() {},
beforeDestroy() {},
methods: {
...mapMutations("menu", ["SET_menuList_X", "SET_menuTree_X"]),
getMenuList(isFirst = false) {
let obj = {
page: this.tablePagination.current, //当前页
size: this.tablePagination.pageSize, //每页条数
};
if (isFirst) {
obj = {
page: 1, //-1 全部数据
size: -1, //-1 全部数据
};
}
menuList(obj).then((res) => {
// console.log(res);
let { code, data, dict } = res.data;
if (code == 1) {
data.data = data.data.map((item) => {
this.menuRouterList.forEach((v) => {
if (v["title"] == item.name) {
item["routerPath"] = v["routerPath"];
}
});
},
getMenuDict() {
//目前只有三级 一级查询条件-1
let list = deepClone(this.menuListData);
let obj = list.sort((a, b) => {
return parseFloat(b["parentId"]) - parseFloat(a["parentId"]);
})[0];
Promise.all([
// 一级菜单字典
menuList({
parentId: -1,
}),
// 二级菜单字典
menuList({
parentId: obj["firstMenuId"],
}),
// 三级菜单字典
menuList({
parentId: obj["secondMenuId"],
}),
])
.then((res) => {
// 一级菜单字典
this.MenuDict["firstLevelOptions"] = res[0].data.data;
// 二级菜单字典
this.MenuDict["secondLevelOptions"] = res[1].data.data;
// 三级菜单字典
this.MenuDict["thirdLevelOptions"] = res[2].data.data;
// console.log(this.MenuDict);
})
.catch((err) => {
// console.log(err);
});
},
item["value"] = item.id;
item["label"] = item.name;
return item;
});
// console.log(data.data);
// this.$message.success(res.msg);
this.tablePagination.current = data.current_page;
this.tablePagination.total = data.total;
this.menuListData = data.data;
this.menuTreeData = toTreeData(data.data, -1, "id", "parentId");
this.SET_menuList_X(deepClone(this.menuListData));
this.SET_menuTree_X(deepClone(this.menuTreeData));
this.MenuDict = dict;
this.MenuDict["MenuTree"] = deepClone(this.menuTreeData);
// console.log(this.menuListData);
// console.log(this.menuTreeData);
// this.getMenuDict(); //弃用
} else {
this.$message.error(res.msg);
}
});
},
getMenuDict() {
//目前只有三级 一级查询条件-1
let list = deepClone(this.menuListData);
let obj = list.sort((a, b) => {
return parseFloat(b["parentId"]) - parseFloat(a["parentId"]);
})[0];
Promise.all([
// 一级菜单字典
menuList({
parentId: -1,
}),
// 二级菜单字典
menuList({
parentId: obj["firstMenuId"],
}),
// 三级菜单字典
menuList({
parentId: obj["secondMenuId"],
}),
])
.then((res) => {
// 一级菜单字典
this.MenuDict["firstLevelOptions"] = res[0].data.data;
// 二级菜单字典
this.MenuDict["secondLevelOptions"] = res[1].data.data;
// 三级菜单字典
this.MenuDict["thirdLevelOptions"] = res[2].data.data;
// console.log(this.MenuDict);
})
.catch((err) => {
// console.log(err);
});
},
}
\ No newline at end of file
},
};
......@@ -39,6 +39,7 @@ axios.interceptors.response.use(
// 取出数据
let { code, msg } = response.data;
if (code === -1) {
console.log(response.data);
message.error({
content: msg,
maxCount: 1,
......
......@@ -21,19 +21,19 @@ const router = new VueRouter({
routes: routeConfig,
});
// router.beforeEach((to, from, next) => {
// let islogin = store.getters["user/token"];
// if (islogin) {
// next();
// } else {
// // 再次判断防止死循环
// if (to.path === "/") {
// next();
// } else {
// next({ path: "/" });
// }
// }
// });
router.beforeEach((to, from, next) => {
let islogin = store.getters["user/token"];
if (islogin) {
next();
} else {
// 再次判断防止死循环
if (to.path === "/") {
next();
} else {
next({ path: "/" });
}
}
});
router.afterEach((to, from, next) => {
window.scrollTo(0, 0);
......
export default {
namespaced: true,
state: {
menuList_X: [], //简单结构
menuTree_X: [], //树型结构
namespaced: true,
state: {
menuList_X: [], //简单结构
menuTree_X: [], //树型结构
},
getters: {
menuList_X: (state) => state.menuList_X,
menuTree_X: (state) => state.menuTree_X,
},
mutations: {
SET_menuList_X(state, data) {
state.menuList_X = data;
// console.log(state.menuList_X);
},
getters: {
menuList_X: state => state.menuList_X,
menuTree_X: state => state.menuTree_X,
SET_menuTree_X(state, data) {
state.menuTree_X = data;
// console.log(state.menuTree_X);
},
mutations: {
SET_menuList_X(state, data) {
state.menuList_X = data;
// console.log(state.menuList_X);
},
SET_menuTree_X(state, data) {
state.menuTree_X = data;
// console.log(state.menuTree_X);
}
},
actions: {
}
}
},
actions: {},
};
<template>
<div class="actuary w-full h-auto">
<Start class="start"/>
<div class="act_cont">
<div class="act_tit">
<h1>智慧政务数据精算</h1>
......@@ -7,29 +8,19 @@
运用以人工智能为代表的新技术,驱动政务服务模式创新,为人民提供更加智慧化、人性化的政务服务,实现互联网与政务服务深度融合,大幅提升政务服务智慧化水平,让政府服务更聪明,让企业和市民办事更方便、更快捷、更有效率。
</p>
</div>
<div class="act_mod">
<div
class="mod_max"
v-for="item of menuPermission"
:key="item.id"
@click="handleJump(item.url)"
>
<div class="flip">
<div class="mod_min">
<img
:src="
item.imgPath
? api + item.imgPath
: require('../../assets/images/qyhx.png')
"
alt
/>
<div class="mod_cont">
<p class="name">{{ item.name }}</p>
<p class="remark">
{{ item.remark }}
</p>
</div>
<div class="over_act_mod">
<div class="act_mod" ref="mode">
<div class="act_mod_item" v-for="(item,index) of menuPermission"
:key="item.id"
@click="handleJump(item.url)"
@mouseover="hoverItem(index)"
@mouseleave="hoverleave(index)"
:style="{background: `url(${require('@/assets/images/dataActuary/'+(index+1)+'.png')}) no-repeat`}">
<div class="actitem_tit">
{{item.name}}
</div>
<div class="actitem_p">
{{item.hover?item.remark:'Business data analysis'}}
</div>
</div>
</div>
......@@ -41,6 +32,7 @@
<script>
import menu from "@/mixins/menu";
import Storage from "@/utils/js/Storage";
import Start from "./demo2"
export default {
mixins: [menu],
data() {
......@@ -49,6 +41,9 @@ export default {
menuPermission: [],
};
},
components:{
Start
},
created() {
this.getMenuList(true);
......@@ -57,6 +52,23 @@ export default {
},
methods: {
hoverItem(index){
this.menuPermission[index].hover = true
this.$refs.mode.style.transition="all 1s ease 0s";
// 如果大于6就要往前移动
if(index>5){
let num = index-5
this.$refs.mode.style.transform="translateX(-"+num*190+"px)";
this.$forceUpdate()
}
},
hoverleave(index){
this.$refs.mode.style.transform="translate(0, 0)";
this.$refs.mode.style.transition="all .5s ease 0s";
this.menuPermission[index].hover = false
this.$forceUpdate()
},
// 跳转
handleJump(url) {
this.$router.push(url);
......@@ -66,7 +78,7 @@ export default {
let { menuList } = Storage.get(2, "userInfo");
let actuary = menuList.filter((v) => v.name === "数据精算");
if (actuary.length) {
this.menuPermission = actuary
let arr = actuary
.map((v) => {
if (v.childList.length) {
return v.childList;
......@@ -75,6 +87,10 @@ export default {
}
})
.flat();
arr.forEach(item=>{
item.hover = false
})
this.menuPermission = arr
}
},
},
......@@ -83,85 +99,144 @@ export default {
<style lang="less" scoped>
@headerH: 4.5rem;
@keyframes startopen{
0% {
width: 170px;
}
100% {
width: 551px;
}
}
@keyframes leaveopen{
0% {
width: 551px;
background-size: 100% 100%;
}
100% {
background-size: 100% 100%;
width: 170px;
}
}
.start{
position: absolute;
bottom: 0;
z-index: 0;
overflow: hidden;
}
.actuary {
background: url("~@/assets/images/jinsuanbg.png") center no-repeat;
background: url("~@/assets/images/dataActuary/bg.png") center no-repeat;
background-size: cover;
padding-top: @headerH;
.act_cont {
margin: 120px auto;
position: relative;
z-index: 3;
.act_tit {
text-align: center;
margin: auto;
max-width: 800px;
max-width: 1300px;
h1 {
font-weight: 700;
font-size: 44px;
color: #ffffff;
font-size: 53px;
font-family: FZZhengHeiS-EB-GB;
color: #FFFFFF;
line-height: 64px;
letter-spacing: 6px;
background: linear-gradient(0deg, #D2F8FF 0%, #FFFFFF 88.37890625%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
p {
font-weight: 400;
font-size: 14px;
color: #ffffff;
line-height: 20px;
padding-top: 20px;
text-align: left;
font-size: 22px;
font-family: Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
line-height: 34px;
}
}
.over_act_mod{
width: 1520px;
overflow: hidden;
margin: 50px auto 0;
}
.act_mod {
margin: 30px 100px 0;
display: flex;
flex-wrap: wrap;
.mod_max {
width: 344px;
height: 200px;
padding: 18px;
cursor: pointer;
&:hover > .flip {
transform: translateY(-10px);
justify-content: space-between;
transition: all 1s ease 0s;
.act_mod_item:hover{
// animation: startopen 1s normal 1 forwards;
transition: all 1s ease 0s;
overflow: hidden;
flex-shrink: 0;
width: 551px;
height: 450px;
background: url('~@/assets/images/dataActuary/bg-open.png') center no-repeat !important;
background-size: 100% 100%;
border-radius: 12px;
box-sizing: border-box;
padding: 90px 50px;
.actitem_tit{
width: 350px;
font-size: 31px;
font-family: Source Han Sans CN;
font-weight: bold;
color: #FFFFFF;
line-height: 59px;
margin-bottom: 20px;
}
.flip {
width: 100%;
height: 100%;
border-radius: 8px;
background-color: #ffffff;
transition: all linear 200ms;
.actitem_tit::before{
content: none;
}
.mod_min {
width: 285px;
height: 100%;
margin: auto;
display: flex;
align-items: center;
img {
width: 85px;
height: 72px;
}
.mod_cont {
width: 100%;
.name {
font-size: 18px;
font-weight: bold;
padding-bottom: 10px;
text-align: center;
}
.remark {
font-size: 14px;
line-height: 18px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
overflow: hidden;
}
}
.actitem_p{
width: 350px;
font-size: 16px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #FFFFFF;
line-height: 28px;
}
}
.act_mod_item{
// animation: leaveopen .5s normal 1 forwards;
transition: all .5s ease 0s;
flex-shrink: 0;
width: 170px;
height: 450px;
border-radius: 12px;
margin:0 10px;
.actitem_p{
padding: 0 10px;
font-size: 12px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #0857E8;
line-height: 38px;
opacity: 0.7;
}
.actitem_tit{
font-size: 20px;
font-family: Source Han Sans CN;
font-weight: bold;
color: #0857E8;
line-height: 38px;
padding:40px 10px 8px;
position: relative;
}
.actitem_tit::before{
content: "";
position: absolute;
left: 10px;
bottom: 0;
width: 30px;
height: 2px;
background: linear-gradient(to bottom right, #0857E8, #fff);
}
}
}
......
<template>
<div id="indexLizi" class="demo"></div>
</template>
<script>
import * as THREE from "three";
export default {
name: "Pointwave",
props: {
amountX: {
type: Number,
default: 50,
},
amountY: {
type: Number,
default: 50,
},
color: {
type: String,
default: "#10cbff",
},
top: {
type: Number,
default: 350,
},
},
data() {
return {
count: 0,
// 用来跟踪鼠标水平位置
mouseX: 0,
windowHalfX: null,
// 相机
camera: null,
// 场景
scene: null,
// 批量管理粒子
particles: null,
// 渲染器
renderer: null,
};
},
mounted() {
this.init();
this.animate();
},
methods: {
init() {
const SEPARATION = 100;
const SCREEN_WIDTH = window.innerWidth;
const SCREEN_HEIGHT = window.innerHeight;
const container = document.createElement("div");
this.windowHalfX = window.innerWidth / 2;
container.style.position = "relative";
container.style.top = `${this.top}px`;
container.style.height = `${SCREEN_HEIGHT - this.top}px`;
document.getElementById("indexLizi").appendChild(container);
this.camera = new THREE.PerspectiveCamera(
75,
SCREEN_WIDTH / SCREEN_HEIGHT,
1,
10000
);
this.camera.position.z = 1000;
this.scene = new THREE.Scene();
const numParticles = this.amountX * this.amountY;
const positions = new Float32Array(numParticles * 3);
const scales = new Float32Array(numParticles);
// 初始化粒子位置和大小
let i = 0;
let j = 0;
for (let ix = 0; ix < this.amountX; ix++) {
for (let iy = 0; iy < this.amountY; iy++) {
positions[i] = ix * SEPARATION - (this.amountX * SEPARATION) / 2;
positions[i + 1] = 0;
positions[i + 2] = iy * SEPARATION - (this.amountY * SEPARATION) / 2;
scales[j] = 1;
i += 3;
j++;
}
}
const geometry = new THREE.BufferGeometry();
geometry.setAttribute(
"position",
new THREE.BufferAttribute(positions, 3)
);
geometry.setAttribute("scale", new THREE.BufferAttribute(scales, 1));
// 初始化粒子材质
const material = new THREE.ShaderMaterial({
uniforms: {
color: { value: new THREE.Color(this.color) },
},
vertexShader: `
attribute float scale;
void main() {
vec4 mvPosition = modelViewMatrix * vec4( position, 2.0 );
gl_PointSize = scale * ( 300.0 / - mvPosition.z );
gl_Position = projectionMatrix * mvPosition;
}
`,
fragmentShader: `
uniform vec3 color;
void main() {
if ( length( gl_PointCoord - vec2( 0.5, 0.5 ) ) > 0.475 ) discard;
gl_FragColor = vec4( color, 1.0 );
}
`,
});
this.particles = new THREE.Points(geometry, material);
this.scene.add(this.particles);
this.renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
this.renderer.setSize(container.clientWidth, container.clientHeight);
this.renderer.setPixelRatio(window.devicePixelRatio);
this.renderer.setClearAlpha(0);
container.appendChild(this.renderer.domElement);
window.addEventListener("resize", this.onWindowResize, {
passive: false,
});
document.addEventListener("mousemove", this.onDocumentMouseMove, {
passive: false,
});
document.addEventListener("touchstart", this.onDocumentTouchStart, {
passive: false,
});
document.addEventListener("touchmove", this.onDocumentTouchMove, {
passive: false,
});
},
render() {
this.camera.position.x += (this.mouseX - this.camera.position.x) * 0.05;
this.camera.position.y = 400;
this.camera.lookAt(this.scene.position);
const positions = this.particles.geometry.attributes.position.array;
const scales = this.particles.geometry.attributes.scale.array;
// 计算粒子位置及大小
let i = 0;
let j = 0;
for (let ix = 0; ix < this.amountX; ix++) {
for (let iy = 0; iy < this.amountY; iy++) {
positions[i + 1] =
Math.sin((ix + this.count) * 0.3) * 100 +
Math.sin((iy + this.count) * 0.5) * 100;
scales[j] =
(Math.sin((ix + this.count) * 0.3) + 1) * 8 +
(Math.sin((iy + this.count) * 0.5) + 1) * 8;
i += 3;
j++;
}
}
// 重新渲染粒子
this.particles.geometry.attributes.position.needsUpdate = true;
this.particles.geometry.attributes.scale.needsUpdate = true;
this.renderer.render(this.scene, this.camera);
this.count += 0.1;
},
animate() {
requestAnimationFrame(this.animate);
this.render();
// setInterval(() => {
// }, 50);
},
onDocumentMouseMove(event) {
this.mouseX = event.clientX - this.windowHalfX;
},
onDocumentTouchStart(event) {
if (event.touches.length === 1) {
this.mouseX = event.touches[0].pageX - this.windowHalfX;
}
},
onDocumentTouchMove(event) {
if (event.touches.length === 1) {
event.preventDefault();
this.mouseX = event.touches[0].pageX - this.windowHalfX;
}
},
onWindowResize() {
this.windowHalfX = window.innerWidth / 2;
this.camera.aspect = window.innerWidth / window.innerHeight;
this.camera.updateProjectionMatrix();
this.renderer.setSize(window.innerWidth, window.innerHeight);
},
},
};
</script>
<style lang="less" scoped>
.demo {
width: 100%;
height: 100%;
// background: url("@/assets/img/demo/bg.png") no-repeat center;
}
</style>
\ No newline at end of file
<template>
<div class="route-view min-h-full w-full flex">
<div class="header w-full flex justify-between items-center text-white">
<div
class="header w-full flex justify-between items-center text-white"
:class="{ inside: !isHomePage }"
>
<a-space>
<img
class="logo cursor-pointer"
......@@ -20,15 +23,29 @@
</div>
</a-space>
<!-- 菜单 -->
<a-menu :selectedKeys="current" @click="handelClick" mode="horizontal">
<a-menu
v-if="isHomePage"
:selectedKeys="current"
@click="handelClick"
mode="horizontal"
>
<a-menu-item v-for="v in homeMenus" :key="v.url">
{{ v.name }}
</a-menu-item>
</a-menu>
<!-- 时间、用户信息展示 -->
<div class="flex items-center">
<div class="show-time flex flex-col items-end">
<div class="time">{{ nowTime }}</div>
<!-- 返回门户 -->
<div
v-if="!isHomePage"
class="flex flex-col items-center cursor-pointer"
@click="backHome"
>
<a-icon type="desktop" class="desktop mb-1" />
<p class="text-[14px]">返回门户</p>
</div>
<div v-if="isHomePage" class="show-time flex flex-col items-end">
<div class="time mb-1">{{ nowTime }}</div>
<div class="date">{{ nowDay }} {{ nowWeek }}</div>
</div>
<div class="line"></div>
......@@ -36,7 +53,7 @@
<a-dropdown>
<div class="flex items-center">
<div class="userInfo flex flex-col items-center cursor-pointer">
<span>
<span class="mb-1">
{{ userData.loginName ? userData.loginName : "--" }}
</span>
<span>
......@@ -81,6 +98,12 @@ export default {
nowDay: "",
nowWeek: "",
visibleEditPwd: false,
homePage: [
"/home/dataManagement",
"/home/siteArrange",
"/home/dataActuary",
"/home/thePlatformIsSet/setPlatformes",
],
};
},
computed: {
......@@ -94,6 +117,11 @@ export default {
}
return [path];
},
isHomePage() {
let cur = this.$route.path;
let curParent = this.$route.matched[1]?.path;
return this.homePage.includes(cur) || this.homePage.includes(curParent);
},
},
created() {
this.setMoment();
......@@ -107,7 +135,12 @@ export default {
this.$router.go(0);
},
backHome() {
this.$router.push("/datamanage");
let path = storage.get(1, "routeInfo");
if (path) {
this.$router.push(path);
} else {
this.$router.push("/home");
}
},
setMoment() {
this.timer = setInterval(() => {
......@@ -144,6 +177,7 @@ export default {
});
},
handelClick(route) {
storage.set(1, "routeInfo", route.key);
this.$router.push(route.key);
},
},
......@@ -237,6 +271,7 @@ export default {
.date {
font-family: Source Han Sans CN;
font-weight: 500;
font-size: 14px;
}
.line {
width: 1px;
......@@ -245,4 +280,7 @@ export default {
background: #ffffff;
}
}
.inside {
background: linear-gradient(90deg, #1845c6 0%, #2999ff 100%) !important;
}
</style>
......@@ -67,7 +67,7 @@
<script>
import { LoginInterface } from "@/api/user.js";
import { mapMutations } from "vuex";
import { mapMutations, mapState } from "vuex";
import { changeAccount } from "@/utils/js/validate";
import { encrypt } from "@/utils";
import storage from "@/utils/js/Storage";
......@@ -97,7 +97,13 @@ export default {
},
};
},
computed: {
...mapState("user", ["token"]),
},
created() {
if (this.token) {
this.$router.push("/home");
}
this.createCode();
},
methods: {
......
<template>
<div class="station w-full h-auto">
<a-carousel
effect="fade"
autoplay
:autoplaySpeed="2000"
:dots="false"
style="width: 100%; height: 100%; overflow: hidden"
>
<div class="img_box img1"></div>
<!-- style="
height: 100vh;
width: 100%;
background: url('@/assets/images/bg.jpg') center no-repeat;
overflow: hidden;
background-size: cover;
" -->
<div class="img_box img2"></div>
<div class="img_box img3"></div>
</a-carousel>
<div class="title">
<h3 style="text-align: center; font-size: 50px">宜人·宜宾·宜办事</h3>
<!-- <p>“互联网+政务服务”整体解决方案提供商和服务商</p> -->
<!-- 删除常用 -->
<div class="del-box" :class="['del-box', { active: isDel }]">
<draggable
v-model="delList"
:options="{
group: { name: draName1, pull: false, put: joinDel },
}"
animation="400"
delay="20"
draggable=".common-item"
class="w-full h-full text-white text-xl flex items-center justify-center"
@add="handleDelete"
>
<span class="del-text">{{ placeholder }}</span>
</draggable>
</div>
<div class="classification">
<div class="modules">
<div
class="mod_max"
v-for="item of siteModelList"
:key="item.id"
@click="openWindow(item)"
<div class="title flex flex-col items-center mt-[150px] mb-[25px]">
<img
class="img-title mb-[42px]"
src="@/assets/images/siteArrange/title.png"
/>
<div class="slogan">建设高效便民、智慧泛在的智慧政务大厅</div>
</div>
<!-- 站点 -->
<div class="site-content w-full" :class="{ collapsed: isCollapsed }">
<!-- 常用 -->
<div
class="common flex items-center justify-between mb-[15px] h-[130px]"
:class="{ 'common-add': isAdd }"
>
<draggable
v-model="collectList"
:options="{
group: { name: draName2, pull: true, put: handleJoin },
}"
animation="400"
delay="20"
draggable=".common-item"
class="common-list"
dragClass="dragClass"
@add="addEnd"
@end="collectEnd"
@start="delStart"
>
<div class="picture" :style="{ background: item.color }">
<img
width="40"
height="35"
:src="
item.modelIcon
? api + item.modelIcon
: require('../../assets/images/u222.svg')
"
alt
/>
<div
class="common-item w-full flex flex-col items-center cursor-pointer"
v-for="(v, i) in collectList"
:key="'' + v.id + i"
@click="openWindow(v)"
>
<div class="item-logo item-logo1">
<img
class="w-full h-full object-cover"
:src="api + v.modelIcon"
/>
<img
class="bottom-img"
src="@/assets/images/siteArrange/pic-bottom.png"
/>
</div>
<div class="text-white mt-[10px] leading-[20px]">
{{ v.modelName }}
</div>
</div>
<div class="name" style="margin-top: 10px">{{ item.modelName }}</div>
</draggable>
<div class="w-[160px] flex justify-center items-center">
<img
class="cursor-pointer icon-img"
src="@/assets/images/siteArrange/extension.png"
@click="isCollapsed = !isCollapsed"
/>
</div>
</div>
<!-- 站点列表 -->
<div class="site-box">
<div class="site-type" v-for="(v, i) in siteModelList" :key="i">
<div class="type-title">{{ v.type }}</div>
<draggable
v-model="v.list"
:options="{
group: { name: draName3, pull: 'clone', put: false },
sort: false,
}"
animation="400"
delay="20"
draggable=".common-item"
class="type-list"
dragClass="dragClass"
@start="isAdd = true"
@end="isAdd = false"
>
<div
class="common-item w-[160px] flex flex-col items-center cursor-pointer"
v-for="item in v.list"
:key="item.id"
@click="openWindow(item)"
>
<div class="item-logo">
<img
class="w-full h-full object-cover"
:src="api + item.modelIcon"
/>
</div>
<div class="text-white mt-[10px] leading-[20px]">
{{ item.modelName }}
</div>
</div>
</draggable>
</div>
</div>
</div>
......@@ -50,164 +115,260 @@
</template>
<script>
import menu from "@/mixins/menu";
import { appsListInterface } from "@/api/siteArrange";
import { appsListInterface, getCollect, saveCollect } from "@/api/siteArrange";
import Storage from "@/utils/js/Storage";
import { mapState } from "vuex";
export default {
mixins: [menu],
data() {
return {
api: process.env.VUE_APP_API_IMG_URL,
siteId: "",
siteId: Storage.get(2, "siteId"),
arr: [],
collectList: [], // 用户常用列表
siteModelList: [], // 站点编排列表
isAdd: false, // 是否在拖动站点到常用列表
isCollapsed: true,
draName1: "item",
draName2: "item",
draName3: "item",
placeholder: "将模块拖到此处删除",
delList: [],
isDel: false,
};
},
computed: {
...mapState("user", ["token", "userData"]),
},
created() {
this.getMenuList(true);
this.getCollect();
this.appsListInterface();
this.$bus.$on("changeSite", () => {
this.appsListInterface();
});
},
methods: {
// 获取用户常用站点列表
async getCollect() {
let res = await getCollect();
if (res.data.code == 1) {
this.collectList = res.data.data;
}
},
// 获取站点分类列表
async appsListInterface() {
this.siteId = Storage.get(2, "siteId");
let res = await appsListInterface({ siteId: this.siteId });
let { data } = res.data;
let color = [];
let colorArr = ["#546DFF", "#1E6FFF", "#3CBFFF", "#00AA5B", "#FFAB00"];
color = colorArr.concat(
colorArr,
colorArr,
colorArr,
colorArr,
colorArr,
colorArr
);
this.siteModelList = data.map((v, i) => {
v["color"] = color[i];
return v;
});
if (res.data.code == 1) {
let { data } = res.data.data;
this.siteModelList = data;
}
},
openWindow(row) {
let token = Storage.get(2, "Authorization");
let siteid = Storage.get(2, "siteId") ? Storage.get(2, "siteId") : 0;
let siteName = Storage.get(2, "siteName")
? Storage.get(2, "siteName")
: "";
let info = Storage.get(2, "userInfo");
let siteid = Storage.get(2, "siteId") || 0;
let siteName = Storage.get(2, "siteName") || "";
let userInfo = JSON.stringify({
id: info.id,
name: info.loginName,
id: this.userData.id,
name: this.userData.loginName,
});
let { modelUrl, modelName, modelIcon } = row;
let path = this.$route.path;
modelName = encodeURI(modelName);
window.open(
`${modelUrl}?token=${token}&siteid=${siteid}&siteName=${siteName}&userInfo=${userInfo}&sysName=${modelName}&sysLogo=${modelIcon}&path=${path}`,
`${modelUrl}?token=${this.token}&siteid=${siteid}&siteName=${encodeURI(
siteName
)}&userInfo=${userInfo}&sysName=${modelName}&sysLogo=${modelIcon}&path=${path}`,
"_blank"
);
},
handleJoin() {
if (this.collectList.length >= 10) {
this.$message.warning("常用列表最多只能添加10个模块");
return false;
}
},
// 常用添加以后去重
addEnd() {
let bool = this.hasDuplicate(this.collectList);
if (bool) {
const res = new Map();
this.collectList = this.collectList.filter((v) => {
return !res.has(v.id) && res.set(v.id, 1);
});
this.$message.warning("该模块已存在");
} else {
this.saveCollect();
}
},
// 保存收藏
async saveCollect() {
let modelIds = this.collectList.map((v) => v.id).join(",");
let res = await saveCollect({
modelIds,
});
// if (res.data.code == 1) {
// this.$message.success("设置成功");
// this.getCollect();
// }
if (res.data.code != 1) {
this.getCollect();
}
},
// 删除开始时
delStart() {
this.isDel = true;
this.draName3 = "del";
},
// 进入删除范围
joinDel() {},
collectEnd() {
this.getCollect();
this.isDel = false;
this.draName3 = "item";
},
// 删除常用
handleDelete() {
this.saveCollect();
this.delList.pop();
this.isDel = false;
this.draName3 = "item";
},
// 判断是否有重复
hasDuplicate(arr) {
let idSet = new Set();
for (let i = 0; i < arr.length; i++) {
if (idSet.has(arr[i].id)) {
return true;
}
idSet.add(arr[i].id);
}
return false;
},
},
};
</script>
<style lang="less" scoped>
@headerH: 4.5rem;
.ant-carousel :deep(.slick-slide) {
width: 100%;
height: 100%;
.station {
background: url("@/assets/images/siteArrange/bg.png") no-repeat;
background-size: 100% 100%;
overflow: hidden;
.img_box {
.del-box {
width: 100%;
height: 92.1vh;
overflow: hidden;
background-size: cover;
}
.img1 {
background: url("~@/assets/images/bg.jpg") center no-repeat;
}
.img2 {
background: url("~@/assets/images/bgg1.jpg") center no-repeat;
height: 150px;
background: rgba(0, 0, 0, 0.5);
position: fixed;
top: -100%;
left: 0px;
transition: all 0.5s;
.del-text {
position: absolute;
}
}
.img3 {
background: url("~@/assets/images/bgg2.jpg") center no-repeat;
.active {
top: 0px;
}
}
.station {
width: 100%;
height: 100%;
// background: url("~@/assets/images/bg.jpg") center no-repeat;
background-size: cover;
position: relative;
padding-top: @headerH;
overflow: hidden;
.title {
width: 650px;
height: 100px;
position: absolute;
top: 30%;
left: 50%;
transform: translate(-50%, -50%);
h3 {
font-weight: 400;
font-size: 28px;
.slogan {
font-size: 39px;
font-family: Source Han Sans CN;
font-weight: 500;
color: #ffffff;
}
}
.site-content {
height: 600px;
transition: all 1s;
}
p {
font-weight: 700;
font-size: 28px;
color: #ffffff;
padding-top: 20px;
padding-left: 25px;
.common {
padding: 0px 40px;
.common-list {
width: 100%;
display: grid;
grid-template-columns: repeat(10, 1fr);
align-items: start;
justify-items: center;
}
}
.classification {
.icon-img {
transform: rotateZ(0deg);
transition: all 1s;
}
.common-add {
background: rgba(0, 0, 0, 0.5);
}
.item-logo {
width: 80px;
height: 80px;
padding: 10px;
box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.1);
border-radius: 20px;
position: relative;
.bottom-img {
position: absolute;
left: 0px;
bottom: -10px;
}
}
.item-logo1 {
background: linear-gradient(180deg, #daefff 0%, #ffffff 100%);
}
.site-box {
width: 100%;
height: 410px;
position: absolute;
bottom: 0;
background-color: rgba(3, 23, 24, 0.452);
overflow-y: auto;
.modules {
margin: 0 100px;
padding-top: 20px;
height: 440px;
padding: 20px 10px 0px 10px;
background: rgba(3, 18, 51, 0.4);
display: grid;
grid-template-columns: repeat(3, 1fr);
opacity: 1;
transition: all 3s;
.site-type {
height: inherit;
display: flex;
flex-wrap: wrap;
.mod_max {
width: 96px;
height: 115px;
margin-left: 39px;
margin-top: 5px;
flex-direction: column;
.type-title {
margin-bottom: 20px;
font-size: 22px;
font-family: Source Han Sans CN;
font-weight: bold;
color: #ffffff;
text-align: center;
cursor: pointer;
.picture {
width: 72px;
height: 72px;
line-height: 72px;
margin: auto;
border-radius: 24px;
background-color: rgba(84, 120, 140, 1);
}
.type-list {
flex: 1;
padding: 0px 6px;
height: 200px;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-row-gap: 10px;
overflow-y: auto;
}
&:nth-child(1) {
.item-logo {
background: linear-gradient(180deg, #c7e1f6 0%, #ffffff 85%);
}
.name {
width: 100%;
font-weight: 700;
font-size: 16px;
color: #ffffff;
padding-top: 5px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&:nth-child(2) {
.item-logo {
background: linear-gradient(180deg, #c7f6db 0%, #ffffff 85%);
}
}
&:nth-child(3) {
.item-logo {
background: linear-gradient(180deg, #f6e7c7 0%, #ffffff 85%);
}
}
}
}
.collapsed {
transform: translateY(450px);
.site-box {
opacity: 0;
}
.icon-img {
transform: rotateZ(180deg);
}
}
}
</style>
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -40,4 +40,17 @@ CREATE TABLE `mortals_xhx_user_pwd_record` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户密码修改记录';
UPDATE mortals_xhx_user SET lastUpdatePwdTime=NOW();
\ No newline at end of file
UPDATE mortals_xhx_user SET lastUpdatePwdTime=NOW();
-- ----------------------------
2023-08-29
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_user_model_collect`;
CREATE TABLE `mortals_xhx_user_model_collect` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键,自增长',
`userId` bigint(20) DEFAULT NULL COMMENT '用户ID,主键,自增长',
`realName` varchar(64) DEFAULT NULL COMMENT '登录名',
`modelIds` varchar(128) DEFAULT NULL COMMENT '收藏模块',
`createTime` datetime DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户模块收藏';
\ No newline at end of file
......@@ -5,9 +5,9 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.common.code.ModelTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.ModelPdu;
import com.mortals.xhx.feign.model.IApiModelFeign;
......@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -113,6 +114,73 @@ public class ModelController extends BaseJsonBodyController {
return ret;
}
/**
* 根据站点id查询模块列表
* @param query
* @return
*/
@PostMapping({"list/group"})
public Rest<Object> getListGroup(@RequestBody ModelVO query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "查询站点编排" ;
int code=1;
try {
if(this.getCurUser()==null){
throw new AppException("未登录或者登录过期");
}
ModelPdu modelPdu = new ModelPdu();
modelPdu.setSiteId(query.getSiteId());
if(this.getCurUser().getId()==1 && StringUtils.isEmpty(this.getCurUser().getSiteIds())){
modelPdu.setIsAdmin(1);
}else {
modelPdu.setIsAdmin(0);
}
//ApiResp<List<ModelFeignVO>> apiResp = apiModelFeign.getModelBySiteId(modelPdu);
String resp = apiModelFeign.getModelBySiteId(modelPdu);
ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取站点列表信息失败:" + apiResp.getMsg());
}
Map<Long,Long> map = roleModelService.getModelIdsUserId(this.getCurUser().getId());
List<ModelFeignVO> modelFeignVOList = JSONObject.parseArray(apiResp.getData().get("data").toString(),ModelFeignVO.class);
List<ModelFeignVO> list = modelFeignVOList.stream().filter(item->map.containsKey(item.getId())).collect(Collectors.toList());
if(this.getCurUser().getId()==1){
model.put("data", doGroup(modelFeignVOList));
}else {
model.put("data", doGroup(list));
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
ret.setCode(code);
ret.setData(model);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
private List<Map<String,Object>> doGroup(List<ModelFeignVO> result){
Map<Integer,List<ModelFeignVO>> groupMap = result.stream().collect(Collectors.groupingBy(t -> t.getType()));
List<Map<String,Object>> mapList = new ArrayList<>();
Map<String,Object> jcMap = new HashMap<>();
jcMap.put("type",ModelTypeEnum.JC.getDesc());
jcMap.put("list",groupMap.get(ModelTypeEnum.JC.getValue()));
mapList.add(jcMap);
Map<String,Object> g2gMap = new HashMap<>();
jcMap.put("type",ModelTypeEnum.G2G.getDesc());
jcMap.put("list",groupMap.get(ModelTypeEnum.G2G.getValue()));
mapList.add(g2gMap);
Map<String,Object> g2cMap = new HashMap<>();
jcMap.put("type",ModelTypeEnum.G2C.getDesc());
jcMap.put("list",groupMap.get(ModelTypeEnum.G2C.getValue()));
mapList.add(g2cMap);
return mapList;
}
/**
* 根据站点id查询数据管理列表
* @param query
......
......@@ -13,5 +13,5 @@ import java.util.List;
public interface PageInfoDao extends ICRUDDao<PageInfoEntity,Long>{
List<PageInfoEntity> getProductList();
}
package com.mortals.xhx.module.page.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.page.dao.PageInfoDao;
import com.mortals.xhx.module.page.model.PageInfoEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 产品页面配置DaoImpl DAO接口
......@@ -17,5 +17,8 @@ import java.util.List;
public class PageInfoDaoImpl extends BaseCRUDDaoMybatis<PageInfoEntity,Long> implements PageInfoDao {
@Override
public List<PageInfoEntity> getProductList() {
return this.getSqlSession().selectList(this.getSqlId("getProductList"));
}
}
package com.mortals.xhx.module.page.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.page.model.PageInfoEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 产品页面配置视图对象
*
......
......@@ -3,6 +3,9 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.page.model.PageInfoEntity;
import java.util.List;
/**
* PageInfoService
*
......@@ -21,4 +24,6 @@ public interface PageInfoService extends ICRUDService<PageInfoEntity,Long>{
* @throws AppException
*/
PageInfoEntity saveScreen(PageInfoEntity entity, Context context) throws AppException;
List<PageInfoEntity> getProductList() throws AppException;
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import com.mortals.xhx.module.page.model.PageInfoEntity;
import com.mortals.xhx.module.page.service.PageInfoService;
import java.util.Date;
import java.util.List;
/**
* PageInfoService
......@@ -82,6 +83,11 @@ public class PageInfoServiceImpl extends AbstractCRUDServiceImpl<PageInfoDao, Pa
}
}
@Override
public List<PageInfoEntity> getProductList() throws AppException {
return dao.getProductList();
}
private void doSaveImageBase64(PageInfoEntity entity,String oldName){
String base64 = String.valueOf(entity.getScreenUrl());
base64 = base64.replaceAll("data:image/png;base64,","");
......
......@@ -57,13 +57,27 @@ public class PageInfoController extends BaseCRUDJsonBodyMappingController<PageIn
Context context = this.getContext();
String busiDesc = "查询产品列表";
int code;
int code=1;
try {
List<PageInfoEntity> list = service.getProductList();
Map<Long,Long> productMap = new HashMap<>();
for(PageInfoEntity infoEntity:list){
productMap.put(infoEntity.getProductId(),infoEntity.getProductId());
}
//
// model.put("data", result);
// model.put("message_info", busiDesc + "成功");
Rest<RespData<List<ProductPdu>>> result = productFeign.list(query);
code = result.getCode();
if(code > 0) {
model.put("data", result.getData().getData());
model.put("pageInfo", result.getData().getPageInfo());
List<ProductPdu> pduList = new ArrayList<>();
for(ProductPdu pdu:result.getData().getData()){
if(productMap.containsKey(pdu.getId())){
pduList.add(pdu);
}
}
model.put("data", pduList);
// model.put("pageInfo", result.getData().getPageInfo());
model.put("dict", result.getData().getDict());
model.put("message_info", busiDesc + "成功");
}else {
......
package com.mortals.xhx.module.user.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import java.util.List;
/**
* 用户模块收藏Dao
* 用户模块收藏 DAO接口
*
* @author zxfei
* @date 2023-08-29
*/
public interface UserModelCollectDao extends ICRUDDao<UserModelCollectEntity,Long>{
}
package com.mortals.xhx.module.user.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.user.dao.UserModelCollectDao;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import org.springframework.stereotype.Repository;
/**
* 用户模块收藏DaoImpl DAO接口
*
* @author zxfei
* @date 2023-08-29
*/
@Repository("userModelCollectDao")
public class UserModelCollectDaoImpl extends BaseCRUDDaoMybatis<UserModelCollectEntity,Long> implements UserModelCollectDao {
}
package com.mortals.xhx.module.user.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.user.model.vo.UserModelCollectVo;
import lombok.Data;
/**
* 用户模块收藏实体对象
*
* @author zxfei
* @date 2023-08-29
*/
@Data
public class UserModelCollectEntity extends UserModelCollectVo {
private static final long serialVersionUID = 1L;
/**
* 用户ID,主键,自增长
*/
private Long userId;
/**
* 登录名
*/
private String realName;
/**
* 收藏模块
*/
private String modelIds;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof UserModelCollectEntity) {
UserModelCollectEntity tmp = (UserModelCollectEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.userId = -1L;
this.realName = "";
this.modelIds = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.user.model;
import java.util.List;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
/**
* 用户模块收藏查询对象
*
* @author zxfei
* @date 2023-08-29
*/
public class UserModelCollectQuery extends UserModelCollectEntity {
/** 开始 主键,自增长 */
private Long idStart;
/** 结束 主键,自增长 */
private Long idEnd;
/** 增加 主键,自增长 */
private Long idIncrement;
/** 主键,自增长列表 */
private List <Long> idList;
/** 主键,自增长排除列表 */
private List <Long> idNotList;
/** 开始 用户ID,主键,自增长 */
private Long userIdStart;
/** 结束 用户ID,主键,自增长 */
private Long userIdEnd;
/** 增加 用户ID,主键,自增长 */
private Long userIdIncrement;
/** 用户ID,主键,自增长列表 */
private List <Long> userIdList;
/** 用户ID,主键,自增长排除列表 */
private List <Long> userIdNotList;
/** 登录名 */
private List<String> realNameList;
/** 登录名排除列表 */
private List <String> realNameNotList;
/** 收藏模块 */
private List<String> modelIdsList;
/** 收藏模块排除列表 */
private List <String> modelIdsNotList;
/** 开始 创建时间 */
private String createTimeStart;
/** 结束 创建时间 */
private String createTimeEnd;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<UserModelCollectQuery> orConditionList;
/** AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4) */
private List<UserModelCollectQuery> andConditionList;
public UserModelCollectQuery(){}
/**
* 获取 开始 主键,自增长
* @return idStart
*/
public Long getIdStart(){
return this.idStart;
}
/**
* 设置 开始 主键,自增长
* @param idStart
*/
public void setIdStart(Long idStart){
this.idStart = idStart;
}
/**
* 获取 结束 主键,自增长
* @return $idEnd
*/
public Long getIdEnd(){
return this.idEnd;
}
/**
* 设置 结束 主键,自增长
* @param idEnd
*/
public void setIdEnd(Long idEnd){
this.idEnd = idEnd;
}
/**
* 获取 增加 主键,自增长
* @return idIncrement
*/
public Long getIdIncrement(){
return this.idIncrement;
}
/**
* 设置 增加 主键,自增长
* @param idIncrement
*/
public void setIdIncrement(Long idIncrement){
this.idIncrement = idIncrement;
}
/**
* 获取 主键,自增长
* @return idList
*/
public List<Long> getIdList(){
return this.idList;
}
/**
* 设置 主键,自增长
* @param idList
*/
public void setIdList(List<Long> idList){
this.idList = idList;
}
/**
* 获取 主键,自增长
* @return idNotList
*/
public List<Long> getIdNotList(){
return this.idNotList;
}
/**
* 设置 主键,自增长
* @param idNotList
*/
public void setIdNotList(List<Long> idNotList){
this.idNotList = idNotList;
}
/**
* 获取 开始 用户ID,主键,自增长
* @return userIdStart
*/
public Long getUserIdStart(){
return this.userIdStart;
}
/**
* 设置 开始 用户ID,主键,自增长
* @param userIdStart
*/
public void setUserIdStart(Long userIdStart){
this.userIdStart = userIdStart;
}
/**
* 获取 结束 用户ID,主键,自增长
* @return $userIdEnd
*/
public Long getUserIdEnd(){
return this.userIdEnd;
}
/**
* 设置 结束 用户ID,主键,自增长
* @param userIdEnd
*/
public void setUserIdEnd(Long userIdEnd){
this.userIdEnd = userIdEnd;
}
/**
* 获取 增加 用户ID,主键,自增长
* @return userIdIncrement
*/
public Long getUserIdIncrement(){
return this.userIdIncrement;
}
/**
* 设置 增加 用户ID,主键,自增长
* @param userIdIncrement
*/
public void setUserIdIncrement(Long userIdIncrement){
this.userIdIncrement = userIdIncrement;
}
/**
* 获取 用户ID,主键,自增长
* @return userIdList
*/
public List<Long> getUserIdList(){
return this.userIdList;
}
/**
* 设置 用户ID,主键,自增长
* @param userIdList
*/
public void setUserIdList(List<Long> userIdList){
this.userIdList = userIdList;
}
/**
* 获取 用户ID,主键,自增长
* @return userIdNotList
*/
public List<Long> getUserIdNotList(){
return this.userIdNotList;
}
/**
* 设置 用户ID,主键,自增长
* @param userIdNotList
*/
public void setUserIdNotList(List<Long> userIdNotList){
this.userIdNotList = userIdNotList;
}
/**
* 获取 登录名
* @return realNameList
*/
public List<String> getRealNameList(){
return this.realNameList;
}
/**
* 设置 登录名
* @param realNameList
*/
public void setRealNameList(List<String> realNameList){
this.realNameList = realNameList;
}
/**
* 获取 登录名
* @return realNameNotList
*/
public List<String> getRealNameNotList(){
return this.realNameNotList;
}
/**
* 设置 登录名
* @param realNameNotList
*/
public void setRealNameNotList(List<String> realNameNotList){
this.realNameNotList = realNameNotList;
}
/**
* 获取 收藏模块
* @return modelIdsList
*/
public List<String> getModelIdsList(){
return this.modelIdsList;
}
/**
* 设置 收藏模块
* @param modelIdsList
*/
public void setModelIdsList(List<String> modelIdsList){
this.modelIdsList = modelIdsList;
}
/**
* 获取 收藏模块
* @return modelIdsNotList
*/
public List<String> getModelIdsNotList(){
return this.modelIdsNotList;
}
/**
* 设置 收藏模块
* @param modelIdsNotList
*/
public void setModelIdsNotList(List<String> modelIdsNotList){
this.modelIdsNotList = modelIdsNotList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
*/
public String getCreateTimeStart(){
return this.createTimeStart;
}
/**
* 设置 开始 创建时间
* @param createTimeStart
*/
public void setCreateTimeStart(String createTimeStart){
this.createTimeStart = createTimeStart;
}
/**
* 获取 结束 创建时间
* @return createTimeEnd
*/
public String getCreateTimeEnd(){
return this.createTimeEnd;
}
/**
* 设置 结束 创建时间
* @param createTimeEnd
*/
public void setCreateTimeEnd(String createTimeEnd){
this.createTimeEnd = createTimeEnd;
}
/**
* 设置 主键,自增长
* @param id
*/
public UserModelCollectQuery id(Long id){
setId(id);
return this;
}
/**
* 设置 开始 主键,自增长
* @param idStart
*/
public UserModelCollectQuery idStart(Long idStart){
this.idStart = idStart;
return this;
}
/**
* 设置 结束 主键,自增长
* @param idEnd
*/
public UserModelCollectQuery idEnd(Long idEnd){
this.idEnd = idEnd;
return this;
}
/**
* 设置 增加 主键,自增长
* @param idIncrement
*/
public UserModelCollectQuery idIncrement(Long idIncrement){
this.idIncrement = idIncrement;
return this;
}
/**
* 设置 主键,自增长
* @param idList
*/
public UserModelCollectQuery idList(List<Long> idList){
this.idList = idList;
return this;
}
/**
* 设置 主键,自增长
* @param idNotList
*/
public UserModelCollectQuery idNotList(List<Long> idNotList){
this.idNotList = idNotList;
return this;
}
/**
* 设置 用户ID,主键,自增长
* @param userId
*/
public UserModelCollectQuery userId(Long userId){
setUserId(userId);
return this;
}
/**
* 设置 开始 用户ID,主键,自增长
* @param userIdStart
*/
public UserModelCollectQuery userIdStart(Long userIdStart){
this.userIdStart = userIdStart;
return this;
}
/**
* 设置 结束 用户ID,主键,自增长
* @param userIdEnd
*/
public UserModelCollectQuery userIdEnd(Long userIdEnd){
this.userIdEnd = userIdEnd;
return this;
}
/**
* 设置 增加 用户ID,主键,自增长
* @param userIdIncrement
*/
public UserModelCollectQuery userIdIncrement(Long userIdIncrement){
this.userIdIncrement = userIdIncrement;
return this;
}
/**
* 设置 用户ID,主键,自增长
* @param userIdList
*/
public UserModelCollectQuery userIdList(List<Long> userIdList){
this.userIdList = userIdList;
return this;
}
/**
* 设置 用户ID,主键,自增长
* @param userIdNotList
*/
public UserModelCollectQuery userIdNotList(List<Long> userIdNotList){
this.userIdNotList = userIdNotList;
return this;
}
/**
* 设置 登录名
* @param realName
*/
public UserModelCollectQuery realName(String realName){
setRealName(realName);
return this;
}
/**
* 设置 登录名
* @param realNameList
*/
public UserModelCollectQuery realNameList(List<String> realNameList){
this.realNameList = realNameList;
return this;
}
/**
* 设置 收藏模块
* @param modelIds
*/
public UserModelCollectQuery modelIds(String modelIds){
setModelIds(modelIds);
return this;
}
/**
* 设置 收藏模块
* @param modelIdsList
*/
public UserModelCollectQuery modelIdsList(List<String> modelIdsList){
this.modelIdsList = modelIdsList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
*/
public List<UserModelCollectQuery> getOrConditionList(){
return this.orConditionList;
}
/**
* 设置 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @param orConditionList
*/
public void setOrConditionList(List<UserModelCollectQuery> orConditionList){
this.orConditionList = orConditionList;
}
/**
* 获取 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @return andConditionList
*/
public List<UserModelCollectQuery> getAndConditionList(){
return this.andConditionList;
}
/**
* 设置 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @param andConditionList
*/
public void setAndConditionList(List<UserModelCollectQuery> andConditionList){
this.andConditionList = andConditionList;
}
}
\ No newline at end of file
package com.mortals.xhx.module.user.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户模块收藏视图对象
*
* @author zxfei
* @date 2023-08-29
*/
@Data
public class UserModelCollectVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.user.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import com.mortals.xhx.module.user.dao.UserModelCollectDao;
/**
* UserModelCollectService
*
* 用户模块收藏 service接口
*
* @author zxfei
* @date 2023-08-29
*/
public interface UserModelCollectService extends ICRUDService<UserModelCollectEntity,Long>{
UserModelCollectDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.user.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.user.dao.UserModelCollectDao;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import com.mortals.xhx.module.user.service.UserModelCollectService;
import lombok.extern.slf4j.Slf4j;
/**
* UserModelCollectService
* 用户模块收藏 service实现
*
* @author zxfei
* @date 2023-08-29
*/
@Service("userModelCollectService")
@Slf4j
public class UserModelCollectServiceImpl extends AbstractCRUDServiceImpl<UserModelCollectDao, UserModelCollectEntity, Long> implements UserModelCollectService {
}
\ No newline at end of file
package com.mortals.xhx.module.user.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.utils.BeanUtil;
import com.mortals.framework.utils.ReflectUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.ModelPdu;
import com.mortals.xhx.feign.model.IApiModelFeign;
import com.mortals.xhx.feign.model.vo.ModelFeignVO;
import com.mortals.xhx.feign.rsp.ApiResp;
import com.mortals.xhx.module.user.model.UserModelCollectEntity;
import com.mortals.xhx.module.user.service.UserModelCollectService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
/**
*
* 用户模块收藏
*
* @author zxfei
* @date 2023-08-29
*/
@RestController
@RequestMapping("user/model/collect")
public class UserModelCollectController extends BaseCRUDJsonBodyMappingController<UserModelCollectService,UserModelCollectEntity,Long> {
@Autowired
private IApiModelFeign apiModelFeign;
public UserModelCollectController(){
super.setModuleDesc( "用户模块收藏");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
@PostMapping({"get"})
public String getCollect() {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
String busiDesc = "查看" + this.getModuleDesc();
Context context = this.getContext();
model.put("data", Collections.emptyList());
try {
UserModelCollectEntity query = new UserModelCollectEntity();
query.setUserId(this.getCurUser().getId());
UserModelCollectEntity entity = this.service.selectOne(query);
if (entity == null) {
entity = new UserModelCollectEntity();
entity.setUserId(this.getCurUser().getId());
entity.setRealName(this.getCurUser().getRealName());
entity.setModelIds("");
}else {
if(StringUtils.isNotEmpty(entity.getModelIds())){
List<Long> idList = new ArrayList();
for(String id:entity.getModelIds().split(",")){
Long idL = DataUtil.converStr2Long(id,0l);
idList.add(idL);
}
ModelPdu pdu = new ModelPdu();
pdu.setIdList(idList);
String resp = apiModelFeign.getModelByQuery(pdu);
ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取站点列表信息失败:" + apiResp.getMsg());
}
try {
List<ModelFeignVO> modelFeignVOList = JSONArray.parseArray(JSONObject.toJSONString(apiResp.getData().get("data")), ModelFeignVO.class);
Map<Long,ModelFeignVO> map = new HashMap<>();
for (ModelFeignVO vo:modelFeignVOList){
map.put(vo.getId(),vo);
}
List<ModelFeignVO> result = new ArrayList<>();
for(Long id:idList){
result.add(map.get(id));
}
model.put("data", result);
}catch (Exception e){
model.put("data", apiResp.getData().get("data"));
}
}
}
model.put("message_info", busiDesc + "成功");
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
}
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
ret.put("data", model.get("data"));
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
@Override
@PostMapping({"save"})
@RepeatSubmit
public String save(@RequestBody UserModelCollectEntity entity) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
int code = 1;
String busiDesc = "保存" + this.getModuleDesc();
if(StringUtils.isEmpty(entity.getModelIds())){
return this.createFailJsonResp("请选择要收藏的模块");
}
try {
UserModelCollectEntity query = new UserModelCollectEntity();
query.setUserId(this.getCurUser().getId());
UserModelCollectEntity temp = this.service.selectOne(query);
if (temp == null) {
Class<UserModelCollectEntity> tClass = ReflectUtils.getClassGenricType(this.getClass(), 1);
UserModelCollectEntity initEntity = (UserModelCollectEntity)tClass.newInstance();
initEntity.initAttrValue();
BeanUtils.copyProperties(entity, initEntity, BeanUtil.getNullPropertyNames(entity));
entity = initEntity;
busiDesc = "新增" + this.getModuleDesc();
initEntity.setCreateTime(new Date());
IUser user = this.getCurUser();
if (user != null) {
initEntity.setUserId(user.getId());
initEntity.setRealName(user.getRealName());
}
this.service.save(initEntity, context);
} else {
busiDesc = "修改" + this.getModuleDesc();
entity.setId(temp.getId());
this.service.update(entity, context);
}
model.put("id", entity.getId());
code = this.saveAfter(entity, model, context);
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + entity.getId() + "]");
} catch (Exception var9) {
this.doException(this.request, busiDesc, model, var9);
model.put("entity", entity);
this.init(model, context);
code = this.saveException(entity, model, context, var9);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.page.dao.ibatis.PageInfoDaoImpl">
<select id="getProductList" resultMap="PageInfoEntity-Map">
SELECT DISTINCT t.productId,t.productName FROM mortals_xhx_page_info t ORDER BY t.productId;
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.user.dao.ibatis.UserModelCollectDaoImpl">
<!-- 字段和属性映射 -->
<resultMap type="UserModelCollectEntity" id="UserModelCollectEntity-Map">
<id property="id" column="id" />
<result property="userId" column="userId" />
<result property="realName" column="realName" />
<result property="modelIds" column="modelIds" />
<result property="createTime" column="createTime" />
</resultMap>
<!-- 表所有列 -->
<sql id="_columns">
<trim suffixOverrides="," suffix="">
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
a.id,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('userId') or colPickMode == 1 and data.containsKey('userId')))">
a.userId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('realName') or colPickMode == 1 and data.containsKey('realName')))">
a.realName,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('modelIds') or colPickMode == 1 and data.containsKey('modelIds')))">
a.modelIds,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
a.createTime,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="UserModelCollectEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_user_model_collect
(userId,realName,modelIds,createTime)
VALUES
(#{userId},#{realName},#{modelIds},#{createTime})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_user_model_collect
(userId,realName,modelIds,createTime)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.userId},#{item.realName},#{item.modelIds},#{item.createTime})
</foreach>
</insert>
<!-- 根据ParamDto更新 -->
<update id="update" parameterType="paramDto">
update mortals_xhx_user_model_collect as a
set
<trim suffixOverrides="," suffix="">
<if test="(colPickMode==0 and data.containsKey('userId')) or (colPickMode==1 and !data.containsKey('userId'))">
a.userId=#{data.userId},
</if>
<if test="(colPickMode==0 and data.containsKey('userIdIncrement')) or (colPickMode==1 and !data.containsKey('userIdIncrement'))">
a.userId=ifnull(a.userId,0) + #{data.userIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('realName')) or (colPickMode==1 and !data.containsKey('realName'))">
a.realName=#{data.realName},
</if>
<if test="(colPickMode==0 and data.containsKey('modelIds')) or (colPickMode==1 and !data.containsKey('modelIds'))">
a.modelIds=#{data.modelIds},
</if>
<if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
a.createTime=#{data.createTime},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</update>
<!-- 批量更新 -->
<update id="updateBatch" parameterType="paramDto">
update mortals_xhx_user_model_collect as a
<trim prefix="set" suffixOverrides=",">
<trim prefix="userId=(case" suffix="ELSE userId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('userId')) or (colPickMode==1 and !item.containsKey('userId'))">
when a.id=#{item.id} then #{item.userId}
</when>
<when test="(colPickMode==0 and item.containsKey('userIdIncrement')) or (colPickMode==1 and !item.containsKey('userIdIncrement'))">
when a.id=#{item.id} then ifnull(a.userId,0) + #{item.userIdIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="realName=(case" suffix="ELSE realName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('realName')) or (colPickMode==1 and !item.containsKey('realName'))">
when a.id=#{item.id} then #{item.realName}
</if>
</foreach>
</trim>
<trim prefix="modelIds=(case" suffix="ELSE modelIds end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('modelIds')) or (colPickMode==1 and !item.containsKey('modelIds'))">
when a.id=#{item.id} then #{item.modelIds}
</if>
</foreach>
</trim>
<trim prefix="createTime=(case" suffix="ELSE createTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
when a.id=#{item.id} then #{item.createTime}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
#{item.id}
</foreach>
</update>
<!-- 根据主健查询 -->
<select id="getByKey" parameterType="paramDto" resultMap="UserModelCollectEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_user_model_collect as a
where a.id=#{condition.id}
</select>
<!-- 根据主健删除 -->
<delete id="deleteByKey" parameterType="paramDto">
delete a.* from mortals_xhx_user_model_collect as a where a.id=#{condition.id}
</delete>
<!-- 根据主健删除一批,针对单一主健有效 -->
<delete id="deleteByKeys">
delete from mortals_xhx_user_model_collect where id in
<foreach collection="array" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 根据主健列表删除一批,针对单一主健有效 -->
<delete id="deleteByKeyList">
delete from mortals_xhx_user_model_collect where id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 根据对象列表删除一批,针对单一主健有效 -->
<delete id="deleteByEntityList">
delete from mortals_xhx_user_model_collect where id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item.id}
</foreach>
</delete>
<!-- 根据paramDto删除一批 -->
<delete id="deleteByMap" parameterType="paramDto">
delete a.* from mortals_xhx_user_model_collect as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</delete>
<!-- 获取列表 -->
<select id="getList" parameterType="paramDto" resultMap="UserModelCollectEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_user_model_collect as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取 -->
<select id="getListCount" parameterType="paramDto" resultType="int">
select count(1)
from mortals_xhx_user_model_collect as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</select>
<!-- 条件映射 -->
<sql id="_condition_">
<if test="condition != null and !condition.isEmpty()">
<!-- 条件映射-普通条件 -->
<include refid="_condition_param_">
<property name="_conditionParam_" value="condition"/>
<property name="_conditionType_" value="and"/>
</include>
<!-- 条件映射-集合之间使用AND,集合中元素使用OR-(list[0].1 or list[0].2) and (list[1].3 or list[1].4) -->
<if test="condition.containsKey('andConditionList') and !condition.andConditionList.isEmpty()">
and
<foreach collection="condition.andConditionList" open="(" close=")" index="index" item="andCondition" separator=" and ">
<trim prefixOverrides="or" prefix="(" suffix=")">
<include refid="_condition_param_">
<property name="_conditionParam_" value="andCondition"/>
<property name="_conditionType_" value="or"/>
</include>
</trim>
</foreach>
</if>
<!-- 条件映射-集合之间使用OR,集合中元素使用AND-(list[0].1 and list[0].2) or (list[1].3 and list[1].4) -->
<if test="condition.containsKey('orConditionList') and !condition.orConditionList.isEmpty()">
and
<foreach collection="condition.orConditionList" open="(" close=")" index="index" item="orCondition" separator=" or ">
<trim prefixOverrides="and" prefix="(" suffix=")">
<include refid="_condition_param_">
<property name="_conditionParam_" value="orCondition"/>
<property name="_conditionType_" value="and"/>
</include>
</trim>
</foreach>
</if>
</if>
</sql>
<!-- 条件映射-代参数 -->
<sql id="_condition_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null">
${_conditionType_} a.id=#{${_conditionParam_}.id}
</if>
</if>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null ">
${_conditionType_} a.id = #{${_conditionParam_}.id}
</if>
<if test="conditionParamRef.id == null">
${_conditionType_} a.id is null
</if>
</if>
<if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
${_conditionType_} a.id in
<foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('idNotList') and conditionParamRef.idNotList.size() > 0">
${_conditionType_} a.id not in
<foreach collection="conditionParamRef.idNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('idStart') and conditionParamRef.idStart != null">
${_conditionType_} a.id <![CDATA[ >= ]]> #{${_conditionParam_}.idStart}
</if>
<if test="conditionParamRef.containsKey('idEnd') and conditionParamRef.idEnd != null">
${_conditionType_} a.id <![CDATA[ <= ]]> #{${_conditionParam_}.idEnd}
</if>
<if test="conditionParamRef.containsKey('userId')">
<if test="conditionParamRef.userId != null ">
${_conditionType_} a.userId = #{${_conditionParam_}.userId}
</if>
<if test="conditionParamRef.userId == null">
${_conditionType_} a.userId is null
</if>
</if>
<if test="conditionParamRef.containsKey('userIdList') and conditionParamRef.userIdList.size() > 0">
${_conditionType_} a.userId in
<foreach collection="conditionParamRef.userIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('userIdNotList') and conditionParamRef.userIdNotList.size() > 0">
${_conditionType_} a.userId not in
<foreach collection="conditionParamRef.userIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('userIdStart') and conditionParamRef.userIdStart != null">
${_conditionType_} a.userId <![CDATA[ >= ]]> #{${_conditionParam_}.userIdStart}
</if>
<if test="conditionParamRef.containsKey('userIdEnd') and conditionParamRef.userIdEnd != null">
${_conditionType_} a.userId <![CDATA[ <= ]]> #{${_conditionParam_}.userIdEnd}
</if>
<if test="conditionParamRef.containsKey('realName')">
<if test="conditionParamRef.realName != null and conditionParamRef.realName != ''">
${_conditionType_} a.realName like #{${_conditionParam_}.realName}
</if>
<if test="conditionParamRef.realName == null">
${_conditionType_} a.realName is null
</if>
</if>
<if test="conditionParamRef.containsKey('realNameList') and conditionParamRef.realNameList.size() > 0">
${_conditionType_} a.realName in
<foreach collection="conditionParamRef.realNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('realNameNotList') and conditionParamRef.realNameNotList.size() > 0">
${_conditionType_} a.realName not in
<foreach collection="conditionParamRef.realNameNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('modelIds')">
<if test="conditionParamRef.modelIds != null and conditionParamRef.modelIds != ''">
${_conditionType_} a.modelIds like #{${_conditionParam_}.modelIds}
</if>
<if test="conditionParamRef.modelIds == null">
${_conditionType_} a.modelIds is null
</if>
</if>
<if test="conditionParamRef.containsKey('modelIdsList') and conditionParamRef.modelIdsList.size() > 0">
${_conditionType_} a.modelIds in
<foreach collection="conditionParamRef.modelIdsList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('modelIdsNotList') and conditionParamRef.modelIdsNotList.size() > 0">
${_conditionType_} a.modelIds not in
<foreach collection="conditionParamRef.modelIdsNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('createTime')">
<if test="conditionParamRef.createTime != null ">
${_conditionType_} a.createTime = #{${_conditionParam_}.createTime}
</if>
<if test="conditionParamRef.createTime == null">
${_conditionType_} a.createTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('createTimeStart') and conditionParamRef.createTimeStart != null and conditionParamRef.createTimeStart!=''">
${_conditionType_} a.createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('createTimeEnd') and conditionParamRef.createTimeEnd != null and conditionParamRef.createTimeEnd!=''">
${_conditionType_} a.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
order by
<trim suffixOverrides="," suffix="">
<foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
${item.colName} ${item.sortKind}
</foreach>
</trim>
</if>
<if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
order by
<trim suffixOverrides="," suffix="">
<if test="orderCol.containsKey('id')">
a.id
<if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('userId')">
a.userId
<if test='orderCol.userId != null and "DESC".equalsIgnoreCase(orderCol.userId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('realName')">
a.realName
<if test='orderCol.realName != null and "DESC".equalsIgnoreCase(orderCol.realName)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('modelIds')">
a.modelIds
<if test='orderCol.modelIds != null and "DESC".equalsIgnoreCase(orderCol.modelIds)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('createTime')">
a.createTime
<if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
,
</if>
</trim>
</if>
</sql>
<sql id="_group_by_">
<if test="groupList != null and !groupList.isEmpty()">
GROUP BY
<trim suffixOverrides="," suffix="">
<foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
${item}
</foreach>
</trim>
</if>
</sql>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment