|
|
@ -17,9 +17,13 @@ import com.hnac.hzims.equipment.mapper.EmInfoNoScopeMapper; |
|
|
|
import com.hnac.hzims.equipment.service.*; |
|
|
|
import com.hnac.hzims.equipment.service.*; |
|
|
|
import com.hnac.hzims.equipment.vo.*; |
|
|
|
import com.hnac.hzims.equipment.vo.*; |
|
|
|
import com.hnac.hzims.fdp.service.IFdpQuestionService; |
|
|
|
import com.hnac.hzims.fdp.service.IFdpQuestionService; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.access.feign.IAccessMaterialClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.spare.feign.ISpareClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.spare.vo.SparePartVO; |
|
|
|
import com.hnac.hzims.util.TableJsonUtils; |
|
|
|
import com.hnac.hzims.util.TableJsonUtils; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; |
|
|
@ -87,12 +91,17 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IEmTreeInspectService emTreeInspectService; |
|
|
|
private IEmTreeInspectService emTreeInspectService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IEmTreeBasicService emTreeBasicService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IEmDefinitionService emDefinitionService; |
|
|
|
private IEmDefinitionService emDefinitionService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IAccessMaterialClient accessMaterialClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IStationClient stationClient; |
|
|
|
private IStationClient stationClient; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IAnalyseDataSearchClient searchClient; |
|
|
|
private IAnalyseDataSearchClient searchClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private ISpareClient spareClient; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private RedisTemplate redisTemplate; |
|
|
|
private RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
|
@ -563,10 +572,61 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit |
|
|
|
return emInfoContentList; |
|
|
|
return emInfoContentList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 备品备件台账 |
|
|
|
|
|
|
|
* @param emCode |
|
|
|
|
|
|
|
* @param startTime |
|
|
|
|
|
|
|
* @param endTime |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<SparePartVO> getSparePart(String emCode, String startTime, String endTime) { |
|
|
|
public List<SparePartVO> getSparePart(String emCode, String startTime, String endTime) { |
|
|
|
EmInfoEntity emInfo = this.getEmInfoByEmCode(emCode); |
|
|
|
// 查询路径设备
|
|
|
|
return baseMapper.getSparePart(emInfo.getPath(), startTime, endTime); |
|
|
|
List<EmInfoEntity> devices = deviceByPath(emCode); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(devices)){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 物资台账记录
|
|
|
|
|
|
|
|
List<Long> trees = devices.stream().map(EmInfoEntity::getTreeId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(trees)){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<EmTreeBasicEntity> treeBasics = emTreeBasicService.list(Wrappers.<EmTreeBasicEntity>lambdaQuery() |
|
|
|
|
|
|
|
.in(EmTreeBasicEntity::getTreeId,trees)); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(treeBasics)){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<Long> basics = treeBasics.stream().map(EmTreeBasicEntity::getBasicId).filter(ObjectUtil::isNotEmpty).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(basics)){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 仓库、物资种类、库存上限、库存下限、物资库存
|
|
|
|
|
|
|
|
List<SparePartVO> spares = spareClient.sparePart(basics); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(spares)){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 物资消耗
|
|
|
|
|
|
|
|
List<MaterialConsumeVO> consumes = accessMaterialClient.materialConsume(basics); |
|
|
|
|
|
|
|
return spares.stream().peek(spare -> { |
|
|
|
|
|
|
|
List<MaterialConsumeVO> spareConsumes = consumes.stream().filter(consume->consume.getBasicId().equals(spare.getBasicId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(spareConsumes)){ |
|
|
|
|
|
|
|
spare.setExpend(0); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
spare.setExpend(spareConsumes.get(0).getExpend()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 设备名称
|
|
|
|
|
|
|
|
List<EmTreeBasicEntity> deviceBasics = treeBasics.stream().filter(tree->tree.getBasicId().equals(spare.getBasicId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(deviceBasics)){ |
|
|
|
|
|
|
|
spare.setEmName("未知设备"); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
List<EmInfoEntity> deivceEntitys = devices.stream().filter(device->device.getTreeId().equals(deviceBasics.get(0).getTreeId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(deivceEntitys)){ |
|
|
|
|
|
|
|
spare.setEmName("未知设备"); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
spare.setEmName(deivceEntitys.get(0).getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -911,4 +971,23 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit |
|
|
|
.eq(EmInfoEntity::getEmType,4)); |
|
|
|
.eq(EmInfoEntity::getEmType,4)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 符合设备路径的设备 |
|
|
|
|
|
|
|
* @param emCode |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<EmInfoEntity> deviceByPath(String emCode) { |
|
|
|
|
|
|
|
EmInfoEntity device = this.getOne(Wrappers.<EmInfoEntity>lambdaQuery(). |
|
|
|
|
|
|
|
eq(EmInfoEntity::getNumber,emCode)); |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(device)){ |
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(StringUtil.isEmpty(device.getPath())){ |
|
|
|
|
|
|
|
return Collections.singletonList(device); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String[] deviceCodes = device.getPath().split("/"); |
|
|
|
|
|
|
|
return this.list(Wrappers.<EmInfoEntity>lambdaQuery().in(EmInfoEntity::getNumber, Arrays.asList(deviceCodes))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|