1、增加推送两个平台的功能
This commit is contained in:
parent
02c4b14110
commit
75215c410e
@ -40,6 +40,7 @@ public class GnssDevice {
|
||||
private Integer group_id = 1; //组参数,缓存自动下发
|
||||
private Integer calc_group_id = 1;
|
||||
private String fwd_group_id;
|
||||
private String fwd_group_id2;
|
||||
private Boolean syn; //组参数是否同步
|
||||
private String pictures;
|
||||
private Double b562e; //初始位置
|
||||
|
||||
@ -94,7 +94,7 @@ public class TCPClient {
|
||||
}
|
||||
|
||||
private void flush(){
|
||||
if(sendBuffer.readableBytes()>0){
|
||||
if(sendBuffer!=null && sendBuffer.readableBytes()>0){
|
||||
channel.writeAndFlush(sendBuffer).addListener(future -> {
|
||||
if (future.isSuccess()) {
|
||||
logger.info("send to xfz server succeed.");
|
||||
|
||||
@ -15,6 +15,7 @@ public class Forwarder {
|
||||
String name;
|
||||
String description;
|
||||
Integer tenantId;
|
||||
boolean useFwdId;
|
||||
|
||||
@Autowired
|
||||
private GnssDeviceMapper deviceMapper;
|
||||
@ -30,10 +31,11 @@ public class Forwarder {
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
void init(String name, String desc, Integer tenantId){
|
||||
void init(String name, String desc, Integer tenantId, boolean useFwdId){
|
||||
this.name = name;
|
||||
this.description = desc;
|
||||
this.tenantId = tenantId;
|
||||
this.useFwdId = useFwdId;
|
||||
QueryWrapper<GnssGroupFwd> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("name",name);
|
||||
GnssGroupFwd gnssGroupFwd = fwdMapper.selectOne(queryWrapper);
|
||||
@ -58,7 +60,9 @@ public class Forwarder {
|
||||
String sendAfterTime = nowTime.minusMinutes(30).format(formatter);
|
||||
|
||||
QueryWrapper<GnssDevice> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("fwd_group_id", fwdGroupId);
|
||||
queryWrapper.eq("fwd_group_id", fwdGroupId)
|
||||
.or()
|
||||
.eq("fwd_group_id2", fwdGroupId);
|
||||
List<GnssDevice> gnssDeviceList = deviceMapper.selectList(queryWrapper);
|
||||
List<GnssCalcData> recordsToSend;
|
||||
for(GnssDevice device:gnssDeviceList){
|
||||
@ -87,7 +91,7 @@ public class Forwarder {
|
||||
record.setRb562n(record.getRb562n()-device.getB562n());
|
||||
record.setRb562d(record.getRb562d()-device.getB562d());
|
||||
}
|
||||
if(device.getFwddeviceid()!=null && device.getFwddeviceid().trim().length()>0) {
|
||||
if(useFwdId && device.getFwddeviceid()!=null && device.getFwddeviceid().trim().length()>0) {
|
||||
record.setDeviceid(device.getFwddeviceid());
|
||||
}
|
||||
recordsToSend.add(record);
|
||||
@ -162,7 +166,7 @@ public class Forwarder {
|
||||
// 推送
|
||||
lastTime = calcData.getCreatetime();
|
||||
// 替换推送名和值
|
||||
if(device.getFwddeviceid()!=null && device.getFwddeviceid().trim().length()>0) {
|
||||
if(useFwdId && device.getFwddeviceid()!=null && device.getFwddeviceid().trim().length()>0) {
|
||||
calcData.setDeviceid(device.getFwddeviceid());
|
||||
}
|
||||
if(device.getB562e()!=null &&
|
||||
|
||||
@ -33,14 +33,14 @@ public class GZYForwarder extends Forwarder{
|
||||
|
||||
@PostConstruct
|
||||
void registerMe(){
|
||||
init(FORWARDER_NAME, host+":"+port,2);
|
||||
init(FORWARDER_NAME, host+":"+port,2,true);
|
||||
udpClient = new UDPClient();
|
||||
udpClient.init(host, port);
|
||||
}
|
||||
/**
|
||||
* 每半小时转发GNSS解算结果
|
||||
*/
|
||||
@Scheduled(cron = "0 0/5 * * * ?") // 每30分钟执行一次
|
||||
@Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
||||
private void forwardGnss() {
|
||||
forwardCurrentGnss(FORWARDER_NAME);
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ public class KingMaForwarder extends Forwarder{
|
||||
|
||||
@PostConstruct
|
||||
void registerMe(){
|
||||
init(FORWARDER_NAME, data_host,3);
|
||||
init(FORWARDER_NAME, data_host,3,true);
|
||||
}
|
||||
/**
|
||||
* 每半小时转发GNSS解算结果
|
||||
|
||||
@ -64,7 +64,8 @@ public class GnssDeviceController extends BasicController{
|
||||
}
|
||||
|
||||
@RequestMapping("/page/table/gnss_add_dev")
|
||||
public String gnssUpdateDev(Model m){
|
||||
public String gnssUpdateDev(Model m, HttpSession session) {
|
||||
initModel(m, session);
|
||||
//以下用于下拉框数据
|
||||
List<GnssGroup> gnssGroups = gnssGroupMapper.selectList(null);
|
||||
List<GnssGroupCalc> gnssGroupCalcs = gnssGroupCalcMapper.selectList(null);
|
||||
|
||||
@ -52,6 +52,7 @@ CREATE TABLE IF NOT EXISTS `gnssdevices` (
|
||||
`group_id` int DEFAULT 1,
|
||||
`calc_group_id` int DEFAULT 1,
|
||||
`fwd_group_id` varchar(64) DEFAULT NULL,
|
||||
`fwd_group_id2` varchar(64) DEFAULT NULL,
|
||||
`syn` bit(1) DEFAULT 0 COMMENT '是否已同步',
|
||||
`pictures` varchar(100) DEFAULT NULL,
|
||||
`b562e` double DEFAULT NULL COMMENT '初始位置东E',
|
||||
|
||||
@ -79,11 +79,29 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
|
||||
<script th:inline="none">
|
||||
<script th:inline="javascript">
|
||||
layui.use(['form', 'table'], function () {
|
||||
var $ = layui.$,
|
||||
form = layui.form,
|
||||
table = layui.table;
|
||||
var cfg_cols = [
|
||||
{field: 'deviceid', title: '设备号', sort: true},
|
||||
{field: 'name', title: '设备名称'},
|
||||
{field: 'devicetype', title: '类型',templet: '#typeTrans'},
|
||||
{field: 'parentid', title: '父设备号'},
|
||||
{field: 'tenantname', title: '所属组织'},
|
||||
{field: 'project_id', title: '项目号'},
|
||||
{field: 'group_id', title: '基本参数组'},
|
||||
{field: 'calc_group_id', title: '解算参数组'},
|
||||
{field: 'fwd_group_id', title: '推送组'},
|
||||
{field: 'fwd_group_id2', title: '推送2'},
|
||||
{field: 'opmode', title: '使用状态',templet: '#modeTrans'},
|
||||
{field: 'syn', title: '参数同步',templet: '#synTrans'},
|
||||
{title: '操作', toolbar: '#currentTableBar', align: "center", minWidth: 120}
|
||||
];
|
||||
if([[${role}]] != "ADMIN" && [[${role}]] != "SUPER_ADMIN") {
|
||||
cfg_cols[9].hide = true;
|
||||
}
|
||||
/**
|
||||
* 初始化表单,要加上,不然刷新部分组件可能会不加载
|
||||
*/
|
||||
@ -94,20 +112,9 @@
|
||||
url: '/gnss/device/list',
|
||||
toolbar: '#toolbarTop',
|
||||
defaultToolbar: ['filter'],
|
||||
cols: [[
|
||||
{field: 'deviceid', title: '设备号', sort: true},
|
||||
{field: 'name', title: '设备名称'},
|
||||
{field: 'devicetype', title: '类型',templet: '#typeTrans'},
|
||||
{field: 'parentid', title: '父设备号'},
|
||||
{field: 'tenantname', title: '所属组织'},
|
||||
{field: 'project_id', title: '项目号'},
|
||||
{field: 'group_id', title: '基本参数组'},
|
||||
{field: 'calc_group_id', title: '解算参数组'},
|
||||
{field: 'fwd_group_id', title: '推送组'},
|
||||
{field: 'opmode', title: '使用状态',templet: '#modeTrans'},
|
||||
{field: 'syn', title: '参数同步',templet: '#synTrans'},
|
||||
{title: '操作', toolbar: '#currentTableBar', align: "center", minWidth: 120}
|
||||
]],
|
||||
cols: [
|
||||
cfg_cols
|
||||
],
|
||||
limits: [10, 15, 20, 25, 50, 100],
|
||||
limit: 15,
|
||||
page: true,
|
||||
|
||||
@ -102,7 +102,16 @@
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">推送至</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="fwd_group_id" id="fwd_group_id" lay-verify="required" lay-search="">
|
||||
<select name="fwd_group_id" id="fwd_group_id" lay-search="">
|
||||
<option value="不推送">不推送</option>
|
||||
<option th:each="item : ${gnss_group_fwd_list}" th:text="${item.name}" th:value="${item.name}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline" th:if="${role=='SUPER_ADMIN' || role=='ADMIN'}">
|
||||
<label class="layui-form-label">推送2</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="fwd_group_id2" id="fwd_group_id2" lay-search="">
|
||||
<option value="不推送">不推送</option>
|
||||
<option th:each="item : ${gnss_group_fwd_list}" th:text="${item.name}" th:value="${item.name}"></option>
|
||||
</select>
|
||||
@ -210,6 +219,7 @@
|
||||
$('#group_id').val(data.group_id);
|
||||
$('#calc_group_id').val(data.calc_group_id);
|
||||
$('#fwd_group_id').val(data.fwd_group_id);
|
||||
$('#fwd_group_id2').val(data.fwd_group_id2);
|
||||
$('#opmode').val(data.opmode);
|
||||
$('#fwddeviceid').val(data.fwddeviceid);
|
||||
$('#b562e').val(data.b562e);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user