Commit fca720f0 authored by “yiyousong”'s avatar “yiyousong”
parents 63ceb4f4 5204032c
package com.mortals.xhx.common.pdu.site;
import java.util.Date;
import java.util.List;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
/**
* 站点大厅信息Pdu对象
*
* @author zxfei
* @date 2023-04-26
*/
@Data
public class SiteHallPdu extends BaseEntityLong {
private static final long serialVersionUID = 1L;
/**
* 站点ID
*/
private Long siteId;
/**
* 站点名称
*/
private String siteName;
/**
* 大厅名称
*/
private String hallName;
/**
* 地址
*/
private String address;
/**
* 楼层
*/
private Integer floor;
/**
* 楼栋
*/
private Integer build;
/**
* 备注
*/
private String remark;
public void initAttrValue(){
this.siteId = null;
this.siteName = "";
this.hallName = "";
this.address = "";
this.floor = 1;
this.build = 1;
this.remark = "";
}
}
\ No newline at end of file
package com.mortals.xhx.feign.site;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SiteHallPdu;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 站点大厅信息 Feign接口
*
* @author zxfei
* @date 2023-04-26
*/
@FeignClient(name = "base-manager", path = "/base", fallbackFactory = SiteHallFeignFallbackFactory.class)
public interface ISiteHallFeign extends IFeign {
/**
* 查看站点大厅信息列表
*
* @param siteHallPdu
* @return
*/
@PostMapping(value = "/site/hall/list")
Rest<RespData<List<SiteHallPdu>>> list(@RequestBody SiteHallPdu siteHallPdu);
/**
* 查看站点大厅信息
*
* @param id
* @return
*/
@GetMapping(value = "/site/hall/info")
Rest<SiteHallPdu> info(@RequestParam(value = "id") Long id);
/**
* 删除站点大厅信息
*
* @param ids
* @return
*/
@GetMapping(value = "/site/hall/delete")
Rest<Void> delete(Long[] ids, @RequestHeader("Authorization") String authorization);
/**
* 站点大厅信息保存更新
*
* @param siteHallPdu
* @return
*/
@PostMapping(value = "/site/hall/save")
Rest<RespData<SiteHallPdu>> save(@RequestBody SiteHallPdu siteHallPdu, @RequestHeader("Authorization") String authorization);
}
@Slf4j
@Component
class SiteHallFeignFallbackFactory implements FallbackFactory<ISiteHallFeign> {
@Override
public ISiteHallFeign create(Throwable t) {
return new ISiteHallFeign() {
@Override
public Rest<RespData<List<SiteHallPdu>>> list(SiteHallPdu siteHallPdu) {
return Rest.fail("暂时无法获取站点大厅信息列表,请稍后再试!");
}
@Override
public Rest<SiteHallPdu> info(Long id) {
return Rest.fail("暂时无法获取站点大厅信息详细,请稍后再试!");
}
@Override
public Rest<Void> delete(Long[] ids, String authorization) {
return Rest.fail("暂时无法删除站点大厅信息,请稍后再试!");
}
@Override
public Rest<RespData<SiteHallPdu>> save(SiteHallPdu siteHallPdu, String authorization) {
return Rest.fail("暂时无法保存站点大厅信息,请稍后再试!");
}
};
}
}
...@@ -23,9 +23,6 @@ export default { ...@@ -23,9 +23,6 @@ export default {
clearTimeout(this.loadingTimer); clearTimeout(this.loadingTimer);
}, },
methods: { methods: {
test() {
console.log("test")
},
// 开启、关闭 // 开启、关闭
changePath(path) { changePath(path) {
this.pageInfo.list = path + "/list"; this.pageInfo.list = path + "/list";
...@@ -376,6 +373,7 @@ export default { ...@@ -376,6 +373,7 @@ export default {
toString: [], toString: [],
defaultConfig: { defaultConfig: {
search: [], // 头部搜索配置 search: [], // 头部搜索配置
tableName:"table",
columns: [], // 表格列信息配置 columns: [], // 表格列信息配置
addQuery: {}, // 新增按钮携带的参数 addQuery: {}, // 新增按钮携带的参数
buttons: [], // 增加查询区域自定义操作按钮,格式:[{label:'按钮显示名称',isShow:是否显示true/false,loading:true/false,type:'类型',icon:'图标',method:function(){}}] buttons: [], // 增加查询区域自定义操作按钮,格式:[{label:'按钮显示名称',isShow:是否显示true/false,loading:true/false,type:'类型',icon:'图标',method:function(){}}]
......
<template> <template>
<el-table <el-table
size='small' size='small'
:ref="tableName"
:data="tableData" :data="tableData"
:row-key="handleRowKeyMethod" :row-key="handleRowKeyMethod"
:span-method="handleSpanMethod" :span-method="handleSpanMethod"
...@@ -69,6 +70,11 @@ export default { ...@@ -69,6 +70,11 @@ export default {
required: false, required: false,
default: () => {} default: () => {}
}, },
toggleRowSelection: {
type: Function,
required: false,
default: () => {}
},
handleSelectionChange: { handleSelectionChange: {
type: Function, type: Function,
required: false, required: false,
...@@ -103,6 +109,11 @@ export default { ...@@ -103,6 +109,11 @@ export default {
type: Array, type: Array,
required: false, required: false,
default: ()=> [], default: ()=> [],
},
tableName: {
type: String,
required: false,
default: "table",
} }
}, },
computed: { computed: {
......
...@@ -156,6 +156,7 @@ ...@@ -156,6 +156,7 @@
v-if="showType == 'table'" v-if="showType == 'table'"
:tableData="data.data" :tableData="data.data"
:columns="config.columns" :columns="config.columns"
:tableName="config.tableName"
:loading="data.loading" :loading="data.loading"
:tableRowClassName="config.methods.tableRowClassName" :tableRowClassName="config.methods.tableRowClassName"
:handleSpanMethod="config.methods.handleSpanMethod" :handleSpanMethod="config.methods.handleSpanMethod"
......
// 管理后台通用表格,含:搜索,分页,表格
<template>
<div class="layout-table" :loading='data.loading'>
<div class="table-head flex flex-pack-justify">
<div class="table-head-left flex flex-align-center">
<slot name='breadcrumb'>
<Breadcrumb />
</slot>
<div class="buttons">
<slot name='table-head-left'></slot>
<slot name='table-head-center'>
<el-button v-if='isShowButton("notAdd")' type='primary' icon="el-icon-plus" size='mini' @click='config.methods.add' title="新增"></el-button>
<el-button v-if='isShowBtn("import")' size='mini' @click='config.methods.importView' class="el-icon-upload2" title="导入"></el-button>
<Confirm v-if='isShowButton("notDel")' @confirm='config.methods.del' message='确定要删除选中的多条记录吗?'>
<el-button icon="el-icon-delete" type="danger" size='mini' title="删除"></el-button>
</Confirm>
<el-button @click='item.method' size='mini' :key="item.label" :icon='item.icon' :type ='item.type' :loading="item.loading" v-if="item.isShow" v-for='(item) in config.buttons' circle :title="item.label"></el-button>
<el-button v-if='isShowBtn("back")' @click='config.methods.back' size='mini' icon='el-icon-back' circle title="返回"></el-button>
</slot>
<slot name='table-head-left2'></slot>
</div>
</div>
<div class="table-head-right">
<div class="extend flex flex-pack-justify">
<slot name='table-head-right'></slot>
<div>
<el-tooltip content="查询" placement="top" v-if='isShowButton("notSearch")'>
<el-button icon="el-icon-search" circle size='mini' @click='showSearch = !showSearch'></el-button>
</el-tooltip>
<el-tooltip content="刷新" placement="top" v-if='isShowButton("notFresh")'>
<el-button icon="el-icon-refresh" circle size='mini' @click='config.methods.refresh'></el-button>
</el-tooltip>
</div>
<el-radio-group v-model="showType" size='mini' v-if='isMobile'>
<el-radio-button label="card"><i class="el-icon-menu"></i></el-radio-button>
<el-radio-button label="table"><i class="el-icon-tickets"></i></el-radio-button>
<el-radio-button label="treetable"><i class="el-icon-tickets"></i></el-radio-button>
</el-radio-group>
<slot name='table-head-right2'></slot>
</div>
</div>
</div>
<!-- 表格查询条件-->
<div class="table-form" v-if='!isShowButton("notSearch") ? false : showSearch'>
<slot name="table-search-left"></slot>
<SearchForm :search='config.search' :table='data'
:downloadUrl='config.downloadUrl'
:areaSelect='config.areaSelect'
/>
</div>
<!-- 表格主体 -->
<div class="table-body">
<slot name='table-body-head'></slot>
<slot>
<DataTableMobile
v-if='showType == "card"'
:tableData='data.data'
:columns='config.columns'
:tableRowClassName='config.methods.tableRowClassName'
:handleSelectionChange='config.methods.handleSelectionChange'
:handleRowClick='config.methods.handleRowClick'/>
<DataTable
v-if='showType == "table"'
:tableData='data.data'
:columns='config.columns'
:loading='data.loading'
:tableRowClassName='config.methods.tableRowClassName'
:handleSpanMethod='config.methods.handleSpanMethod'
:handleSortChange='config.methods.handleSortChange'
:handleSelectionChange='config.methods.handleSelectionChange'
:handleRowClick='config.methods.handleRowClick'/>
<DataTableFlow
v-if='showType == "tableFlow"'
:tableData='data.data'
:columns='config.columns'
:dict='data.dict'
:loading='data.loading'
:tableRowClassName='config.methods.tableRowClassName'
:handleSpanMethod='config.methods.handleSpanMethod'
:handleSortChange='config.methods.handleSortChange'
:handleSelectionChange='config.methods.handleSelectionChange'
:handleRowClick='config.methods.handleRowClick'/>
<DataTreeTable
v-if='showType == "treetable"'
:tableData='data.data'
:columns='config.columns'
:loading='data.loading'
:expand='config.expand'
:tableRowClassName='config.methods.tableRowClassName'
:handleSpanMethod='config.methods.handleSpanMethod'
:handleSortChange='config.methods.handleSortChange'
:handleSelectionChange='config.methods.handleSelectionChange'
:handleRowClick='config.methods.handleRowClick'/>
</slot>
</div>
<!-- 分页器 -->
<div class="table-foot" v-if='!isShowButton("notPagination") ? false : data.pageInfo.totalResult'>
<Pagination :total='data.pageInfo.totalResult' :prePageResult='data.pageInfo.prePageResult'/>
</div>
</div>
</template>
<script>
import Pagination from '@/components/Pagination.vue';
import SearchForm from '@/components/SearchForm.vue';
import Confirm from '@/components/Confirm.vue';
import DataTable from '@/components/DataTable.vue';
import DataTableMobile from './DataTableMobile.js';
import DataTableFlow from './DataTableFlow.vue';
import DataTreeTable from '@/components/DataTreeTable.vue';
export default {
props: {
data: {
type: Object,
required: true,
default: () => {}
},
config: {
type: Object,
required: true,
default: () => {}
}
},
components: {
SearchForm,
Pagination,
Confirm,
DataTable,
DataTableMobile,
DataTableFlow,
DataTreeTable
},
methods: {
// 根据url的query参数判断是否展示查询条件
isShowSearch(query) {
if (!this.config.showSearch) {
return false
}
let showSearch = false;
Object.keys(query).forEach(item=>{
if(/^query\./.test(item)){
showSearch = true;
return;
}
});
if (this.config.showSearch) {
showSearch = true;
}
return showSearch;
},
isShowButton(name) {
return this.canShow.indexOf(name) === -1;
},
isShowBtn(name) {
return this.canShow.indexOf(name) !== -1;
},
},
watch: {
'$route'(route) {
this.showSearch = this.isShowSearch(route.query)
},
},
computed: {
isMobile() {
return this.$store.state.isMobile
},
canShow() {
this.showType=this.config.showType?this.config.showType:'table'
return Object.keys(this.$attrs) || [];
}
},
data() {
return {
loading: this.config.loading,
showSearch: this.isShowSearch(this.$route.query),
showType: 'table',
}
}
}
</script>
<style lang="less">
@media screen and (max-width: 800px){
.layout-table{
.table-head{
display: block;
width: 100%;
.el-button{
margin-bottom: 5px;
}
.table-head-left{
margin-bottom: 10px;
display: block;
width: 100%;
}
.el-breadcrumb{
margin-bottom: 10px;
display: block;
width: 100%;
}
}
}
}
.layout-table{
.table-head{
margin-bottom: 10px;
padding-bottom: 12px;
border-bottom: 1px solid #ededed;
.el-breadcrumb{
margin-right: 30px;
}
.table-head-left .buttons{
button + button{ margin-left: 10px}
button + span{ margin-left: 10px}
span + span{ margin-left: 10px}
span + button{ margin-left: 10px}
}
}
.table-form{
padding-top: 10px;
margin-top: 10px;
overflow: hidden;
}
.search-form-wapper{
float: left;
}
.table-foot{
width: 100%;
overflow: auto;
}
&[loading]{
pointer-events: none;
.my-compontent-switch span,
.el-button,
.el-input,
.el-tag,
input{
background: #eee;
color: transparent;
border-color: #eee;
}
input{color: #ccc}
td, th{
color: #eee;
}
.el-pagination{
color: #eee;
span, input, button, li{
color: #eee;
}
}
}
}
</style>
\ No newline at end of file
...@@ -119,6 +119,14 @@ export default { ...@@ -119,6 +119,14 @@ export default {
// toView(row) { // toView(row) {
// this.$refs.dialogform.view(row); // this.$refs.dialogform.view(row);
// }, // },
handAdd(row){
this.$router.push({
path: this.pageInfo.add,
query: {},
})
}
}, },
data() { data() {
return { return {
......
...@@ -20,3 +20,11 @@ ALTER TABLE mortals_xhx_device ADD COLUMN `deviceVersion` varchar (64) COMME ...@@ -20,3 +20,11 @@ ALTER TABLE mortals_xhx_device ADD COLUMN `deviceVersion` varchar (64) COMME
2023-02-2 2023-02-2
-- ---------------------------- -- ----------------------------
ALTER TABLE mortals_xhx_device ADD COLUMN `productCode` varchar (64) default '' COMMENT '产品编码' AFTER productId; ALTER TABLE mortals_xhx_device ADD COLUMN `productCode` varchar (64) default '' COMMENT '产品编码' AFTER productId;
-- ----------------------------
2023-04-26
-- ----------------------------
ALTER TABLE mortals_xhx_device ADD COLUMN `hallId` bigint(20) COMMENT '大厅Id' AFTER skinName;
ALTER TABLE mortals_xhx_device ADD COLUMN `hallName` varchar(256) default '' COMMENT '大厅名称' AFTER hallId;
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<profiles.active>develop</profiles.active> <profiles.active>develop</profiles.active>
<profiles.server.port>18222</profiles.server.port> <profiles.server.port>18222</profiles.server.port>
<!-- <profiles.platform.type>standalone</profiles.platform.type>--> <!-- <profiles.platform.type>standalone</profiles.platform.type>-->
<profiles.platform.type>cloud</profiles.platform.type> <profiles.platform.type>standalone</profiles.platform.type>
<profiles.datasource.uri> <profiles.datasource.uri>
<![CDATA[jdbc:mysql://192.168.0.98:3306/device-new-platform?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri> <![CDATA[jdbc:mysql://192.168.0.98:3306/device-new-platform?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username> <profiles.datasource.username>root</profiles.datasource.username>
......
...@@ -603,7 +603,7 @@ public class DeviceApiController { ...@@ -603,7 +603,7 @@ public class DeviceApiController {
@PostMapping("callbackByProduct") @PostMapping("callbackByProduct")
@UnAuth @UnAuth
public String callbackByProduct(@RequestBody DeviceMsgReq deviceMsgReq) { public String callbackByProduct(@RequestBody DeviceMsgReq deviceMsgReq) {
log.info("【设备数据消息接收】【请求体】--> " + JSONObject.toJSONString(deviceMsgReq)); log.info("【设备产品数据消息接收】【请求体】--> " + JSONObject.toJSONString(deviceMsgReq));
ApiResp<String> rsp = new ApiResp<>(); ApiResp<String> rsp = new ApiResp<>();
rsp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel()); rsp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue()); rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
......
...@@ -85,37 +85,6 @@ public class DownMsgTask implements Runnable { ...@@ -85,37 +85,6 @@ public class DownMsgTask implements Runnable {
TimeUnit.SECONDS.sleep(1); TimeUnit.SECONDS.sleep(1);
} }
/*
list.stream().sorted(Comparator.comparing(DeviceMsgReq::getTimestamp)).forEach(item -> {
//根据设备编码查询设备
DeviceEntity deviceEntity = deviceService.getExtCache(item.getDeviceCode());
if (!ObjectUtils.isEmpty(deviceEntity)) {
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
header.put(MessageHeader.MESSAGETYPE, item.getMessageType());
header.put(MessageHeader.DEVICECODE, item.getDeviceCode());
header.put(MessageHeader.TIMESTAMP, item.getTimestamp().toString());
TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastUUID(), item.getData(), header);
messageProducer.sendMsg(QueueKey.DEFAULT_EXCHANGE,Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(),JSON.toJSONString(queueMsg));
DeviceLogEntity deviceLogEntity = new DeviceLogEntity();
deviceLogEntity.initAttrValue();
deviceLogEntity.setTraceID(IdUtil.fastSimpleUUID());
deviceLogEntity.setSiteId(deviceEntity.getSiteId());
deviceLogEntity.setDeviceId(deviceEntity.getId());
deviceLogEntity.setDeviceName(deviceEntity.getDeviceName());
deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode());
deviceLogEntity.setMessageHead(item.getMessageType());
deviceLogEntity.setContent(item.getData());
deviceLogEntity.setLogType(LogTypeEnum.下发服务.getValue());
deviceLogEntity.setCreateUserId(1L);
deviceLogEntity.setCreateTime(new Date());
deviceLogService.save(deviceLogEntity,null);
} else {
log.info("未找到设备,deviceCode:{}", item.getDeviceCode());
}
});*/
} catch (Exception e) { } catch (Exception e) {
log.error("异常:", e); log.error("异常:", e);
} }
......
package com.mortals.xhx.module.device.model; package com.mortals.xhx.module.device.model;
import java.util.Date;
import java.util.List; import java.util.List;
import com.mortals.xhx.module.device.model.DeviceEntity;
/** /**
* 设备查询对象 * 设备查询对象
* *
* @author zxfei * @author zxfei
* @date 2023-02-25 * @date 2023-04-26
*/ */
public class DeviceQuery extends DeviceEntity { public class DeviceQuery extends DeviceEntity {
/** 开始 主键ID,主键,自增长 */ /** 开始 主键ID,主键,自增长 */
...@@ -413,6 +415,26 @@ public class DeviceQuery extends DeviceEntity { ...@@ -413,6 +415,26 @@ public class DeviceQuery extends DeviceEntity {
/** 产品编码排除列表 */ /** 产品编码排除列表 */
private List <String> productCodeNotList; private List <String> productCodeNotList;
/** 开始 大厅Id */
private Long hallIdStart;
/** 结束 大厅Id */
private Long hallIdEnd;
/** 增加 大厅Id */
private Long hallIdIncrement;
/** 大厅Id列表 */
private List <Long> hallIdList;
/** 大厅Id排除列表 */
private List <Long> hallIdNotList;
/** 大厅名称 */
private List<String> hallNameList;
/** 大厅名称排除列表 */
private List <String> hallNameNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<DeviceQuery> orConditionList; private List<DeviceQuery> orConditionList;
...@@ -2726,6 +2748,119 @@ public class DeviceQuery extends DeviceEntity { ...@@ -2726,6 +2748,119 @@ public class DeviceQuery extends DeviceEntity {
this.productCodeNotList = productCodeNotList; this.productCodeNotList = productCodeNotList;
} }
/**
* 获取 开始 大厅Id
* @return hallIdStart
*/
public Long getHallIdStart(){
return this.hallIdStart;
}
/**
* 设置 开始 大厅Id
* @param hallIdStart
*/
public void setHallIdStart(Long hallIdStart){
this.hallIdStart = hallIdStart;
}
/**
* 获取 结束 大厅Id
* @return $hallIdEnd
*/
public Long getHallIdEnd(){
return this.hallIdEnd;
}
/**
* 设置 结束 大厅Id
* @param hallIdEnd
*/
public void setHallIdEnd(Long hallIdEnd){
this.hallIdEnd = hallIdEnd;
}
/**
* 获取 增加 大厅Id
* @return hallIdIncrement
*/
public Long getHallIdIncrement(){
return this.hallIdIncrement;
}
/**
* 设置 增加 大厅Id
* @param hallIdIncrement
*/
public void setHallIdIncrement(Long hallIdIncrement){
this.hallIdIncrement = hallIdIncrement;
}
/**
* 获取 大厅Id
* @return hallIdList
*/
public List<Long> getHallIdList(){
return this.hallIdList;
}
/**
* 设置 大厅Id
* @param hallIdList
*/
public void setHallIdList(List<Long> hallIdList){
this.hallIdList = hallIdList;
}
/**
* 获取 大厅Id
* @return hallIdNotList
*/
public List<Long> getHallIdNotList(){
return this.hallIdNotList;
}
/**
* 设置 大厅Id
* @param hallIdNotList
*/
public void setHallIdNotList(List<Long> hallIdNotList){
this.hallIdNotList = hallIdNotList;
}
/**
* 获取 大厅名称
* @return hallNameList
*/
public List<String> getHallNameList(){
return this.hallNameList;
}
/**
* 设置 大厅名称
* @param hallNameList
*/
public void setHallNameList(List<String> hallNameList){
this.hallNameList = hallNameList;
}
/**
* 获取 大厅名称
* @return hallNameNotList
*/
public List<String> getHallNameNotList(){
return this.hallNameNotList;
}
/**
* 设置 大厅名称
* @param hallNameNotList
*/
public void setHallNameNotList(List<String> hallNameNotList){
this.hallNameNotList = hallNameNotList;
}
/** /**
* 设置 主键ID,主键,自增长 * 设置 主键ID,主键,自增长
* @param id * @param id
...@@ -4105,6 +4240,79 @@ public class DeviceQuery extends DeviceEntity { ...@@ -4105,6 +4240,79 @@ public class DeviceQuery extends DeviceEntity {
return this; return this;
} }
/**
* 设置 大厅Id
* @param hallId
*/
public DeviceQuery hallId(Long hallId){
setHallId(hallId);
return this;
}
/**
* 设置 开始 大厅Id
* @param hallIdStart
*/
public DeviceQuery hallIdStart(Long hallIdStart){
this.hallIdStart = hallIdStart;
return this;
}
/**
* 设置 结束 大厅Id
* @param hallIdEnd
*/
public DeviceQuery hallIdEnd(Long hallIdEnd){
this.hallIdEnd = hallIdEnd;
return this;
}
/**
* 设置 增加 大厅Id
* @param hallIdIncrement
*/
public DeviceQuery hallIdIncrement(Long hallIdIncrement){
this.hallIdIncrement = hallIdIncrement;
return this;
}
/**
* 设置 大厅Id
* @param hallIdList
*/
public DeviceQuery hallIdList(List<Long> hallIdList){
this.hallIdList = hallIdList;
return this;
}
/**
* 设置 大厅Id
* @param hallIdNotList
*/
public DeviceQuery hallIdNotList(List<Long> hallIdNotList){
this.hallIdNotList = hallIdNotList;
return this;
}
/**
* 设置 大厅名称
* @param hallName
*/
public DeviceQuery hallName(String hallName){
setHallName(hallName);
return this;
}
/**
* 设置 大厅名称
* @param hallNameList
*/
public DeviceQuery hallNameList(List<String> hallNameList){
this.hallNameList = hallNameList;
return this;
}
/** /**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) * 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList * @return orConditionList
......
...@@ -48,6 +48,9 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{ ...@@ -48,6 +48,9 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{
*/ */
void restartApp(DeviceEntity deviceEntity,Context context); void restartApp(DeviceEntity deviceEntity,Context context);
void batchUpdateHall(DeviceEntity deviceEntity,Context context);
/** /**
* 设备启用停用 * 设备启用停用
* @param id * @param id
......
...@@ -73,7 +73,7 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDServiceImpl<D ...@@ -73,7 +73,7 @@ public class DeviceModuleDistributeServiceImpl extends AbstractCRUDServiceImpl<D
//RuntimeUtil //RuntimeUtil
//部署路径是否存在 如果不存在 创建目录, //部署路径是否存在 如果不存在 创建目录,
String path = GlobalSysInfo.getParamValue(Constant.DISTRIBUTE_PATH, "/home/publish/device-manager-ui/homeDeviceUrl"); String path = GlobalSysInfo.getParamValue(Constant.DISTRIBUTE_PATH, "/home/publish/app/homeDeviceUrl");
String code = distributeEntity.getProductCode(); String code = distributeEntity.getProductCode();
String imageRe = distributeEntity.getImageResolutionValue(); String imageRe = distributeEntity.getImageResolutionValue();
String disPath = "/" + path + "/" + code + "/" + imageRe; String disPath = "/" + path + "/" + code + "/" + imageRe;
......
...@@ -261,6 +261,27 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -261,6 +261,27 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
} }
@Override
public void batchUpdateHall(DeviceEntity deviceEntity, Context context) {
if (ObjectUtils.isEmpty(deviceEntity.getIdList())) {
throw new AppException("请选择需要更新大厅的设备!");
}
if(ObjectUtils.isEmpty(deviceEntity.getHallId())){
throw new AppException("设备所属大厅不能为空!");
}
DeviceQuery condition = new DeviceQuery();
condition.setIdList(deviceEntity.getIdList());
DeviceQuery deviceQuery = new DeviceQuery();
deviceQuery.setHallId(deviceEntity.getHallId());
deviceQuery.setHallName(deviceEntity.getHallName());
deviceQuery.setUpdateTime(new Date());
this.getDeviceDao().update(deviceQuery, condition);
}
@Override @Override
public void deviceEnabled(Long id, Integer enabled, Context context) { public void deviceEnabled(Long id, Integer enabled, Context context) {
DeviceEntity deviceEntity = this.get(id, context); DeviceEntity deviceEntity = this.get(id, context);
......
...@@ -14,10 +14,12 @@ import com.mortals.xhx.base.system.param.service.ParamService; ...@@ -14,10 +14,12 @@ import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.upload.service.UploadService; import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SiteHallPdu;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.pdu.skin.SkinBasePdu; import com.mortals.xhx.common.pdu.skin.SkinBasePdu;
import com.mortals.xhx.common.utils.QRCodeUtil; import com.mortals.xhx.common.utils.QRCodeUtil;
import com.mortals.xhx.feign.site.ISiteFeign; import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.feign.site.ISiteHallFeign;
import com.mortals.xhx.feign.skin.ISkinBaseFeign; import com.mortals.xhx.feign.skin.ISkinBaseFeign;
import com.mortals.xhx.module.device.model.DeviceEntity; import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceMapEntity; import com.mortals.xhx.module.device.model.DeviceMapEntity;
...@@ -73,6 +75,8 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -73,6 +75,8 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
private String platFormType;//版本,默认云服务版本 private String platFormType;//版本,默认云服务版本
@Autowired @Autowired
private SiteService siteService; private SiteService siteService;
@Autowired
public ISiteHallFeign siteHallFeign;
public DeviceController() { public DeviceController() {
...@@ -100,6 +104,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -100,6 +104,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
this.addDict(model, "skinProductCodeMap", skinProductCodeMap); this.addDict(model, "skinProductCodeMap", skinProductCodeMap);
} }
} }
//siteHallFeign.list(new SiteHallPdu().setSiteId(context.g);)
super.init(model, context); super.init(model, context);
} }
...@@ -108,6 +113,14 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -108,6 +113,14 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
List<OrderCol> orderColList = new ArrayList<>(); List<OrderCol> orderColList = new ArrayList<>();
orderColList.add(new OrderCol("createTime", OrderCol.DESCENDING)); orderColList.add(new OrderCol("createTime", OrderCol.DESCENDING));
query.setOrderColList(orderColList); query.setOrderColList(orderColList);
SiteHallPdu siteHallPdu = new SiteHallPdu();
siteHallPdu.setSiteId(query.getSiteId());
Rest<RespData<List<SiteHallPdu>>> rest = siteHallFeign.list(siteHallPdu);
if(rest.getCode()==YesNoEnum.YES.getValue()){
Map<String, String> hallMap = rest.getData().getData().stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getHallName(), (o, n) -> n));
this.addDict(model, "hallId", hallMap);
}
super.doListBefore(query, model, context); super.doListBefore(query, model, context);
} }
...@@ -328,6 +341,25 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe ...@@ -328,6 +341,25 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
return Rest.ok(model); return Rest.ok(model);
} }
/**
* 设备批量更新设备所属大厅
*/
@PostMapping(value = "batchUpdateHall")
public Rest<Void> batchUpdateHall(@RequestBody DeviceEntity deviceEntity) {
log.info("批量设备重启", deviceEntity.getDeviceCode());
String busiDesc = this.getModuleDesc() + "批量更新所属大厅";
Rest<Void> rest = Rest.ok(busiDesc + " 【成功】");
try {
this.service.batchUpdateHall(deviceEntity,getContext());
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error("批量更新所属大厅", e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
@Override @Override
public void doImportDataBefore(List<DeviceEntity> list, boolean updateSupport, Context context) throws AppException { public void doImportDataBefore(List<DeviceEntity> list, boolean updateSupport, Context context) throws AppException {
......
...@@ -666,6 +666,9 @@ key|String|消息唯一标识|是|- ...@@ -666,6 +666,9 @@ key|String|消息唯一标识|是|-
} }
``` ```
## 码表 ## 码表
### 响应结果码表 ### 响应结果码表
......
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