Browse Source

#设备档案

zhongwei
yang_shj 11 months ago
parent
commit
74f2439c63
  1. 6
      hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java
  2. 6
      hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClientFallback.java
  3. 6
      hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SparePartVO.java
  4. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  5. 5
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  6. 20
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClientFallback.java
  7. 28
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/feign/IAccessMaterialClient.java
  8. 17
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/vo/MaterialConsumeVO.java
  9. 11
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java
  10. 3
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java
  11. 16
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml
  12. 3
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/IWtSpBasicService.java
  13. 6
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java
  14. 4
      hzims-service/equipment/pom.xml
  15. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  16. 16
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  17. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.java
  18. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmInfoMapper.xml
  19. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmInfoService.java
  20. 85
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  21. 34
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/AccessMaterialClient.java
  22. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.java
  23. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml
  24. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java
  25. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
  26. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessMaterialService.java
  27. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessMaterialServiceImpl.java
  28. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  29. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/vo/RepairBillVO.java
  30. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java
  31. 12
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml
  32. 25
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
  33. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketBillVO.java

6
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<AreaTimelyVo> exceedLimit(@RequestParam("deptId") Long deptId);
@GetMapping(EXCEED_LIMIT)
List<SparePartVO> sparePart(@RequestParam("basics") List<Long> basics);
}

6
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<AreaTimelyVo> exceedLimit(Long deptId) {
return new ArrayList<>();
}
@Override
public List<SparePartVO> sparePart(List<Long> basics) {
return new ArrayList<>();
}
}

6
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/vo/SparePartVO.java → 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;

5
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<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo);
@GetMapping(DEVICE_BY_PATH)
List<EmInfoEntity> deviceByPath(@RequestParam("emCode") String emCode);
}

5
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<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo) {
return new ArrayList<>();
}
@Override
public List<EmInfoEntity> deviceByPath(String emCode) {
return new ArrayList<>();
}
}

20
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<MaterialConsumeVO> materialConsume(List<Long> basics) {
return new ArrayList<>();
}
}

28
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<MaterialConsumeVO> materialConsume(@RequestParam("basics") List<Long> basics);
}

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

11
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<SparePartVO> sparePart(List<Long> basics) {
return wtSpBasicService.sparePart(basics);
}
}

3
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<WtSpBasicEntity
@UserDataAuth
List<SpTemporaryStockDetailEntity> getInList(Long spBasicId);
List<SparePartVO> sparePart(@RequestParam("basics") List<Long> basics);
}

16
hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml

@ -94,4 +94,20 @@
AND b.type = 5
</select>
<select id="sparePart" resultType="com.hnac.hzims.spare.vo.SparePartVO">
SELECT basic.ID as basicId,house.`NAME` as houseName,basic.`NAME` as basicName,basic.UPPER_LIMIT,basic.LOWER_LIMIT,total.stock
FROM WT_SP_BASIC basic
LEFT JOIN WT_SP_TOTAL total ON basic.id = total.SP_BASIC_ID
LEFT JOIN WT_SP_WAREHOUSE house ON total.WAREHOUSE_ID = house.id
<where>
1 = 2 OR
<if test="basics != null">
and basic.ID in
<foreach collection="basics" item="basic" index="index" open="(" close=")" separator=",">
#{basic}
</foreach>
</if>
</where>
</select>
</mapper>

3
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<WtSpBasicEntity> {
R importExcel(MultipartFile file) throws Exception;
List<SparePartVO> sparePart(List<Long> basics);
/**
* 获取流程中的用户
* @param deptId

6
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<WtSpBasicMapper, WtSpB
}
@Override
public List<SparePartVO> sparePart(List<Long> basics) {
return this.basicMapper.sparePart(basics);
}
private InputStream copyStream(InputStream source) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];

4
hzims-service/equipment/pom.xml

@ -98,6 +98,10 @@
<groupId>com.hnac.hzims</groupId>
<artifactId>inspect-api</artifactId>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>assets-api</artifactId>
</dependency>
</dependencies>

3
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;

16
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<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo) {
return service.getVideoDeviceByEmCode(emInfo);
}
/**
* 获取设备路径下的设备
* @param emCode
* @return
*/
@Override
public List<EmInfoEntity> deviceByPath(String emCode) {
return service.deviceByPath(emCode);
}
@PostMapping(GET_EM_CREATE_TABLE)
@Override
public List<CreateTableVO> getEmCreateTable(List<String> tableNames) {

2
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;

2
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>
<select id="getSparePart" resultType="com.hnac.hzims.equipment.vo.SparePartVO">
<select id="getSparePart" resultType="com.hnac.hzims.spare.vo.SparePartVO">
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

3
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<EmInfoEntity> {
List<EmInfoEntity> getVideoDeviceByEmCode(EmInfoEntity emInfo);
List<EmInfoEntity> hkVideoDevices();
List<EmInfoEntity> deviceByPath(String emCode);
}

85
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<EmInfoMapper, EmInfoEntit
@Autowired
private IEmTreeInspectService emTreeInspectService;
@Autowired
private IEmTreeBasicService emTreeBasicService;
@Autowired
private IEmDefinitionService emDefinitionService;
@Autowired
private IAccessMaterialClient accessMaterialClient;
@Autowired
private IStationClient stationClient;
@Autowired
private IAnalyseDataSearchClient searchClient;
@Autowired
private ISpareClient spareClient;
@Autowired
private RedisTemplate redisTemplate;
@ -563,10 +572,61 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
return emInfoContentList;
}
/**
* 备品备件台账
* @param emCode
* @param startTime
* @param endTime
* @return
*/
@Override
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
@ -911,4 +971,23 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
.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)));
}
}

