Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 9 months ago
parent
commit
bb33aafaa5
  1. 28
      hzims-biz-common/src/main/java/com/hnac/hzims/common/statistics/Charts.java
  2. 6
      hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/DateUtil.java
  3. 3
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/CameraInfoEntity.java
  4. 8
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/DictKeyConstants.java
  5. 3
      hzims-service/equipment/src/main/resources/db/2.0.0.sql.1
  6. 34
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskObjectController.java
  7. 217
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/VideoTaskSchedule.java
  8. 3
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/XxlJobConstants.java
  9. 3
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskObjectService.java
  10. 36
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectServiceImpl.java
  11. 9
      hzims-service/inspect/src/main/resources/db/2.0.0.sql.1
  12. 1
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java
  13. 5
      hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/controller/MsgPushStatisticController.java
  14. 3
      hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/service/IMsgPushStatisticService.java
  15. 40
      hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/service/impl/MsgPushStatisticServiceImpl.java
  16. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java
  17. 30
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/AccidentController.java

28
hzims-biz-common/src/main/java/com/hnac/hzims/common/statistics/Charts.java

@ -0,0 +1,28 @@
package com.hnac.hzims.common.statistics;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.List;
@ApiModel("统计图表")
@Data
@EqualsAndHashCode
public class Charts implements Serializable {
@ApiModelProperty("类别")
private List<String> legends;
@ApiModelProperty("x轴分区")
private List<String> xAxis;
@ApiModelProperty("展示数据")
private List<List> series;
}

6
hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/DateUtil.java

