|
|
@ -1,8 +1,7 @@ |
|
|
|
package com.hnac.hzims.operational.duty.service.impl; |
|
|
|
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.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.entity.AnalyseExample; |
|
|
|
import com.hnac.hzims.operational.duty.mapper.ImsAnalyseExampleMapper; |
|
|
|
import com.hnac.hzims.operational.duty.mapper.ImsAnalyseExampleMapper; |
|
|
|
import com.hnac.hzims.operational.duty.mapper.ImsDutyMainMapper; |
|
|
|
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.HzPage; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
import com.hnac.hzinfo.sdk.v5.analyse.AnalyseDataHandlerClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.analyse.AnalyseDataHandlerClient; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.v5.analyse.vo.AnalseInstanceVO; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils; |
|
|
|
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.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.springblade.core.tool.api.R; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -34,93 +35,81 @@ import java.util.List; |
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExampleMapper, AnalyseExample> implements IImsAnalyseExampleService { |
|
|
|
public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExampleMapper, AnalyseExample> implements IImsAnalyseExampleService { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private ImsDutyMainMapper imsDutyMainMapper; |
|
|
|
private ImsDutyMainMapper imsDutyMainMapper; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IAnalyseDataSearchClient searchClient; |
|
|
|
private IAnalyseDataSearchClient searchClient; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private AnalyseDataHandlerClient handlerClient; |
|
|
|
private AnalyseDataHandlerClient handlerClient; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据时间段+分析实例ID查询值班日志 |
|
|
|
* 根据时间段+分析实例ID查询值班日志 |
|
|
|
* @param analyzeDataCondition |
|
|
|
* |
|
|
|
|
|
|
|
* @param analyzeDataCondition |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition) { |
|
|
|
public R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition) { |
|
|
|
//设备ID:分析实例编码
|
|
|
|
//设备ID:分析实例编码
|
|
|
|
R<HzPage<AnalyzeDataList>> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); |
|
|
|
R<HzPage<AnalyzeDataList>> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition); |
|
|
|
|
|
|
|
|
|
|
|
return R.data(analyzeDataByAnalyzeCode); |
|
|
|
return R.data(analyzeDataByAnalyzeCode); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询值班日志模板 |
|
|
|
* 查询值班日志模板 |
|
|
|
* @param analyseExample |
|
|
|
* @param analyseExample |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R queryAnalyseExample(AnalyseExample analyseExample) { |
|
|
|
public R queryAnalyseExample(AnalyseExample analyseExample, Query query) { |
|
|
|
QueryWrapper<AnalyseExample> queryWrapper = getQueryWrapper(analyseExample); |
|
|
|
QueryWrapper<AnalyseExample> queryWrapper = getQueryWrapper(analyseExample); |
|
|
|
List<AnalyseExample> analyseExamples = baseMapper.selectList(queryWrapper); |
|
|
|
IPage<AnalyseExample> analyseExamples = this.page(Condition.getPage(query), queryWrapper); |
|
|
|
if (CollectionUtils.isNotEmpty(analyseExamples)){ |
|
|
|
return R.data(analyseExamples); |
|
|
|
return R.data(analyseExamples); |
|
|
|
} |
|
|
|
}else { |
|
|
|
|
|
|
|
return R.success("暂无数据"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R getAnalyseId(String projectId) { |
|
|
|
public R getAnalyseId(String projectId) { |
|
|
|
Result result = handlerClient.analyseInstanceByProjectId(projectId); |
|
|
|
Result result = handlerClient.analyseInstanceByProjectId(projectId); |
|
|
|
String data = result.getData().toString(); |
|
|
|
List<AnalseInstanceVO> data = new ArrayList<>(); |
|
|
|
String s="11111111111111"; |
|
|
|
if (ObjectUtils.isNotEmpty(result.getData())) { |
|
|
|
Result result1 = handlerClient.analyseByAnalyseAttr(s); |
|
|
|
data = (List<AnalseInstanceVO>) result.getData(); |
|
|
|
String data2 = result1.getData().toString(); |
|
|
|
} |
|
|
|
System.out.println(data2); |
|
|
|
// 根据实例code拿到分析实例物模型
|
|
|
|
// if ()
|
|
|
|
// String s="11111111111111";
|
|
|
|
return R.data(data); |
|
|
|
// Result result1 = handlerClient.analyseByAnalyseAttr(s);
|
|
|
|
} |
|
|
|
// String data2 = result1.getData().toString();
|
|
|
|
|
|
|
|
return R.data(data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 生成值班日志模板 |
|
|
|
* 生成值班日志模板 |
|
|
|
* @param analyseExample |
|
|
|
* @param analyseExample |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R updateAnalyseExample(AnalyseExample analyseExample) { |
|
|
|
public R updateAnalyseExample(AnalyseExample analyseExample) { |
|
|
|
AnalyseExample entity = baseMapper.selectOne(new LambdaQueryWrapper<AnalyseExample>() {{ |
|
|
|
this.saveOrUpdate(analyseExample); |
|
|
|
eq(AnalyseExample::getClassId, analyseExample.getClassId()); |
|
|
|
return R.success("保存成功"); |
|
|
|
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) { |
|
|
|
private QueryWrapper<AnalyseExample> getQueryWrapper(AnalyseExample analyseExample) { |
|
|
|
QueryWrapper<AnalyseExample> queryWrapper = new QueryWrapper(); |
|
|
|
QueryWrapper<AnalyseExample> queryWrapper = new QueryWrapper(); |
|
|
|
if (ObjectUtils.isNotEmpty(analyseExample.getId())) { |
|
|
|
if (ObjectUtils.isNotEmpty(analyseExample.getId())) { |
|
|
|
queryWrapper.lambda().eq(AnalyseExample::getId, analyseExample.getId()); |
|
|
|
queryWrapper.lambda().eq(AnalyseExample::getId, analyseExample.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtils.isNotEmpty(analyseExample.getClassName())) { |
|
|
|
if (ObjectUtils.isNotEmpty(analyseExample.getSiteName())) { |
|
|
|
queryWrapper.lambda().like(AnalyseExample::getClassName, analyseExample.getClassName()); |
|
|
|
queryWrapper.lambda().like(AnalyseExample::getSiteName, analyseExample.getSiteName()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtils.isNotEmpty(analyseExample.getEquipmentId())) { |
|
|
|
if (ObjectUtils.isNotEmpty(analyseExample.getEquipmentId())) { |
|
|
|
queryWrapper.lambda().eq(AnalyseExample::getEquipmentId, analyseExample.getEquipmentId()); |
|
|
|
queryWrapper.lambda().eq(AnalyseExample::getEquipmentId, analyseExample.getEquipmentId()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtils.isNotEmpty(analyseExample.getAnalyseId())) { |
|
|
|
if (ObjectUtils.isNotEmpty(analyseExample.getDeviceCode())) { |
|
|
|
queryWrapper.lambda().eq(AnalyseExample::getAnalyseId, analyseExample.getAnalyseId()); |
|
|
|
queryWrapper.lambda().eq(AnalyseExample::getDeviceCode, analyseExample.getDeviceCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
return queryWrapper; |
|
|
|
return queryWrapper; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|