diff --git a/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java index ba86f10..0318679 100644 --- a/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java +++ b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java @@ -3,6 +3,7 @@ package com.hnac.hzims.spare.feign; import com.hnac.hzims.operational.census.vo.AreaTimelyVo; import com.hnac.hzims.spare.entity.*; import com.hnac.hzims.spare.vo.ExceedVo; +import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzims.spare.vo.WtSpBasicVO; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; @@ -23,6 +24,8 @@ public interface ISpareClient { String EXCEED_LIMIT = API_PREFIX + "/exceedLimit" ; + String SPARE_PART = API_PREFIX + "/sparePart" ; + /** * 保存工单与出库单关联信息 * @param recordEntity @@ -33,4 +36,7 @@ public interface ISpareClient { @PostMapping(EXCEED_LIMIT) List exceedLimit(@RequestParam("deptId") Long deptId); + + @GetMapping(EXCEED_LIMIT) + List sparePart(@RequestParam("basics") List basics); } diff --git a/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClientFallback.java b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClientFallback.java index 6a55a8e..35e052e 100644 --- a/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClientFallback.java +++ b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClientFallback.java @@ -2,6 +2,7 @@ package com.hnac.hzims.spare.feign; import com.hnac.hzims.operational.census.vo.AreaTimelyVo; import com.hnac.hzims.spare.entity.*; +import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzims.spare.vo.WtSpBasicVO; import org.springblade.core.tool.api.R; import org.springframework.stereotype.Component; @@ -24,4 +25,9 @@ public class ISpareClientFallback implements ISpareClient { public List exceedLimit(Long deptId) { return new ArrayList<>(); } + + @Override + public List sparePart(List basics) { + return new ArrayList<>(); + } } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/SparePartVO.java b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SparePartVO.java similarity index 86% rename from hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/SparePartVO.java rename to hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SparePartVO.java index d97b830..52ca7de 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/SparePartVO.java +++ b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SparePartVO.java @@ -1,4 +1,4 @@ -package com.hnac.hzims.equipment.vo; +package com.hnac.hzims.spare.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -9,6 +9,10 @@ import lombok.Data; */ @Data public class SparePartVO { + + @ApiModelProperty(value = "物资类别编号") + private Long basicId; + @ApiModelProperty(value = "设备名称") private String emName; diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java index 235ccdc..084f3b0 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java @@ -82,6 +82,8 @@ public interface IEmInfoClient { String GET_EM_CREATE_TABLE = API_PREFIX + "/getEmCreateTable"; String GET_VIDEO_DEVICE_BY_EM_CODE = API_PREFIX + "/getVideoDeviceByEmCode"; + String DEVICE_BY_PATH = API_PREFIX + "/deviceByPath"; + @PostMapping(DETAIL) EmInfoEntity getByCode(@RequestParam("code") String id); @@ -161,4 +163,7 @@ public interface IEmInfoClient { @GetMapping(value = GET_VIDEO_DEVICE_BY_EM_CODE) List getVideoDeviceByEmCode(EmInfoEntity emInfo); + + @GetMapping(DEVICE_BY_PATH) + List deviceByPath(@RequestParam("emCode") String emCode); } diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java index 02ccc38..9239354 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java @@ -104,4 +104,9 @@ public class IEmInfoClientBack implements IEmInfoClient { public List getVideoDeviceByEmCode(EmInfoEntity emInfo) { return new ArrayList<>(); } + + @Override + public List deviceByPath(String emCode) { + return new ArrayList<>(); + } } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClientFallback.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClientFallback.java new file mode 100644 index 0000000..7acb56b --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClientFallback.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.operational.access.feign; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.operational.access.vo.MaterialConsumeVO; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author ysj + */ +@Component +public class AccessMaterialClientFallback implements IAccessMaterialClient { + + @Override + public List materialConsume(List basics) { + return new ArrayList<>(); + } +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessMaterialClient.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessMaterialClient.java new file mode 100644 index 0000000..f77298c --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessMaterialClient.java @@ -0,0 +1,28 @@ +package com.hnac.hzims.operational.access.feign; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.operational.OperationalConstants; +import com.hnac.hzims.operational.access.vo.MaterialConsumeVO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + * @author ysj + */ +@FeignClient( + value = OperationalConstants.APP_NAME, + fallback = AccessMaterialClientFallback.class +) +public interface IAccessMaterialClient { + + String API_PREFIX = "/feign/accessMaterial"; + + String MATERIAL_CONSUME = API_PREFIX + "/materialConsume"; + + @GetMapping(MATERIAL_CONSUME) + List materialConsume(@RequestParam("basics") List basics); +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/vo/MaterialConsumeVO.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/vo/MaterialConsumeVO.java new file mode 100644 index 0000000..ed1c28f --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/vo/MaterialConsumeVO.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.operational.access.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author ysj + */ +@Data +public class MaterialConsumeVO { + + @ApiModelProperty(value = "物资编号") + private Long basicId; + + @ApiModelProperty(value = "消耗数量") + private Integer expend; +} diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java index 4711db9..7eaa129 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java @@ -6,6 +6,7 @@ import com.hnac.hzims.spare.entity.*; import com.hnac.hzims.spare.mapper.SpRecordMapper; import com.hnac.hzims.spare.mapper.SpWarehouseOutMapper; import com.hnac.hzims.spare.service.*; +import com.hnac.hzims.spare.vo.SparePartVO; import lombok.RequiredArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -129,4 +130,14 @@ public class SpareClient implements ISpareClient{ } return exceeds; } + + /** + * 备品备件台账 + * @param basics + * @return + */ + @Override + public List sparePart(List basics) { + return wtSpBasicService.sparePart(basics); + } } diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java index 74bf8bb..3ec89f4 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java @@ -2,9 +2,11 @@ package com.hnac.hzims.spare.mapper; import com.hnac.hzims.spare.entity.SpTemporaryStockDetailEntity; import com.hnac.hzims.spare.entity.WtSpBasicEntity; +import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzims.spare.vo.WtSpBasicVO; import org.springblade.core.datascope.annotation.UserDataAuth; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; import java.util.Map; @@ -46,4 +48,5 @@ public interface WtSpBasicMapper extends UserDataScopeBaseMapper getInList(Long spBasicId); + List sparePart(@RequestParam("basics") List basics); } diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml index d832b9d..7db89ac 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml @@ -94,4 +94,20 @@ AND b.type = 5 + + diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/IWtSpBasicService.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/IWtSpBasicService.java index 64fcef5..0bf27a7 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/IWtSpBasicService.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/IWtSpBasicService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.spare.entity.SpTemporaryStockDetailEntity; import com.hnac.hzims.spare.entity.SpTemporaryStockEntity; import com.hnac.hzims.spare.entity.WtSpBasicEntity; +import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzims.spare.vo.WtSpBasicVO; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; @@ -73,6 +74,8 @@ public interface IWtSpBasicService extends BaseService { R importExcel(MultipartFile file) throws Exception; + List sparePart(List basics); + /** * 获取流程中的用户 * @param deptId diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java index 8955c81..6f40e06 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java @@ -29,6 +29,7 @@ import com.hnac.hzims.spare.service.IWtSpTotalService; import com.hnac.hzims.spare.service.IWtSpWarehouseService; import com.hnac.hzims.spare.utils.ExcelToolListener; import com.hnac.hzims.spare.utils.SheetWriteStyleHandler; +import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzims.spare.vo.WtSpBasicVO; import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; @@ -580,6 +581,11 @@ public class WtSpBasicServiceImpl extends BaseServiceImpl sparePart(List basics) { + return this.basicMapper.sparePart(basics); + } + private InputStream copyStream(InputStream source) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; diff --git a/hzims-service/equipment/pom.xml b/hzims-service/equipment/pom.xml index 90808d8..e2286e6 100644 --- a/hzims-service/equipment/pom.xml +++ b/hzims-service/equipment/pom.xml @@ -98,6 +98,10 @@ com.hnac.hzims inspect-api + + com.hnac.hzims + assets-api + diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java index 92ab91d..e1346c1 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java @@ -10,14 +10,13 @@ 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; import com.hnac.hzims.equipment.vo.EmInfoVO; -import com.hnac.hzims.equipment.vo.SparePartVO; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; +import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzims.util.MemoryPagination; import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import io.swagger.annotations.Api; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java index fbbef97..ca0e5f3 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java @@ -9,11 +9,16 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.service.IEmInfoService; import com.hnac.hzims.equipment.vo.DeviceVO; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.vo.CreateTableVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -131,6 +136,17 @@ public class EmInfoClient implements IEmInfoClient { public List getVideoDeviceByEmCode(EmInfoEntity emInfo) { return service.getVideoDeviceByEmCode(emInfo); } + + /** + * 获取设备路径下的设备 + * @param emCode + * @return + */ + @Override + public List deviceByPath(String emCode) { + return service.deviceByPath(emCode); + } + @PostMapping(GET_EM_CREATE_TABLE) @Override public List getEmCreateTable(List tableNames) { diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java index 3f2cb5c..f9b826b 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java @@ -4,7 +4,7 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.vo.EmInfoExtendVo; import com.hnac.hzims.equipment.vo.DeviceVO; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; -import com.hnac.hzims.equipment.vo.SparePartVO; +import com.hnac.hzims.spare.vo.SparePartVO; import org.apache.ibatis.annotations.Param; import org.springblade.core.datascope.annotation.UserDataAuth; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml index 7b3e34f..e9d738a 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml @@ -120,7 +120,7 @@ select max(em_index) from hzims_em_info where DEPARTMENT = #{department} and em_grade = #{emGrade} and is_deleted = 0 - select info.`NAME` as emName,house.`NAME` as houseName,basic.`NAME` as basicName, mat.number as expend,basic.UPPER_LIMIT,basic.LOWER_LIMIT,total.stock from hzims_em_info info diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java index 8562541..e3527c3 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.equipment.dto.DeviceTreeDTO; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.vo.*; +import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import org.springblade.core.mp.base.BaseService; import org.springblade.core.tool.api.R; @@ -91,4 +92,6 @@ public interface IEmInfoService extends BaseService { List getVideoDeviceByEmCode(EmInfoEntity emInfo); List hkVideoDevices(); + + List deviceByPath(String emCode); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java index cadc489..c796b39 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java @@ -17,9 +17,13 @@ import com.hnac.hzims.equipment.mapper.EmInfoNoScopeMapper; import com.hnac.hzims.equipment.service.*; import com.hnac.hzims.equipment.vo.*; 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.station.entity.StationEntity; 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.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; @@ -87,12 +91,17 @@ public class EmInfoServiceImpl extends BaseServiceImpl getSparePart(String emCode, String startTime, String endTime) { - EmInfoEntity emInfo = this.getEmInfoByEmCode(emCode); - return baseMapper.getSparePart(emInfo.getPath(), startTime, endTime); + // 查询路径设备 + List devices = deviceByPath(emCode); + if(CollectionUtil.isEmpty(devices)){ + return new ArrayList<>(); + } + // 物资台账记录 + List trees = devices.stream().map(EmInfoEntity::getTreeId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(trees)){ + return new ArrayList<>(); + } + List treeBasics = emTreeBasicService.list(Wrappers.lambdaQuery() + .in(EmTreeBasicEntity::getTreeId,trees)); + if(CollectionUtil.isEmpty(treeBasics)){ + return new ArrayList<>(); + } + List basics = treeBasics.stream().map(EmTreeBasicEntity::getBasicId).filter(ObjectUtil::isNotEmpty).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(basics)){ + return new ArrayList<>(); + } + // 仓库、物资种类、库存上限、库存下限、物资库存 + List spares = spareClient.sparePart(basics); + if(CollectionUtil.isEmpty(spares)){ + return new ArrayList<>(); + } + // 物资消耗 + List consumes = accessMaterialClient.materialConsume(basics); + return spares.stream().peek(spare -> { + List 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 deviceBasics = treeBasics.stream().filter(tree->tree.getBasicId().equals(spare.getBasicId())).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(deviceBasics)){ + spare.setEmName("未知设备"); + }else{ + List 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 @@ -911,4 +971,23 @@ public class EmInfoServiceImpl extends BaseServiceImpl deviceByPath(String emCode) { + EmInfoEntity device = this.getOne(Wrappers.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.lambdaQuery().in(EmInfoEntity::getNumber, Arrays.asList(deviceCodes))); + } + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClient.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClient.java new file mode 100644 index 0000000..803857f --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClient.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.operational.access.feign; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.operational.access.service.AccessPlanV4Service; +import com.hnac.hzims.operational.access.service.IOperAccessMaterialService; +import com.hnac.hzims.operational.access.vo.MaterialConsumeVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author ysj + */ +@RestController +@RequestMapping("/feign/accessMaterial") +@Slf4j +@RequiredArgsConstructor +public class AccessMaterialClient implements IAccessMaterialClient { + + private final IOperAccessMaterialService accessMaterialService; + + /** + * 备品备件台账-物资消耗 + * @param basics + * @return + */ + @Override + public List materialConsume(@RequestParam("basics") List basics) { + return accessMaterialService.materialConsume(basics); + } +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.java index a7c726c..d68d1f1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.java @@ -2,6 +2,7 @@ package com.hnac.hzims.operational.access.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity; +import com.hnac.hzims.operational.access.vo.MaterialConsumeVO; import org.apache.ibatis.annotations.Param; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; @@ -17,4 +18,6 @@ import java.util.List; public interface OperAccessMaterialMapper extends BaseMapper { List getList(@Param(value = "planId") String planId,@Param(value = "taskId") String taskId); + + List materialConsume(@Param(value = "basics") List basics); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml index 60ead9a..1310abb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml @@ -39,4 +39,19 @@ + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java index b45f846..9cb87d3 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java @@ -41,5 +41,5 @@ public interface OperAccessTaskMapper extends UserDataScopeBaseMapper selectAccessTask(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("list")List list); - List getRepairBill(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime); + List getRepairBill(@Param("deviceCodes") List deviceCodes,@Param("startTime") String startTime, @Param("endTime") String endTime); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml index 4606b2d..7810d05 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml @@ -207,15 +207,17 @@