@ -6,6 +6,7 @@ import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.time.*; import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalAdjusters;
import java.util.Date; import java.util.Date;
@ -16,11 +17,14 @@ import java.util.stream.IntStream;
/** /**
* @author hx * @author hx
*/ */
public class DateUtil { public class DateUtil extends org.springblade.core.tool.utils.DateUtil {
public static final String yyyy_MM_dd_HH_MM_SS= "yyyy-MM-dd HH:mm:ss"; public static final String yyyy_MM_dd_HH_MM_SS= "yyyy-MM-dd HH:mm:ss";
public static final String yyyy_MM_dd= "yyyy-MM-dd"; public static final String yyyy_MM_dd= "yyyy-MM-dd";
public static final String yyyy_MM= "yyyy-MM"; public static final String yyyy_MM= "yyyy-MM";
public static final DateTimeFormatter monthFormatter = DateTimeFormatter.ofPattern("yyyy-MM");
public static final String yyyy= "yyyy"; public static final String yyyy= "yyyy";
public static final String YEAR = "year"; public static final String YEAR = "year";

3
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/entity/CameraInfoEntity.java

@ -132,4 +132,7 @@ public class CameraInfoEntity extends TenantEntity {
@ApiModelProperty(value = "是否平台接入") @ApiModelProperty(value = "是否平台接入")
private Integer isHikvideo; private Integer isHikvideo;
@ApiModelProperty("设备编号")
private String emCode;
} }

8
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/constants/DictKeyConstants.java

@ -0,0 +1,8 @@
package com.hnac.hzims.message.constants;
public interface DictKeyConstants {
/**消息推送类型 [appPush-app推送 smsPush-短信推送 websocketPush-web推送 mailPush-邮件推送]**/
String MESSAGE_TYPE = "messageType";
}

3
hzims-service/equipment/src/main/resources/db/2.0.0.sql.1

@ -29,4 +29,7 @@ alter table `HZIMS_PARAM_BACKUPS` add column `em_name` varchar(100) COMMENT '设
update HZIMS_PARAM_BACKUPS pb,HZIMS_EM_INFO ei set pb.EM_NAME = ei.`NAME` WHERE pb.EM_CODE = ei.NUMBER; update HZIMS_PARAM_BACKUPS pb,HZIMS_EM_INFO ei set pb.EM_NAME = ei.`NAME` WHERE pb.EM_CODE = ei.NUMBER;
update bladex.blade_dict set dict_key = '2' where id = 1675699613977288706; update bladex.blade_dict set dict_key = '2' where id = 1675699613977288706;
update equipment.hzims_em_definition set type = '2' where type = '0';
update bladex.blade_dict set dict_key = '2' where id = 1675699613977288706;
update equipment.hzims_em_definition set type = '2' where type = '0'; update equipment.hzims_em_definition set type = '2' where type = '0';

34
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskObjectController.java

@ -0,0 +1,34 @@
package com.hnac.hzinfo.inspect.task.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzinfo.inspect.task.service.ITaskObjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@AllArgsConstructor
@Api(value = "任务对象管理",tags = "任务对象管理")
@RestController
@RequestMapping("/task/object")
public class TaskObjectController extends BladeController {
private final ITaskObjectService taskObjectService;
@GetMapping("/getVideosByObjId")
@ApiOperation("根据任务对象ID获取摄像头点位信息")
@ApiOperationSupport(order = 1)
public R<List<StationVideoTypeEntity>> getVideosByObjId(@RequestParam @ApiParam("任务ID") Long taskId, @RequestParam @ApiParam("对象ID") Long objId) {
return R.data(taskObjectService.getVideosByObjId(taskId,objId));
}
}

217
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/VideoTaskSchedule.java

@ -0,0 +1,217 @@
package com.hnac.hzinfo.inspect.task.schedule;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hnac.hzinfo.datasearch.soe.ISoeClient;
import com.hnac.hzinfo.datasearch.soe.vo.DeviceSoeVO;
import com.hnac.hzinfo.inspect.ai.entity.CameraInfoEntity;
import com.hnac.hzinfo.inspect.ai.entity.RobotTaskEntity;
import com.hnac.hzinfo.inspect.ai.service.ICameraInfoService;
import com.hnac.hzinfo.inspect.ai.service.IRobotTaskService;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskObjectVO;
import com.hnac.hzinfo.inspect.hikVideo.service.IHikApiService;
import com.hnac.hzinfo.inspect.plan.PlanContants;
import com.hnac.hzinfo.inspect.task.TaskContants;
import com.hnac.hzinfo.inspect.task.entity.EventEntity;
import com.hnac.hzinfo.inspect.task.entity.EventRecordEntity;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import com.hnac.hzinfo.inspect.task.entity.TaskUserEntity;
import com.hnac.hzinfo.inspect.task.service.IEventRecordService;
import com.hnac.hzinfo.inspect.task.service.IEventService;
import com.hnac.hzinfo.inspect.task.service.ITaskService;
import com.hnac.hzinfo.inspect.task.service.ITaskUserService;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Component;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
import static com.hnac.hzinfo.inspect.task.schedule.XxlJobConstants.EXECUTE_VIDEO_TASK;
/**
* 视频巡检任务定时调度
*/
@Component
@AllArgsConstructor
@Slf4j
public class VideoTaskSchedule {
private final ITaskService taskService;
private final ITaskUserService taskUserService;
private final IEventService eventService;
private final IEventRecordService eventRecordService;
private final IHikApiService hikApiService;
private final IRobotTaskService robotTaskService;
private final ICameraInfoService cameraInfoService;
private final ISoeClient soeClient;
private final DataSourceTransactionManager dataSourceTransactionManager;
private final TransactionDefinition transactionDefinition;
/**
* 视频巡检任务执行
* @param params 任务ID
* @return
*/
@XxlJob(EXECUTE_VIDEO_TASK)
@Transactional
public ReturnT<String> execute(String params) throws InterruptedException {
List<TaskEntity> taskList = Lists.newArrayList();
// 获取待执行的任务
if(StringUtil.isBlank(params)) {
LambdaQueryWrapper<TaskEntity> queryWrapper = Wrappers.<TaskEntity>lambdaQuery()
.eq(TaskEntity::getStatus, TaskContants.TaskStatusEnum.INIT_STATUS.getStatus())
.le(TaskEntity::getPlanStartTime, LocalDateTime.now())
.ge(TaskEntity::getPlanEndTime, LocalDateTime.now())
.eq(TaskEntity::getAutoVideo, PlanContants.InspectTypeEnum.VIDEO.getVal());
taskList.addAll(taskService.list(queryWrapper));
}
else {
LambdaQueryWrapper<TaskEntity> queryWrapper = Wrappers.<TaskEntity>lambdaQuery()
.in(TaskEntity::getId, Func.toLongList(",", params))
.eq(TaskEntity::getStatus, TaskContants.TaskStatusEnum.UNDERWAY_STATUS.getStatus())
.eq(TaskEntity::getAutoVideo, PlanContants.InspectTypeEnum.VIDEO.getVal());
taskList.addAll(taskService.list(queryWrapper));
}
taskList.forEach(this::executeVideoTask);
return ReturnT.SUCCESS;
}
/**
* 执行视频巡检任务
* @param task 视频巡检任务
*/
private void executeVideoTask(TaskEntity task) {
try {
// 登记任务
this.registration(task);
// 完善视频巡检执行情况
this.fillEvent(task);
// 更新视频巡检任务状态
taskService.update(Wrappers.<TaskEntity>lambdaUpdate()
.set(TaskEntity::getStatus,TaskContants.TaskStatusEnum.FINISH_STATUS.getStatus())
.set(TaskEntity::getEndTime,LocalDateTime.now())
.eq(TaskEntity::getId,task.getId()));
}
catch(Exception e) {
e.printStackTrace();
XxlJobLogger.log("【taskId:"+task.getId()+"】视频巡检任务执行失败,报错信息为:"+e.getMessage());
}
try {
Thread.sleep(3*1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
/**
* 填充视频巡检执行情况
* @param task 视频巡检任务
*/
private void fillEvent(TaskEntity task) {
List<com.hnac.hzinfo.inspect.task.vo.TaskObjectVO> taskObjects = taskService.getTaskById(task.getId());
List<TaskObjectVO> taskObjectList = JSONArray.parseArray(JSON.toJSONString(taskObjects),TaskObjectVO.class);
taskObjectList.forEach(object -> object.getProjects().forEach(project -> {
EventEntity event = new EventEntity();
event.setTaskId(task.getId());
event.setObjectId(object.getObjId());
event.setProjectId(project.getProjectId());
event.setIsProblem("0");
event.setTenantId(task.getTenantId());
event.setCreateUser(task.getCreateUser());
event.setCreateDept(task.getCreateDept());
event.setUpdateUser(task.getUpdateUser());
eventService.save(event);
List<EventRecordEntity> recordList = project.getContents().stream().map(content -> {
EventRecordEntity record = new EventRecordEntity();
record.setEventId(event.getId());
record.setObjectId(object.getObjId());
record.setProjectId(project.getProjectId());
record.setContentId(content.getContentId());
record.setTenantId(task.getTenantId());
record.setCreateUser(task.getCreateUser());
record.setCreateDept(task.getCreateDept());
record.setUpdateUser(task.getUpdateUser());
record.setCurrentStatus("1");
CameraInfoEntity camera = this.getCameraByProIdAndConId(project.getProjectId(), content.getContentId());
if(Func.isNotEmpty(camera)) {
// 获取计划时间段内视频的告警信息设置是否异常
if(Func.isNotEmpty(camera.getEmCode())) {
Result<HzPage<DeviceSoeVO>> deviceSoeR = soeClient.getDeviceCodeByTaosSoe(DateUtil.formatDateTime(task.getPlanStartTime()), DateUtil.formatDateTime(task.getPlanEndTime()), camera.getEmCode(), 0, String.valueOf(-1));
if(deviceSoeR.isSuccess() && CollectionUtil.isNotEmpty(deviceSoeR.getData().getRecords())) {
record.setCurrentStatus("0");
}
}
// 调用海康威视api实现手动截屏回传至fileUrl
if(Func.isNotEmpty(camera.getPointCode())) {
String picUrl = hikApiService.manualCapture(camera.getPointCode());
record.setFileUrl(picUrl);
record.setCurrentValue(picUrl);
}
}
return record;
}).collect(Collectors.toList());
eventRecordService.saveBatch(recordList);
if(recordList.stream().anyMatch(r -> TaskContants.CurrentStatusEnum.abnormal.getType().equals(r.getCurrentStatus()))) {
eventService.update(Wrappers.<EventEntity>lambdaUpdate().set(EventEntity::getIsProblem,"1").eq(EventEntity::getId,event.getId()));
}
}));
}
/**
* 登记任务
* @param task 视频巡检任务
*/
private void registration(TaskEntity task) {
// 选择第一个人领用改任务
LambdaQueryWrapper<TaskUserEntity> userQueryWrapper = Wrappers.<TaskUserEntity>lambdaQuery().eq(TaskUserEntity::getTaskId, task.getId());
List<TaskUserEntity> taskUserList = taskUserService.list(userQueryWrapper);
TaskUserEntity taskUserEntity = taskUserList.get(0);
task.setUserId(taskUserEntity.getUserId());
taskUserEntity.setClaimStatus(TaskContants.ClaimStatusEnum.COLLECT.getStatus());
taskUserEntity.setClaimTime(LocalDateTime.now());
taskUserService.updateById(taskUserEntity);
if(PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(task.getMethod())) {
taskUserService.removeByIds(taskUserList.stream().map(TaskUserEntity::getId).filter(id -> !taskUserEntity.getId().equals(id)).collect(Collectors.toList()));
}
// 更改任务状态
task.setStatus(Integer.valueOf(TaskContants.TaskStatusEnum.UNDERWAY_STATUS.getStatus()));
task.setStartTime(LocalDateTime.now());
taskService.updateById(task);
}
/**
* 根据项目ID以及内容ID获取摄像头编号
* @param projectId 项目ID
* @param contentId 内容ID
* @return 摄像头编号
*/
private CameraInfoEntity getCameraByProIdAndConId(Long projectId,Long contentId) {
RobotTaskEntity robotTaskEntity = robotTaskService.getOne(Wrappers.<RobotTaskEntity>lambdaQuery()
.eq(RobotTaskEntity::getProjectId, projectId)
.like(RobotTaskEntity::getContentIds, String.valueOf(contentId))
);
if(Func.isNotEmpty(robotTaskEntity)) {
return cameraInfoService.getById(robotTaskEntity.getCameraId());
}
return null;
}
}

3
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/XxlJobConstants.java

@ -8,4 +8,7 @@ public interface XxlJobConstants {
/**巡检任务结束提醒**/ /**巡检任务结束提醒**/
String TASK_END_REMIND = "taskEndRemind"; String TASK_END_REMIND = "taskEndRemind";
/**视频巡检任务执行**/
String EXECUTE_VIDEO_TASK = "executeVideoTask";
} }

3
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/ITaskObjectService.java

@ -1,5 +1,6 @@
package com.hnac.hzinfo.inspect.task.service; package com.hnac.hzinfo.inspect.task.service;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO; import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO;
import com.hnac.hzinfo.inspect.task.vo.TaskObjectVO; import com.hnac.hzinfo.inspect.task.vo.TaskObjectVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
@ -24,4 +25,6 @@ public interface ITaskObjectService extends BaseService<TaskObjectEntity> {
List<TaskObjectVO> getTaskObjectsDetail(TaskObjectEntity to); List<TaskObjectVO> getTaskObjectsDetail(TaskObjectEntity to);
List<TaskObjectOfflineVO> getExObjectData(List<Long> taskIds); List<TaskObjectOfflineVO> getExObjectData(List<Long> taskIds);
List<StationVideoTypeEntity> getVideosByObjId(Long taskId, Long objId);
} }

36
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskObjectServiceImpl.java

@ -1,14 +1,24 @@
package com.hnac.hzinfo.inspect.task.service.impl; package com.hnac.hzinfo.inspect.task.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity;
import com.hnac.hzinfo.inspect.ai.entity.CameraInfoEntity;
import com.hnac.hzinfo.inspect.ai.entity.RobotTaskEntity;
import com.hnac.hzinfo.inspect.ai.mapper.RobotTaskMapper;
import com.hnac.hzinfo.inspect.ai.service.ICameraInfoService;
import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity;
import com.hnac.hzinfo.inspect.obj.services.ProjectService; import com.hnac.hzinfo.inspect.obj.services.ProjectService;
import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity; import com.hnac.hzinfo.inspect.task.entity.TaskObjectEntity;
import com.hnac.hzinfo.inspect.task.entity.TaskObjectProjectEntity;
import com.hnac.hzinfo.inspect.task.mapper.TaskObjectMapper; import com.hnac.hzinfo.inspect.task.mapper.TaskObjectMapper;
import com.hnac.hzinfo.inspect.task.service.ITaskObjectProjectContentService; import com.hnac.hzinfo.inspect.task.service.ITaskObjectProjectContentService;
import com.hnac.hzinfo.inspect.task.service.ITaskObjectProjectService;
import com.hnac.hzinfo.inspect.task.service.ITaskObjectService; import com.hnac.hzinfo.inspect.task.service.ITaskObjectService;
import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO; import com.hnac.hzinfo.inspect.task.vo.TaskObjectOfflineVO;
import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectContentVO; import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectContentVO;
import com.hnac.hzinfo.inspect.task.vo.TaskObjectVO; import com.hnac.hzinfo.inspect.task.vo.TaskObjectVO;
import com.hnac.hzinfo.inspect.utils.HiKUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
@ -16,6 +26,7 @@ import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 服务实现类 * 服务实现类
@ -28,6 +39,9 @@ public class TaskObjectServiceImpl extends BaseServiceImpl<TaskObjectMapper, Tas
private final ITaskObjectProjectContentService taskContentService; private final ITaskObjectProjectContentService taskContentService;
private final ProjectService projectService; private final ProjectService projectService;
private final ITaskObjectProjectService taskObjectProjectService;
private final RobotTaskMapper robotTaskMapper;
private final ICameraInfoService cameraInfoService;
@Override @Override
public List<TaskObjectEntity> getTaskObjectList(TaskObjectEntity taskObjectEntity) { public List<TaskObjectEntity> getTaskObjectList(TaskObjectEntity taskObjectEntity) {
@ -57,4 +71,26 @@ public class TaskObjectServiceImpl extends BaseServiceImpl<TaskObjectMapper, Tas
public List<TaskObjectOfflineVO> getExObjectData(List<Long> taskIds) { public List<TaskObjectOfflineVO> getExObjectData(List<Long> taskIds) {
return this.baseMapper.getExObjectData(taskIds); return this.baseMapper.getExObjectData(taskIds);
} }
@Override
public List<StationVideoTypeEntity> getVideosByObjId(Long taskId, Long objId) {
LambdaQueryWrapper<TaskObjectProjectEntity> projectQueryWrapper = Wrappers.<TaskObjectProjectEntity>lambdaQuery()
.eq(TaskObjectProjectEntity::getTaskId, taskId)
.eq(TaskObjectProjectEntity::getObjectId, objId);
List<TaskObjectProjectEntity> TaskProjectList = taskObjectProjectService.list(projectQueryWrapper);
List<StationVideoTypeEntity> result = TaskProjectList.stream().map(TaskObjectProjectEntity::getProjectId).filter(Func::isNotEmpty).flatMap(
proId -> robotTaskMapper.selectList(Wrappers.<RobotTaskEntity>lambdaQuery().eq(RobotTaskEntity::getProjectId, proId)).stream().map(r -> cameraInfoService.getById(r.getCameraId()))
).filter(Func::isNotEmpty).map(this::convert).collect(Collectors.toList());
return result;
}
private StationVideoTypeEntity convert(CameraInfoEntity cameraInfoEntity) {
StationVideoTypeEntity result = new StationVideoTypeEntity();
result.setName(cameraInfoEntity.getName());
result.setVideoHost(HiKUtil.HOST);
result.setAppKey(HiKUtil.APP_KEY);
result.setAppSecret(HiKUtil.APP_SECRET);
result.setPointCode(cameraInfoEntity.getPointCode());
return result;
}
} }

9
hzims-service/inspect/src/main/resources/db/2.0.0.sql.1

@ -1,3 +1,10 @@
ALTER TABLE `hzims-inspect`.`hz_st_ex_task_user` MODIFY COLUMN `CLAIM_STATUS` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领用状态 0:未领用 1:已领用 每条任务可以存在多个用户,但是只有一个领用人' AFTER `USER_ID`; ALTER TABLE `hzims-inspect`.`hz_st_ex_task_user` MODIFY COLUMN `CLAIM_STATUS` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领用状态 0:未领用 1:已领用 每条任务可以存在多个用户,但是只有一个领用人' AFTER `USER_ID`;
ALTER TABLE `hzims-inspect`.`hz_st_ex_task_user` ADD COLUMN `user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `TENANT_ID`; ALTER TABLE `hzims-inspect`.`hz_st_ex_task_user` ADD COLUMN `user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `TENANT_ID`;
alter table `hz_st_ex_task` add column `hik_video_task_id` varchar(50) default null comment '海康录制视频任务ID';
alter table `hz_st_ex_task` add column `video_start_time` datetime default null comment '视频录制开始时间';
alter table `hz_st_ex_task` add column `video_end_time` datetime default null comment '视频录制开始时间';
alter table `hz_st_ex_task` add column `video_url` varchar(255) default null comment '手动录制视频地址';
-- 巡检摄像头管理添加设备编号
alter table `hz_st_camera_info` add column `em_code` varchar(50) default null comment '设备编号';

1
hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java

@ -12,6 +12,7 @@ import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
import java.util.Map;
public interface IMessagePushRecordService extends BaseService<MessagePushRecordEntity> { public interface IMessagePushRecordService extends BaseService<MessagePushRecordEntity> {

5
hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/controller/MsgPushStatisticController.java

@ -1,6 +1,7 @@
package com.hnac.hzims.message.statistics.controller; package com.hnac.hzims.message.statistics.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.statistics.Charts;
import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto;
import com.hnac.hzims.message.statistics.service.IMsgPushStatisticService; import com.hnac.hzims.message.statistics.service.IMsgPushStatisticService;
import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO; import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO;
@ -36,4 +37,8 @@ public class MsgPushStatisticController extends BladeController {
return R.data(msgPushStatisticService.getMsgPushStatistic(msgPushStatisticDto)); return R.data(msgPushStatisticService.getMsgPushStatistic(msgPushStatisticDto));
} }
public R<Charts> getMsgPushStat(MsgPushStatisticDto req) {
return R.data(msgPushStatisticService.getMsgPushStat(req));
}
} }

3
hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/service/IMsgPushStatisticService.java

@ -1,5 +1,6 @@
package com.hnac.hzims.message.statistics.service; package com.hnac.hzims.message.statistics.service;
import com.hnac.hzims.common.statistics.Charts;
import com.hnac.hzims.common.utils.DateUtil; import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto;
@ -27,6 +28,8 @@ public interface IMsgPushStatisticService {
*/ */
List<MsgPushStatisticVO> getMsgPushStatistic(MsgPushStatisticDto msgPushStatisticDto); List<MsgPushStatisticVO> getMsgPushStatistic(MsgPushStatisticDto msgPushStatisticDto);
Charts getMsgPushStat(MsgPushStatisticDto req);
/** /**
* 处理年日查询日期格式 填充开始时间以及结束时间 * 处理年日查询日期格式 填充开始时间以及结束时间
* @param msgPushStatisticDto * @param msgPushStatisticDto

40
hzims-service/message/src/main/java/com/hnac/hzims/message/statistics/service/impl/MsgPushStatisticServiceImpl.java

@ -1,19 +1,34 @@
package com.hnac.hzims.message.statistics.service.impl; package com.hnac.hzims.message.statistics.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.common.statistics.Charts;
import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.constants.DictKeyConstants;
import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto; import com.hnac.hzims.message.dto.statistic.MsgPushStatisticDto;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.log.mapper.AppLogMapper; import com.hnac.hzims.message.log.mapper.AppLogMapper;
import com.hnac.hzims.message.log.mapper.MailLogMapper; import com.hnac.hzims.message.log.mapper.MailLogMapper;
import com.hnac.hzims.message.log.mapper.SmsLogMapper; import com.hnac.hzims.message.log.mapper.SmsLogMapper;
import com.hnac.hzims.message.service.IMessagePushRecordService;
import com.hnac.hzims.message.statistics.service.IMsgPushStatisticService; import com.hnac.hzims.message.statistics.service.IMsgPushStatisticService;
import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO; import com.hnac.hzims.message.vo.statistic.MsgPushStatisticVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dict;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/** /**
* @author hx * @author hx
@ -26,6 +41,7 @@ public class MsgPushStatisticServiceImpl implements IMsgPushStatisticService {
private final AppLogMapper appLogMapper; private final AppLogMapper appLogMapper;
private final MailLogMapper mailLogMapper; private final MailLogMapper mailLogMapper;
private final SmsLogMapper smsLogMapper; private final SmsLogMapper smsLogMapper;
private final IMessagePushRecordService messagePushRecordService;
@Override @Override
public List<MsgPushStatisticVO> getMsgPushStatistic(MsgPushStatisticDto msgPushStatisticDto) { public List<MsgPushStatisticVO> getMsgPushStatistic(MsgPushStatisticDto msgPushStatisticDto) {
@ -50,4 +66,28 @@ public class MsgPushStatisticServiceImpl implements IMsgPushStatisticService {
} }
return result; return result;
} }
@Override
public Charts getMsgPushStat(MsgPushStatisticDto req) {
List<Dict> types = DictCache.getList(DictKeyConstants.MESSAGE_TYPE);
Charts charts = new Charts();
if(CollectionUtil.isNotEmpty(types)) {
charts.setLegends(types.stream().map(Dict::getDictValue).collect(Collectors.toList()));
charts.setXAxis(this.getFullMonth());
Function<String,List<Integer>> getCountByType = messageType -> {
return Lists.newArrayList();
};
charts.setSeries(types.stream().map(Dict::getDictKey).map(getCountByType).collect(Collectors.toList()));
}
return charts;
}
private List<String> getFullMonth() {
YearMonth now = YearMonth.now();
return IntStream.iterate(0, index -> index + 1).limit(12)
.mapToObj(index -> now.minusMonths(index))
.map(yearMonth -> yearMonth.format(DateUtil.monthFormatter))
.collect(Collectors.toList());
}
} }

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java

@ -23,6 +23,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.entity.BladeFlow;
@ -163,6 +164,9 @@ public class MaintenanceTaskSchedule {
OperMaintenanceTaskEntityVo vo = BeanUtil.copy(task,OperMaintenanceTaskEntityVo.class); OperMaintenanceTaskEntityVo vo = BeanUtil.copy(task,OperMaintenanceTaskEntityVo.class);
Map<String,Object> params = new HashMap<String, Object>() {{ Map<String,Object> params = new HashMap<String, Object>() {{
put("taskId", task.getId()); put("taskId", task.getId());
if(Func.isEmpty(AuthUtil.getUser())) {
put("startFlowUserId", task.getCreateUser().toString());
}
String userId = task.getDisposer(); String userId = task.getDisposer();
List<String> userIds = Stream.of(userId.split(",")).collect(Collectors.toList()); List<String> userIds = Stream.of(userId.split(",")).collect(Collectors.toList());
Stream.iterate(0, i -> i + 1).limit(5).forEach(index -> { Stream.iterate(0, i -> i + 1).limit(5).forEach(index -> {

30
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/AccidentController.java

@ -50,9 +50,6 @@ public class AccidentController extends BladeController {
private final IAccidentService accidentService; private final IAccidentService accidentService;
private final IOssClient ossClient; private final IOssClient ossClient;
private static final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
private static final ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock();
private static final ReentrantReadWriteLock.ReadLock readLock = lock.readLock();
@PostMapping("/save") @PostMapping("/save")
@ApiOperation("事故管理保存") @ApiOperation("事故管理保存")
@ -67,19 +64,8 @@ public class AccidentController extends BladeController {
@ApiOperation("事故管理查询详情") @ApiOperation("事故管理查询详情")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public R<AccidentVO> detail(@PathVariable(value = "id") Long id) { public R<AccidentVO> detail(@PathVariable(value = "id") Long id) {
AccidentVO accidentVO = null; AccidentEntity accidentEntity = accidentService.getById(id);
readLock.lock(); return R.data(AccidentWrapper.build().entityVO(accidentEntity));
try {
AccidentEntity accidentEntity = accidentService.getById(id);
if (ObjectUtil.isNotEmpty(accidentEntity)) {
accidentVO = AccidentWrapper.build().entityVO(accidentEntity);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
readLock.unlock();
}
return R.data(accidentVO);
} }
@PostMapping("updateById") @PostMapping("updateById")
@ -87,16 +73,8 @@ public class AccidentController extends BladeController {
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public R updateById(@RequestBody @Valid AccidentDTO req) { public R updateById(@RequestBody @Valid AccidentDTO req) {
writeLock.lock(); AccidentEntity accidentEntity = BeanUtil.copy(req, AccidentEntity.class);
try { return R.status(accidentService.updateById(accidentEntity));
AccidentEntity accidentEntity = BeanUtil.copy(req, AccidentEntity.class);
accidentService.updateById(accidentEntity);
} catch (Exception e) {
e.printStackTrace();
} finally {
writeLock.unlock();
}
return R.success("操作成功");
} }
@PutMapping("/remove/{ids}") @PutMapping("/remove/{ids}")

Loading…
Cancel
Save