Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 2 years ago
parent
commit
bbf2471708
  1. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/entity/AnalyseExample.java
  2. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyEmergencyVo.java
  3. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java
  4. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/mapper/ImsAnalyseExampleMapper.xml
  5. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsAnalyseExampleService.java
  6. 147
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java
  7. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyEmergencyServiceImpl.java

6
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 * 站点ID
*/ */
@ApiModelProperty(value = "站点ID") @ApiModelProperty(value = "站点ID")
private Long classId; private Long siteId;
/** /**
* 站点名称 * 站点名称
*/ */
@ApiModelProperty(value = "站点名称") @ApiModelProperty(value = "站点名称")
private String className; private String siteName;
/** /**
* 设备ID * 设备ID
*/ */
@ -52,7 +52,7 @@ public class AnalyseExample extends TenantEntity {
* 分析实例ID * 分析实例ID
*/ */
@ApiModelProperty(value = "分析实例ID") @ApiModelProperty(value = "分析实例ID")
private Long analyseId; private Long deviceCode;
/** /**
* 分析实例名称 * 分析实例名称
*/ */

8
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) @DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME) @JsonFormat(pattern = DateUtil.PATTERN_DATE)
@ApiModelProperty(value = "值班开始日期") @ApiModelProperty(value = "值班开始日期")
private Date dutyStartTime; private Date dutyStartTime;
/** /**
* 值班结束日期 * 值班结束日期
*/ */
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME) @DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME) @JsonFormat(pattern = DateUtil.PATTERN_DATE)
@ApiModelProperty(value = "值班结束日期") @ApiModelProperty(value = "值班结束日期")
private Date dutyEndTime; private Date dutyEndTime;
/** /**

15
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") @PostMapping("/queryEmergency")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "查询突发事件记录", notes = "传入imsDutyEmergencyEntity") @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); return iImsDutyEmergencyService.queryEntity(imsDutyEmergencyVo,query);
} }
@ -274,8 +274,17 @@ public class ImsDutyRecController extends BladeController {
@PostMapping("/queryAnalyseExample") @PostMapping("/queryAnalyseExample")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "查询分析实例模板", notes = "传入analyseExample") @ApiOperation(value = "查询分析实例模板", notes = "传入analyseExample")
public R queryAnalyseExample( AnalyseExample analyseExample) { public R queryAnalyseExample( AnalyseExample analyseExample,Query query) {
return iImsAnalyseExampleService.queryAnalyseExample(analyseExample); 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 * 查询分析实例Id

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

@ -4,11 +4,11 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="ims_duty_recResultMap" type="com.hnac.hzims.operational.duty.entity.AnalyseExample"> <resultMap id="ims_duty_recResultMap" type="com.hnac.hzims.operational.duty.entity.AnalyseExample">
<result column="ID" property="id"/> <result column="ID" property="id"/>
<result column="CLASS_ID" property="classId"/> <result column="SITE_ID" property="siteId"/>
<result column="CLASS_NAME" property="className"/> <result column="SITE_NAME" property="siteName"/>
<result column="EQUIPMENT_ID" property="equipmentId"/> <result column="EQUIPMENT_ID" property="equipmentId"/>
<result column="EQUIPMENT_NAME" property="equipmentName"/> <result column="EQUIPMENT_NAME" property="equipmentName"/>
<result column="ANALYSE_ID" property="analyseId"/> <result column="DEVICE_CODE" property="deviceCode"/>
<result column="ANALYSE_NAME" property="analyseName"/> <result column="ANALYSE_NAME" property="analyseName"/>
<result column="PROPERTY_IDS" property="propertyIds"/> <result column="PROPERTY_IDS" property="propertyIds"/>
</resultMap> </resultMap>

4
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 com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.mp.support.Query;
/** /**
* 服务类 * 服务类
@ -18,7 +18,7 @@ public interface IImsAnalyseExampleService extends BaseService<AnalyseExample> {
R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition); R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition);
R queryAnalyseExample(AnalyseExample analyseExample); R queryAnalyseExample(AnalyseExample analyseExample,Query query);
R getAnalyseId(String projectId); R getAnalyseId(String projectId);

147
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; 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;
} }
} }

2
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; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; 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.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

Loading…
Cancel
Save