Browse Source

修改突发事件记录相关接口,添加值班日志的相关接口

zhongwei
tyty 2 years ago
parent
commit
33e8c1ce4b
  1. 70
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/AnalyseExample.java
  2. 26
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyEmergencyEntity.java
  3. 43
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java
  4. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.java
  5. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.xml
  6. 26
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsAnalyseExampleService.java
  7. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyEmergencyService.java
  8. 126
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java
  9. 44
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyEmergencyServiceImpl.java

70
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/AnalyseExample.java

@ -0,0 +1,70 @@
package com.hnac.hzims.operational.duty.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* 实体类
*
* @author ty
*/
@Data
@TableName("hz_ims_duty_analyse_example")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "AnalyseExample对象", description = "分析实例配置类")
public class AnalyseExample extends TenantEntity {
private static final long serialVersionUID = 4259568798118459986L;
/**
* 配置ID
*/
@ApiModelProperty(value = "配置ID")
private Long id;
/**
* 站点ID
*/
@ApiModelProperty(value = "站点ID")
private Long classId;
/**
* 站点名称
*/
@ApiModelProperty(value = "站点名称")
private String className;
/**
* 设备ID
*/
@ApiModelProperty(value = "设备ID")
private Long equipmentId;
/**
* 设备名称
*/
@ApiModelProperty(value = "设备名称")
private String equipmentName;
/**
* 分析实例ID
*/
@ApiModelProperty(value = "分析实例ID")
private Long analyseId;
/**
* 分析实例名称
*/
@ApiModelProperty(value = "分析实例名称")
private String analyseName;
/**
* 属性ID
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "属性ID")
private String propertyIds;
}

26
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyEmergencyEntity.java

@ -1,6 +1,7 @@
package com.hnac.hzims.operational.duty.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@ -32,8 +33,8 @@ public class ImsDutyEmergencyEntity extends TenantEntity {
/**
* 值班日期
*/
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
@JsonFormat(pattern = DateUtil.PATTERN_DATE)
@ApiModelProperty(value = "值班日期")
private Date dutyTime;
@ -42,6 +43,13 @@ public class ImsDutyEmergencyEntity extends TenantEntity {
*/
@ApiModelProperty(value = "班次")
private Long dutyClass;
/**
* 班次
*/
@TableField(exist=false)
@ApiModelProperty(value = "班次")
private String dutyClassName;
/**
* 登记人
*/
@ -49,12 +57,26 @@ public class ImsDutyEmergencyEntity extends TenantEntity {
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long registrant;
/**
* 登记人姓名
*/
@TableField(exist=false)
@ApiModelProperty(value = "登记人")
@JsonSerialize(nullsUsing = NullSerializer.class)
private String registrantName;
/**
* 值班长
*/
@ApiModelProperty(value = "值班长")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long chargePerson;
/**
* 值班长
*/
@TableField(exist=false)
@ApiModelProperty(value = "值班长")
@JsonSerialize(nullsUsing = NullSerializer.class)
private String chargePersonName;
/**
* 登记时间
*/
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)

43
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java

@ -5,13 +5,16 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.duty.entity.AnalyseExample;
import com.hnac.hzims.operational.duty.entity.ImsDutyEmergencyEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import com.hnac.hzims.operational.duty.service.IImsAnalyseExampleService;
import com.hnac.hzims.operational.duty.service.IImsDutyEmergencyService;
import com.hnac.hzims.operational.duty.service.IImsDutyRecService;
import com.hnac.hzims.operational.duty.vo.ImsDutyEmergencyVo;
import com.hnac.hzims.operational.duty.vo.ImsDutyRecVO;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition;
import com.hnac.hzinfo.inspect.plan.vo.PlanVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -45,6 +48,8 @@ public class ImsDutyRecController extends BladeController {
private final IImsDutyRecService imsDutyRecService;
@Resource
private IImsDutyEmergencyService iImsDutyEmergencyService;
@Resource
private IImsAnalyseExampleService iImsAnalyseExampleService;
/**
* 详情
@ -252,6 +257,44 @@ public class ImsDutyRecController extends BladeController {
public R queryEmergency( ImsDutyEmergencyVo imsDutyEmergencyVo,Query query) {
return iImsDutyEmergencyService.queryEntity(imsDutyEmergencyVo,query);
}
/**
* 查询分析实例数据
*/
@PostMapping("/queryAnalyseExampleData")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "查询分析实例数据", notes = "传入imsDutyEmergencyEntity")
public R queryAnalyseExampleData( AnalyzeDataCondition analyzeDataCondition) {
return iImsAnalyseExampleService.queryAnalyseExampleData(analyzeDataCondition);
}
/**
* 查询分析实例模板
*/
@PostMapping("/queryAnalyseExample")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "查询分析实例模板", notes = "传入analyseExample")
public R queryAnalyseExample( AnalyseExample analyseExample) {
return iImsAnalyseExampleService.queryAnalyseExample(analyseExample);
}
/**
* 查询分析实例Id
*/
@PostMapping("/getAnalyseId")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "查询分析实例Id", notes = "传入Id")
public R getAnalyseId(String projectId) {
return iImsAnalyseExampleService.getAnalyseId(projectId);
}
/**
* 新增分析实例
*/
@PostMapping("/updateAnalyzeExample")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增分析实例", notes = "传入analyseExample")
public R updateAnalyzeExample(AnalyseExample analyseExample) {
return iImsAnalyseExampleService.updateAnalyseExample(analyseExample);
}
}