34
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<MaterialConsumeVO> materialConsume(@RequestParam("basics") List<Long> basics) {
return accessMaterialService.materialConsume(basics);
}
}

3
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<OperAccessMaterialEntity> {
List<OperAccessMaterialEntity> getList(@Param(value = "planId") String planId,@Param(value = "taskId") String taskId);
List<MaterialConsumeVO> materialConsume(@Param(value = "basics") List<Long> basics);
}

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml

@ -39,4 +39,19 @@
</if>
</select>
<select id="materialConsume" resultType="com.hnac.hzims.operational.access.vo.MaterialConsumeVO">
SELECT SP_BASIC_ID AS basicId,sum(NUMBER) FROM HZIMS_OPER_ACCESS_MATERIAL
<where>
NOT SP_BASIC_ID IS NULL AND
1 = 2 OR
<if test="basics != null">
and basic.ID in
<foreach collection="basics" item="basic" index="index" open="(" close=")" separator=",">
#{basic}
</foreach>
</if>
</where>
GROUP BY SP_BASIC_ID
</select>
</mapper>

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java

@ -41,5 +41,5 @@ public interface OperAccessTaskMapper extends UserDataScopeBaseMapper<OperAccess
List<OperAccessTaskEntity> selectAccessTask(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("list")List<Long> list);
List<RepairBillVO> getRepairBill(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<RepairBillVO> getRepairBill(@Param("deviceCodes") List<String> deviceCodes,@Param("startTime") String startTime, @Param("endTime") String endTime);
}

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml

@ -207,15 +207,17 @@
</select>
<select id="getRepairBill" resultType="com.hnac.hzims.operational.access.vo.RepairBillVO">
SELECT e.`NAME` AS emName,p.`GRADE_CODE`,count(t.ID) AS frequency,
SELECT t.EM_CODE AS emCode,p.`GRADE_CODE`,count(t.ID) AS frequency,
sum(m.NUMBER) AS amount,t.ACT_HOURS,max(t.PLAN_START_TIME) AS recently
FROM hzims_oper_access_task t
LEFT JOIN hzims_oper_access_plan p ON t.PLAN_ID = p.ID
LEFT JOIN hzims_oper_access_material m ON t.ID = m.TASK_ID
LEFT JOIN equipment.hzims_em_info e ON t.EM_CODE = e.NUMBER
<where>
<if test="path != null">
e.path like CONCAT(#{path},'%')
<if test="deviceCodes != null">
and t.EM_CODE in
<foreach collection="deviceCodes" item="code" index="index" open="(" close=")" separator=",">
#{code}
</foreach>
</if>
<if test="startTime != null">
and t.PLAN_START_TIME &gt;= #{startTime}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessMaterialService.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.access.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.access.dto.OperAccessMaterialDTO;
import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity;
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO;
import com.hnac.hzims.operational.access.vo.OperAccessMaterialVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
@ -25,4 +26,6 @@ public interface IOperAccessMaterialService extends BaseService<OperAccessMateri
R<IPage<OperAccessMaterialVO>> list(OperAccessMaterialDTO req, Query query);
List<OperAccessMaterialVO> getList(String planId,String taskId);
List<MaterialConsumeVO> materialConsume(List<Long> basics);
}

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessMaterialServiceImpl.java

@ -7,6 +7,7 @@ import com.hnac.hzims.operational.access.dto.OperAccessMaterialDTO;
import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity;
import com.hnac.hzims.operational.access.mapper.OperAccessMaterialMapper;
import com.hnac.hzims.operational.access.service.IOperAccessMaterialService;
import com.hnac.hzims.operational.access.vo.MaterialConsumeVO;
import com.hnac.hzims.operational.access.vo.OperAccessMaterialVO;
import com.hnac.hzims.operational.access.wrapper.OperAccessMaterialWrapper;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -66,4 +67,14 @@ public class OperAccessMaterialServiceImpl extends BaseServiceImpl<OperAccessMat
}
return OperAccessMaterialWrapper.build().listVO(list);
}
/**
* 备品备件台账
* @param basics
* @return
*/
@Override
public List<MaterialConsumeVO> materialConsume(List<Long> basics) {
return this.baseMapper.materialConsume(basics);
}
}

27
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java

