Commit 084a25c4 authored by 赵啸非's avatar 赵啸非

添加批量激活设备

parent 4fb53f64
package com.mortals.xhx.daemon.task; package com.mortals.xhx.daemon.task;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.base.framework.ws.message.SendToAllRequest;
import com.mortals.xhx.base.framework.ws.util.WebSocketUtil;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.DeviceOnlineStatusEnum;
import com.mortals.xhx.common.code.DeviceMethodEnum;
import com.mortals.xhx.common.code.DeviceStatusEnum;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.device.model.*; import com.mortals.xhx.module.device.model.*;
import com.mortals.xhx.module.device.service.DeviceLogService; import com.mortals.xhx.module.device.service.DeviceLogService;
import com.mortals.xhx.module.device.service.DeviceModuleService; import com.mortals.xhx.module.device.service.DeviceModuleService;
import com.mortals.xhx.module.device.service.DeviceModuleUseService; import com.mortals.xhx.module.device.service.DeviceModuleUseService;
import com.mortals.xhx.module.device.service.DeviceService; import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService;
import lombok.extern.apachecommons.CommonsLog; import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -53,6 +40,7 @@ public class DeviceModuleUseTaskImpl implements ITaskExcuteService { ...@@ -53,6 +40,7 @@ public class DeviceModuleUseTaskImpl implements ITaskExcuteService {
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
log.info("设备模块使用统计任务");
doDeviceModuleUse(); doDeviceModuleUse();
} }
......
...@@ -40,7 +40,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService { ...@@ -40,7 +40,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
log.info("设备状态修正任务");
//获取所有在线设备 //获取所有在线设备
List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().deviceStatus(DeviceStatusEnum.在线.getValue())); List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().deviceStatus(DeviceStatusEnum.在线.getValue()));
//更新离线 //更新离线
......
package com.mortals.xhx.daemon.task; package com.mortals.xhx.daemon.task;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.DateUtils; import com.mortals.xhx.common.code.PlatformTypeEnum;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.pdu.RespData;
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.alarm.model.AlarmSmsSendEntity; import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.alarm.model.AlarmSmsSendQuery;
import com.mortals.xhx.module.alarm.service.AlarmSmsSendService;
import com.mortals.xhx.module.device.model.*;
import com.mortals.xhx.module.device.service.*;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.service.ProductService;
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;
import org.springframework.beans.factory.annotation.Autowired; 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 org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static java.math.BigDecimal.ROUND_HALF_DOWN;
import static java.util.stream.Collectors.counting;
/** /**
* 设备统计任务,生成当天统计数据 * 设备统计任务,生成当天统计数据
...@@ -59,7 +37,7 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService { ...@@ -59,7 +37,7 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
log.info("设备统计任务,生成当天统计数据");
if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) { if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) {
//统计所有站点 //统计所有站点
SitePdu sitePdu = new SitePdu(); SitePdu sitePdu = new SitePdu();
...@@ -67,7 +45,7 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService { ...@@ -67,7 +45,7 @@ public class DeviceTotalStatTaskImpl implements ITaskExcuteService {
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 -> { siteService.find(new SiteQuery()).forEach(item -> {
deviceService.deviceStat(item.getId(), null); deviceService.deviceStat(item.getId(), null);
}); });
......
...@@ -41,6 +41,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService { ...@@ -41,6 +41,7 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
log.info("站点统计任务");
if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) { if (platFormType.equalsIgnoreCase(PlatformTypeEnum.CLOUD.getValue())) {
SitePdu sitePdu = new SitePdu(); SitePdu sitePdu = new SitePdu();
sitePdu.setSize(-1); sitePdu.setSize(-1);
......
...@@ -36,7 +36,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -36,7 +36,7 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
log.info("同步用户任务");
UserPdu userPdu = new UserPdu(); UserPdu userPdu = new UserPdu();
userPdu.setPage(1); userPdu.setPage(1);
userPdu.setSize(-1); userPdu.setSize(-1);
...@@ -58,12 +58,9 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -58,12 +58,9 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
BeanUtils.copyProperties(user, userEntity, new String[]{"loginPwd","userType","status","lastLoginTime", "lastLoginAddress"}); BeanUtils.copyProperties(user, userEntity, new String[]{"loginPwd","userType","status","lastLoginTime", "lastLoginAddress"});
log.info("更新:{}", JSON.toJSONString(userEntity)); log.info("更新:{}", JSON.toJSONString(userEntity));
userService.getUserDao().update(userEntity); userService.getUserDao().update(userEntity);
} }
}); });
} }
// log.info("syncUserResp:{}", JSON.toJSONString(resp)); // log.info("syncUserResp:{}", JSON.toJSONString(resp));
} }
......
...@@ -61,9 +61,6 @@ public class DeviceStatController extends BaseCRUDJsonBodyMappingController<Devi ...@@ -61,9 +61,6 @@ public class DeviceStatController extends BaseCRUDJsonBodyMappingController<Devi
deviceStatQuery.setDay(calendar.get(Calendar.DAY_OF_MONTH)); deviceStatQuery.setDay(calendar.get(Calendar.DAY_OF_MONTH));
deviceStatQuery.setSiteId(deviceQuery.getSiteId()); deviceStatQuery.setSiteId(deviceQuery.getSiteId());
Rest<Object> resp = this.list(deviceStatQuery); Rest<Object> resp = this.list(deviceStatQuery);
return resp; return resp;
} catch (Exception e) { } catch (Exception e) {
log.error("刷新异常", e); log.error("刷新异常", e);
......
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