From c379e21fda0192db6d15944ff0fa42a7ee5c1160 Mon Sep 17 00:00:00 2001 From: lius <Lius2225@163.com> Date: 星期一, 14 八月 2023 17:22:32 +0800 Subject: [PATCH] 设备日志接口更新 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java | 4 ++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java | 17 +++++++++-------- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java | 7 ++++++- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java | 22 +++++++++++++--------- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java index c2ea7db..4e2248e 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java @@ -32,4 +32,8 @@ @InterceptorIgnore(tenantLine = "1") @Select("select CollectTime ${columns} from [${tableName}] where CollectTime > #{startTime} and CollectTime <= #{endTime} order by CollectTime asc") List<Map<String, Object>> getWorkLineList(Map<String, Object> param); + + @InterceptorIgnore(tenantLine = "1") + @Select("SELECT COUNT(*) FROM SysObjects WHERE XType='U' AND name = '${tableName}'") + Integer isTableExist(@Param("tableName") String tableName); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java index 0208a23..2db1122 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java @@ -19,5 +19,10 @@ /** * 鏌ユ壘瑗块棬瀛愮被鍨嬭澶囪繍琛屾椂娈电殑璁惧绋嬪簭鍙� */ - List<EquipmentMachingDto> getEquipmentSequencenumber(String drivetype, String equipmentid, Date startTime, Date endTime); + List<EquipmentMachingDto> getEquipmentSequencenumber(String tableName, Date startTime, Date endTime); + + /** + * 鍒ゆ柇琛ㄦ槸鍚﹀瓨鍦� + */ + Boolean isTableExist(String tableName); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java index 208b1aa..04bfbad 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java @@ -34,14 +34,15 @@ @Override @Transactional(readOnly = true) - public List<EquipmentMachingDto> getEquipmentSequencenumber(String drivetype, String equipmentid, Date startTime, Date endTime) { - String tableName = drivetype + "_" + equipmentid; - try { - List<Map<String, Object>> list = equipmentWorkLineMapper.getEquipmentSequenceNumber(tableName, startTime, endTime); - return convertData(list); - } catch (Exception e) { - return null; - } + public List<EquipmentMachingDto> getEquipmentSequencenumber(String tableName, Date startTime, Date endTime) { + List<Map<String, Object>> list = equipmentWorkLineMapper.getEquipmentSequenceNumber(tableName, startTime, endTime); + return convertData(list); + } + + @Override + public Boolean isTableExist(String tableName) { + Integer count = equipmentWorkLineMapper.isTableExist(tableName); + return count != 0; } private List<EquipmentMachingDto> convertData(List<Map<String, Object>> list) { diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java index 0531cfc..9742ac9 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java @@ -52,18 +52,22 @@ List<MdcEquipmentRunningSection> errs = loadEquipmentErrorTrace(equipmentRunningSectionVo.getEquipmentId(), equipmentRunningSectionVo.getCollectTimeStr()); if (!running.isEmpty()) { MdcEquipmentRunningSectionDto dto; + Equipment equip = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getEquipmentid, equipmentRunningSectionVo.getEquipmentId())); + String tableName = ""; + Boolean isTableExist = false; + if (equip != null) { + if (StringUtils.isNotBlank(equip.getDrivetype())) { + tableName = equip.getDrivetype() + "_" + equip.getEquipmentid(); + isTableExist = equipmentWorkLineService.isTableExist(tableName); + } + } for (MdcEquipmentRunningSection entity : running) { dto = new MdcEquipmentRunningSectionDto(); BeanUtils.copyProperties(entity, dto); - if (entity.getStatus() == 3 && StringUtils.isBlank(entity.getSequenceNumber())) { - Equipment equip = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getEquipmentid, entity.getEquipmentId())); - if (equip != null) { - if (StringUtils.isNotBlank(equip.getDrivetype())) { - List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipmentSequencenumber(equip.getDrivetype(), equip.getEquipmentid(), entity.getStartTime(), entity.getEndTime()); - if (esList != null && esList.size() > 1) { - dto.setSequenceNumber(esList.get(0).getSequencenumber()); - } - } + if (entity.getStatus() == 3 && StringUtils.isBlank(entity.getSequenceNumber()) && isTableExist) { + List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipmentSequencenumber(tableName, entity.getStartTime(), entity.getEndTime()); + if (esList != null && esList.size() > 1) { + dto.setSequenceNumber(esList.get(0).getSequencenumber()); } } dtos.add(dto); -- Gitblit v1.9.3