From a558086d4def35e987642a4e25b74580204f4192 Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Wed, 10 Jul 2024 17:47:24 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=B8=8A=E5=B1=82=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=83=A8=E9=97=A8=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspur/framework/web/service/UserDetailsServiceImpl.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/zfipc-server/zfipc-framework/src/main/java/com/inspur/framework/web/service/UserDetailsServiceImpl.java b/zfipc-server/zfipc-framework/src/main/java/com/inspur/framework/web/service/UserDetailsServiceImpl.java index d5bb83b..d0e300c 100644 --- a/zfipc-server/zfipc-framework/src/main/java/com/inspur/framework/web/service/UserDetailsServiceImpl.java +++ b/zfipc-server/zfipc-framework/src/main/java/com/inspur/framework/web/service/UserDetailsServiceImpl.java @@ -34,8 +34,6 @@ public class UserDetailsServiceImpl implements UserDetailsService @Autowired private SysPermissionService permissionService; - @Value("${user.deptId}") - private Long deptId; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException @@ -56,9 +54,6 @@ public class UserDetailsServiceImpl implements UserDetailsService log.info("登录用户:{} 已被停用.", username); throw new ServiceException("对不起,您的账号:" + username + " 已停用"); } - else if (deptId != null && !deptId.equals(user.getDeptId())){ - throw new ServiceException("对不起,您的账号:" + username + " 不属于该工控机,无法登录"); - } passwordService.validate(user); From 847a1bae5c915e848d8200207c7be1ef9a0a13c6 Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Thu, 11 Jul 2024 17:33:05 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BA=A7=E7=BA=BF=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=8E=A5=E5=8F=A3=E5=8A=9F=E8=83=BD=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigscreen/FactoryDashboardController.java | 42 ++++++++ .../domain/IpcDailyEquipNumByStatus.java | 97 +++++++++++++++++++ .../bigscreen/dto/FactoryDashboardDTO.java | 27 ++++++ .../mapper/FactoryDashboardMapper.java | 39 ++++++++ .../IpcDailyEquipNumByStatusMapper.java | 61 ++++++++++++ .../service/IFactoryDashboardService.java | 34 +++++++ .../IIpcDailyEquipNumByStatusService.java | 62 ++++++++++++ .../service/impl/FactoryDashboardService.java | 85 ++++++++++++++++ .../IpcDailyEquipNumByStatusServiceImpl.java | 94 ++++++++++++++++++ .../bigscreen/FactoryDashboardMapper.xml | 81 ++++++++++++++++ .../IpcDailyEquipNumByStatusMapper.xml | 71 ++++++++++++++ zfipc-ui/src/api/bigscreen/factory.js | 33 +++++++ 12 files changed, 726 insertions(+) create mode 100644 zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/FactoryDashboardController.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/domain/IpcDailyEquipNumByStatus.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/FactoryDashboardDTO.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/FactoryDashboardMapper.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/IpcDailyEquipNumByStatusMapper.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IFactoryDashboardService.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IIpcDailyEquipNumByStatusService.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/FactoryDashboardService.java create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/IpcDailyEquipNumByStatusServiceImpl.java create mode 100644 zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml create mode 100644 zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/IpcDailyEquipNumByStatusMapper.xml create mode 100644 zfipc-ui/src/api/bigscreen/factory.js diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/FactoryDashboardController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/FactoryDashboardController.java new file mode 100644 index 0000000..59a4062 --- /dev/null +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/FactoryDashboardController.java @@ -0,0 +1,42 @@ +package com.inspur.web.controller.bigscreen; + +import com.inspur.bigscreen.service.IFactoryDashboardService; +import com.inspur.common.core.domain.AjaxResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author zhangjunwen + * @create 2024/7/11 + */ +@RestController +@RequestMapping("/bigscreen/factory") +public class FactoryDashboardController { + + @Autowired + private IFactoryDashboardService factoryDashboardService; + + @GetMapping("/countEquipNumByProductionLine/{deptId}") + public AjaxResult countEquipNumByProductionLine(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countEquipNumByProductionLine(deptId)); + } + + + @GetMapping("/countEquipNumByStatusAndProductionLine/{deptId}") + public AjaxResult countEquipNumByStatusandProductionLine(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countEquipNumByStatusandProductionLine(deptId)); + } + + @GetMapping("/countSensorNumByProductionLine/{deptId}") + public AjaxResult countSensorNumByProductionLine(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countSensorNumByProductionLine(deptId)); + } + + @GetMapping("/countAlarmNumByProductionLine/{deptId}") + public AjaxResult countWeeklyAlarmNumByLineDeptId(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countAlarmNumByProductionLine(deptId)); + } +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/domain/IpcDailyEquipNumByStatus.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/domain/IpcDailyEquipNumByStatus.java new file mode 100644 index 0000000..2e6c56e --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/domain/IpcDailyEquipNumByStatus.java @@ -0,0 +1,97 @@ +package com.inspur.bigscreen.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.inspur.common.annotation.Excel; +import com.inspur.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 每日设备状态统计对象 ipc_daily_equip_num_by_status + * + * @author inspur + * @date 2024-07-11 + */ +public class IpcDailyEquipNumByStatus extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 设备id */ + @Excel(name = "设备id") + private String equipId; + + /** 设备状态 */ + @Excel(name = "设备状态") + private Integer status; + + /** 设备所属部门id */ + @Excel(name = "设备所属部门id") + private Long deptId; + + /** 统计时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "统计时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createDate; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setEquipId(String equipId) + { + this.equipId = equipId; + } + + public String getEquipId() + { + return equipId; + } + public void setStatus(Integer status) + { + this.status = status; + } + + public Integer getStatus() + { + return status; + } + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + public Long getDeptId() + { + return deptId; + } + public void setCreateDate(Date createDate) + { + this.createDate = createDate; + } + + public Date getCreateDate() + { + return createDate; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("equipId", getEquipId()) + .append("status", getStatus()) + .append("deptId", getDeptId()) + .append("createDate", getCreateDate()) + .toString(); + } +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/FactoryDashboardDTO.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/FactoryDashboardDTO.java new file mode 100644 index 0000000..d586237 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/FactoryDashboardDTO.java @@ -0,0 +1,27 @@ +package com.inspur.bigscreen.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @Author zhangjunwen + * @create 2024/7/11 + */ +@Data +public class FactoryDashboardDTO { + + private Long deptId; + + private String deptName; + + private Integer data; + + private Integer status; + + private String time; + + private List x; + + private List y; +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/FactoryDashboardMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/FactoryDashboardMapper.java new file mode 100644 index 0000000..9f71829 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/FactoryDashboardMapper.java @@ -0,0 +1,39 @@ +package com.inspur.bigscreen.mapper; + +import com.inspur.bigscreen.dto.FactoryDashboardDTO; +import org.apache.ibatis.annotations.MapKey; + +import java.util.List; +import java.util.Map; + +/** + * @Author zhangjunwen + * @create 2024/7/11 + */ +public interface FactoryDashboardMapper { + + /** + * 查询公司下各个产线设备数量 + */ + public List countEquipNumByProductionLine(Long deptId); + + /** + * 根据厂区部门id查询各个产线不同状态设备数 + */ + public List countEquipNumByStatusandProductionLine(Long deptId); + + /** + * 根据厂区部门id查询各个产线传感器数量 + */ + public List countSensorNumByProductionLine(Long deptId); + + /** + * 根据产线部门id查询一周内各个产线报警数量 + */ + public List countWeeklyAlarmNumByLineDeptId(Long deptId); + + /** + * 近一周产线各设备正常运行数量 + */ + public List countWeeklyEquipRunningNumByLineDeptId(Long deptId); +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/IpcDailyEquipNumByStatusMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/IpcDailyEquipNumByStatusMapper.java new file mode 100644 index 0000000..8ea18f7 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/IpcDailyEquipNumByStatusMapper.java @@ -0,0 +1,61 @@ +package com.inspur.bigscreen.mapper; + +import java.util.List; +import com.inspur.bigscreen.domain.IpcDailyEquipNumByStatus; + +/** + * 每日设备状态统计Mapper接口 + * + * @author inspur + * @date 2024-07-11 + */ +public interface IpcDailyEquipNumByStatusMapper +{ + /** + * 查询每日设备状态统计 + * + * @param id 每日设备状态统计主键 + * @return 每日设备状态统计 + */ + public IpcDailyEquipNumByStatus selectIpcDailyEquipNumByStatusById(Long id); + + /** + * 查询每日设备状态统计列表 + * + * @param ipcDailyEquipNumByStatus 每日设备状态统计 + * @return 每日设备状态统计集合 + */ + public List selectIpcDailyEquipNumByStatusList(IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus); + + /** + * 新增每日设备状态统计 + * + * @param ipcDailyEquipNumByStatus 每日设备状态统计 + * @return 结果 + */ + public int insertIpcDailyEquipNumByStatus(IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus); + + /** + * 修改每日设备状态统计 + * + * @param ipcDailyEquipNumByStatus 每日设备状态统计 + * @return 结果 + */ + public int updateIpcDailyEquipNumByStatus(IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus); + + /** + * 删除每日设备状态统计 + * + * @param id 每日设备状态统计主键 + * @return 结果 + */ + public int deleteIpcDailyEquipNumByStatusById(Long id); + + /** + * 批量删除每日设备状态统计 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteIpcDailyEquipNumByStatusByIds(Long[] ids); +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IFactoryDashboardService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IFactoryDashboardService.java new file mode 100644 index 0000000..b376375 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IFactoryDashboardService.java @@ -0,0 +1,34 @@ +package com.inspur.bigscreen.service; + +import com.inspur.bigscreen.dto.FactoryDashboardDTO; + +import java.util.List; +import java.util.Map; + + +/** + * @Author zhangjunwen + * @create 2024/7/11 + */ +public interface IFactoryDashboardService { + + /** + *根据厂区id查询厂区下所有产线设备数量 + */ + public List countEquipNumByProductionLine(Long deptId); + + /** + * 根据厂区部门id查询各个产线不同状态设备数 + */ + public List countEquipNumByStatusandProductionLine(Long deptId); + + /** + * 根据厂区部门id查询各个产线传感器数量 + */ + public List countSensorNumByProductionLine(Long deptId); + + /** + * 根据厂区部门id查询各个产线报警数量 + */ + public List countAlarmNumByProductionLine(Long deptId); +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IIpcDailyEquipNumByStatusService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IIpcDailyEquipNumByStatusService.java new file mode 100644 index 0000000..f8c0ad3 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IIpcDailyEquipNumByStatusService.java @@ -0,0 +1,62 @@ +package com.inspur.bigscreen.service; + +import java.util.List; +import com.inspur.bigscreen.domain.IpcDailyEquipNumByStatus; + +/** + * 每日设备状态统计Service接口 + * + * @author inspur + * @date 2024-07-11 + */ +public interface IIpcDailyEquipNumByStatusService +{ + /** + * 查询每日设备状态统计 + * + * @param id 每日设备状态统计主键 + * @return 每日设备状态统计 + */ + public IpcDailyEquipNumByStatus selectIpcDailyEquipNumByStatusById(Long id); + + /** + * 查询每日设备状态统计列表 + * + * @param ipcDailyEquipNumByStatus 每日设备状态统计 + * @return 每日设备状态统计集合 + */ + public List selectIpcDailyEquipNumByStatusList(IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus); + + /** + * 新增每日设备状态统计 + * + * @param ipcDailyEquipNumByStatus 每日设备状态统计 + * @return 结果 + */ + public int insertIpcDailyEquipNumByStatus(IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus); + + /** + * 修改每日设备状态统计 + * + * @param ipcDailyEquipNumByStatus 每日设备状态统计 + * @return 结果 + */ + public int updateIpcDailyEquipNumByStatus(IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus); + + /** + * 批量删除每日设备状态统计 + * + * @param ids 需要删除的每日设备状态统计主键集合 + * @return 结果 + */ + public int deleteIpcDailyEquipNumByStatusByIds(Long[] ids); + + /** + * 删除每日设备状态统计信息 + * + * @param id 每日设备状态统计主键 + * @return 结果 + */ + public int deleteIpcDailyEquipNumByStatusById(Long id); +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/FactoryDashboardService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/FactoryDashboardService.java new file mode 100644 index 0000000..fd3e5a6 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/FactoryDashboardService.java @@ -0,0 +1,85 @@ +package com.inspur.bigscreen.service.impl; + +import com.inspur.bigscreen.dto.FactoryDashboardDTO; +import com.inspur.bigscreen.mapper.FactoryDashboardMapper; +import com.inspur.bigscreen.service.IFactoryDashboardService; +import com.inspur.common.core.domain.entity.SysDept; +import com.inspur.system.mapper.SysDeptMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @Author zhangjunwen + * @create 2024/7/11 + */ +@Service +public class FactoryDashboardService implements IFactoryDashboardService { + + @Autowired + private FactoryDashboardMapper factoryDashboardMapper; + + @Autowired + private SysDeptMapper sysDeptMapper; + + /** + * @param deptId 厂区的部门id + *根据厂区id查询厂区下所有产线设备数量 + */ + @Override + public List countEquipNumByProductionLine(Long deptId){ + + List resultList = new ArrayList<>(); + List factoryDashboardDTOList = factoryDashboardMapper.countEquipNumByProductionLine(deptId); + for (FactoryDashboardDTO factoryDashboardDTO : factoryDashboardDTOList) { + SysDept deptInfo = sysDeptMapper.selectDeptById(factoryDashboardDTO.getDeptId()); + factoryDashboardDTO.setDeptName(deptInfo.getDeptName()); + resultList.add(factoryDashboardDTO); + } + return resultList; + } + + + /** + * @param deptId 厂区的部门id + * 根据厂区部门id查询各个产线不同状态设备数 + */ + @Override + public List countEquipNumByStatusandProductionLine(Long deptId){ + return factoryDashboardMapper.countEquipNumByStatusandProductionLine(deptId); + } + + /** + * @param deptId 厂区的部门id + * 根据厂区部门id查询各个产线传感器数量 + */ + @Override + public List countSensorNumByProductionLine(Long deptId){ + return factoryDashboardMapper.countSensorNumByProductionLine(deptId); + } + + /** + * 根据厂区部门id查询各个产线报警数量 + */ + @Override + public List countAlarmNumByProductionLine(Long deptId){ + List resultList = new ArrayList<>(); + List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); + for (SysDept sysDept : childDeptList) { + FactoryDashboardDTO data = new FactoryDashboardDTO(); + data.setDeptName(sysDept.getDeptName()); + List factoryDashboardDTOList = factoryDashboardMapper.countWeeklyAlarmNumByLineDeptId(sysDept.getDeptId()); + List timeList = factoryDashboardDTOList.stream().map(FactoryDashboardDTO::getTime).collect(Collectors.toList()); + List dataList = factoryDashboardDTOList.stream().map(FactoryDashboardDTO::getData).collect(Collectors.toList()); + data.setX(timeList); + data.setY(dataList); + resultList.add(data); + } + return resultList; + } +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/IpcDailyEquipNumByStatusServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/IpcDailyEquipNumByStatusServiceImpl.java new file mode 100644 index 0000000..dbecfe9 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/IpcDailyEquipNumByStatusServiceImpl.java @@ -0,0 +1,94 @@ +package com.inspur.bigscreen.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.bigscreen.mapper.IpcDailyEquipNumByStatusMapper; +import com.inspur.bigscreen.domain.IpcDailyEquipNumByStatus; +import com.inspur.bigscreen.service.IIpcDailyEquipNumByStatusService; + +/** + * 每日设备状态统计Service业务层处理 + * + * @author inspur + * @date 2024-07-11 + */ +@Service +public class IpcDailyEquipNumByStatusServiceImpl implements IIpcDailyEquipNumByStatusService +{ + @Autowired + private IpcDailyEquipNumByStatusMapper ipcDailyEquipNumByStatusMapper; + + /** + * 查询每日设备状态统计 + * + * @param id 每日设备状态统计主键 + * @return 每日设备状态统计 + */ + @Override + public IpcDailyEquipNumByStatus selectIpcDailyEquipNumByStatusById(Long id) + { + return ipcDailyEquipNumByStatusMapper.selectIpcDailyEquipNumByStatusById(id); + } + + /** + * 查询每日设备状态统计列表 + * + * @param ipcDailyEquipNumByStatus 每日设备状态统计 + * @return 每日设备状态统计 + */ + @Override + public List selectIpcDailyEquipNumByStatusList(IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus) + { + return ipcDailyEquipNumByStatusMapper.selectIpcDailyEquipNumByStatusList(ipcDailyEquipNumByStatus); + } + + /** + * 新增每日设备状态统计 + * + * @param ipcDailyEquipNumByStatus 每日设备状态统计 + * @return 结果 + */ + @Override + public int insertIpcDailyEquipNumByStatus(IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus) + { + return ipcDailyEquipNumByStatusMapper.insertIpcDailyEquipNumByStatus(ipcDailyEquipNumByStatus); + } + + /** + * 修改每日设备状态统计 + * + * @param ipcDailyEquipNumByStatus 每日设备状态统计 + * @return 结果 + */ + @Override + public int updateIpcDailyEquipNumByStatus(IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus) + { + return ipcDailyEquipNumByStatusMapper.updateIpcDailyEquipNumByStatus(ipcDailyEquipNumByStatus); + } + + /** + * 批量删除每日设备状态统计 + * + * @param ids 需要删除的每日设备状态统计主键 + * @return 结果 + */ + @Override + public int deleteIpcDailyEquipNumByStatusByIds(Long[] ids) + { + return ipcDailyEquipNumByStatusMapper.deleteIpcDailyEquipNumByStatusByIds(ids); + } + + /** + * 删除每日设备状态统计信息 + * + * @param id 每日设备状态统计主键 + * @return 结果 + */ + @Override + public int deleteIpcDailyEquipNumByStatusById(Long id) + { + return ipcDailyEquipNumByStatusMapper.deleteIpcDailyEquipNumByStatusById(id); + } +} + diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml new file mode 100644 index 0000000..9c6c9af --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + select curdate() as click_date + union all + select date_sub(curdate(), interval 1 day) as click_date + union all + select date_sub(curdate(), interval 2 day) as click_date + union all + select date_sub(curdate(), interval 3 day) as click_date + union all + select date_sub(curdate(), interval 4 day) as click_date + union all + select date_sub(curdate(), interval 5 day) as click_date + union all + select date_sub(curdate(), interval 6 day) as click_date + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/IpcDailyEquipNumByStatusMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/IpcDailyEquipNumByStatusMapper.xml new file mode 100644 index 0000000..5165abc --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/IpcDailyEquipNumByStatusMapper.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + select id, equip_id, status, dept_id, create_date from ipc_daily_equip_num_by_status + + + + + + + + insert into ipc_daily_equip_num_by_status + + equip_id, + status, + dept_id, + create_date, + + + #{equipId}, + #{status}, + #{deptId}, + #{createDate}, + + + + + update ipc_daily_equip_num_by_status + + equip_id = #{equipId}, + status = #{status}, + dept_id = #{deptId}, + create_date = #{createDate}, + + where id = #{id} + + + + delete from ipc_daily_equip_num_by_status where id = #{id} + + + + delete from ipc_daily_equip_num_by_status where id in + + #{id} + + + \ No newline at end of file diff --git a/zfipc-ui/src/api/bigscreen/factory.js b/zfipc-ui/src/api/bigscreen/factory.js new file mode 100644 index 0000000..8989d99 --- /dev/null +++ b/zfipc-ui/src/api/bigscreen/factory.js @@ -0,0 +1,33 @@ +import request from "@/utils/request"; + +// 按照工厂id查询设备数量 +export function getEquipNumByProductionLine(deptId) { + return request({ + url: "/bigscreen/factory/countEquipNumByProductionLine/" + deptId, + method: "get", + }); +} + +// 按照工厂id查询不同状态设备数量 +export function getEquipNumByStatusAndProductionLine(deptId) { + return request({ + url: "/bigscreen/factory/countEquipNumByStatusAndProductionLine/" + deptId, + method: "get", + }); +} + +// 按照工厂id查询不同状态传感器数量 +export function getSensorNumByProductionLine(deptId) { + return request({ + url: "/bigscreen/factory/countSensorNumByProductionLine/" + deptId, + method: "get", + }); +} + +// 按照工厂id查询不同产线一周的产线报警数 +export function getWeeklyAlarmNumByProductionLine(deptId) { + return request({ + url: "/bigscreen/factory/countAlarmNumByProductionLine/" + deptId, + method: "get", + }); +} From 6b9bf6cf640c8f72e1e24419a34a5053adf33f57 Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Thu, 11 Jul 2024 17:56:53 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=95=B0=E9=87=8F=E4=BF=A1=E6=81=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/IpcDailyEquipNumByStatus.java | 16 +++++++-------- .../inspur/bigscreen/task/StatsDataTask.java | 20 +++++++++++++++++++ .../IpcDailyEquipNumByStatusMapper.xml | 12 +++++------ 3 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/task/StatsDataTask.java diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/domain/IpcDailyEquipNumByStatus.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/domain/IpcDailyEquipNumByStatus.java index 2e6c56e..e453acb 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/domain/IpcDailyEquipNumByStatus.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/domain/IpcDailyEquipNumByStatus.java @@ -21,8 +21,7 @@ public class IpcDailyEquipNumByStatus extends BaseEntity private Long id; /** 设备id */ - @Excel(name = "设备id") - private String equipId; + private Integer nums; /** 设备状态 */ @Excel(name = "设备状态") @@ -46,15 +45,15 @@ public class IpcDailyEquipNumByStatus extends BaseEntity { return id; } - public void setEquipId(String equipId) - { - this.equipId = equipId; + + public Integer getNums() { + return nums; } - public String getEquipId() - { - return equipId; + public void setNums(Integer nums) { + this.nums = nums; } + public void setStatus(Integer status) { this.status = status; @@ -87,7 +86,6 @@ public class IpcDailyEquipNumByStatus extends BaseEntity public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) - .append("equipId", getEquipId()) .append("status", getStatus()) .append("deptId", getDeptId()) .append("createDate", getCreateDate()) diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/task/StatsDataTask.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/task/StatsDataTask.java new file mode 100644 index 0000000..8868a85 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/task/StatsDataTask.java @@ -0,0 +1,20 @@ +package com.inspur.bigscreen.task; + +import org.springframework.stereotype.Component; + +/** + * 大屏数据统计定时任务 + * @Author zhangjunwen + * @create 2024/7/11 + */ +@Component("statsDataTask") +public class StatsDataTask { + + /** + * 每日根据不同状态统计设备数量 + */ + public void countDailyEquipNumByStatus(){ + + } + +} diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/IpcDailyEquipNumByStatusMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/IpcDailyEquipNumByStatusMapper.xml index 5165abc..7039758 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/IpcDailyEquipNumByStatusMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/IpcDailyEquipNumByStatusMapper.xml @@ -6,20 +6,20 @@ - + - select id, equip_id, status, dept_id, create_date from ipc_daily_equip_num_by_status + select id, nums, status, dept_id, create_date from ipc_daily_equip_num_by_status - + + + + + + \ No newline at end of file diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml index 2199eec..39e3036 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml @@ -144,6 +144,19 @@ WHERE parent_equip_id = #{parentEquipId} and status in ('0') + + + insert into ipc_equip_info diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml index 17cd6fa..02e2897 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcAlarmRecordMapper.xml @@ -27,6 +27,7 @@ + @@ -92,6 +93,23 @@ where a.id = #{id} + + + insert into ipc_alarm_record diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/system/SysDeptMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/system/SysDeptMapper.xml index 0110ee2..439f2f8 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -48,6 +48,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by d.parent_id, d.order_num + + + select + #{status} as status, + COUNT(1) as data + from + ipc_equip_info + where + dept_id in + (select dept_id from sys_dept where FIND_IN_SET(#{deptId}, ancestors)) + and status = #{status} + + + + + + \ No newline at end of file diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml index 927fd6f..47036cc 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml @@ -33,16 +33,31 @@ select dept_id,count(1) as data from ipc_equip_info where dept_id in (select dept_id from sys_dept where parent_id = #{deptId}) + and status != 3 GROUP BY dept_id; - + SELECT + d.dept_id, + d.dept_name, + COALESCE(ei.data, 0) AS data, + #{status} AS status + FROM + (SELECT dept_id,dept_name FROM sys_dept WHERE FIND_IN_SET(#{deptId}, ancestors)) d -- 生成所有可能的dept_id和dept_name + LEFT JOIN + (SELECT + a.dept_id, + COUNT(1) AS data + FROM + ipc_equip_info a + WHERE + a.status = #{status} + GROUP BY + a.dept_id) ei -- 子查询来计数满足条件的记录 + ON + d.dept_id = ei.dept_id;