@ -426,11 +426,32 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
return baseMapper.selectPage(dbPage, queryWrapper);
}
/**
* 获取设备检修台账
* @param emCode
* @param startTime
* @param endTime
* @return
*/
@Override
public List<RepairBillVO> getRepairBill(String emCode, String startTime, String endTime) {
EmInfoEntity emInfo = emInfoClient.getEmInfoByEmCode(emCode).getData();
List<RepairBillVO> repairBillList = baseMapper.getRepairBill(emInfo.getPath(), startTime, endTime);
return repairBillList;
// 查询路径设备
List<EmInfoEntity> devices = emInfoClient.deviceByPath(emCode);
if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>();
}
List<RepairBillVO> repairs = baseMapper.getRepairBill(devices.stream().map(EmInfoEntity::getNumber).collect(Collectors.toList()),startTime, endTime);
if(CollectionUtil.isEmpty(repairs)){
return new ArrayList<>();
}
return repairs.stream().map(repair->{
List<EmInfoEntity> repairDevice = devices.stream().filter(device->device.getNumber().equals(repair.getEmCode())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(repairDevice)){
return repair;
}
repair.setEmName(repairDevice.get(0).getName());
return repair;
}).collect(Collectors.toList());
}
@Override

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/vo/RepairBillVO.java

@ -12,6 +12,9 @@ import lombok.EqualsAndHashCode;
@Data
public class RepairBillVO {
@ApiModelProperty("设备编码")
private String emCode;
@ApiModelProperty("设备名称")
private String emName;

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/WorkTicketInfoMapper.java

@ -67,7 +67,7 @@ public interface WorkTicketInfoMapper extends UserDataScopeBaseMapper<WorkTicket
Page<WorkTicketInfoEntity> selectPages(Page<WorkTicketInfoEntity> pageEntity,
@Param(Constants.WRAPPER) QueryWrapper<WorkTicketInfoEntity> queryWrapper);
List<WorkTicketBillVO> getWorkTicketBill(@Param("path") String path, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<WorkTicketBillVO> getWorkTicketBill(@Param("deviceCodes") List<String> deviceCodes, @Param("startTime") String startTime, @Param("endTime") String endTime);
@UserDataAuth
List<Map> selectTicketList(@Param(Constants.WRAPPER) QueryWrapper<WorkTicketInfoEntity> queryWrapper);

12
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml

@ -86,16 +86,18 @@
</select>
<select id="getWorkTicketBill" resultType="com.hnac.hzims.ticket.workTicket.vo.WorkTicketBillVO">
select em.`NAME` as emName,info.`type`,count(*) as payment,
select info.em_code as emCode,info.`type`,count(*) as payment,
(select count(*) from hzims_work_ticket_info i where flow_description = '结束' and i.id = info.id) as finish,
(select count(*) from hzims_work_ticket_info i where flow_description = '作废' and i.id = info.id) as invalid,
(select count(*) from hzims_ticket_info_evaluate e where evaluate = '合格!' and e.id = eval.id) as qualified
from hzims_work_ticket_info info
LEFT JOIN hzims_ticket_info_evaluate eval ON info.id = eval.ticket_id
LEFT JOIN `equipment`.hzims_em_info em ON info.em_code = em.NUMBER
LEFT JOIN hzims_ticket_info_evaluate eval ON info.id = eval.ticket_i
<where>
<if test="path != null">
em.path like CONCAT(#{path},'%')
<if test="deviceCodes != null">
and info.em_code in
<foreach collection="deviceCodes" item="deviceCode" separator="," open="(" close=")" index="index">
#{deviceCode}
</foreach>
</if>
<if test="startTime != null">
and info.make_date_time &gt;= #{startTime}

25
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

@ -1127,14 +1127,23 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
@Override
public List<WorkTicketBillVO> getWorkTicketBill(String emCode, String startTime, String endTime) {
R<EmInfoEntity> emInfoEntityR = emInfoClient.getEmInfoByEmCode(emCode);
if (emInfoEntityR.getCode() != 200 || Func.isEmpty(emInfoEntityR.getData())) {
throw new ServiceException("设备信息查询异常");
}
EmInfoEntity emInfo = emInfoEntityR.getData();
List<WorkTicketBillVO> workTicketBillList = baseMapper.getWorkTicketBill(emInfo.getPath(), startTime, endTime);
return workTicketBillList;
// 查询路径设备
List<EmInfoEntity> devices = emInfoClient.deviceByPath(emCode);
if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>();
}
List<WorkTicketBillVO> tickets = baseMapper.getWorkTicketBill(devices.stream().map(EmInfoEntity::getNumber).collect(Collectors.toList()), startTime, endTime);
if(CollectionUtil.isEmpty(tickets)){
return new ArrayList<>();
}
return tickets.stream().map(ticket->{
List<EmInfoEntity> repairDevice = devices.stream().filter(device->device.getNumber().equals(ticket.getEmCode())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(repairDevice)){
return ticket;
}
ticket.setEmName(repairDevice.get(0).getName());
return ticket;
}).collect(Collectors.toList());
}

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/vo/WorkTicketBillVO.java

@ -10,6 +10,10 @@ import lombok.Data;
*/
@Data
public class WorkTicketBillVO {
@ApiModelProperty("设备编码")
private String emCode;
@ApiModelProperty("设备名称")
private String emName;

Loading…
Cancel
Save