Commit 9248a1f7 authored by 赵啸非's avatar 赵啸非

修正redis 最大连接数

parent 4733fb1a
...@@ -119,14 +119,14 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -119,14 +119,14 @@ public class CustomerKeyExpirationListener implements MessageListener {
if (messageoff == YesNoEnum.YES.getValue()) { if (messageoff == YesNoEnum.YES.getValue()) {
// todo 发送短信 // todo 发送短信
//短信使用模板,如 设备告警:{产品}设备:{设备名称加编码}已离线,请注意检查! //短信使用模板,如 设备告警:{产品}设备:{设备名称加编码}已离线,请注意检查!
DeviceAlarmInfoEntity deviceAlarmInfoEntity = deviceAlarmInfoService.selectOne(new DeviceAlarmInfoQuery().alarmDevice(deviceEntity.getId())); int count = deviceAlarmInfoService.count(new DeviceAlarmInfoQuery().alarmDevice(deviceEntity.getId()), null);
if (!ObjectUtils.isEmpty(deviceAlarmInfoEntity)) { if (count > 0) {
AlarmSmsSendEntity alarmSmsSendEntity = new AlarmSmsSendEntity(); AlarmSmsSendEntity alarmSmsSendEntity = new AlarmSmsSendEntity();
alarmSmsSendEntity.initAttrValue(); alarmSmsSendEntity.initAttrValue();
alarmSmsSendEntity.setId(IdUtil.getSnowflake().nextId()); alarmSmsSendEntity.setId(IdUtil.getSnowflake().nextId());
alarmSmsSendEntity.setSiteId(deviceAlarmInfoEntity.getSiteId()); alarmSmsSendEntity.setSiteId(deviceEntity.getSiteId());
alarmSmsSendEntity.setMobile(deviceAlarmInfoEntity.getReceivePersonnelTelephone()); alarmSmsSendEntity.setMobile(deviceEntity.getLeadingOfficial());
alarmSmsSendEntity.setReceiver(deviceAlarmInfoEntity.getAlarmReceivePersonnel()); alarmSmsSendEntity.setReceiver(deviceEntity.getLeadingOfficialTelephone());
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("1", productEntity.getProductName()); map.put("1", productEntity.getProductName());
map.put("2", deviceEntity.getDeviceName() + ":" + deviceEntity.getDeviceName()); map.put("2", deviceEntity.getDeviceName() + ":" + deviceEntity.getDeviceName());
......
...@@ -51,13 +51,17 @@ public class DeviceStatTaskImpl implements ITaskExcuteService { ...@@ -51,13 +51,17 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
} else { } else {
waitDeviceInfos.add(deviceEntity); waitDeviceInfos.add(deviceEntity);
} }
try {
Thread.sleep(500);
} catch (InterruptedException e) {
log.error("线程休眠异常",e);
}
} }
log.info("waitDeviceInfos size:{}", waitDeviceInfos.size()); log.info("waitDeviceInfos size:{}", waitDeviceInfos.size());
if (!ObjectUtils.isEmpty(waitDeviceInfos)) { if (!ObjectUtils.isEmpty(waitDeviceInfos)) {
deviceService.update(waitDeviceInfos); deviceService.update(waitDeviceInfos);
} }
//获取所有在线设备 //获取所有在线设备
List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().deviceStatus(DeviceStatusEnum.在线.getValue())); List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().deviceStatus(DeviceStatusEnum.在线.getValue()));
//更新离线 //更新离线
......
...@@ -7,6 +7,8 @@ import com.mortals.xhx.common.code.PlatformTypeEnum; ...@@ -7,6 +7,8 @@ import com.mortals.xhx.common.code.PlatformTypeEnum;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.site.ISiteFeign; import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.device.service.DeviceService; import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.device.service.DeviceStatService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery; import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.service.SiteService; import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
...@@ -14,6 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 设备统计任务,生成当天统计数据 * 设备统计任务,生成当天统计数据
* *
...@@ -26,6 +30,8 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService { ...@@ -26,6 +30,8 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private DeviceService deviceService; private DeviceService deviceService;
@Autowired
private DeviceStatService deviceStatService;
@Value("${platform.type:cloud}") @Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本 private String platFormType;//版本,默认云服务版本
...@@ -43,12 +49,13 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService { ...@@ -43,12 +49,13 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
SitePdu sitePdu = new SitePdu(); SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1); sitePdu.setSize(-1);
siteFeign.list(sitePdu).getData().getData().parallelStream().forEach(item -> { siteFeign.list(sitePdu).getData().getData().parallelStream().forEach(item -> {
deviceService.deviceStat(item.getId(), null); //deviceService.deviceStat(item.getId(), null);
}); });
} else if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) { } else if (platFormType.equalsIgnoreCase(PlatformTypeEnum.STANDALONE.getValue())) {
siteService.find(new SiteQuery()).forEach(item -> { List<SiteEntity> siteEntities = siteService.find(new SiteQuery());
deviceService.deviceStat(item.getId(), null); for (SiteEntity siteEntity : siteEntities) {
}); deviceStatService.deviceStat(siteEntity.getId(), null);
}
} }
} }
......
...@@ -68,11 +68,7 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{ ...@@ -68,11 +68,7 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{
DeviceDao getDeviceDao(); DeviceDao getDeviceDao();
/**
* 设备统计当天情况
* @param context
*/
void deviceStat(Long siteId,Context context);
List<DeviceMapEntity> deviceMap(DeviceEntity query, Context context); List<DeviceMapEntity> deviceMap(DeviceEntity query, Context context);
......
...@@ -17,6 +17,12 @@ import java.util.List; ...@@ -17,6 +17,12 @@ import java.util.List;
*/ */
public interface DeviceStatService extends ICRUDService<DeviceStatEntity, Long> { public interface DeviceStatService extends ICRUDService<DeviceStatEntity, Long> {
/**
* 设备统计当天情况
* @param context
*/
void deviceStat(Long siteId,Context context);
List<DeviceStatEntity> getBillInfos(Long siteId,String createTimeStart, Integer datePattern, PageInfo pageInfo, Context context); List<DeviceStatEntity> getBillInfos(Long siteId,String createTimeStart, Integer datePattern, PageInfo pageInfo, Context context);
} }
\ No newline at end of file
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