|
|
|
@ -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<ImsAnalyseExampleMapper, AnalyseExample> 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<HzPage<AnalyzeDataList>> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition) { |
|
|
|
|
//设备ID:分析实例编码
|
|
|
|
|
R<HzPage<AnalyzeDataList>> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); |
|
|
|
|
|
|
|
|
|
return R.data(analyzeDataByAnalyzeCode); |
|
|
|
|
} |
|
|
|
|
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 queryAnalyseExample(AnalyseExample analyseExample, Query query) { |
|
|
|
|
QueryWrapper<AnalyseExample> queryWrapper = getQueryWrapper(analyseExample); |
|
|
|
|
IPage<AnalyseExample> 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<AnalseInstanceVO> data = new ArrayList<>(); |
|
|
|
|
if (ObjectUtils.isNotEmpty(result.getData())) { |
|
|
|
|
data = (List<AnalseInstanceVO>) 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<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("保存成功"); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 生成值班日志模板 |
|
|
|
|
* @param analyseExample |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R updateAnalyseExample(AnalyseExample 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; |
|
|
|
|
} |
|
|
|
|
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.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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|