16
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.java

@ -0,0 +1,16 @@
package com.hnac.hzims.operational.duty.mapper;
import com.hnac.hzims.operational.duty.entity.AnalyseExample;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* Mapper 接口
*
* @author Chill
*/
public interface ImsAnalyseExampleMapper extends UserDataScopeBaseMapper<AnalyseExample> {
}

16
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.operational.duty.mapper.ImsAnalyseExampleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="ims_duty_recResultMap" type="com.hnac.hzims.operational.duty.entity.AnalyseExample">
<result column="ID" property="id"/>
<result column="CLASS_ID" property="classId"/>
<result column="CLASS_NAME" property="className"/>
<result column="EQUIPMENT_ID" property="equipmentId"/>
<result column="EQUIPMENT_NAME" property="equipmentName"/>
<result column="ANALYSE_ID" property="analyseId"/>
<result column="ANALYSE_NAME" property="analyseName"/>
<result column="PROPERTY_IDS" property="propertyIds"/>
</resultMap>
</mapper>

26
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsAnalyseExampleService.java

@ -0,0 +1,26 @@
package com.hnac.hzims.operational.duty.service;
import com.hnac.hzims.operational.duty.entity.AnalyseExample;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
/**
* 服务类
*
* @author Chill
*/
public interface IImsAnalyseExampleService extends BaseService<AnalyseExample> {
R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition);
R queryAnalyseExample(AnalyseExample analyseExample);
R getAnalyseId(String projectId);
R updateAnalyseExample(AnalyseExample analyseExample);
}

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyEmergencyService.java

@ -20,4 +20,5 @@ public interface IImsDutyEmergencyService extends BaseService<ImsDutyEmergencyEn
R deleteEntity(ImsDutyEmergencyEntity imsDutyEmergencyEntity);
R queryEntity(ImsDutyEmergencyVo imsDutyEmergencyVo, Query query);
}

126
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java

@ -0,0 +1,126 @@
package com.hnac.hzims.operational.duty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.hnac.hzims.operational.duty.entity.AnalyseExample;
import com.hnac.hzims.operational.duty.mapper.ImsAnalyseExampleMapper;
import com.hnac.hzims.operational.duty.mapper.ImsDutyMainMapper;
import com.hnac.hzims.operational.duty.service.IImsAnalyseExampleService;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataList;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.analyse.AnalyseDataHandlerClient;
import lombok.extern.slf4j.Slf4j;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 服务实现类
*
* @author ty
*/
@Slf4j
@Service
public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExampleMapper, AnalyseExample> implements IImsAnalyseExampleService {
@Resource
private ImsDutyMainMapper imsDutyMainMapper;
@Autowired
private IAnalyseDataSearchClient searchClient;
@Autowired
private AnalyseDataHandlerClient handlerClient;
/**
* 根据时间段+分析实例ID查询值班日志
* @param analyzeDataCondition
* @return
*/
@Override
public R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition) {
//设备ID:分析实例编码
R<HzPage<AnalyzeDataList>> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition);
return R.data(analyzeDataByAnalyzeCode);
}
/**
* 查询值班日志模板
* @param analyseExample
* @return
*/
@Override
public R queryAnalyseExample(AnalyseExample analyseExample) {
QueryWrapper<AnalyseExample> queryWrapper = getQueryWrapper(analyseExample);
List<AnalyseExample> analyseExamples = baseMapper.selectList(queryWrapper);
if (CollectionUtils.isNotEmpty(analyseExamples)){
return R.data(analyseExamples);
}else {
return R.success("暂无数据");
}
}
@Override
public R getAnalyseId(String projectId) {
Result result = handlerClient.analyseInstanceByProjectId(projectId);
String data = result.getData().toString();
String s="11111111111111";
Result result1 = handlerClient.analyseByAnalyseAttr(s);
String data2 = result1.getData().toString();
System.out.println(data2);
// if ()
return R.data(data);
}
/**
* 生成值班日志模板
* @param analyseExample
* @return
*/
@Override
public R updateAnalyseExample(AnalyseExample analyseExample) {
AnalyseExample entity = baseMapper.selectOne(new LambdaQueryWrapper<AnalyseExample>() {{
eq(AnalyseExample::getClassId, analyseExample.getClassId());
eq(AnalyseExample::getEquipmentId,analyseExample.getEquipmentId());
last(" limit 1");
}});
if (ObjectUtils.isNotEmpty(entity)){
BeanUtils.copyProperties(analyseExample,entity);
this.saveOrUpdate(analyseExample);
}else {
analyseExample.setId(IdWorker.getId(analyseExample));
this.saveOrUpdate(analyseExample);
}
return R.success("保存成功");
}
private QueryWrapper<AnalyseExample> getQueryWrapper(AnalyseExample analyseExample) {
QueryWrapper<AnalyseExample> queryWrapper = new QueryWrapper();
if (ObjectUtils.isNotEmpty(analyseExample.getId())) {
queryWrapper.lambda().eq(AnalyseExample::getId, analyseExample.getId());
}
if (ObjectUtils.isNotEmpty(analyseExample.getClassName())) {
queryWrapper.lambda().like(AnalyseExample::getClassName, analyseExample.getClassName());
}
if (ObjectUtils.isNotEmpty(analyseExample.getEquipmentId())) {
queryWrapper.lambda().eq(AnalyseExample::getEquipmentId, analyseExample.getEquipmentId());
}
if (ObjectUtils.isNotEmpty(analyseExample.getAnalyseId())) {
queryWrapper.lambda().eq(AnalyseExample::getAnalyseId, analyseExample.getAnalyseId());
}
return queryWrapper;
}
}

