From a446977615f9804122d5ebbaaf9466c00ea2ebe2 Mon Sep 17 00:00:00 2001 From: tyty Date: Sat, 8 Apr 2023 15:58:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=80=BC=E7=8F=AD=E6=97=A5?= =?UTF-8?q?=E5=BF=97=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 | 6 +- .../operational/duty/vo/ImsDutyEmergencyVo.java | 8 +- .../duty/controller/ImsDutyRecController.java | 15 ++- .../duty/mapper/ImsAnalyseExampleMapper.xml | 6 +- .../duty/service/IImsAnalyseExampleService.java | 4 +- .../service/impl/ImsAnalyseExampleServiceImpl.java | 147 ++++++++++----------- .../service/impl/ImsDutyEmergencyServiceImpl.java | 2 +- 7 files changed, 93 insertions(+), 95 deletions(-) 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 index debcfdb..0f1f43e 100644 --- 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 @@ -31,12 +31,12 @@ public class AnalyseExample extends TenantEntity { * 站点ID */ @ApiModelProperty(value = "站点ID") - private Long classId; + private Long siteId; /** * 站点名称 */ @ApiModelProperty(value = "站点名称") - private String className; + private String siteName; /** * 设备ID */ @@ -52,7 +52,7 @@ public class AnalyseExample extends TenantEntity { * 分析实例ID */ @ApiModelProperty(value = "分析实例ID") - private Long analyseId; + private Long deviceCode; /** * 分析实例名称 */ diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyEmergencyVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyEmergencyVo.java index bc4c837..7ea37b6 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyEmergencyVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyEmergencyVo.java @@ -27,15 +27,15 @@ public class ImsDutyEmergencyVo 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 dutyStartTime; /** * 值班结束日期 */ - @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) - @JsonFormat(pattern = DateUtil.PATTERN_DATETIME) + @DateTimeFormat(pattern = DateUtil.PATTERN_DATE) + @JsonFormat(pattern = DateUtil.PATTERN_DATE) @ApiModelProperty(value = "值班结束日期") private Date dutyEndTime; /** 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 703b6ee..c9866b4 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 @@ -254,7 +254,7 @@ public class ImsDutyRecController extends BladeController { @PostMapping("/queryEmergency") @ApiOperationSupport(order = 6) @ApiOperation(value = "查询突发事件记录", notes = "传入imsDutyEmergencyEntity") - public R queryEmergency( ImsDutyEmergencyVo imsDutyEmergencyVo,Query query) { + public R queryEmergency( @Valid @RequestBody ImsDutyEmergencyVo imsDutyEmergencyVo,Query query) { return iImsDutyEmergencyService.queryEntity(imsDutyEmergencyVo,query); } @@ -274,8 +274,17 @@ public class ImsDutyRecController extends BladeController { @PostMapping("/queryAnalyseExample") @ApiOperationSupport(order = 6) @ApiOperation(value = "查询分析实例模板", notes = "传入analyseExample") - public R queryAnalyseExample( AnalyseExample analyseExample) { - return iImsAnalyseExampleService.queryAnalyseExample(analyseExample); + public R queryAnalyseExample( AnalyseExample analyseExample,Query query) { + return iImsAnalyseExampleService.queryAnalyseExample(analyseExample,query); + } + /** + * 删除分析实例模板 + */ + @PostMapping("/deleteAnalyseExample") + @ApiOperationSupport(order = 6) + @ApiOperation(value = "删除分析实例模板", notes = "传入analyseExample") + public R deleteAnalyseExample(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { + return R.status(iImsAnalyseExampleService.deleteLogic(Func.toLongList(ids))); } /** * 查询分析实例Id 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 index 493bca2..929eacf 100644 --- 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 @@ -4,11 +4,11 @@ - - + + - + 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 index 60e0922..830a136 100644 --- 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 @@ -4,7 +4,7 @@ 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; - +import org.springblade.core.mp.support.Query; /** * 服务类 @@ -18,7 +18,7 @@ public interface IImsAnalyseExampleService extends BaseService { R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition); - R queryAnalyseExample(AnalyseExample analyseExample); + R queryAnalyseExample(AnalyseExample analyseExample,Query query); R getAnalyseId(String projectId); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java index 53ec84b..8b415b6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java @@ -1,8 +1,7 @@ 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.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.operational.duty.entity.AnalyseExample; import com.hnac.hzims.operational.duty.mapper.ImsAnalyseExampleMapper; import com.hnac.hzims.operational.duty.mapper.ImsDutyMainMapper; @@ -13,16 +12,18 @@ 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 com.hnac.hzinfo.sdk.v5.analyse.vo.AnalseInstanceVO; 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.mp.support.Condition; +import org.springblade.core.mp.support.Query; 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.ArrayList; import java.util.List; @@ -34,93 +35,81 @@ import java.util.List; @Slf4j @Service public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl implements IImsAnalyseExampleService { - @Resource - private ImsDutyMainMapper imsDutyMainMapper; - @Autowired - private IAnalyseDataSearchClient searchClient; - @Autowired - private AnalyseDataHandlerClient handlerClient; + @Resource + private ImsDutyMainMapper imsDutyMainMapper; + @Autowired + private IAnalyseDataSearchClient searchClient; + @Autowired + private AnalyseDataHandlerClient handlerClient; - /** + /** * 根据时间段+分析实例ID查询值班日志 - * @param analyzeDataCondition + * + * @param analyzeDataCondition * @return - */ - @Override - public R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition) { - //设备ID:分析实例编码 - R> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); + */ + @Override + public R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition) { + //设备ID:分析实例编码 + R> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); - return R.data(analyzeDataByAnalyzeCode); - } + 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 queryAnalyseExample(AnalyseExample analyseExample, Query query) { + QueryWrapper queryWrapper = getQueryWrapper(analyseExample); + IPage analyseExamples = this.page(Condition.getPage(query), queryWrapper); + return R.data(analyseExamples); + } - @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); - } + @Override + public R getAnalyseId(String projectId) { + Result result = handlerClient.analyseInstanceByProjectId(projectId); + List data = new ArrayList<>(); + if (ObjectUtils.isNotEmpty(result.getData())) { + data = (List) result.getData(); + } +// 根据实例code拿到分析实例物模型 +// String s="11111111111111"; +// Result result1 = handlerClient.analyseByAnalyseAttr(s); +// String data2 = result1.getData().toString(); + 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("保存成功"); - } + /** + * 生成值班日志模板 + * @param analyseExample + * @return + */ + @Override + public R updateAnalyseExample(AnalyseExample 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; - } + 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.getSiteName())) { + queryWrapper.lambda().like(AnalyseExample::getSiteName, analyseExample.getSiteName()); + } + if (ObjectUtils.isNotEmpty(analyseExample.getEquipmentId())) { + queryWrapper.lambda().eq(AnalyseExample::getEquipmentId, analyseExample.getEquipmentId()); + } + if (ObjectUtils.isNotEmpty(analyseExample.getDeviceCode())) { + queryWrapper.lambda().eq(AnalyseExample::getDeviceCode, analyseExample.getDeviceCode()); + } + 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 329a255..8067b69 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,5 +1,6 @@ package com.hnac.hzims.operational.duty.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -22,7 +23,6 @@ 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.ObjectUtil; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Autowired;