Commit 41e3e6bd authored by tianhongyang's avatar tianhongyang

Merge branch 'V20231129-中建一局二公司' of http://192.168.60.201/root/dsk-operate-sys...

Merge branch 'V20231129-中建一局二公司' of http://192.168.60.201/root/dsk-operate-sys into V20231129-中建一局二公司
parents ca986227 37d1fcc8
......@@ -171,6 +171,8 @@ tenant:
- advisory_body_custom_form
- dim_area
- biz_dict_data
- push_monitor_rules
- push_monitor_info
# MyBatisPlus配置
......
......@@ -12,6 +12,7 @@ import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Calendar;
import java.util.Date;
/**
......@@ -191,4 +192,30 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
int year = localDate.getHour();
return year;
}
/**
* 获取小时前后日期
* @param date
* @param hours
* @return
*/
public static Date addDays(Date date, int hours) {
return org.apache.commons.lang3.time.DateUtils.addHours(date, hours);
}
/***
*@Description: yyyy-MM-dd HH:mm:ss
*@Param:
*@return: java.lang.String
*@Author: Dgm
*@date: 2023/12/21 18:23
*/
public static String format(Date date) {
Calendar calendar = Calendar.getInstance();
if (date != null) {
calendar.setTime(date);
}
return new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS).format(calendar.getTime());
}
}
//package com.dsk.monitor.job;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.dsk.common.utils.DateUtils;
//import com.dsk.monitor.domain.dto.PushMonitorRules;
//import com.dsk.monitor.mapper.PushMonitorInfoMapper;
//import com.dsk.monitor.mapper.PushMonitorRulesMapper;
//import com.dsk.monitor.util.SendMessageUtil;
//import org.springframework.scheduling.annotation.Scheduled;
//
//import javax.annotation.Resource;
//
///**
// * @ClassName PushScheduling
// * @Description 发送短信
// * @Author Dgm
// * @Date 2023/12/9 13:51
// * @Version
// */
//public class PushScheduling {
//
// @Resource
// private PushMonitorInfoMapper monitorInfoMapper;
//
// @Resource
// private PushMonitorRulesMapper rulesMapper;
//
// @Scheduled(cron = "0 0 5 * * * ?")
// public void receiveModePhone() {
// // 获取当前整点时间
// Integer concurrentHour = DateUtils.getHour();
// QueryWrapper queryWrapper = new QueryWrapper();
// PushMonitorRules detail = rulesMapper.selectOne(queryWrapper);
// // 推送时段-起
// Integer timePeriodStart = detail.getTimePeriodStart();
// // 推送时段-止
// Integer timePeriodEnd = detail.getTimePeriodEnd();
// if (concurrentHour > timePeriodStart && concurrentHour < timePeriodEnd) {
// QueryWrapper monitorInfoWrapper = new QueryWrapper();
// // 风险类型
// monitorInfoWrapper.in("risk_type", detail.getRiskType());
// // 监控维度
// monitorInfoWrapper.in("dimension", detail.getDimension());
// Long count = monitorInfoMapper.selectCount(monitorInfoWrapper);
// if (count >0 ) {
// SendMessageUtil.sendMessage(detail.getPhones(), count.toString());
// }
// }
// }
//}
package com.dsk.monitor.job;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsk.common.tenant.helper.TenantHelper;
import com.dsk.common.utils.DateUtils;
import com.dsk.monitor.domain.dto.PushMonitorRules;
import com.dsk.monitor.domain.vo.ConditionVo;
import com.dsk.monitor.domain.vo.PushMonitorDynamicPageVo;
import com.dsk.monitor.mapper.PushMonitorInfoMapper;
import com.dsk.monitor.mapper.PushMonitorRulesMapper;
import com.dsk.monitor.service.MonitorService;
import com.dsk.monitor.util.SendMessageUtil;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @ClassName PushScheduling
* @Description 发送短信
* @Author Dgm
* @Date 2023/12/9 13:51
* @Version
*/
@Component
public class PushScheduling {
@Resource
private MonitorService monitorService;
@Resource
private PushMonitorInfoMapper monitorInfoMapper;
@Resource
private PushMonitorRulesMapper rulesMapper;
// @Scheduled(cron = "0 0/2 * * * ?")
@Scheduled(cron = "0 0 * * * ?")
public void receiveModePhone() throws Exception {
// 是否是周末
boolean isWeekend = DateUtil.isWeekend(new Date());
String aa = DateUtil.now();
TenantHelper.setTenantId("1");
// 获取当前整点时间
Integer concurrentHour = DateUtils.getHour();
QueryWrapper<PushMonitorRules> queryWrapper = new QueryWrapper();
List<PushMonitorRules> detailList = rulesMapper.selectList(queryWrapper);
for (PushMonitorRules detail : detailList) {
// 推送时段-起
String timePeriodStart = detail.getTimePeriodStart();
timePeriodStart = timePeriodStart.substring(0,2);
if (timePeriodStart.contains("0")) {
timePeriodStart = timePeriodStart.substring(1,2);
}
// 推送时段-止
String timePeriodEnd = detail.getTimePeriodEnd();
timePeriodEnd = timePeriodEnd.substring(0,2);
if (timePeriodEnd.contains("0")) {
timePeriodEnd = timePeriodEnd.substring(1,2);
}
Integer pushFrequency = detail.getPushFrequency();
if (pushFrequency > 1) {
if (isWeekend) {
continue;
}
}
Integer timeStart = Integer.valueOf(timePeriodStart);
Integer timeEnd = Integer.valueOf(timePeriodEnd);
if (concurrentHour >= timeStart && concurrentHour <= timeEnd) {
QueryWrapper monitorInfoWrapper = new QueryWrapper();
// 风险类型
// monitorInfoWrapper.in("risk_type", detail.getRiskType());
PushMonitorDynamicPageVo pageVo = new PushMonitorDynamicPageVo();
pageVo.setUserId(detail.getUserId());
ConditionVo vo = new ConditionVo();
// 截止时间
vo.setEndTime(DateUtils.getDate());
vo.setBeginTime(DateUtils.format(DateUtils.addDays(new Date(),-1)));
// 监控维度
vo.setDimension(getDimension(detail.getDimension()));
vo.setUserId(detail.getUserId());
pageVo.setCondition(vo);;
Integer count = monitorService.companyDynamicPage2(pageVo);
if (count > 0 ) {
SendMessageUtil.sendMessage(detail.getPhones(), count.toString());
}
}
}
}
public List<String> getDimension(String dimension) {
List<String> dimensionList = Arrays.asList(dimension.split(","));
return dimensionList;
}
}
......@@ -52,7 +52,7 @@ public interface MonitorService {
/***
*@Description: 监控动态/监控报告 分页
*@Description: 监控动态 分页
*@Param: pageVo 信息
*@return: R
*@Author: Dgm
......@@ -60,6 +60,15 @@ public interface MonitorService {
*/
TableDataInfo companyDynamicPage(PushMonitorDynamicPageVo pageVo) throws Exception;
/***
*@Description: 监控动态分页(定时任务使用)
*@Param: pageVo 信息
*@return: R
*@Author: Dgm
*@date: 2023/12/9 10:03
*/
Integer companyDynamicPage2(PushMonitorDynamicPageVo pageVo) throws Exception;
/***
*@Description: 监控报告
*@Param: pageVo 信息
......
......@@ -14,6 +14,7 @@ import com.dsk.monitor.mapper.PushMonitorRulesMapper;
import com.dsk.monitor.service.MonitorService;
import com.dsk.system.utils.DskOpenApiUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
......@@ -92,7 +93,6 @@ public class MonitorServiceImpl implements MonitorService {
@Override
public TableDataInfo companyDynamicPage(PushMonitorDynamicPageVo pageVo) throws Exception {
pageVo.setPageSize(3);
Long userId = LoginHelper.getUserId();
if (ObjectUtil.isNotEmpty(userId)) {
pageVo.setUserId(userId);
......@@ -103,6 +103,19 @@ public class MonitorServiceImpl implements MonitorService {
return dskOpenApiUtil.responsePageT(map);
}
@Override
public Integer companyDynamicPage2(PushMonitorDynamicPageVo pageVo) throws Exception {
Map<String, Object> map = dskOpenApiUtil.requestBody("/operate/monitor/company/info/companyDynamicList", BeanUtil.beanToMap(pageVo, false, false));
log.info("companyDynamicPage=============================>"+map);
Integer code = MapUtils.getInteger(map, "code", 300);
Map data = MapUtils.getMap(map, "data", null);
Integer count = 0;
if (code.equals(200)) {
count = MapUtils.getInteger(data, "totalCount", 0);
}
return count;
}
@Override
public TableDataInfo reportPage(PushMonitorReportPageVo pageVo) throws Exception {
Long userId = LoginHelper.getUserId();
......
......@@ -455,12 +455,11 @@ li {
.table-item {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
// 骨架屏预留
min-height: 360px;
.el-table {
width: 100%;
height: 100%;
height: auto;
font-size: 14px;
color: #232323;
......
......@@ -58,7 +58,7 @@
</template>
</el-table>
<div style="padding: 30px 0;box-sizing:border-box;" v-else>
<div class="table-empty-container" v-else>
<no-data />
</div>
</div>
......@@ -250,11 +250,25 @@ export default {
height: 16px;
}
// 空状态容器
.table-empty-container {
width: 100%;
height: 100%;
padding: 30px 0;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
}
.el-table {
/* .cell {
display: flex;
align-items: center;
} */
height: auto;
display: flex;
flex-direction: column;
align-items: center;
.el-table__header-wrapper {
min-height: 40px;
}
}
}
......
......@@ -53,7 +53,7 @@
<skeleton v-if="tableLoading"></skeleton>
<!-- table 列表 -->
<table-list-com ref="tableContainer" :tableData="tableDataList" :formColum="formColum" :tableDataTotal="total" :queryParams="queryParams"
v-else-if="!tableLoading" :height="'100%'" @handle-current-change="handleCurrentChange">
v-else-if="!tableLoading" :maxHeight="'100%'" @handle-current-change="handleCurrentChange">
<!-- 项目列表 -->
<template slot="projectName" slot-scope="{data,row}">
<div v-if="row.projectName" class="no-line-feed ">{{row.projectName}}</div>
......
......@@ -36,7 +36,7 @@
<skeleton v-if="tableLoading"></skeleton>
<!-- table 列表 -->
<table-list-com ref="tableContainer" :tableData="tableDataList" :formColum="formColum" :tableDataTotal="total" :queryParams="queryParams"
v-else-if="!tableLoading" :height="'100%'" @handle-current-change="handleCurrentChange">
v-else-if="!tableLoading" :maxHeight="'100%'" @handle-current-change="handleCurrentChange">
<!-- 咨询机构名称 -->
<template slot="advisoryBodyName" slot-scope="{data,row}">
<div v-if="row.advisoryBodyName" class="no-line-feed ">{{row.advisoryBodyName}}</div>
......
......@@ -71,7 +71,7 @@
<skeleton v-if="tableLoading"></skeleton>
<!-- table 列表 -->
<table-list-com ref="tableContainer" :tableData="tableDataList" :formColum="formColum" :tableDataTotal="total" :queryParams="queryParams"
v-else-if="!tableLoading" :height="'100%'" @handle-current-change="handleCurrentChange">
v-else-if="!tableLoading" :maxHeight="'100%'" @handle-current-change="handleCurrentChange">
<!-- 项目列表 -->
<template slot="projectName" slot-scope="{data,row}">
<div v-if="row.projectName" class="no-line-feed" v-html="row.projectName">{{row.projectName}}</div>
......
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