From 33e8c1ce4b57d5c41340cfd2001ceea25dc320c6 Mon Sep 17 00:00:00 2001 From: tyty Date: Fri, 7 Apr 2023 19:34:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AA=81=E5=8F=91=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E8=AE=B0=E5=BD=95=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?,=E6=B7=BB=E5=8A=A0=E5=80=BC=E7=8F=AD=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=9A=84=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/duty/entity/AnalyseExample.java | 70 ++++++++++++ .../duty/entity/ImsDutyEmergencyEntity.java | 26 ++++- .../duty/controller/ImsDutyRecController.java | 43 +++++++ .../duty/mapper/ImsAnalyseExampleMapper.java | 16 +++ .../duty/mapper/ImsAnalyseExampleMapper.xml | 16 +++ .../duty/service/IImsAnalyseExampleService.java | 26 +++++ .../duty/service/IImsDutyEmergencyService.java | 1 + .../service/impl/ImsAnalyseExampleServiceImpl.java | 126 +++++++++++++++++++++ .../service/impl/ImsDutyEmergencyServiceImpl.java | 44 +++++-- 9 files changed, 358 insertions(+), 10 deletions(-) create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/AnalyseExample.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.xml create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsAnalyseExampleService.java create mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/AnalyseExample.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/AnalyseExample.java new file mode 100644 index 0000000..debcfdb --- /dev/null +++ b/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; + + +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyEmergencyEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyEmergencyEntity.java index 2cc9887..5e1a465 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/ImsDutyEmergencyEntity.java +++ b/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) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java index 02e2317..703b6ee 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java +++ b/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); + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.java new file mode 100644 index 0000000..7149ec3 --- /dev/null +++ b/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 { + + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.xml new file mode 100644 index 0000000..493bca2 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsAnalyseExampleService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsAnalyseExampleService.java new file mode 100644 index 0000000..60e0922 --- /dev/null +++ b/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 { + + + + + R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition); + + R queryAnalyseExample(AnalyseExample analyseExample); + + R getAnalyseId(String projectId); + + R updateAnalyseExample(AnalyseExample analyseExample); +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyEmergencyService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyEmergencyService.java index 36709ef..c0aceaf 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyEmergencyService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyEmergencyService.java @@ -20,4 +20,5 @@ public interface IImsDutyEmergencyService extends BaseService 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> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); + + return R.data(analyzeDataByAnalyzeCode); + } + + /** + * 查询值班日志模板 + * @param analyseExample + * @return + */ + @Override + public R queryAnalyseExample(AnalyseExample analyseExample) { + QueryWrapper queryWrapper = getQueryWrapper(analyseExample); + List 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() {{ + 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 getQueryWrapper(AnalyseExample analyseExample) { + QueryWrapper 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; + } + + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyEmergencyServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyEmergencyServiceImpl.java index 57f37c8..329a255 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyEmergencyServiceImpl.java +++ b/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 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() {{ @@ -60,9 +75,22 @@ public class ImsDutyEmergencyServiceImpl extends BaseServiceImpl queryWrapper = getQueryWrapper(imsDutyEmergencyVo); IPage imsDutyEmergencyEntityIPage = baseMapper.selectPage(Condition.getPage(query), queryWrapper); + List records = imsDutyEmergencyEntityIPage.getRecords(); + List collect ; + if (CollectionUtils.isNotEmpty(records)){ + collect= records.stream().map(sig -> { + R user = userClient.userInfoById(sig.getRegistrant()); + sig.setRegistrantName(user.getData().getName()); + R 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 getQueryWrapper(ImsDutyEmergencyVo imsDutyEmergencyVo) { QueryWrapper queryWrapper = new QueryWrapper(); if (ObjectUtils.isNotEmpty(imsDutyEmergencyVo.getId())) {