Commit 5daf7c58 authored by 姬鋆屾's avatar 姬鋆屾
parents dc4dba71 39e6d56a
......@@ -95,6 +95,17 @@
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>4.8.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
</dependencies>
......
package com.mortals.xhx.common.keys;
/**
* rabbit 队列key定义
*/
public class QueueKey {
public static final String ACCESS_LOG_QUEUE = "ACCESS_LOG_QUEUE";
public static final String BIZ_LOG_QUEUE = "BIZ_LOG_QUEUE";
public static final String ERROR_LOG_QUEUE = "ERROR_LOG_QUEUE";
public static final String OPERATION_LOG_QUEUE = "OPERATION_LOG_QUEUE";
public static final String EXCHANGE = "LOG";
public static final String ROUTING_KEY = "LOG_ROUTING_KEY";
}
package com.mortals.xhx.system;
import com.alibaba.fastjson.JSON;
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.common.keys.QueueKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@Component
@Primary
@Slf4j
public class MessageProducer implements IMessageProduceService {
@Autowired
private RabbitTemplate rabbitTemplate;
public void syncAccessSend(AccessLogPdu accessLogPdu) {
//new Message(JSON.toJSONString(accessLogPdu).getBytes(StandardCharsets.UTF_8))
//rabbitTemplate.send(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE,new Message(JSON.toJSONString(accessLogPdu).getBytes(StandardCharsets.UTF_8)));
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, JSON.toJSONString(accessLogPdu));
//rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, accessLogPdu);
}
@Override
public void syncBizSend(BizLogPdu bizLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.BIZ_LOG_QUEUE, JSON.toJSONString(bizLogPdu));
}
@Override
public void syncErrorSend(ErrorLogPdu errorLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ERROR_LOG_QUEUE, JSON.toJSONString(errorLogPdu));
}
@Override
public void syncOperSend(OperateLogPdu operLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, JSON.toJSONString(operLogPdu));
}
}
......@@ -228,7 +228,7 @@ Content-Type: multipart/form-data
参数名称|类型|必填|描述
:---|:---|:---|:------
page|Integer|否|当前页
page|Integer|否|当前页
size|Integer|否|每页条数,值为-1,查询所有记录
**请求样例:**
......
......@@ -14,6 +14,9 @@ export default {
},
watch: {
'$route'(route) {
if(route.path=='/device/electron/list'||route.path=='/device/meet/list'){
this.changePath("device")
}
this.query = Object.assign({}, this.query, route.query);
this.getData();
}
......
......@@ -8,7 +8,7 @@
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
@row-click="handleRowClick"
height="560"
height="520"
:row-class-name="tableRowClassName"
:empty-text="emptyText"
border
......
......@@ -28,7 +28,6 @@ export default {
},
watch: {
'$route'(route) {
this.initPage(route.query);
}
},
......@@ -42,7 +41,13 @@ export default {
this.currSize = parseInt(query['size']) || this.prePageResult;
},
changeHash(key, val) {
console.log("$route:",this.$route)
let {path, query} = this.$route;
console.log("path",path)
// if(path=="/device/meet/list"||path=="/device/electron/list"){
// path="/device/list"
// }
this.$router.push({
path: path,
query: Object.assign({}, query, {[`${key}`]: val})
......
......@@ -253,7 +253,7 @@ export default {
}
});
this.form = Object.assign({}, this.form, newFormData);
this.form = Object.assign({}, this.form, data);
//this.form = Object.assign({}, this.form, data);
},
cleanForm() {
this.clean();
......
......@@ -68,6 +68,7 @@
</template>
<script>
<<<<<<< HEAD
/** 表单弹出框模式需引入 */
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
......@@ -121,6 +122,22 @@ export default {
"/device/exportExcel",
{
idList: this.selection,
=======
/** 表单弹出框模式需引入 */
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
export default {
name: "DeviceList",
components: {
drawerShow
},
mixins: [table],
created() {
console.log("route",this.$route)
this.changePath("/device")
console.log("this.pageInfo.list000",this.pageInfo.list)
this.query = Object.assign({}, this.query, {productCode:"dzmp"});
>>>>>>> 39e6d56acbefe19665a6d0358d3730be6122fa01
},
{ type: "excel" }
)
......
......@@ -68,6 +68,7 @@
</template>
<script>
<<<<<<< HEAD
/** 表单弹出框模式需引入 */
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
......@@ -121,6 +122,21 @@ export default {
"/device/exportExcel",
{
idList: this.selection,
=======
/** 表单弹出框模式需引入 */
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
export default {
name: "DeviceList",
components: {
drawerShow
},
mixins: [table],
created() {
console.log("route111",this.$route)
this.changePath("/device")
this.query = Object.assign({}, this.query, {productCode:"hysdzmp"});
>>>>>>> 39e6d56acbefe19665a6d0358d3730be6122fa01
},
{ type: "excel" }
)
......
......@@ -14,16 +14,40 @@
</el-form-item>
</el-col>
<!--<Field label="ID" prop="id" v-model="form.id" v-if='pageInfo.type !== "add"' disabled />-->
<Field label="名称" prop="name" v-model="form.name"/>
<Field label="权限类型" prop="authType" v-model="form.authType" :enumData='dict.authType' type='select' />
<Field label="名称" prop="name" v-model="form.name" />
<Field
label="权限类型"
prop="authType"
v-model="form.authType"
:enumData="dict.authType"
type="select"
/>
<Field label="访问地址" prop="url" v-model="form.url" />
<Field label="状态" prop="status" v-model="form.status" :enumData='dict.status' type='radio' />
<Field class="radio-group-container" label="图标" prop="imgPath" :span='24'>
<el-radio-group v-model="form.imgPath" class='form-el-radio-group'>
<el-radio-button style="width: 180px" label="">不需要图标</el-radio-button>
<el-radio-button style="width: 180px" v-for='(icon, index) in icons' :key='index' :label="icon">
<i :class="'el-icon-'+icon" style="font-size: 20px"></i>
{{icon}}
<Field
label="状态"
prop="status"
v-model="form.status"
:enumData="dict.status"
type="radio"
/>
<Field
class="radio-group-container"
label="图标"
prop="imgPath"
:span="24"
>
<el-radio-group v-model="form.imgPath" class="form-el-radio-group">
<el-radio-button style="width: 180px" label=""
>不需要图标</el-radio-button
>
<el-radio-button
style="width: 180px"
v-for="(icon, index) in icons"
:key="index"
:label="icon"
>
<i :class="'el-icon-' + icon" style="font-size: 20px"></i>
{{ icon }}
</el-radio-button>
</el-radio-group>
</Field>
......@@ -40,7 +64,7 @@
import form from "@/assets/mixins/formdialog";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import axios from 'axios'
import axios from "axios";
export default {
mixins: [form],
components: {
......@@ -48,16 +72,43 @@ export default {
},
data() {
return {
fileContent:"",
id:null,
fileContent: "",
id: null,
icons: [
'info', 'error', 'success', 'warning', 'question',
'tickets', 'document', 'goods', 'sold-out', 'news',
'message', 'date', 'printer', 'time', 'bell',
'mobile-phone', 'service', 'view', 'menu', 'star-on',
'location', 'phone', 'picture', 'delete', 'search',
'edit', 'rank', 'refresh', 'share', 'setting',
'upload', 'upload2', 'download', 'loading',
"info",
"error",
"success",
"warning",
"question",
"tickets",
"document",
"goods",
"sold-out",
"news",
"message",
"date",
"printer",
"time",
"bell",
"mobile-phone",
"service",
"view",
"menu",
"star-on",
"location",
"phone",
"picture",
"delete",
"search",
"edit",
"rank",
"refresh",
"share",
"setting",
"upload",
"upload2",
"download",
"loading",
],
menuOptions: [],
// 遮罩层
......@@ -66,44 +117,36 @@ export default {
title: "菜单信息",
// 是否显示弹出层
open: false,
toString:[
"status",
"linkType",
"commMenu",
"menuType",
"authType",
],
toString: ["status", "linkType", "commMenu", "menuType", "authType"],
// 表单校验
rules: {
}
rules: {},
};
},
created() {
axios.get('/icon.txt')
.then(response => {
this.fileContent = response.data
this.icons = this.fileContent.split('\n')
})
axios.get("/icon.txt").then((response) => {
this.fileContent = response.data;
this.icons = this.fileContent.split("\n");
});
},
methods: {
/** 编辑 */
edit(row, menuOptions) {
this.reset()
this.reset();
this.query = { id: row.id };
this.urls.currUrl =this.pageInfo.editUrl;;
this.urls.currUrl = this.pageInfo.editUrl;
this.getData();
this.menuOptions = menuOptions;
this.title = "修改菜单信息";
},
/** 新增 */
add(row, menuOptions) {
this.reset()
this.reset();
this.query = { id: row.id };
this.urls.currUrl = this.pageInfo.addUrl;
this.getData();
if(row.id){
this.id=row.id
this.form.parentId=row.id
if (row.id) {
this.id = row.id;
this.form.parentId = row.id;
}
this.menuOptions = menuOptions;
this.title = "新增菜单信息";
......@@ -111,7 +154,7 @@ export default {
/** 查看*/
view(row, menuOptions) {
this.query = { id: row.id };
this.urls.currUrl =this.pageInfo.viewUrl;;
this.urls.currUrl = this.pageInfo.viewUrl;
this.getData();
this.menuOptions = menuOptions;
this.title = "菜单信息详细";
......@@ -122,8 +165,8 @@ export default {
},
/**获取数据后弹框 */
afterRender(data) {
if(this.id){
this.form.parentId=this.id
if (this.id) {
this.form.parentId = this.id;
}
this.open = true;
},
......@@ -147,28 +190,27 @@ export default {
reset() {
this.resetForm("form");
this.form = {
name : "",
url : null,
ancestors : null,
parentId : null,
orderId : null,
status : 1,
linkType : 0,
groupId : 1,
groupName : null,
imgPath : null,
buttonImgPath : null,
imgCommPath : null,
commMenu : 0,
menuType : 0,
authType : 3,
createUserName : null,
name: "",
url: null,
ancestors: null,
parentId: null,
orderId: null,
status: 1,
linkType: 0,
groupId: 1,
groupName: null,
imgPath: null,
buttonImgPath: null,
imgCommPath: null,
commMenu: 0,
menuType: 0,
authType: 3,
createUserName: null,
};
},
resetForm(refName) {
if (this.$refs[refName]) {
console.log("重置表单")
console.log("重置表单");
this.$refs[refName].resetFields();
}
},
......@@ -196,10 +238,10 @@ export default {
box-shadow: none;
}
.el-radio-button__orig-radio:checked+.el-radio-button__inner {
.el-radio-button__orig-radio:checked + .el-radio-button__inner {
background: rgba(0, 0, 0, 0);
border: 1px solid #3E7BFA !important;
color: #3E7BFA;
border: 1px solid #3e7bfa !important;
color: #3e7bfa;
line-height: 14px;
outline: none;
box-shadow: none;
......
<template>
<div className="page">
<div
class="page"
style="padding: 0 !important;height: 81% !important; min-height: 81% !important;"
>
<el-card>
<LayoutTable
notPagination
......@@ -161,12 +164,20 @@ export default {
{
prop: "parentId",
label: "父ID",
<<<<<<< HEAD
formatter: (row) => (row.parentId ? row.parentId : "--"),
=======
width: 160,
>>>>>>> 39e6d56acbefe19665a6d0358d3730be6122fa01
},
{
prop: "url",
label: "地址",
<<<<<<< HEAD
formatter: (row) => (row.url ? row.url : "--"),
=======
width: 160,
>>>>>>> 39e6d56acbefe19665a6d0358d3730be6122fa01
},
{
prop: "status",
......
......@@ -210,6 +210,7 @@ export default {
{ type: "selection", width: 60 },
{ type: "index", label: "序号", width: 50 },
<<<<<<< HEAD
{
label: "照片",
prop: "photoPath",
......@@ -225,6 +226,75 @@ export default {
);
},
},
=======
},
data() {
return {
loginName:null,
newPwd:null,
// 用户导入参数
upload: {
// 是否显示弹出层(工作人员导入)
open: false,
// 弹出层标题(工作人员导入)
title: "导入工作人员数据",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的数据
updateSupport: 0,
// 上传的地址
url: "/office/workman/importData",
},
user: {
// 是否显示弹出层(工作人员导入)
open: false,
// 弹出层标题(工作人员导入)
title: "修改密码",
},
isExport: false,
config: {
search: [
{
name: "name",
type: "text",
label: "姓名",
fuzzy: true
},
{
name: "roomId",
type: "select",
label: "所属房间"
},
{
name: "workStatus",
type: "select",
label: "工作状态"
}
],
columns: [
{type: "selection", width: 60},
{type: "index",label: "序号",width: 50},
{width: 100,label: "照片", prop: "photoPath",formatter: (row) => {
return row.photoPath != "" ? (
<el-image
style="width: 70px; height: 100px"
src={row.photoPath}
preview-src-list={[row.photoPath]}
></el-image>
) : (
"--"
);
},},
{label: "姓名", prop: "name"},
{label: "所属部门", prop: "deptName"},
{label: "所属房间", prop: "roomName"},
{label: "职位", prop: "userPost"},
>>>>>>> 39e6d56acbefe19665a6d0358d3730be6122fa01
{
label: "姓名",
......
......@@ -47,6 +47,11 @@
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.rabbitmq.host>192.168.0.251</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.log.level>INFO</profiles.log.level>
<package.environment>test</package.environment>
......@@ -63,6 +68,11 @@
<profiles.nacos.server-addr>172.15.28.120:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.rabbitmq.host>172.15.28.115</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.log.level>info</profiles.log.level>
<profiles.publish.path>/home/publish</profiles.publish.path>
......
......@@ -4,6 +4,8 @@ import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.IMessageProduceService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
......@@ -35,14 +37,29 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
@Autowired
private OperLogService operLogService;
@Autowired
private IMessageProduceService messageProduceService;
@Override
public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl,
String content, String ip, Date logDate) {
super.doHandlerLog(platformMark, userId, userName, loginName, requestUrl, content, ip, logDate);
//用户id不为空才记录操作日志
if(ObjectUtils.isEmpty(userId)){
if (ObjectUtils.isEmpty(userId)) return;
operLogService.insertOperLog(ip, requestUrl, userId, userName, loginName, content);
}
OperateLogPdu operateLogPdu = new OperateLogPdu();
operateLogPdu.initAttrValue();
operateLogPdu.setIp(ip);
operateLogPdu.setRequestUrl(requestUrl);
operateLogPdu.setUserId(userId);
operateLogPdu.setUserName(userName);
operateLogPdu.setLoginName(loginName);
operateLogPdu.setPlatformMark(platformMark);
operateLogPdu.setLogDate(logDate);
operateLogPdu.setContent(content);
operateLogPdu.setOperType(1);
messageProduceService.syncOperSend(operateLogPdu);
}
@Override
......
......@@ -89,13 +89,14 @@ public class OperLogServiceImpl extends AbstractCRUDServiceImpl<OperLogDao,OperL
break;
case DELETE:
formatterLogContent(operLogEntity, content, id, operType);
case SEARCH:
formatterLogContent(operLogEntity, content, id, operType);
break;
default:
operLogEntity.setOperType(OperTypeEnum.UPDATE.getValue());
operLogEntity.setContent(StringUtils.isBlank(id) ? content : content + "id:" + id);
break;
}
super.save(operLogEntity, null);
}
......
package com.mortals.xhx.busiz.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
......@@ -11,6 +12,8 @@ import com.mortals.xhx.common.pdu.device.DeviceReq;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.room.model.RoomDeviceEntity;
import com.mortals.xhx.module.room.service.RoomDeviceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
......@@ -19,7 +22,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import static com.mortals.xhx.common.key.ErrorCode.*;
......@@ -30,6 +35,8 @@ public class DeviceCallbackController {
@Autowired
private DeviceService deviceService;
@Autowired
private RoomDeviceService roomDeviceService;
@PostMapping("callback")
@UnAuth
......@@ -59,6 +66,12 @@ public class DeviceCallbackController {
case STOP:
deviceStop(req);
break;
case ONLINE:
deviceOnline(req);
break;
case OFFLINE:
deviceOffline(req);
break;
}
} catch (Exception e) {
log.error("接收数据失败", e);
......@@ -105,7 +118,7 @@ public class DeviceCallbackController {
if (ObjectUtils.isEmpty(deviceEntity)) {
//不存在设备 则新增
this.deviceAdd(req);
}else{
} else {
log.info("设备更新~");
deviceEntity.setDeviceName(req.getDeviceName());
deviceEntity.setDeviceCode(req.getDeviceCode());
......@@ -135,6 +148,11 @@ public class DeviceCallbackController {
//根据设备编码查询设备
DeviceEntity deviceEntity = checkDeviceExist(req);
deviceService.remove(new Long[]{deviceEntity.getId()}, null);
//关联删除
RoomDeviceEntity condition = new RoomDeviceEntity();
condition.setDeviceId(deviceEntity.getId());
roomDeviceService.getDao().delete(condition);
}
......@@ -175,6 +193,29 @@ public class DeviceCallbackController {
deviceService.update(deviceEntity);
}
private void deviceOnline(DeviceReq req) throws AppException {
log.info("【设备上线】【请求体】--> " + JSONObject.toJSONString(req));
DeviceEntity deviceEntity = checkDeviceExist(req);
deviceEntity.setDeviceStatus(DeviceStatusEnum.在线.getValue());
deviceEntity.setUpdateTime(new Date());
deviceEntity.setUpdateUserId(1L);
deviceEntity.setUpdateTime(new Date());
deviceEntity.setUpdateUserId(1L);
deviceService.update(deviceEntity);
}
private void deviceOffline(DeviceReq req) throws AppException {
log.info("【设备离线】【请求体】--> " + JSONObject.toJSONString(req));
DeviceEntity deviceEntity = checkDeviceExist(req);
deviceEntity.setDeviceStatus(DeviceStatusEnum.离线.getValue());
deviceEntity.setUpdateTime(new Date());
deviceEntity.setUpdateUserId(1L);
deviceEntity.setUpdateTime(new Date());
deviceEntity.setUpdateUserId(1L);
deviceService.update(deviceEntity);
}
private DeviceEntity checkDeviceExist(DeviceReq req) {
if (ObjectUtils.isEmpty(req.getDeviceCode())) {
throw new AppException(DEVICE_CODE_IS_EMPTY, DEVICE_CODE_IS_EMPTY_CONTENT);
......
......@@ -11,6 +11,7 @@ public enum OperTypeEnum {
SAVE(0,"添加"),
UPDATE(1,"更新"),
DELETE(2,"删除"),
SEARCH(3,"查询"),
OTHER(-1,"其它");
private int value;
......
......@@ -10,7 +10,9 @@ import com.mortals.xhx.common.pdu.LoginForm;
import com.mortals.xhx.common.pdu.device.DeviceReq;
import com.mortals.xhx.feign.device.IDeviceFeign;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.room.model.RoomDeviceEntity;
import com.mortals.xhx.module.room.model.RoomQuery;
import com.mortals.xhx.module.room.service.RoomDeviceService;
import com.mortals.xhx.module.room.service.RoomService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
......@@ -51,6 +53,8 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
@Autowired
private RoomService roomService;
@Autowired
private RoomDeviceService roomDeviceService;
@Autowired
private IDeviceFeign deviceFeign;
......@@ -179,9 +183,11 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
deviceReq.setDeviceCode(entity.getDeviceCode());
Rest<String> rest = deviceFeign.deviceCall(deviceReq, token);
log.info("删除结果:{}", JSON.toJSONString(rest));
//关联删除
RoomDeviceEntity condition = new RoomDeviceEntity();
condition.setDeviceId(entity.getId());
roomDeviceService.getDao().delete(condition);
}
}
private String getToken() {
......
package com.mortals.xhx.module.room.service.impl;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.workman.model.WorkmanQuery;
import com.mortals.xhx.module.workman.service.WorkmanService;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -19,6 +22,7 @@ import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
......@@ -37,7 +41,20 @@ public class RoomServiceImpl extends AbstractCRUDServiceImpl<RoomDao, RoomEntity
private RoomDeviceService roomDeviceService;
@Autowired
private DeviceService deviceService;
@Autowired
private WorkmanService workmanService;
@Override
protected void findAfter(RoomEntity params, PageInfo pageInfo, Context context, List<RoomEntity> list) throws AppException {
super.findAfter(params, pageInfo, context, list);
Map<Long, Long> collect = workmanService.find(new WorkmanQuery()).stream().collect(Collectors.groupingBy(x -> x.getRoomId(), Collectors.counting()));
list.forEach(item->{
item.setCountPerson(collect.getOrDefault(item.getId(),item.getCountPerson()));
});
}
@Override
protected void saveAfter(RoomEntity entity, Context context) throws AppException {
......
......@@ -121,6 +121,11 @@ public class WorkmanServiceImpl extends AbstractCRUDServiceImpl<WorkmanDao, Work
uploadDeviceReq.setAction("refreshWorkman");
log.info("downMsg:{}", JSON.toJSONString(uploadDeviceReq));
messageFeign.downMsg(uploadDeviceReq);
RoomQuery roomQuery = new RoomQuery();
roomQuery.setId(roomEntity.getId());
roomQuery.setCountPersonIncrement(-1L);
roomService.update(roomQuery,context);
}
});
......
......@@ -21,6 +21,12 @@ spring:
default-property-inclusion: NON_NULL
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
rabbitmq:
host: @profiles.rabbitmq.host@
port: @profiles.rabbitmq.port@
username: @profiles.rabbitmq.username@
password: @profiles.rabbitmq.password@
virtualHost: @profiles.rabbitmq.virtualhost@
dao:
exceptiontranslation:
enabled: false
......
......@@ -64,13 +64,11 @@ client.global.set("Device_id", JSON.parse(response.body).data.id);
%}
###设备管理查看
GET {{baseUrl}}/device/info?id={{Device_id}}
Authorization: {{authToken}}
GET {{baseUrl}}/device/info?id=17
Accept: application/json
###设备管理编辑
GET {{baseUrl}}/device/edit?id={{Device_id}}
Authorization: {{authToken}}
GET {{baseUrl}}/device/edit?id=17
Accept: application/json
......
......@@ -19,8 +19,7 @@ Content-Type: application/json
{
"page":1,
"size":-1,
"deviceCode":"11-22-33-44"
"size":-1
}
......@@ -30,16 +29,16 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"meetName":"he54lk",
"meetDate":"1684684800000",
"meetTimeStart":"1684684800000",
"meetTimeEnd":"1684684800000",
"meetName":"he54lk1",
"meetDate":"2023-06-02 15:30:00",
"meetTimeStart":"2023-06-02 15:30:00",
"meetTimeEnd":"2023-06-02 15:30:00",
"roomId":101,
"roomName":"7o0iut",
"meetDeptName":"k6be71",
"meetStatus":0,
"finishMethod":0,
"remark":"lk9hlk",
"remark":"lk9hlk"
}
> {%
......@@ -47,9 +46,7 @@ client.global.set("MettingRecord_id", JSON.parse(response.body).data.id);
%}
###会议记录查看
GET {{baseUrl}}/metting/record/info?id={{MettingRecord_id}}
Authorization: {{authToken}}
Accept: application/json
GET {{baseUrl}}/metting/record/info?id=12
###会议记录编辑
GET {{baseUrl}}/metting/record/edit?id={{MettingRecord_id}}
......@@ -58,7 +55,7 @@ Accept: application/json
###会议记录删除
GET {{baseUrl}}/metting/record/delete?id={{MettingRecord_id}}
GET {{baseUrl}}/metting/record/delete?id=12
Authorization: {{authToken}}
Accept: application/json
......
......@@ -19,8 +19,7 @@ Content-Type: application/json
{
"page":1,
"size":1,
"deviceCode":"0E-B7-8C-0F-6E-9B"
"size":1
}
......@@ -44,7 +43,7 @@ client.global.set("Room_id", JSON.parse(response.body).data.id);
%}
###房间管理查看
GET {{baseUrl}}/room/info?id={{Room_id}}
GET {{baseUrl}}/room/info?id=4
Authorization: {{authToken}}
Accept: application/json
......
POST http://192.168.0.252:18001/sm/file/commonupload
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="file.txt"
< F://user.xlsx
--WebAppBoundary--
###
###登录
POST {{baseUrl}}/login/login
......
......@@ -20,7 +20,7 @@ Content-Type: application/json
{
"page":1,
"size":-1,
"deviceCode":"24-4C-B8-3D-56-B3"
"deviceCode":"a0-9f-10-5a-e0-10"
}
......@@ -48,8 +48,7 @@ client.global.set("Workman_id", JSON.parse(response.body).data.id);
%}
###工作人员查看
GET {{baseUrl}}/workman/info?id={{Workman_id}}
Authorization: {{authToken}}
GET {{baseUrl}}/workman/info?id=1
Accept: application/json
###工作人员编辑
......
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