Commit 25ed2622 authored by “yiyousong”'s avatar “yiyousong”
parents b9d36586 69ea2f56
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>release</id>
<formats>
<format>tar.gz</format>
</formats>
<!-- 需要打包的文件集 -->
<fileSets>
<fileSet>
<directory>${project.parent.basedir}/device-manager-ui/admin/dist</directory>
<includes>
<include>**/*</include>
</includes>
<outputDirectory>/dist</outputDirectory>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>release</id>
<formats>
<format>tar.gz</format>
</formats>
<fileSets>
<fileSet>
<directory>target/bin</directory>
<!-- <directory>src/main/bin</directory>-->
<outputDirectory>bin</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<!-- <directory>${project.parent.basedir}/dist/${project.parent.artifactId}/boot</directory>-->
<directory>${project.parent.basedir}/dist/${project.parent.artifactId}/boot</directory>
<outputDirectory>boot</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<!-- <directory>${project.parent.basedir}/dist/${project.parent.artifactId}/db</directory>-->
<directory>./db</directory>
<includes>
<include>*.sql</include>
</includes>
<outputDirectory>db</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${project.artifactId}-${project.version}.jar</source>
<outputDirectory>boot</outputDirectory>
</file>
</files>
</assembly>
\ No newline at end of file
......@@ -28,7 +28,7 @@ public interface IUserFeign extends IFeign {
* @param userPdu
* @return
*/
@PostMapping(value = "/user/list")
@PostMapping(value = "/user/listPage")
Rest<RespData<List<UserPdu>>> list(@RequestBody UserPdu userPdu);
......
......@@ -2,10 +2,9 @@ package com.mortals.xhx.queue;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Data
@Component
//@Component
public class TbQueueCoreSettings {
@Value("${queue.core.topic}")
......
......@@ -7,7 +7,6 @@ import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
......@@ -20,7 +19,7 @@ public class TbRabbitMqSettings {
private String exchangeName;
@Value("${queue.rabbitmq.host:}")
private String host;
@Value("${queue.rabbitmq.port:}")
@Value("${queue.rabbitmq.port:0}")
private int port;
@Value("${queue.rabbitmq.virtual_host:}")
private String virtualHost;
......
This diff is collapsed.
......@@ -2,14 +2,14 @@
NODE_ENV = production
# 地址
VUE_APP_BASE_API = http://192.168.0.26:9005/m
VUE_APP_BASE_API = http://192.168.0.251:9005/m
# websocket地址
VUE_APP_WEBSOCKET_API =192.168.0.98:18222/m
VUE_APP_WEBSOCKET_API =192.168.0.251:18222/m
# 门户登录地址
VUE_APP_PORTAL_URL = http://192.168.0.98:11072
VUE_APP_PORTAL_URL = http://192.168.0.251:11072
# 站点请求地址
VUE_APP_SITETREE_URL = http://192.168.0.98:18222/m/site/siteTree
\ No newline at end of file
VUE_APP_SITETREE_URL = http://192.168.0.251:18222/m/site/siteTree
\ No newline at end of file
# 测试环境配置
NODE_ENV = 'production'
NODE_ENV = 'test'
# 地址
VUE_APP_BASE_API = http://192.168.0.98:11091/m
......
......@@ -4,8 +4,9 @@
"private": true,
"scripts": {
"dev": "vue-cli-service serve",
"dev1": "vue-cli-service serve --mode test",
"build": "vue-cli-service build",
"stage": "vue-cli-service build --mode stage",
"test": "vue-cli-service build --mode test",
"build:prod": "vue-cli-service build --model prod"
},
"dependencies": {
......
......@@ -22,8 +22,8 @@
/> -->
<Field
label="MAC地址"
prop="deviceMac"
v-model="form.deviceMac"
prop="deviceCode"
v-model="form.deviceCode"
placeholder="请输入设备的MAC地址"
/>
<!-- <Field label="平台类型" prop="platformId" v-model="form.platformId" type="select" :enumData="dict.platformId" placeholder="请选择平台类型"/> -->
......
......@@ -30,6 +30,9 @@ import { createSocket } from "@/assets/utils/websocket";
export default {
name: "login",
created() {
console.log("url:"+process.env.VUE_APP_PORTAL_URL)
// let obj = {};
// obj.lng = 104.21;
// obj.lat = 30.56;
......
<template>
<!-- 弹出框表单 -->
<el-dialog :title="title" :visible.sync="open" width="90%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<Field label="站点名称" prop="siteName" v-model="form.siteName" placeholder="请输入站点名称"/>
<!-- <Field label="站点编号" prop="siteCode" v-model="form.siteCode" placeholder="请输入站点编号"/> -->
<Field label="区域编号" disabled prop="areaCode" v-model="form.areaCode" />
<Field label="区域名称" disabled prop="areaName" v-model="form.areaName" />
<Field label="省编码" prop="proCode" v-model="form.proCode" placeholder="请输入省编码"/>
<Field label="市编码" prop="cityCode" v-model="form.cityCode" placeholder="请输入市编码"/>
<Field label="区编码" prop="districtCode" v-model="form.districtCode" placeholder="请输入区编码"/>
<Field label="站点服务器ip" prop="siteIp" v-model="form.siteIp" placeholder="请输入站点服务器ip"/>
<Field label="站点服务器端口" prop="sitePort" v-model="form.sitePort" placeholder="请输入站点服务器端口"/>
<Field label="经度" prop="longitude" v-model="form.longitude" placeholder="请输入经度"/>
<Field label="纬度" prop="latitude" v-model="form.latitude" placeholder="请输入纬度"/>
<Field label="中心联系电话" prop="siteTel" v-model="form.siteTel" placeholder="请输入中心联系电话"/>
<Field label="中心详细地址" prop="detailAddress" v-model="form.detailAddress" type="textarea" placeholder="请输入中心详细地址"/>
<Field label="中心介绍" prop="siteRemark" v-model="form.siteRemark" type="textarea" placeholder="请输入中心介绍"/>
<Field label="上午上班开始时间" prop="amWorkStartTime" v-model="form.amWorkStartTime" type="date" />
<Field label="上午上班结束时间" prop="amWorkEndTime" v-model="form.amWorkEndTime" type="date" />
<Field label="下午上班开始时间" prop="pmWorkStartTime" mo-model="form.pmWorkStartTime" type="date" />
<Field label="下午上班结束时间" prop="pmWorkEndTime" v-model="form.pmWorkEndTime" type="date" />
<Field label="周一 " prop="workday1" v-model="form.workday1" type="select" :enumData="dict.workday1" placeholder="请选择周一 "/>
<Field label="周二 " prop="workday2" v-model="form.workday2" type="select" :enumData="dict.workday2" placeholder="请选择周二 "/>
<Field label="周三 " prop="workday3" v-model="form.workday3" type="select" :enumData="dict.workday3" placeholder="请选择周三 "/>
<Field label="周四 " prop="workday4" v-model="form.workday4" type="select" :enumData="dict.workday4" placeholder="请选择周四 "/>
<Field label="周五 " prop="workday5" v-model="form.workday5" type="select" :enumData="dict.workday5" placeholder="请选择周五 "/>
<Field label="周六 " prop="workday6" v-model="form.workday6" type="select" :enumData="dict.workday6" placeholder="请选择周六 "/>
<Field label="周日 " prop="workday7" v-model="form.workday7" type="select" :enumData="dict.workday7" placeholder="请选择周日 "/>
<Field label="楼层" prop="level" v-model="form.level" placeholder="请输入楼层"/>
<Field label="楼栋" prop="building" v-model="form.building" placeholder="请输入楼栋"/>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" v-if="pageInfo.type !== 'view'" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
import form from "@/assets/mixins/formdialog";
import dialogShow from "./dialogshow";
export default {
mixins: [form],
components: {
dialogShow ,
},
data() {
return {
// 遮罩层
loading: true,
// 弹出层标题
title: "站点",
// 是否显示弹出层
open: false,
toString:[
"workday1",
"workday2",
"workday3",
"workday4",
"workday5",
"workday6",
"workday7",
],
// 表单校验
rules: {
}
};
},
methods: {
/** 编辑 */
edit(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl =this.pageInfo.editUrl;;
this.getData();
this.pageInfo.type="edit"
this.title = "修改站点";
},
/** 新增 */
add(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl = this.pageInfo.addUrl;
this.form.areaCode=row.areaCode
this.form.areaName=row.areaName
this.getData();
this.pageInfo.type="add"
this.title = "新增站点";
},
/** 查看*/
view(row) {
this.reset()
this.query = { id: row.id };
this.urls.currUrl =this.pageInfo.viewUrl;;
this.getData();
this.pageInfo.type="view"
this.title = "站点详细";
},
/**取消按钮 */
cancel() {
this.open = false;
},
/**获取数据后弹框 */
afterRender(data) {
this.open = true;
},
afterSubmit(data) {
this.open = false;
this.$emit("ok");
},
// 表单重置
reset() {
this.form = {
siteName : null,
siteCode : null,
areaID : null,
areaCode : null,
areaName : null,
proCode : null,
cityCode : null,
districtCode : null,
siteIp : null,
sitePort : null,
longitude : null,
latitude : null,
siteTel : null,
detailAddress : null,
siteRemark : null,
amWorkStartTime : null,
amWorkEndTime : null,
pmWorkStartTime : null,
pmWorkEndTime : null,
workday1 : 1,
workday2 : 1,
workday3 : 1,
workday4 : 1,
workday5 : 1,
workday6 : 0,
workday7 : 0,
level : 1,
building : 1,
};
this.resetForm("form");
},
resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
},
},
};
</script>
<template>
<div class="page">
<el-row :gutter="20" style="margin-top:5px">
<el-col :span="8" :xs="12" class="mytree">
<el-card>
<div slot="header">
<span>站点结构</span>
</div>
<el-scrollbar style="height: 100%">
<el-tree
size="mini"
ref="areaTree"
:data="areaData"
id="el-tree"
node-key="id"
indent="2"
:props="treeProps"
:load="loadNode"
highlight-current
lazy
:render-content="renderContent"
@node-click="handleNodeClick"
>
</el-tree>
</el-scrollbar>
</el-card>
</el-col>
<el-col :span="16" :xs="12">
<el-card>
<el-row>
<el-tooltip effect="light" content="新增站点">
<el-button
circle
@click="toAdd"
icon="el-icon-plus"
size="mini"
></el-button>
</el-tooltip>
<el-tooltip effect="light" content="编辑当前产品">
<el-button
circle
@click="toEdit"
icon="el-icon-edit"
size="mini"
></el-button>
</el-tooltip>
</el-row>
<el-divider></el-divider>
<!-- <view-show ref="viewform" /> -->
</el-card>
</el-col>
</el-row>
<!-- <LayoutTable :data="tableData" :config="tableConfig"> </LayoutTable> -->
<dialog-show ref="dialogform" @ok="refreshNodeBy" />
</div>
</template>
<script>
/** 表单弹出框模式需引入 */
import dialogShow from "./dialogshow";
import viewShow from "./view";
import tree from "@/assets/mixins/tree";
export default {
name: "Site",
components: {dialogShow, viewShow },
mixins: [tree],
created() {
this.$get("/area/getListByParentId", {
parentId: 0,
}).then(({ data }) => {
this.areaData=data.data
});
},
methods: {
/** 重写新增方法 */
toAdd(row) {
if(Object.keys(this.currentNode).length === 0){
this.$message.info("请选择区域后新增站点!")
return
}
if(this.currentNode.type !== 'area'){
this.$message.info("请选择区域后新增站点!")
return
}
row.areaCode=this.currentNode.areaCode
row.areaName=this.currentNode.label
this.$refs.dialogform.add(row);
},
/** 重写编辑方法 */
toEdit(row) {
if(Object.keys(this.currentNode).length === 0){
this.$message.info("请选择站点后再编辑!")
return
}
if(this.currentNode.type !== 'site'){
this.$message.info("请选择站点后再编辑!")
return
}
row.id=this.currentNode.id
this.$refs.dialogform.edit(row);
},
toView(row) {
//console.log("toView", this.$refs.viewform);
// console.log("dialogform", this.$refs.dialogform);
this.$refs.viewform.handleView(row);
},
handleNodeClick(node) {
this.currentNode=node
if(node.type=='site'){
this.toView(this.currentNode);
}
},
renderContent: function (h, { node, data, store }) {
return (
<span>
<i style="font-size:16px;color:#409EFF" class={data.icon}></i>
<span style="padding-left: 2px;font-size:14px">{node.label}</span>
</span>
);
},
refreshNodeBy(id) {
let node = this.$refs.areaTree.getNode(this.currentNode.id); // 通过节点id找到对应树节点对象
node.loaded = false;
node.expand(); // 主动调用展开节点方法,重新查询该节点下的所有子节点
this.toView(this.currentNode);
},
async loadNode(node, resolve) {
if (node.level === 0) {
return;
}
this.$get("/area/getListByParentId", {
parentId: node.data.id,
}).then(({ data }) => {
resolve(data.data);
});
},
},
data() {
return {
treeProps: {
id: "id",
label: "label",
areaCode:"areaCode",
type: "type",
isLeaf: "isLeaf",
children: "children",
icon: "icon",
},
areaData:[],
currentNode:{},
};
},
};
</script>
<style>
.el-card__body {
padding: 10px;
}
.el-calendar-table .el-calendar-day {
height: 70px;
}
.is-selected {
color: #fa3b19;
}
</style>
<style lang="scss" scoped>
.mytree ::v-deep {
.el-tree--highlight-current
::v-deep
.el-tree-node.is-checked
> .el-tree-node__content {
background-color: rgb(255, 255, 255);
color: rgb(64, 158, 255);
}
.el-tree--highlight-current
::v-deep
.el-tree-node.is-current
> .el-tree-node__content {
background-color: rgb(255, 255, 255);
color: rgb(64, 158, 255);
}
.el-tree > .el-tree-node:after {
border-top: none;
}
.el-tree-node {
position: relative;
padding-left: 16px;
}
//节点有间隙,隐藏掉展开按钮就好了,如果觉得空隙没事可以删掉
.el-tree-node__expand-icon.is-leaf {
display: none;
}
.el-tree-node__children {
padding-left: 16px;
}
.el-tree-node :last-child:before {
height: 38px;
}
.el-tree > .el-tree-node:before {
border-left: none;
}
.el-tree > .el-tree-node:after {
border-top: none;
}
.el-tree-node:before {
content: "";
left: -4px;
position: absolute;
right: auto;
border-width: 1px;
}
.el-tree-node:after {
content: "";
left: -4px;
position: absolute;
right: auto;
border-width: 1px;
}
.el-tree-node:before {
border-left: 1px dashed #4386c6;
bottom: 0px;
height: 100%;
top: -26px;
width: 1px;
}
.el-tree-node:after {
border-top: 1px dashed #4386c6;
height: 20px;
top: 12px;
width: 24px;
}
}
</style>
\ No newline at end of file
<template>
<layout-form>
<el-form :model="form" :loading="loading" :rules="rules" size='small' style="width:100%" label-width='120px' ref="form">
<el-row>
<Field label="站点名称" prop="siteName" v-model="form.siteName" type="textarea" placeholder="请输入站点名称"/>
<Field label="站点编号" prop="siteCode" v-model="form.siteCode" placeholder="请输入站点编号"/>
<Field label="区域编号" prop="areaCode" v-model="form.areaCode" placeholder="请输入区域编号"/>
<Field label="区域名称" prop="areaName" v-model="form.areaName" placeholder="请输入区域名称"/>
<Field label="省编码" prop="proCode" v-model="form.proCode" placeholder="请输入省编码"/>
<Field label="市编码" prop="cityCode" v-model="form.cityCode" placeholder="请输入市编码"/>
<Field label="区编码" prop="districtCode" v-model="form.districtCode" placeholder="请输入区编码"/>
<Field label="站点服务器ip" prop="siteIp" v-model="form.siteIp" placeholder="请输入站点服务器ip"/>
<Field label="站点服务器端口" prop="sitePort" v-model="form.sitePort" placeholder="请输入站点服务器端口"/>
<Field label="经度" prop="longitude" v-model="form.longitude" placeholder="请输入经度"/>
<Field label="纬度" prop="latitude" v-model="form.latitude" placeholder="请输入纬度"/>
<Field label="中心联系电话" prop="siteTel" v-model="form.siteTel" placeholder="请输入中心联系电话"/>
<Field label="中心详细地址" prop="detailAddress" v-model="form.detailAddress" type="textarea" placeholder="请输入中心详细地址"/>
<Field label="中心介绍" prop="siteRemark" v-model="form.siteRemark" type="textarea" placeholder="请输入中心介绍"/>
<Field label="上午上班开始时间" prop="amWorkStartTime" v-model="form.amWorkStartTime" type="date" />
<Field label="上午上班结束时间" prop="amWorkEndTime" v-model="form.amWorkEndTime" type="date" />
<Field label="下午上班开始时间" prop="pmWorkStartTime" v-model="form.pmWorkStartTime" type="date" />
<Field label="下午上班结束时间" prop="pmWorkEndTime" v-model="form.pmWorkEndTime" type="date" />
<Field label="周一 " prop="workday1" v-model="form.workday1" type="select" :enumData="dict.workday1" placeholder="请选择周一 "/>
<Field label="周二 " prop="workday2" v-model="form.workday2" type="select" :enumData="dict.workday2" placeholder="请选择周二 "/>
<Field label="周三 " prop="workday3" v-model="form.workday3" type="select" :enumData="dict.workday3" placeholder="请选择周三 "/>
<Field label="周四 " prop="workday4" v-model="form.workday4" type="select" :enumData="dict.workday4" placeholder="请选择周四 "/>
<Field label="周五 " prop="workday5" v-model="form.workday5" type="select" :enumData="dict.workday5" placeholder="请选择周五 "/>
<Field label="周六 " prop="workday6" v-model="form.workday6" type="select" :enumData="dict.workday6" placeholder="请选择周六 "/>
<Field label="周日 " prop="workday7" v-model="form.workday7" type="select" :enumData="dict.workday7" placeholder="请选择周日 "/>
<Field label="楼层" prop="level" v-model="form.level" placeholder="请输入楼层"/>
<Field label="楼栋" prop="building" v-model="form.building" placeholder="请输入楼栋"/>
</el-row>
<form-buttons @submit='submitForm' :noSaveBtn="pageInfo.type === 'view'"/>
</el-form>
</layout-form>
</template>
<script>
import form from "@/assets/mixins/form";
export default {
mixins: [form],
components: {
},
methods: {
},
data() {
return {
toString:[
"workday1",
"workday2",
"workday3",
"workday4",
"workday5",
"workday6",
"workday7",
],
rules: {
}
};
}
};
</script>
\ No newline at end of file
<template>
<div v-if="form.id">
<el-descriptions class="descClass" :title="title" :column="column" :size="size" :colon="false" border>
<template slot="title">
<i class="el-icon-tickets"></i>
基本信息
</template>
<el-descriptions-item label="站点名称" label-class-name="labelClass" content-class-name="contentClass">
{{form.siteName}}
</el-descriptions-item>
<el-descriptions-item label="区域编号" label-class-name="labelClass" content-class-name="contentClass">
{{form.areaCode}}
</el-descriptions-item>
<el-descriptions-item label="区域名称" label-class-name="labelClass" content-class-name="contentClass">
{{form.areaName}}
</el-descriptions-item>
<el-descriptions-item label="站点编号" label-class-name="labelClass" content-class-name="contentClass">
{{form.siteCode}}
</el-descriptions-item>
<el-descriptions-item label="省编码" label-class-name="labelClass" content-class-name="contentClass">
{{form.proCode}}
</el-descriptions-item>
<el-descriptions-item label="区编码" label-class-name="labelClass" content-class-name="contentClass">
{{form.areaCode}}
</el-descriptions-item>
<el-descriptions-item label="市编码" label-class-name="labelClass" content-class-name="contentClass">
{{form.cityCode}}
</el-descriptions-item>
<el-descriptions-item label="站点服务器ip" label-class-name="labelClass" content-class-name="contentClass">
{{form.siteIp}}
</el-descriptions-item>
<el-descriptions-item label="站点服务器端口" label-class-name="labelClass" content-class-name="contentClass">
{{form.sitePort}}
</el-descriptions-item>
<el-descriptions-item label="经度" label-class-name="labelClass" content-class-name="contentClass">
{{form.longitude}}
</el-descriptions-item>
<el-descriptions-item label="纬度" label-class-name="labelClass" content-class-name="contentClass">
{{form.latitude}}
</el-descriptions-item>
<el-descriptions-item label="中心联系电话" label-class-name="labelClass" content-class-name="contentClass">
{{form.siteTel}}
</el-descriptions-item>
<el-descriptions-item label="中心详细地址" label-class-name="labelClass" content-class-name="contentClass">
{{form.detailAddress}}
</el-descriptions-item>
<el-descriptions-item label="中心介绍" label-class-name="labelClass" content-class-name="contentClass">
{{form.siteRemark}}
</el-descriptions-item>
<el-descriptions-item label="楼层" label-class-name="labelClass" content-class-name="contentClass">
{{form.level}}
</el-descriptions-item>
<el-descriptions-item label="楼栋" label-class-name="labelClass" content-class-name="contentClass">
{{form.building}}
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="descClass" :title="title" :column="column" :size="size" :colon="false" border>
<template slot="title">
<i class="el-icon-tickets"></i>
办公信息
</template>
<el-descriptions-item label="上午上班开始时间" label-class-name="labelClass" content-class-name="contentClass">
{{form.amWorkStartTime}}
</el-descriptions-item>
<el-descriptions-item label="上午上班结束时间" label-class-name="labelClass" content-class-name="contentClass">
{{form.amWorkEndTime}}
</el-descriptions-item>
<el-descriptions-item label="下午上班开始时间" label-class-name="labelClass" content-class-name="contentClass">
{{form.pmWorkStartTime}}
</el-descriptions-item>
<el-descriptions-item label="下午上班结束时间" label-class-name="labelClass" content-class-name="contentClass">
{{form.pmWorkEndTime}}
</el-descriptions-item>
<el-descriptions-item label="周一 " label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("workday1", form.workday1) }}
</el-descriptions-item>
<el-descriptions-item label="周二 " label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("workday2", form.workday2) }}
</el-descriptions-item>
<el-descriptions-item label="周三 " label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("workday3", form.workday3) }}
</el-descriptions-item>
<el-descriptions-item label="周四 " label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("workday4", form.workday4) }}
</el-descriptions-item>
<el-descriptions-item label="周五 " label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("workday5", form.workday5) }}
</el-descriptions-item>
<el-descriptions-item label="周六 " label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("workday6", form.workday6) }}
</el-descriptions-item>
<el-descriptions-item label="周日 " label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("workday7", form.workday7) }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="descClass" :title="title" :column="column" :size="size" :colon="false" border>
<template slot="title">
<i class="el-icon-tickets"></i>
部署模块
</template>
<el-descriptions-item label="模块" label-class-name="labelClass" content-class-name="contentClass">
{{ util_formatters("modelIds", form.modelIds) }}
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script>
import view from "@/assets/mixins/view";
export default {
mixins: [view],
components: {
},
methods: {
/** 查看*/
handleView(row) {
this.query = { id: row.id };
this.urls.currUrl =this.pageInfo.viewUrl;;
this.getData();
},
},
data() {
return {
size:"small",
column:2,
toString:[
"workday1",
"workday2",
"workday3",
"workday4",
"workday5",
"workday6",
"workday7",
],
toArrays: [
],
toDate: [
]
}
}
}
</script>
<style lang="less">
.descClass{
margin-top:5px;
margin-bottom:5px
}
.labelClass{
width: 200px;
}
.el-descriptions__body{
margin-left: 5px;
margin-right: 5px;
color: #606266;
background-color: #FFF;
}
.contentClass{
width: 600px;
}
</style>
\ No newline at end of file
......@@ -238,11 +238,10 @@ export default {
async saveAuth() {
try {
this.auth.form.resourceIdList = this.auth.checkList
.filter((i) => typeof i === "number")
.join(",");
await this.$post("/role/auth/distributionSource", {
query: this.auth.form,
});
.filter((i) => typeof i === "number");
//.join(",");
await this.$post("/role/auth/distributionSource", this.auth.form,
);
this.auth.visible = false;
this.auth.form = this.initForm();
this.$message.success("操作成功");
......
......@@ -69,9 +69,10 @@ export default {
let data = this.userRoleDialog.data;
this.$post("/user/save", {
"entity.id": data.id,
"entity.mobile": data.mobile,
"entity.roleIds": this.roles.join(","),
"id": data.id,
"mobile": data.mobile,
"lastLoginAddress":"127.0.0.1",
"roleIds": this.roles.join(","),
}).then((res) => {
if (res && res.code == 1) {
this.userRoleDialog.data = {};
......
This diff is collapsed.
/*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 80018
Source Host : localhost:3306
Source Schema : base-platform
Target Server Type : MySQL
Target Server Version : 80018
File Encoding : 65001
Date: 05/11/2021 09:39:57
*/
DROP database if exists `device-platform`;
CREATE database `device-platform` default charset=utf8;
use `device-platform`;
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
......
This diff is collapsed.
use `device-platform`;
-- ----------------------------
-- 设备生产厂商菜单 SQL
-- ----------------------------
......
This diff is collapsed.
use `device-platform`;
-- ----------------------------
-- 设备生产厂商参数 SQL
-- ----------------------------
......@@ -33,3 +33,26 @@ INSERT INTO `mortals_xhx_param` VALUES (null, '日志类型,', 'DeviceLog', 'l
INSERT INTO `mortals_xhx_param` VALUES (null, '数据获取方式', 'Device', 'deviceDataSourceWay', '1', '被动拉取', 1, 4, 0, 'deviceDataSourceWay', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_platform` VALUES (1, '排号系统', 'phxt', 0, 'http://192.168.0.98:8090', '', 1, '', '', 1, '2022-05-31 15:56:20', 1, '2022-07-02 11:46:48');
INSERT INTO `mortals_xhx_platform` VALUES (2, '无感一码通', 'noninductive', 0, 'baidu.com', '', 1, 'baidu.com', 'noninductivenoninductive', 1, '2022-07-07 15:24:31', 1, '2022-07-07 15:24:40');
INSERT INTO `mortals_xhx_platform` VALUES (3, '短信系统', 'information', 0, 'baidu.baodu', '', 0, 'baidu.baodu', 'baidu.baodu', 1, '2022-07-07 15:26:03', 1, '2022-07-07 15:26:03');
INSERT INTO `mortals_xhx_platform` VALUES (4, '存取件平台', 'cqj', 0, 'http://192.168.0.98:8090', '', 0, '', '', 1, '2022-07-26 10:28:08', 1, '2022-07-29 10:09:11');
INSERT INTO `mortals_xhx_platform` VALUES (5, '信息发布系统', 'xxfbxt', 0, 'http://192.168.0.98:8090', '', 1, '', '', 1, '2022-08-04 09:46:43', 1, '2022-08-04 14:52:56');
INSERT INTO `mortals_xhx_platform` VALUES (6, '评价系统', 'pjxt', 0, 'http://192.168.0.98:8090', '', 1, '', '', 1, '2022-08-17 16:33:34', 1, '2022-08-17 16:34:22');
INSERT INTO `mortals_xhx_product` VALUES (1, 1, '排队机', 'pdj', 1, '1920x1080', '/homeDeviceUrl/pdj/1920x1080', '', 1, '2022-05-12 10:35:18', 1, '2022-08-03 10:14:18');
INSERT INTO `mortals_xhx_product` VALUES (2, 1, '窗口屏', 'ckp', 1, '1920x1080', '/homeDeviceUrl/ckp/1920x1080', '1111', 1, '2022-05-31 15:52:59', 1, '2022-08-01 16:59:54');
INSERT INTO `mortals_xhx_product` VALUES (3, 1, '呼叫器', 'hjq', 1, '1920x1080', '/homeDeviceUrl/hjq/1920x1080', '', 1, '2022-05-31 15:53:12', 1, '2022-08-02 09:28:19');
INSERT INTO `mortals_xhx_product` VALUES (4, 1, '集中显示屏', 'jzxsp', 1, '1920x1080', '/homeDeviceUrl/jzxsp/1920x1080', '', 1, '2022-05-31 15:53:27', 1, '2022-08-02 09:28:28');
INSERT INTO `mortals_xhx_product` VALUES (5, 1, '导视机', 'dsj', NULL, NULL, NULL, '', 1, '2022-05-31 15:53:41', 1, '2022-05-31 15:53:41');
INSERT INTO `mortals_xhx_product` VALUES (6, 1, '评价器', 'pjq', NULL, NULL, NULL, '', 1, '2022-05-31 15:53:55', 1, '2022-09-19 09:41:01');
INSERT INTO `mortals_xhx_product` VALUES (7, 1, '自助服务终端', 'zzfwzd', NULL, NULL, NULL, '', 1, '2022-05-31 15:54:09', 1, '2022-05-31 15:54:09');
INSERT INTO `mortals_xhx_product` VALUES (8, 1, '填单机', 'tdj', NULL, NULL, NULL, '', 1, '2022-05-31 15:54:20', 1, '2022-05-31 15:54:20');
INSERT INTO `mortals_xhx_product` VALUES (9, 1, '样表机', 'ybj', NULL, NULL, NULL, '', 1, '2022-05-31 15:54:29', 1, '2022-05-31 15:54:29');
INSERT INTO `mortals_xhx_product` VALUES (10, 2, '一码通', 'ymt', NULL, NULL, NULL, '123', 1, '2022-07-12 15:08:51', 1, '2022-07-12 15:08:51');
INSERT INTO `mortals_xhx_product` VALUES (11, 1, 'LED通屏', 'ledtp', NULL, NULL, 'http://www.baidu.com', '', 1, '2022-07-19 10:13:06', 1, '2022-07-19 10:13:06');
INSERT INTO `mortals_xhx_product` VALUES (13, 4, '取件柜', 'qjg', NULL, NULL, 'http://www.baidu.com', '', 1, '2022-07-26 10:28:42', 1, '2022-07-26 10:28:42');
INSERT INTO `mortals_xhx_product` VALUES (14, 5, '信息发布屏', 'xxfbp', NULL, '', '', '', 1, '2022-08-04 09:42:01', 1, '2022-08-04 09:46:51');
INSERT INTO `mortals_xhx_product` VALUES (15, 6, '背靠背评价设备', 'bkb', NULL, '', '', '背靠背评价设备', 1, '2022-08-17 16:35:05', 1, '2022-08-17 16:35:05');
\ No newline at end of file
This diff is collapsed.
#!/bin/sh
RETVAL=$?
SHELL_NAME="deploy"
BASEDIR=$(dirname $0)
BASEDIR=$( (
cd "$BASEDIR"
pwd
))
LOCK_FILE="/tmp/deploy.lock"
# 时间变量
CDATE=$(date "+%Y-%m-%d")
CTIME=$(date "+%H:%M:%S")
PUBLISH_PATH="@profiles.publish.path@"
PROJECT_NAME="@project.artifactId@"
IP="@profiles.server.ip@"
PORT="@profiles.server.port@"
GATEWAY_PORT="@profiles.server.gatewayport@"
SHELL_LOG="${BASEDIR}/${SHELL_NAME}.log"
SERVICE_PATH="/usr/lib/systemd/system"
JAVA_HOME="/usr/local/java/jdk1.8"
NGINX_CONF_PATH="/etc/nginx/conf.d/"
NGINX_PORT="@profiles.nginx.port@"
NGINX_SERVER_PATH="@profiles.server.path@"
PROJECT_EXECPATH="${PUBLISH_PATH}/${PROJECT_NAME}"
PROJECT_UI_EXECPATH="${PUBLISH_PATH}/${PROJECT_NAME}-ui/dist"
PROJECT_FILENAME="${PROJECT_NAME}.tar.gz"
PROJECT_UI_FILENAME="${PROJECT_NAME}-ui.tar.gz"
PROJECT_SERVICE="${SERVICE_PATH}/${PROJECT_NAME}.service"
PROJECT_NGINX_CONF="${NGINX_CONF_PATH}/${PROJECT_NAME}.conf"
#加锁
shell_lock() {
touch ${LOCK_FILE}
}
#删除锁
shell_unlock() {
rm -f ${LOCK_FILE}
}
#写日志
writelog() {
LOGINFO=$1
echo "${CDATE} ${CTIME}: ${SHELL_NAME} : ${LOGINFO}" >>${SHELL_LOG}
echo ${LOGINFO}
}
#清理目标
clear_deploy() {
SERVICE=$1
EXECPATH=$2
#清理后台自启服务
rm -rf ${SERVICE}
#清理执行文件目录
rm -rf ${EXECPATH}
#清理nginx服务配置文件
rm -f ${NGINX_CONF_PATH}/${PROJECT_NAME}.conf
mkdir -p ${EXECPATH}
}
#清理ui
clear_ui_deploy() {
EXEC_UI_PATH=$1
rm -rf ${EXEC_UI_PATH}
mkdir -p ${EXEC_UI_PATH}
}
build_service() {
SERVICE=$1
EXECPATH=$2
echo "" >${SERVICE}
echo "[Unit]" >>${SERVICE}
echo "Description=${PROJECT_NAME}" >>${SERVICE}
echo "After=network.target" >>${SERVICE}
echo "" >>${SERVICE}
echo "[Service]" >>${SERVICE}
echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE}
echo "Type=forking" >>${SERVICE}
echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE}
echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE}
echo "PrivateTmp=true" >>${SERVICE}
echo "" >>${SERVICE}
echo "[Install]" >>${SERVICE}
echo "WantedBy=multi-user.target" >>${SERVICE}
writelog "${PROJECT_NAME}服务创建完成!"
}
build_nginx() {
echo "server{
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable \"MSIE [1-6]\.\";
listen ${NGINX_PORT};
server_name localhost;
location / {
root ${PROJECT_UI_EXECPATH};
index index.html index.htm;
}
location ${NGINX_SERVER_PATH}/ {
proxy_pass http://${IP}:${GATEWAY_PORT};
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
location /doc/ {
root ${PROJECT_EXECPATH};
index api.html;
}
location /file/fileupload/ {
alias /mortals/app/data/file/fileupload/;
autoindex on;
autoindex_exact_size off;
}
location /file/uploadfile/ {
alias /mortals/app/data/file/uploadfile/;
autoindex on;
autoindex_exact_size off;
}
location /file/preview/ {
alias /mortals/app/data/file/preview/;
autoindex on;
autoindex_exact_size off;
}
}
" >${PROJECT_NGINX_CONF}
}
#启动服务与nginx
start_service_and_nginx() {
writelog "${PROJECT_NAME}服务启动..."
systemctl enable ${PROJECT_NAME}
systemctl daemon-reload
systemctl stop ${PROJECT_NAME} && systemctl start ${PROJECT_NAME}
project_status=$(systemctl status "${PROJECT_NAME}"|grep Active |awk '{print $2}')
nginx -t
nginx -s reload
jcpid=$(ps -ef | grep -v "grep" | grep "${PROJECT_NAME} " | awk '{print $2}')
writelog "${PROJECT_NAME}服务启动,PID is ${jcpid} ,status:${project_status}"
}
#部署后台服务
project_deploy() {
writelog "${PROJECT_NAME}_deploy"
clear_deploy ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
writelog "${PROJECT_NAME}_clear_finish"
tar -zvxf ./${PROJECT_FILENAME} -C ${PUBLISH_PATH}
build_service ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
build_nginx
start_service_and_nginx
writelog "${PROJECT_NAME}_deploy_finish"
}
#部署前台服务
project_ui_deploy() {
writelog "${PROJECT_NAME}_ui_deploy"
clear_ui_deploy ${PROJECT_UI_EXECPATH}
tar -zvxf ./${PROJECT_UI_FILENAME} -C ${PUBLISH_PATH}
writelog "${PROJECT_NAME}_ui_deploy_finish"
}
#主函数
main() {
echo "后台服务部署"
project_deploy
echo "前端服务部署"
project_ui_deploy
exit ${RETVAL}
}
main $1
#! /bin/sh
PORT="17211"
BASEDIR=`dirname $0`
BASEDIR=`(cd "$BASEDIR"; pwd)`
PORT="@profiles.server.port@"
BASEDIR=$(dirname $0)
BASEDIR=$( (
cd "$BASEDIR"
pwd
))
PROJECT_NAME="@project.artifactId@"
MAIN_CLASS="$PROJECT_NAME";
MAIN_CLASS="$PROJECT_NAME"
if [ ! -n "$PORT" ]; then
echo $"Usage: $0 {port}"
exit $FAIL
fi
pid=`ps ax | grep -i "$MAIN_CLASS" | grep java | grep -v grep | awk '{print $1}'`
if [ -z "$pid" ] ; then
pid=$(ps ax | grep -i "$MAIN_CLASS" | grep java | grep -v grep | awk '{print $1}')
if [ -z "$pid" ]; then
echo "No Server running."
exit -1;
exit 1
fi
echo "stoping application $PROJECT_NAME......"
kill -9 ${pid}
kill -15 ${pid}
echo "Send shutdown request to Server $PROJECT_NAME OK"
......@@ -5,9 +5,9 @@ BASEDIR=`(cd "$BASEDIR"; pwd)`
PROJECT_NAME="@project.artifactId@";
MAIN_CLASS="$PROJECT_NAME-@project.version@.jar";
LOG_PATH="@profiles.log.path@/$PROJECT_NAME"
GC_PATH=$LOG_PATH/$PORT"-gc.log"
HS_ERR_PATH=$LOG_PATH/$PORT"-hs_err.log"
HEAP_DUMP_PATH=$LOG_PATH/$PORT"-heap_dump.hprof"
GC_PATH=$LOG_PATH/PROJECT_NAME"-gc.log"
HS_ERR_PATH=$LOG_PATH/PROJECT_NAME"-hs_err.log"
HEAP_DUMP_PATH=$LOG_PATH/PROJECT_NAME"-heap_dump.hprof"
TEMP_PATH=$LOG_PATH/temp/
SUCCESS=0
FAIL=9
......
#! /bin/sh
PORT="@profiles.server.port@"
BASEDIR=`dirname $0`
BASEDIR=`(cd "$BASEDIR"; pwd)`
PROJECT_NAME="@project.artifactId@"
MAIN_CLASS="$PROJECT_NAME";
if [ ! -n "$PORT" ]; then
echo $"Usage: $0 {port}"
exit $FAIL
fi
echo "stoping application $PROJECT_NAME......"
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME is not started or has been stopped!"
else
curl -X POST -i -u $SECURITY_USERNAME:$SECURITY_PASSWORD http://127.0.0.1:$PORT/xxx_manager/shutdown
for i in {1..60}
do
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME has been stopped!"
break
else
echo "stoping the application .. $i"
sleep 1
fi
done
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ $jcpid ]; then
[ -z $jcpid ] || kill -15 $jcpid
for i in {1..30}
do
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ -z $jcpid ]; then
echo "$PROJECT_NAME has been stopped!"
break
else
echo "stoping the application .. $i"
sleep 1
fi
done
fi
jcpid=`ps -ef | grep -v "grep" | grep "$MAIN_CLASS" | grep "app.port=$PORT" | sed -n '1P' | awk '{print $2}'`
if [ $jcpid ]; then
[ -z $jcpid ] || kill -9 $jcpid
[ $? -eq 0 ] && echo "Stop $PROJECT_NAME OK!" || echo "Stop $PROJECT_NAME Fail!"
fi
fi
......@@ -2,8 +2,8 @@ package com.mortals.xhx.base.framework.aspect;
import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.ILogService;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.framework.service.impl.FileLogServiceImpl;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.base.system.oper.service.OperLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -24,7 +24,7 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
@Autowired
private OperLogService operLogService;
@Autowired
private IMessageProduceService messageProduceService;
private MessageProducer messageProducer;
@Override
public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl,
......@@ -42,7 +42,7 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
operateLogPdu.setLogDate(logDate);
operateLogPdu.setContent(content);
operateLogPdu.setOperType(1);
messageProduceService.syncOperSend(operateLogPdu);
messageProducer.syncOperSend(operateLogPdu);
}
......@@ -54,32 +54,4 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
}
/*@Pointcut("execution(public * com.mortals.xhx..*Controller.*(..))")
public void accessLog() {
}
@Before("accessLog()")
public void doBefore(JoinPoint joinPoint) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
// url
log.info("ip[{}]url[{}]", request.getRemoteAddr(), request.getRequestURL());
// 参数第1和第2个参数为HttpServletRequest request, HttpServletResponse
// response
if (joinPoint.getArgs().length > 2) {
log.info("args={}", joinPoint.getArgs()[2]);
} else {
log.info("args={}", joinPoint.getArgs());
}
}
@AfterReturning(returning = "object", pointcut = "accessLog()")
public void doAfterReturning(Object object) {
if (null != object) {
log.info("response={}", object.toString());
}
}*/
}
package com.mortals.xhx.base.framework.config;
import com.mortals.xhx.base.framework.listener.DirectDynamicListener;
import com.mortals.xhx.base.framework.listener.RabbitLoggingErrorHandler;
import com.mortals.xhx.base.framework.listener.SimpleDynamicListener;
import com.mortals.xhx.base.system.message.MessageCallbackService;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.base.system.message.impl.MessageServiceImpl;
import org.checkerframework.checker.units.qual.A;
import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.rabbit.AsyncRabbitTemplate;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
......@@ -30,11 +29,11 @@ public class RabbitConfig {
@Autowired
private SimpleDynamicListener simpleDynamicListener;
@Autowired
private DirectDynamicListener directDynamicListener;
@Autowired
private RabbitLoggingErrorHandler rabbitLoggingErrorHandler;
@Autowired
private MessageProducer messageProducer;
@Autowired
private MessageCallbackService messageCallbackService;
//@Bean("simpleMessageListenerContainer")
public SimpleMessageListenerContainer simpleMessageListenerContainer(CachingConnectionFactory cachingConnectionFactory) {
......@@ -69,8 +68,8 @@ public class RabbitConfig {
@Bean
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
rabbitTemplate.setReturnCallback(messageProducer);
rabbitTemplate.setConfirmCallback(messageProducer);
rabbitTemplate.setReturnCallback(messageCallbackService);
rabbitTemplate.setConfirmCallback(messageCallbackService);
return rabbitTemplate;
}
......
......@@ -7,8 +7,6 @@ import org.redisson.api.RedissonClient;
import org.redisson.client.codec.Codec;
import org.redisson.codec.JsonJacksonCodec;
import org.redisson.config.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -19,8 +17,8 @@ import org.springframework.context.annotation.Configuration;
* @author: zxfei
* @date: 2022/8/8 16:02
*/
//@Configuration
//@ConfigurationProperties(prefix = "spring.redis")
@Configuration
@ConfigurationProperties(prefix = "spring.redis")
@Slf4j
@Data
public class RedissonConfig {
......@@ -33,12 +31,13 @@ public class RedissonConfig {
private int database;
//@Bean
@Bean
public RedissonClient redissonClient() {
RedissonClient redissonClient;
Config config = new Config();
String url = "redis://" + host + ":" + port;
// 单节点配置
if("".equalsIgnoreCase(password)) password=null;
config.useSingleServer().setAddress(url).setDatabase(database).setPassword(password);
//使用json序列化方式
Codec codec = new JsonJacksonCodec();
......
......@@ -8,6 +8,8 @@ import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.PlatformTypeEnum;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
......@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.Base64;
......@@ -58,6 +61,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
@Autowired
private UserService userService;
protected static final Long SECOND = 1l;
protected static final Long SECOND_MINUTE = 60 * SECOND;
......@@ -98,10 +104,14 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
} else {
userStr = cacheService.get(userKey);
}
if (StringUtils.isNotEmpty(userStr)) {
UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class);
userEntity.setToken(token);
//更新portal 中的id 为 device中的id
UserEntity temp = userService.selectOne(new UserQuery().loginName(userEntity.getLoginName()));
if(!ObjectUtils.isEmpty(temp)){
userEntity.setId(temp.getId());
}
return userEntity;
}
} catch (Exception e) {
......
......@@ -18,12 +18,9 @@ import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.queue.DefaultTbQueueMsg;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -62,7 +59,7 @@ public class DirectDynamicListener implements MessageListener {
String queue = message.getMessageProperties().getConsumerQueue();
byte[] body = message.getBody();
String data = new String(body);
log.info("接收到:{} ,\n消息内容为:{}", queue, data);
// log.info("接收到:{} ,\n消息内容为:{}", queue, data);
DefaultQueueMsg queueMsg = JSON.parseObject(data, DefaultQueueMsg.class);
//做相应业务,做日志操作
String deviceCode = queueMsg.getHeaders().getData().get(DEVICECODE);
......
package com.mortals.xhx.base.login.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.CookieService;
import com.mortals.framework.ap.GlobalSysInfo;
......@@ -155,6 +156,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
return JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT));
}
Set<String> urls = resourceService.findUrlSetByUserId(user.getId());
log.info("userId:{},urls:{}", user.getId(),JSON.toJSONString(urls));
List<MenuEntity> outlookBarList = menuService.findTreeMenu(user, urls);
String currUserName = user.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) {
......@@ -169,7 +171,8 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
data.put("id", user.getId());
data.put("userType", user.getUserType());
ret.put(KEY_RESULT_DATA, data);
//this.generateBlackCookie(request, response, user.getLoginName(), urls);
generateMenuUrlCode(urls);
// this.generateBlackCookie(request, response, user.getLoginName(), urls);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
ret.put("resources", urls);
......
......@@ -66,7 +66,6 @@ public class StandaloneLoginController extends BaseCRUDJsonBodyMappingController
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
String securityCode = loginForm.getSecurityCode();
String ip = super.getRequestIP(request);
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
......@@ -76,16 +75,7 @@ public class StandaloneLoginController extends BaseCRUDJsonBodyMappingController
UserEntity userEntity = null;
try {
loginForm.validate();
// boolean result = validCodeService.doCheckImageValidCode(request.getSession().getId(), ip, securityCode);
// if ("8888".equals(securityCode)) {
// result = true;
// }
// if (!result) {
// recordSysLog(request, userEntity, "登录验证码不正确或已过期!");
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
// ret.put(KEY_RESULT_MSG, "登录验证码不正确或已过期!");
// return ret.toJSONString();
// }
userEntity = userService.doLogin(loginName, password, ip);
userEntity.setLastLoginAddress(ip);
......
package com.mortals.xhx.base.system.message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
public interface MessageCallbackService extends RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback {
}
\ No newline at end of file
......@@ -9,7 +9,6 @@ import com.mortals.xhx.queue.TopicPartitionInfo;
public interface MessageService {
/**
* 发送消息
*
......
package com.mortals.xhx.base.system.message;
import com.mortals.xhx.busiz.req.DeviceReq;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.queue.TbQueueCallback;
import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TopicPartitionInfo;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
public interface RabbitMessageService extends RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback {
public interface RabbitMessageService {
/**
......
package com.mortals.xhx.base.system.message.impl;
import com.alibaba.fastjson.JSON;
import com.mortals.xhx.base.system.message.MessageCallbackService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class MessageCallbackServiceImpl implements MessageCallbackService {
@Override
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
log.info("returnedMessage,correlationData:{},ack:{},cause:{},routingKey:{}", JSON.toJSONString(correlationData), ack, cause);
}
@Override
public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
log.info("returnedMessage,replyCode:{},replyText:{},exchange:{},routingKey:{}", replyCode, replyText, exchange, routingKey);
}
}
\ No newline at end of file
......@@ -12,7 +12,6 @@ import com.mortals.xhx.common.key.QueueKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
......@@ -49,8 +48,9 @@ public class MessageProducer implements IMessageProduceService, RabbitMessageSer
@Override
public void syncOperSend(OperateLogPdu operLogPdu) {
log.info("send poerate log ==>{}",JSON.toJSONString(operLogPdu));
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, JSON.toJSONString(operLogPdu));
log.info("send poerate log ==>{}", JSON.toJSONString(operLogPdu));
String send = JSON.toJSONString(operLogPdu);
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, send);
}
@Override
......@@ -73,7 +73,6 @@ public class MessageProducer implements IMessageProduceService, RabbitMessageSer
);
log.debug("队列创建绑定成功,queue:{}", queue);
}
@Override
......@@ -81,17 +80,6 @@ public class MessageProducer implements IMessageProduceService, RabbitMessageSer
return rabbitAdmin.deleteQueue(queue);
}
@Override
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
}
@Override
public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
}
@Override
public void afterPropertiesSet() throws Exception {
System.out.println(111);
......
......@@ -167,19 +167,13 @@ public class MessageServiceImpl implements MessageService{
public static void main(String[] args) {
try {
throw new Exception("1213");
} catch (Exception e) {
e.printStackTrace();
String stacktrace = ExceptionUtil.stacktraceToString(e.fillInStackTrace());
JSONObject jsonObject = new JSONObject();
jsonObject.put("stacktrace", stacktrace);
System.out.println(JSON.toJSONString(jsonObject));
}
......
......@@ -24,7 +24,7 @@ import java.util.List;
*/
public interface ResourceDao extends ICRUDDao<ResourceEntity,Long> {
public List<ResourceEntity> getListByUserId(Long userId);
List<ResourceEntity> getListByUserId(Long userId);
List<ResourceEntity> getAll(int userType);
}
\ No newline at end of file
......@@ -31,7 +31,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return
* @throws AppException
*/
public List<ResourceEntity> findAllEnable() throws AppException;
List<ResourceEntity> findAllEnable() throws AppException;
/**
* 根据用户查询可用资源
......@@ -39,7 +39,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return
* @throws AppException
*/
public List<ResourceEntity> findListByUserId(Long userId) throws AppException;
List<ResourceEntity> findListByUserId(Long userId) throws AppException;
/**
* 查询用户可用资源
......@@ -47,7 +47,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return 字符串,多个以逗号分隔
* @throws AppException
*/
public String findUrlByUserId(Long userId) throws AppException;
String findUrlByUserId(Long userId) throws AppException;
/**
* 查询用户用资源集合
......@@ -55,7 +55,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return
* @throws AppException
*/
public Set<String> findUrlSetByUserId(Long userId) throws AppException;
Set<String> findUrlSetByUserId(Long userId) throws AppException;
/**
* 获取所有资源,不分页
......
......@@ -52,7 +52,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res
@Override
public Set<String> findUrlSetByUserId(Long userId) throws AppException {
Set<String> urls = new HashSet<String>();
Set<String> urls = new HashSet<>();
List<ResourceEntity> resList = this.findListByUserId(userId);
for (ResourceEntity res : resList) {
String url = res.getUrl();
......
package com.mortals.xhx.busiz.req;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.mortals.xhx.base.framework.CustomJsonDateDeserializer;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class TestReq implements Serializable {
/**
* 1:新增,2:修改,3:删除,4:激活,5:启用,6:停用
*/
private Integer receiveMethod;
// /**
// * 平台系统id
// */
// private Long platformId;
// /**
// * 平台系统编码
// */
// private String platformCode;
/**
* 产品id
*/
private Long productId;
/**
* 产品编码
*/
private String productCode;
/**
* 设备生产厂商ID
*/
private Long deviceFirmId;
/**
* 设备生产厂商名称
*/
private String deviceFirmname;
/**
* 设备名称
*/
private String deviceName;
/**
* 设备编码(暂定mac地址)
*/
private String deviceCode;
/**
* 设备Mac
*/
private String deviceMac;
/**
* 所属站点Id
*/
private Long siteId;
/**
* 所属站点编码
*/
private String siteCode;
/**
* 所属站点名称
*/
private String siteName;
/**
* 设备备注信息
*/
private String deviceRemark;
/**
* 设备
*/
private String homeUrl;
/**
* 设备访问ip
*/
private String ip;
/**
* 中心设备编码
*/
private String centernum;
/**
* 端口
*/
private String port;
/**
* 经度
*/
private String lon;
/**
* 纬度
*/
private String lati;
/**
* 楼层
*/
private Integer deviceInBuilding;
/**
* 所属楼栋
*/
private Integer deviceInFloor;
/**
* 负责人
*/
private String leadingOfficial;
/**
* 联系电话
*/
private String leadingOfficialTelephone;
/**
* 保修期至
*/
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
private Date defectsLiabilityPeriod;
/**
* 设备状态 (0.未激活,1.离线,2.在线)
*/
private Integer deviceStatus;
/**
* 设备来源(0.旧设备,1.新设备)
*/
private Integer source;
/**
* 激活(0.否,1.是)
*/
private Integer active;
/**
* 设备版本信息
*/
private String deviceVersion;
}
......@@ -33,6 +33,10 @@ public class ServerInfo implements Serializable {
* 前端对接平台接口地址
*/
private String serverUrl;
/**
* 事件服务器地址
*/
private String eventUrl;
}
package com.mortals.xhx.busiz.web;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.net.url.UrlBuilder;
import cn.hutool.core.util.IdUtil;
import cn.hutool.extra.servlet.ServletUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ILogService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.FileLogServiceImpl;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.framework.annotation.ApiUserAuth;
import com.mortals.xhx.base.login.web.LoginForm;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
......@@ -34,8 +28,6 @@ import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.common.pdu.DefaultQueueMsg;
import com.mortals.xhx.common.pdu.DefaultQueueMsgHeader;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.BeanUtil;
......@@ -49,7 +41,6 @@ import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.firm.model.FirmEntity;
import com.mortals.xhx.module.firm.service.FirmService;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.model.PlatformQuery;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.model.ProductQuery;
......@@ -62,14 +53,12 @@ import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.queue.DefaultTbQueueMsg;
import com.mortals.xhx.queue.TbQueueMsg;
import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TopicPartitionInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
......@@ -78,7 +67,6 @@ import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import static com.mortals.framework.ap.SysConstains.PROP_PLATFORM_MARK;
import static com.mortals.xhx.common.key.Constant.*;
import static com.mortals.xhx.common.key.ErrorCode.*;
import static com.mortals.xhx.common.key.RedisKey.KEY_TOKEN_API_CACHE;
......@@ -103,17 +91,17 @@ public class DeviceApiController {
private ProductVersionService productVersionService;
@Autowired
private PlatformService platformService;
@Value("${queue.rabbitmq.virtual_host:}")
@Value("${spring.rabbitmq.virtual-host:}")
private String virtualHost;
@Value("${queue.rabbitmq.password:}")
@Value("${spring.rabbitmq.password:}")
private String password;
@Value("${queue.rabbitmq.host:}")
@Value("${spring.rabbitmq.host:}")
private String host;
@Value("${queue.rabbitmq.port:}")
@Value("${spring.rabbitmq.port:0}")
private int port;
@Value("${queue.rabbitmq.username:}")
@Value("${spring.rabbitmq.username:}")
private String username;
@Value("${queue.rabbitmq.queue-properties.x-message-ttl:86400000}")
@Value("${spring.rabbitmq.queue-properties.x-message-ttl:86400000}")
private String messageTtl;
@Value("${token.secret}")
private String secret;
......@@ -457,8 +445,10 @@ public class DeviceApiController {
productVersionQuery.setOrderKind(OrderCol.DESCENDING);
ProductVersionEntity productVersionEntity = productVersionService.selectOne(productVersionQuery);
if (ObjectUtils.isEmpty(productVersionEntity))
if (ObjectUtils.isEmpty(productVersionEntity)){
throw new AppException(DEVICE_VERSION_UNEXIST, DEVICE_VERSION_UNEXIST_CONTENT);
}
ProductVersionInfo productVersionInfo = new ProductVersionInfo();
BeanUtils.copyProperties(productVersionEntity, productVersionInfo, BeanUtil.getNullPropertyNames(productVersionEntity));
......@@ -468,7 +458,6 @@ public class DeviceApiController {
deviceResp.setContent(content);
rsp.setData(deviceResp);
} catch (AppException e) {
log.error("接收数据失败", e);
rsp.setCode(e.getCode());
rsp.setMsg(e.getMessage());
return JSON.toJSONString(rsp);
......
package com.mortals.xhx.busiz.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ILogService;
import com.mortals.framework.service.impl.FileLogServiceImpl;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.req.TestReq;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.busiz.rsp.DeviceResp;
import com.mortals.xhx.common.code.ApiRespCodeEnum;
import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.device.service.DeviceLogService;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.firm.service.FirmService;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.module.product.service.ProductVersionService;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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;
/**
* 设备
*
* @author: zxfei
* @date: 2021/8/24 20:28
*/
@RestController
@Slf4j
@RequestMapping("/test")
public class TestSendMsgController {
@Autowired
private DeviceService deviceService;
@Autowired
private ProductService productService;
@Autowired
private UserService userService;
@Autowired
private ProductVersionService productVersionService;
@Autowired
private PlatformService platformService;
@Value("${spring..rabbitmq.virtual_host:}")
private String virtualHost;
@Value("${spring..rabbitmq.password:}")
private String password;
@Value("${spring..rabbitmq.host:}")
private String host;
@Value("${spring..rabbitmq.port:0}")
private int port;
@Value("${spring..rabbitmq.username:}")
private String username;
@Value("${spring..rabbitmq.queue-properties.x-message-ttl:86400000}")
private String messageTtl;
@Value("${token.secret}")
private String secret;
@Autowired
private SendTaskThreadPool sendTaskThreadPool;
@Autowired
private ISiteFeign siteFeign;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
@Autowired
private SiteService siteService;
@Autowired
private FirmService firmService;
@Autowired
private DeviceLogService deviceLogService;
@Autowired
private ICacheService cacheService;
@Autowired
private MessageProducer messageProducer;
@Autowired
protected ILogService logService = FileLogServiceImpl.getInstance();
/**
* 发送日志消息
*
* @param req
* @return
*/
@PostMapping("log")
public String register(@RequestBody TestReq req) {
log.info("【测试消息】【请求体】--> " + JSONObject.toJSONString(req));
ApiResp<DeviceResp> rsp = new ApiResp<>();
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
log.info("响应【设备注册】【响应体】--> " + JSONObject.toJSONString(rsp));
return JSON.toJSONString(rsp);
}
}
package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.xhx.daemon.netty.config.NettyServerConfig;
import com.mortals.xhx.daemon.netty.server.controlserver.ControlServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -40,7 +37,7 @@ public class NettyStartedService implements IApplicationStartedService {
@Override
public void stop() {
log.info("停止服务..");
log.info("netty停止服务..");
if (thread != null) {
thread.interrupt();
}
......
package com.mortals.xhx.daemon.applicationservice;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.xhx.base.framework.listener.SimpleDynamicListener;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.SendTask;
import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceLogEntity;
import com.mortals.xhx.module.device.service.DeviceLogService;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.queue.DefaultTbCoreConsumerService;
import com.mortals.xhx.queue.TbQueueConsumer;
import com.mortals.xhx.queue.TbQueueMsg;
import com.mortals.xhx.queue.TopicPartitionInfo;
import com.mortals.xhx.utils.IotThreadFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.mortals.xhx.common.model.MessageHeader.DEVICECODE;
import static com.mortals.xhx.common.model.MessageHeader.MESSAGETYPE;
//@Component
@Slf4j
......@@ -54,8 +26,6 @@ public class RabbitMsgComsumerStartedService implements IApplicationStartedServi
private PlatformService platformService;
@Autowired
private SimpleDynamicListener simpleDynamicListener;
@Autowired
private DirectMessageListenerContainer directMessageListenerContainer;
@Autowired
@Qualifier("simpleMessageListenerContainer")
......
package com.mortals.xhx.daemon.netty.server.controlserver;
import com.mortals.xhx.daemon.netty.config.NettyServerConfig;
import com.mortals.xhx.module.device.service.DeviceService;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
......@@ -14,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.net.Inet4Address;
@Component
......@@ -63,9 +61,9 @@ public class ControlServer {
@PreDestroy
public void release() {
isClosed = true;
closeChannel();
closeServerBootstrap();
isClosed = true;
}
/**
......
package com.mortals.xhx.daemon.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
......@@ -10,19 +8,10 @@ import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.SendStatusEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.common.utils.SendSmsTask;
import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.alarm.model.AlarmSmsSendEntity;
import com.mortals.xhx.module.alarm.model.AlarmSmsSendQuery;
import com.mortals.xhx.module.alarm.service.AlarmSmsSendService;
import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -56,31 +45,26 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
if (resp.getCode() == YesNoEnum.YES.getValue()) {
//同步更新用户,以loginname为唯一标识,密码默认与用户相同
resp.getData().getData().forEach(user -> {
log.info("loginName:{}", user.getLoginName());
UserEntity tempEntity = userService.selectOne(new UserQuery().loginName(user.getLoginName()));
if (ObjectUtils.isEmpty(tempEntity)) {
UserEntity userEntity = new UserEntity();
BeanUtils.copyProperties(user, userEntity, new String[]{"lastLoginTime", "lastLoginAddress"});
BeanUtils.copyProperties(user, userEntity, new String[]{"id","lastLoginTime", "lastLoginAddress"});
log.info("新增:{}", JSON.toJSONString(userEntity));
userService.getUserDao().insert(userEntity);
}else {
//更新基本信息
UserEntity userEntity = new UserEntity();
BeanUtils.copyProperties(user, userEntity, new String[]{"loginPwd","userType","status","lastLoginTime", "lastLoginAddress"});
log.info("更新:{}", JSON.toJSONString(userEntity));
userService.getUserDao().update(userEntity);
}
});
}
log.info("syncUserResp:{}", JSON.toJSONString(resp));
// return;
// UserPdu userPdu = new UserPdu();
// userPdu.setPage(1);
// userPdu.setSize(-1);
// String resp = userFeign.findAllUser(userPdu);
// log.info("resp:{}",resp);
// JSONObject jsonObject = JSONObject.parseObject(resp);
// if (jsonObject.getInteger("code") == 1) {
// List<UserPdu> userList = jsonObject.getJSONObject("data").getObject("data", new TypeReference<List<UserPdu>>() {
// });
//
// log.info("userList:{}", JSON.toJSONString(userList));
//
// }
// log.info("syncUserResp:{}", JSON.toJSONString(resp));
}
......
......@@ -170,8 +170,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
resp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
resp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
//messageProducer.sendMsg();
messageService.send(info, header, message, callback);
return resp;
}
......@@ -272,39 +270,11 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
super.saveAfter(entity, context);
}
/* private void registerRabbitQueue(DeviceEntity entity, PlatformEntity platformEntity, ProductEntity productEntity) {
String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.UPLOAD_TOPIC + entity.getDeviceCode()).build();
TbQueueCallback callback = new TbQueueCallback() {
@Override
public void onSuccess(TbQueueMsgMetadata metadata) {
log.debug("队列创建成功,设备编码:{}", entity.getDeviceCode());
}
@Override
public void onFailure(Throwable t) {
log.error("队列创建失败,设备通道编码:{},{}", entity.getDeviceCode(), t);
}
};
messageService.queueDeclare(info, callback);
//消费监听线程添加当前声明队列
Set<TopicPartitionInfo> partitions = new HashSet<>();
partitions.add(info);
consumerService.getMainConsumer().subscribe(partitions);
//创建下行队列
info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.DOWN_TOPIC + entity.getDeviceCode()).build();
messageService.queueDeclare(info, callback);
}*/
@Override
protected void updateAfter(DeviceEntity entity, Context context) throws AppException {
PlatformEntity platformEntity = platformService.get(entity.getPlatformId());
ProductEntity productEntity = productService.get(entity.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//新增设备通知第三方平台 激活后的设备才通知和更新
if (entity.getDeviceStatus() > 0) {
//注册rabbmit相关队列与绑定
......
......@@ -85,11 +85,11 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
this.addDict(model, "productId", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())));
this.addDict(model, "productCode", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductCode())));
this.addDict(model, "deviceFirmId", firmService.find(new FirmEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getFirmName())));
this.addDict(model, "deviceSrc", paramService.getParamBySecondOrganize("Device", "deviceSrc"));
this.addDict(model, "deviceDataSourceWay", paramService.getParamBySecondOrganize("Device", "deviceDataSourceWay"));
this.addDict(model, "isReceiveMess", paramService.getParamBySecondOrganize("Device", "isReceiveMess"));
this.addDict(model, "deviceSrc", DeviceSrcEnum.getEnumMap());
this.addDict(model, "deviceDataSourceWay", DeviceDataSourceWayEnum.getEnumMap());
this.addDict(model, "isReceiveMess", IsReceiveMessEnum.getEnumMap());
this.addDict(model, "deviceStatus", DeviceStatusEnum.getEnumMap());
this.addDict(model, "enabled", paramService.getParamBySecondOrganize("Device", "enabled"));
this.addDict(model, "enabled", EnabledEnum.getEnumMap());
this.addDict(model, "source", DeviceSourceEnum.getEnumMap());
//返回产品列表及其样式
//productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())).
......
......@@ -3,6 +3,7 @@ spring:
allow-bean-definition-overriding: true
application:
log:
level:@profiles.log.level@
level: @profiles.log.level@
path: @profiles.log.path@
......@@ -20,11 +20,6 @@ spring:
default-property-inclusion: NON_NULL
# time-zone: GMT+8
# date-format: yyyy-MM-dd HH:mm:ss
security:
enable: true
user:
name: admin
password: 1
redis:
host: @profiles.redis.uri@
port: @profiles.redis.port@
......@@ -58,7 +53,7 @@ spring:
username: @profiles.rabbitmq.username@
password: @profiles.rabbitmq.password@
exchange-name: @profiles.rabbitmq.exchange@
virtual-host: @profiles.rabbitmq.virtualhost1@
virtual-host: @profiles.rabbitmq.virtualhost@
publisher-returns: true
publisher-confirm-type: correlated
dao:
......@@ -98,44 +93,4 @@ sms:
apiId: @profiles.sms.apiId@
type: @profiles.sms.type@
queue:
type: @profiles.queue.type@ # memory or kafka (Apache Kafka) or rabbitmq (RabbitMQ)
core:
topic: tb_core
poll-interval: 25
partitions: 10
pack-processing-timeout: 2000
in_memory:
stats:
print-interval-ms: 60000
kafka:
bootstrap.servers: @profiles.kafka.brokers@
acks: all
retries: 1
batch.size: 16384
linger.ms: 1
buffer.memory: 33554432
replication_factor: 1
max_poll_interval_ms: 300000
max_poll_records: 8192
max_partition_fetch_bytes: 16777216
fetch_max_bytes: 134217728
use_confluent_cloud: false
consumer-stats:
enabled: true
print-interval-ms: 60000
kafka-response-timeout-ms: 1000
rabbitmq:
exchange_name: @profiles.rabbitmq.exchange@
host: @profiles.rabbitmq.host@
port: @profiles.rabbitmq.port@
virtual_host: @profiles.rabbitmq.virtualhost@
username: @profiles.rabbitmq.username@
password: @profiles.rabbitmq.password@
automatic_recovery_enabled: false
connection_timeout: 5000
handshake_timeout: 10000
queue-properties:
x-message-ttl: 86400000
x-max-length-bytes: 1048576000
......@@ -19,12 +19,12 @@
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
</encoder>
<file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log</file>
<file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 文件保存策略-->
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-info.log.%d{yyyyMMdd}</fileNamePattern>
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-info.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>15</MaxHistory>
<MaxHistory>7</MaxHistory>
</rollingPolicy>
</appender>
<!-- 异常文件输出策略-->
......@@ -35,11 +35,11 @@
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%X{traceId}] [%thread] [%.50c\(%L\)] - %msg%n</pattern>
</encoder>
<file>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log</file>
<file>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${serverPort:-default}-error.log.%d{yyyyMMdd}</fileNamePattern>
<fileNamePattern>${logFilePath}/${springApplicationName:-default}/${springApplicationName:-default}-error.log.%d{yyyyMMdd}</fileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>15</MaxHistory>
<MaxHistory>7</MaxHistory>
</rollingPolicy>
</appender>
......
###登录
POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"securityCode":"8888"
}
> {%
client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###人脸识别信息列表
POST {{baseUrl}}/face/list
Authorization: {{authToken}}
Content-Type: application/json
{
"page":1,
"size":10
}
###人脸识别信息更新与保存
POST {{baseUrl}}/face/save
Authorization: {{authToken}}
Content-Type: application/json
{
"placeName":"h4w1jo",
"placeId":"zituyj",
"idCard":"0"
}
> {%
client.global.set("Face_id", JSON.parse(response.body).data.id);
%}
###人脸识别信息查看
GET {{baseUrl}}/face/info?id={{Face_id}}
Authorization: {{authToken}}
Accept: application/json
###人脸识别信息编辑
GET {{baseUrl}}/face/edit?id={{Face_id}}
Authorization: {{authToken}}
Accept: application/json
###人脸识别信息删除
GET {{baseUrl}}/face/delete?id={{Face_id}}
Authorization: {{authToken}}
Accept: application/json
{
"local": {
"baseUrl": "http://127.0.0.1:18228/m",
"baseLogin": "http://127.0.0.1:18228/m"
"baseUrl": "http://127.0.0.1:17214/m",
"baseLogin": "http://127.0.0.1:18222/m"
},
"dev": {
"baseUrl": "http://192.168.0.217:18222/m",
......
package producer;//package producer;
import cn.hutool.core.util.IdUtil;
import com.mortals.framework.model.AccessLogPdu;
import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.model.ErrorLogPdu;
import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.ManagerApplication;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.Date;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ManagerApplication.class)
@Slf4j
public class ProducerTest {
@Autowired
private IMessageProduceService producer;
// private MessageProducer producer;
@Test
public void testSyncAccessSend() {
for (int i = 0; i < 50; i++) {
AccessLogPdu accessLogPdu = new AccessLogPdu();
accessLogPdu.initAttrValue();
accessLogPdu.setTraceID(IdUtil.fastSimpleUUID());
accessLogPdu.setLogTime(new Date());
producer.syncAccessSend(accessLogPdu);
log.info("[testSyncSend][发送编号:[{}] 发送成功]", accessLogPdu.getTraceID());
}
}
@Test
public void testSyncBizSend() {
for (int i = 0; i < 10; i++) {
BizLogPdu bizLogEntity = new BizLogPdu();
bizLogEntity.initAttrValue();
bizLogEntity.setTraceID(IdUtil.fastSimpleUUID());
bizLogEntity.setLogTime(new Date());
producer.syncBizSend(bizLogEntity);
log.info("[testSyncSend][发送编号:[{}] 发送成功]", bizLogEntity.getTraceID());
}
}
@Test
public void testSyncErrorSend() {
for (int i = 0; i < 10; i++) {
ErrorLogPdu errorLogPdu = new ErrorLogPdu();
errorLogPdu.initAttrValue();
errorLogPdu.setTraceID(IdUtil.fastSimpleUUID());
errorLogPdu.setLogTime(new Date());
producer.syncErrorSend(errorLogPdu);
log.info("[testSyncSend][发送编号:[{}] 发送成功]", errorLogPdu.getTraceID());
}
}
@Test
public void testSyncOperSend() {
for (int i = 0; i < 5; i++) {
OperateLogPdu operateLogPdu = new OperateLogPdu();
operateLogPdu.initAttrValue();
operateLogPdu.setIp("192.168.0.98");
operateLogPdu.setRequestUrl("requestUrl");
operateLogPdu.setUserId(1L);
operateLogPdu.setUserName("userName");
operateLogPdu.setLoginName("loginName");
operateLogPdu.setPlatformMark("platformMark");
operateLogPdu.setLogDate(new Date());
operateLogPdu.setContent("content");
operateLogPdu.setOperType(1);
producer.syncOperSend(operateLogPdu);
log.info("[testSyncOperSend][发送成功]");
}
}
}
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