Browse Source

设备定义列表倒序排序

设备信息导入名称逻辑调整
设备信息添加树结构查询接口
设备信息查看巡检内容接口添加返回字段
zhongwei
tanghaihao 1 year ago
parent
commit
abb11eb117
  1. 9
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java
  2. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmTreeEntity.java
  3. 1
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmDefinitionController.java
  4. 47
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  5. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java
  6. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml
  7. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  8. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/EmInfoContentVO.java

9
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmInfoEntity.java

@ -127,12 +127,17 @@ public class EmInfoEntity extends TenantEntity {
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long manager;
/**
* 设备等级01一类设备02二类设备03三类设备
* 设备类别01一类设备02二类设备03三类设备
*/
@ApiModelProperty(value = "设备等级(01:一类设备,02:二类设备,03:三类设备)")
@ApiModelProperty(value = "设备类别(01:一类设备,02:二类设备,03:三类设备)")
@EnumValue(strValues = {"01", "02", "03"}, message = "值只能为01、02、03")
private String gradeCode;
/**
*设备等级0一级设备1二级设备2三级设备
*/
@ApiModelProperty(value = "设备等级(0:一级设备,1:二级设备,2:三级设备)")
private Integer emGrade;
/**
* 安装时间
*/
@ApiModelProperty(value = "安装时间")

2
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmTreeEntity.java

@ -51,7 +51,7 @@ public class EmTreeEntity extends TenantEntity {
@ApiModelProperty(value = "所属组织")
private Long refOreanization;
@ApiModelProperty(value = "设备等级")
@ApiModelProperty(value = "设备等级(0:一级设备,1:二级设备,2:三级设备)")
private Integer emGrade;
@ApiModelProperty(value = "巡检标准")

1
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmDefinitionController.java

@ -65,6 +65,7 @@ public class EmDefinitionController extends BladeController {
if (Func.isNotEmpty(emDefinition.getStatus())) {
wrapper.eq(EmDefinitionEntity::getStatus, emDefinition.getStatus());
}
wrapper.orderByDesc(EmDefinitionEntity::getCreateTime);
IPage<EmDefinitionEntity> pages = emDefinitionService.page(Condition.getPage(query), wrapper);
for (EmDefinitionEntity definition : pages.getRecords()) {
User createUser = UserCache.getUser(definition.getCreateUser());

47
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java

@ -9,6 +9,7 @@ import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.equipment.dto.DeviceTreeDTO;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.EmTreeEntity;
import com.hnac.hzims.equipment.service.IEmInfoService;
import com.hnac.hzims.equipment.vo.EmInfoAddVo;
import com.hnac.hzims.equipment.vo.EmInfoContentVO;
@ -35,6 +36,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.*;
import java.util.stream.Collectors;
/**
* 设备控制器
@ -176,6 +178,51 @@ public class EmInfoController extends BladeController {
}
/**
* 获取所有设备列表(树结构)
* @param refDept 站点机构
* @param name 设备名称
* @return
*/
@ApiLog
@RequestMapping(value = "/getEmInfoTreeList")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "获取所有设备列表(树结构)", notes = "传入设备id")
public R<List<EmInfoEntity>> getEmInfoTreeList(Long refDept, String name) {
List<EmInfoEntity> resultList = new ArrayList<>();
LambdaQueryWrapper<EmInfoEntity> wrapper = new LambdaQueryWrapper<>();
if (Func.isNotEmpty(refDept)) {
wrapper.eq(EmInfoEntity::getDepartment, refDept);
}
if (Func.isNotEmpty(name)) {
wrapper.like(EmInfoEntity::getName, name);
}
List<EmInfoEntity> list = em_infoService.list(wrapper);
if (Func.isNotEmpty(name)) {
for (EmInfoEntity emInfo : list) {
LambdaQueryWrapper<EmInfoEntity> sonWrapper = new LambdaQueryWrapper<>();
sonWrapper.likeRight(EmInfoEntity::getPath, emInfo.getPath());
List<EmInfoEntity> sonList = em_infoService.list(sonWrapper);
// 把List结构数据转换成树结构
Map<Long, List<EmInfoEntity>> emInfoMap = sonList.stream().collect(Collectors.groupingBy(EmInfoEntity::getGpid));
sonList.forEach(emTree -> {
emTree.setInfoChildren(emInfoMap.get(emTree.getId()));
});
sonList = sonList.stream().filter(item -> item.getGpid().equals(emInfo.getGpid())).collect(Collectors.toList());
resultList.addAll(sonList);
}
} else {
// 把List结构数据转换成树结构
Map<Long, List<EmInfoEntity>> emInfoMap = list.stream().collect(Collectors.groupingBy(EmInfoEntity::getGpid));
list.forEach(emTree -> {
emTree.setInfoChildren(emInfoMap.get(emTree.getId()));
});
resultList = list.stream().filter(item -> item.getGpid().equals(0L)).collect(Collectors.toList());
}
return R.data(resultList);
}
/**
* 新增
*/
@PostMapping("/save")

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java

@ -50,7 +50,7 @@ public interface EmInfoMapper extends UserDataScopeBaseMapper<EmInfoEntity> {
List<DeviceVO> listByTenantId(@Param("tenantId") String tenantId);
Integer getMaxEmIndexByPid(@Param("pid") Long pid);
Integer getMaxEmIndexByPid(@Param("department") Long department, @Param("emGrade") Integer emGrade);
List<SparePartVO> getSparePart(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml

@ -117,7 +117,7 @@
</select>
<select id="getMaxEmIndexByPid" resultType="java.lang.Integer">
select max(em_index) from hzims_em_info where GPID = #{pid}
select max(em_index) from hzims_em_info where DEPARTMENT = #{department} and em_grade = #{emGrade}
</select>
<select id="getSparePart" resultType="com.hnac.hzims.equipment.vo.SparePartVO">

8
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -519,6 +519,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
@Override
public List<EmInfoContentVO> getEmInfoContent(String emCode, ContentDTO dto) {
EmInfoEntity emInfo = getEmInfoByEmCode(emCode);
List<EmInfoContentVO> emInfoContentList = new ArrayList<>();
ProjectContentRequest request = new ProjectContentRequest();
request.setCurrent(1);
@ -555,7 +556,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
for (ContentVO content : contentVOList) {
EmInfoContentVO vo = new EmInfoContentVO();
BeanUtils.copyProperties(content, vo);
vo.setEmName(emInfo.getName());
if (Func.isNotEmpty(childrenMap)) {
DeviceChildrenVO deviceChildrenVO = childrenMap.get(vo.getAttrSignage());
vo.setInstanceFacDeviceId(Optional.ofNullable(deviceChildrenVO).map(DeviceChildrenVO::getRealId).orElse(null));//deviceChildrenVO.getRealId()
@ -776,18 +777,19 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
emInfo.setInstallTime(new Date());
emInfo.setRunStatus("1");
emInfo.setStatus(1);
emInfo.setHomePageDisplay("1");
emInfo.setRunDate(new Date());
emInfo.setCreateDept(station.getRefDept());
emInfo.setCreateTime(new Date());
emInfo.setCreateUser(AuthUtil.getUserId());
if (SET_TYPE.equals(emInfo.getEmType())) {
Integer maxIndex = baseMapper.getMaxEmIndexByPid(pid);
Integer maxIndex = baseMapper.getMaxEmIndexByPid(emInfo.getDepartment(), emInfo.getEmGrade());
if (Func.isNotEmpty(maxIndex)) {
emInfo.setEmIndex(maxIndex + 1);
} else {
emInfo.setEmIndex(1);
}
emInfo.setName(emInfo.getEmIndex() + "号机组");
emInfo.setName(emTree.getName() + emInfo.getEmIndex() + "号机组");
}
this.save(emInfo);
LambdaQueryWrapper<EmTreeParamEntity> treeParamWrapper = new LambdaQueryWrapper();

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/EmInfoContentVO.java

@ -11,6 +11,8 @@ import lombok.Data;
@Data
public class EmInfoContentVO {
private Long id;
@ApiModelProperty(value = "内容编码")
private String code;

Loading…
Cancel
Save