44
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyEmergencyServiceImpl.java

@ -1,28 +1,36 @@
package com.hnac.hzims.operational.duty.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.duty.entity.*;
import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyEmergencyEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity;
import com.hnac.hzims.operational.duty.enume.DutyMainStatus;
import com.hnac.hzims.operational.duty.mapper.ImsDutyEmergencyMapper;
import com.hnac.hzims.operational.duty.mapper.ImsDutyMainMapper;
import com.hnac.hzims.operational.duty.service.*;
import com.hnac.hzims.operational.duty.vo.*;
import com.hnac.hzims.operational.duty.service.IImsDutyEmergencyService;
import com.hnac.hzims.operational.duty.vo.ImsDutyEmergencyVo;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.sdk.v5.analyse.AnalyseDataHandlerClient;
import lombok.extern.slf4j.Slf4j;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
@ -35,7 +43,14 @@ import javax.annotation.Resource;
public class ImsDutyEmergencyServiceImpl extends BaseServiceImpl<ImsDutyEmergencyMapper, ImsDutyEmergencyEntity> implements IImsDutyEmergencyService {
@Resource
private ImsDutyMainMapper imsDutyMainMapper;
@Autowired
private IAnalyseDataSearchClient searchClient;
@Autowired
private AnalyseDataHandlerClient handlerClient;
@Autowired
private IUserClient userClient;
@Autowired
private ImsDutyClassServiceImpl imsDutyClassService;
@Override
public R saveEntity(ImsDutyEmergencyEntity imsDutyEmergencyEntity) {
ImsDutyMainEntity entity = imsDutyMainMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
@ -60,9 +75,22 @@ public class ImsDutyEmergencyServiceImpl extends BaseServiceImpl<ImsDutyEmergenc
public R queryEntity(ImsDutyEmergencyVo imsDutyEmergencyVo, Query query) {
QueryWrapper<ImsDutyEmergencyEntity> queryWrapper = getQueryWrapper(imsDutyEmergencyVo);
IPage<ImsDutyEmergencyEntity> imsDutyEmergencyEntityIPage = baseMapper.selectPage(Condition.getPage(query), queryWrapper);
List<ImsDutyEmergencyEntity> records = imsDutyEmergencyEntityIPage.getRecords();
List<ImsDutyEmergencyEntity> collect ;
if (CollectionUtils.isNotEmpty(records)){
collect= records.stream().map(sig -> {
R<User> user = userClient.userInfoById(sig.getRegistrant());
sig.setRegistrantName(user.getData().getName());
R<User> userR = userClient.userInfoById(sig.getChargePerson());
sig.setChargePersonName(userR.getData().getName());
ImsDutyClassEntity classEntity = imsDutyClassService.getById(sig.getDutyClass());
sig.setDutyClassName(classEntity.getClassName());
return sig;
}).collect(Collectors.toList());
imsDutyEmergencyEntityIPage.setRecords(collect);
}
return R.data(imsDutyEmergencyEntityIPage);
}
private QueryWrapper<ImsDutyEmergencyEntity> getQueryWrapper(ImsDutyEmergencyVo imsDutyEmergencyVo) {
QueryWrapper<ImsDutyEmergencyEntity> queryWrapper = new QueryWrapper();
if (ObjectUtils.isNotEmpty(imsDutyEmergencyVo.getId())) {

Loading…
Cancel
Save