diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/CompanyDashboardController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/CompanyDashboardController.java new file mode 100644 index 0000000..5fa84f9 --- /dev/null +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/CompanyDashboardController.java @@ -0,0 +1,33 @@ +package com.inspur.web.controller.bigscreen; + +import com.inspur.bigscreen.service.ICompanyDashboardService; +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/15 + */ +@RestController +@RequestMapping("/bigscreen/company") +public class CompanyDashboardController { + + @Autowired + private ICompanyDashboardService factoryDashboardService; + + @GetMapping("/countEquipNumByCompany/{deptId}") + public AjaxResult countEquipNumByCompany(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countEquipNumByStatus(deptId)); + } + + + @GetMapping("/countEquipNumByDiffCompany/{deptId}") + public AjaxResult countEquipNumByDiffCompany(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countEquipNumByCompanyId(deptId)); + } +} 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..13a0464 --- /dev/null +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/bigscreen/FactoryDashboardController.java @@ -0,0 +1,62 @@ +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)); + } + + @GetMapping("/countWeeklyEquipRunningNumByLineDeptId/{deptId}") + public AjaxResult countWeeklyEquipRunningNumByLineDeptId(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countWeeklyEquipRunningNumByLineDeptId(deptId)); + } + + @GetMapping("/countMaintenanceRecordNumByProductionLine/{deptId}") + public AjaxResult countMaintenanceRecordNumByProductionLine(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countMaintenanceRecordNumByProductionLine(deptId)); + } + + @GetMapping("/countUpkeepRecordNumByProductionLine/{deptId}") + public AjaxResult countUpkeepRecordNumByProductionLine(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.countUpkeepRecordNumByProductionLine(deptId)); + } + + @GetMapping("/listLatestAlarmRecord/{deptId}") + public AjaxResult listLatestAlarmRecord(@PathVariable Long deptId) { + return AjaxResult.success(factoryDashboardService.selectLatestIpcAlarmRecordByFactoryId(deptId)); + } +} 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); diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/constant/EquipInfoStatus.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/constant/EquipInfoStatus.java new file mode 100644 index 0000000..854d174 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/constant/EquipInfoStatus.java @@ -0,0 +1,29 @@ +package com.inspur.bigscreen.constant; + +/** + * @Author zhangjunwen + * @create 2024/7/15 + */ +public class EquipInfoStatus { + + /** + * 运行 + */ + public static final Integer RUNNING = 0; + + /** + * 维修保养 + */ + public static final Integer MAINTENANCE = 1; + + /** + * 停机 + */ + public static final Integer STOP = 2; + + /** + * 报废 + */ + public static final Integer SCRAP = 3; + +} 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..e453acb --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/domain/IpcDailyEquipNumByStatus.java @@ -0,0 +1,95 @@ +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 */ + private Integer nums; + + /** 设备状态 */ + @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 Integer getNums() { + return nums; + } + + public void setNums(Integer nums) { + this.nums = nums; + } + + 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("status", getStatus()) + .append("deptId", getDeptId()) + .append("createDate", getCreateDate()) + .toString(); + } +} + diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/CompanyDashboardDTO.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/CompanyDashboardDTO.java new file mode 100644 index 0000000..1f6fad8 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/CompanyDashboardDTO.java @@ -0,0 +1,29 @@ +package com.inspur.bigscreen.dto; + +import lombok.Data; + +import java.util.List; + +/** + * 公司级产线 + * @Author zhangjunwen + * @create 2024/7/15 + */ +@Data +public class CompanyDashboardDTO { + + 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/dto/FactoryDashboardDTO.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/FactoryDashboardDTO.java new file mode 100644 index 0000000..e67f18b --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/dto/FactoryDashboardDTO.java @@ -0,0 +1,28 @@ +package com.inspur.bigscreen.dto; + +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +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/CompanyDashboardMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/CompanyDashboardMapper.java new file mode 100644 index 0000000..3fec898 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/CompanyDashboardMapper.java @@ -0,0 +1,27 @@ +package com.inspur.bigscreen.mapper; + +import com.inspur.bigscreen.dto.CompanyDashboardDTO; +import com.inspur.bigscreen.dto.FactoryDashboardDTO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author zhangjunwen + * @create 2024/7/15 + */ +public interface CompanyDashboardMapper { + + /** + * 查询公司的各个状态设备数量 + * @param deptId + */ + public CompanyDashboardDTO countDiffStatusCompanyEquipNumByDeptId(@Param("deptId")Long deptId, + @Param("status")Integer status); + + /** + * 根据厂区部门id查询设备总数 + */ + public CompanyDashboardDTO countEquipNumByCompany(@Param("deptId")Long deptId); + +} 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..a9f0b73 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/mapper/FactoryDashboardMapper.java @@ -0,0 +1,56 @@ +package com.inspur.bigscreen.mapper; + +import com.inspur.bigscreen.dto.FactoryDashboardDTO; +import net.sf.jsqlparser.expression.DateTimeLiteralExpression; +import org.apache.ibatis.annotations.MapKey; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +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(@Param("deptId")Long deptId, + @Param("status")Integer status); + + /** + * 根据厂区部门id查询各个产线传感器数量 + */ + public List countSensorNumByProductionLine(Long deptId); + + /** + * 根据产线部门id查询一周内各个产线报警数量 + */ + public List countWeeklyAlarmNumByLineDeptId(Long deptId); + + /** + * 近一周产线各设备正常运行数量 + */ + public List countWeeklyEquipRunningNumByLineDeptId(@Param("deptId") Long deptId, + @Param("status") Integer status); + + /** + * 统计近半年的维修记录数量 + */ + public FactoryDashboardDTO countMaintenanceRecordNumByProductionLine(@Param("date") Date date, + @Param("deptId")Long deptId); + + /** + * 统计近半年的保养记录数量 + */ + public FactoryDashboardDTO countUpkeepRecordNumByProductionLine(@Param("date") Date date, + @Param("deptId")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/ICompanyDashboardService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/ICompanyDashboardService.java new file mode 100644 index 0000000..2f59fa7 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/ICompanyDashboardService.java @@ -0,0 +1,24 @@ +package com.inspur.bigscreen.service; + +import com.inspur.bigscreen.dto.CompanyDashboardDTO; +import com.inspur.bigscreen.dto.FactoryDashboardDTO; + +import java.util.List; + +/** + * 公司级业务层接口 + * @Author zhangjunwen + * @create 2024/7/15 + */ +public interface ICompanyDashboardService { + + /** + * 统计不同状态公司设备数 + */ + public List countEquipNumByStatus(Long deptId); + + /** + * 根据公司id统计公司设备数 + */ + public List countEquipNumByCompanyId(Long deptId); +} 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..48f3006 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/IFactoryDashboardService.java @@ -0,0 +1,55 @@ +package com.inspur.bigscreen.service; + +import com.inspur.bigscreen.dto.FactoryDashboardDTO; +import com.inspur.industrial.domain.IpcAlarmRecord; + +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); + + /** + * 近一周各个产线的运行情况 + */ + public List countWeeklyEquipRunningNumByLineDeptId(Long deptId); + + /** + * 根据厂区id统计近半年各个产线的维修记录数 + */ + public List countMaintenanceRecordNumByProductionLine(Long deptId); + + /** + * 根据厂区id统计近半年各个产线的保养记录数 + */ + public List countUpkeepRecordNumByProductionLine(Long deptId); + + /** + * 根据厂区id查询最新的报警信息 + */ + public List selectLatestIpcAlarmRecordByFactoryId(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/CompanyDashboardService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/CompanyDashboardService.java new file mode 100644 index 0000000..60413da --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/CompanyDashboardService.java @@ -0,0 +1,63 @@ +package com.inspur.bigscreen.service.impl; + +import com.inspur.bigscreen.constant.EquipInfoStatus; +import com.inspur.bigscreen.dto.CompanyDashboardDTO; +import com.inspur.bigscreen.dto.FactoryDashboardDTO; +import com.inspur.bigscreen.mapper.CompanyDashboardMapper; +import com.inspur.bigscreen.service.ICompanyDashboardService; +import com.inspur.bigscreen.service.IFactoryDashboardService; +import com.inspur.common.core.domain.entity.SysDept; +import com.inspur.system.mapper.SysDeptMapper; +import com.inspur.system.service.ISysDeptService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 公司级业务层 + * @Author zhangjunwen + * @create 2024/7/15 + */ +@Service +public class CompanyDashboardService implements ICompanyDashboardService { + + @Autowired + private CompanyDashboardMapper companyDashboardMapper; + + @Autowired + private SysDeptMapper sysDeptMapper; + + /** + * 统计不同状态公司设备数 + */ + public List countEquipNumByStatus(Long deptId){ + List resultList = new ArrayList<>(); + CompanyDashboardDTO runData = companyDashboardMapper.countDiffStatusCompanyEquipNumByDeptId(deptId, EquipInfoStatus.RUNNING); + CompanyDashboardDTO stopData = companyDashboardMapper.countDiffStatusCompanyEquipNumByDeptId(deptId, EquipInfoStatus.STOP); + CompanyDashboardDTO maintainData = companyDashboardMapper.countDiffStatusCompanyEquipNumByDeptId(deptId, EquipInfoStatus.MAINTENANCE); + resultList.add(runData); + resultList.add(stopData); + resultList.add(maintainData); + return resultList; + } + + /** + * 根据公司id统计公司设备数 + */ + @Override + public List countEquipNumByCompanyId(Long deptId){ + //查询给定公司id的厂区id + List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); + List factoryDeptList = childDeptList.stream().filter(dept -> dept.getAncestors().split(",").length == 3 ).collect(Collectors.toList()); + List resultList = new ArrayList<>(); + factoryDeptList.forEach(factoryDept -> { + CompanyDashboardDTO companyDashboardDTO = companyDashboardMapper.countEquipNumByCompany(factoryDept.getDeptId()); + resultList.add(companyDashboardDTO); + }); + return resultList; + } + +} 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..137d9a2 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/service/impl/FactoryDashboardService.java @@ -0,0 +1,218 @@ +package com.inspur.bigscreen.service.impl; + +import com.inspur.bigscreen.constant.EquipInfoStatus; +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.industrial.domain.IpcAlarmRecord; +import com.inspur.industrial.service.IIpcAlarmRecordService; +import com.inspur.system.mapper.SysDeptMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.*; +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; + + @Autowired + private IIpcAlarmRecordService ipcAlarmRecordService; + + + /** + * @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){ + List runningDataList = factoryDashboardMapper.countEquipNumByStatusandProductionLine(deptId,EquipInfoStatus.RUNNING); + List matenanceDataList = factoryDashboardMapper.countEquipNumByStatusandProductionLine(deptId,EquipInfoStatus.MAINTENANCE); + List stopDataList = factoryDashboardMapper.countEquipNumByStatusandProductionLine(deptId,EquipInfoStatus.STOP); + List resultList = new ArrayList<>(); + resultList.addAll(runningDataList); + resultList.addAll(matenanceDataList); + resultList.addAll(stopDataList); + return resultList; + } + + /** + * @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) { + List factoryDashboardDTOList = factoryDashboardMapper.countWeeklyAlarmNumByLineDeptId(sysDept.getDeptId()); + resultList.add(getResultData(sysDept,factoryDashboardDTOList)); + } + return resultList; + } + + /** + * 近一周各个产线的运行情况 + * @param deptId 厂区id + */ + @Override + public List countWeeklyEquipRunningNumByLineDeptId(Long deptId){ + //根据厂区id查询厂区产线id + List resultList = new ArrayList<>(); + List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); + for (SysDept sysDept : childDeptList) { + List factoryDashboardDTOList = factoryDashboardMapper.countWeeklyEquipRunningNumByLineDeptId(sysDept.getDeptId(),0); + resultList.add(getResultData(sysDept,factoryDashboardDTOList)); + } + return resultList; + } + + /** + * 根据厂区id统计近半年各个产线的维修记录数 + */ + @Override + public List countMaintenanceRecordNumByProductionLine(Long deptId){ + List resultList = new ArrayList<>(); + List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); + for (SysDept sysDept : childDeptList) { + FactoryDashboardDTO data = getMatenanceDataByHalfYear(sysDept.getDeptId()); + data.setDeptName(sysDept.getDeptName()); + resultList.add(data); + } + return resultList; + } + + /** + * 根据厂区id统计近半年各个产线的保养记录数 + */ + @Override + public List countUpkeepRecordNumByProductionLine(Long deptId){ + List resultList = new ArrayList<>(); + List childDeptList = sysDeptMapper.selectChildrenDeptById(deptId); + for (SysDept sysDept : childDeptList) { + FactoryDashboardDTO data = getUpkeepDataByHalfYear(sysDept.getDeptId()); + data.setDeptName(sysDept.getDeptName()); + resultList.add(data); + } + return resultList; + } + + /** + * 根据厂区id查询最新的报警信息 + */ + @Override + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId){ + return ipcAlarmRecordService.selectLatestIpcAlarmRecordByFactoryId(deptId); + } + + private FactoryDashboardDTO getResultData(SysDept sysDept, List factoryDashboardDTOList){ + FactoryDashboardDTO data = new FactoryDashboardDTO(); + data.setDeptName(sysDept.getDeptName()); + 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); + return data; + } + + /** + * 获取当前时间半年内的保养数据 + */ + private FactoryDashboardDTO getUpkeepDataByHalfYear(Long deptId){ + FactoryDashboardDTO returnData = new FactoryDashboardDTO(); + List timeList = new ArrayList<>(); + List dataList = new ArrayList<>(); + List halfYearDate = getHalfYearDate(); + //修改日期年月日 + for (Date date : halfYearDate) { + FactoryDashboardDTO factoryData = factoryDashboardMapper.countUpkeepRecordNumByProductionLine(date,deptId); + String time = factoryData.getTime(); + timeList.add(time.substring(0,time.lastIndexOf("-"))); + dataList.add(factoryData.getData()); + } + Collections.reverse(timeList); + Collections.reverse(dataList); + returnData.setX(timeList); + returnData.setY(dataList); + return returnData; + } + + /** + * 获取当前时间半年内的时间并查询数据 + */ + private FactoryDashboardDTO getMatenanceDataByHalfYear(Long deptId){ + FactoryDashboardDTO returnData = new FactoryDashboardDTO(); + List timeList = new ArrayList<>(); + List dataList = new ArrayList<>(); + List halfYearDate = getHalfYearDate(); + //修改日期年月日 + for (Date date : halfYearDate) { + FactoryDashboardDTO factoryData = factoryDashboardMapper.countMaintenanceRecordNumByProductionLine(date,deptId); + String time = factoryData.getTime(); + timeList.add(time.substring(0,time.lastIndexOf("-"))); + dataList.add(factoryData.getData()); + } + Collections.reverse(timeList); + Collections.reverse(dataList); + returnData.setX(timeList); + returnData.setY(dataList); + return returnData; + } + + /** + * 获取当前时间内半年月份 + */ + private List getHalfYearDate(){ + LocalDate currentDate = LocalDate.now(); + List halfYearDate = new ArrayList<>(); + + // 遍历当前日期之后的6个月(包括当前月份) + for (int i = 0; i < 6; i++) { + LocalDate firstDayOfMonth = currentDate.withDayOfMonth(1); + Date date = Date.from(firstDayOfMonth.atStartOfDay(ZoneId.systemDefault()).toInstant()); + halfYearDate.add(date); + currentDate = currentDate.minusMonths(1L); + } + return halfYearDate; + } + +} 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/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..04d3612 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/bigscreen/task/StatsDataTask.java @@ -0,0 +1,73 @@ +package com.inspur.bigscreen.task; + +import com.inspur.bigscreen.domain.IpcDailyEquipNumByStatus; +import com.inspur.bigscreen.mapper.IpcDailyEquipNumByStatusMapper; +import com.inspur.common.core.domain.entity.SysDept; +import com.inspur.common.utils.spring.SpringUtils; +import com.inspur.equip.mapper.IpcEquipInfoMapper; +import com.inspur.system.mapper.SysDeptMapper; +import com.inspur.system.service.ISysDeptService; +import com.inspur.system.service.impl.SysDeptServiceImpl; +import org.springframework.aop.framework.AopContext; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 大屏数据统计定时任务 + * @Author zhangjunwen + * @create 2024/7/11 + */ +@Component("statsDataTask") +public class StatsDataTask { + + @Resource + private ISysDeptService sysDeptService; + + @Resource + private IpcDailyEquipNumByStatusMapper ipcDailyEquipNumByStatusMapper; + + @Resource + private IpcEquipInfoMapper ipcEquipInfoMapper; + + private static final Integer RUNNING = 0; + private static final Integer MAINTANANCE = 1; + + private static final Integer STOP = 2; + + /** + * 每日根据不同状态统计设备数量 + */ + @Transactional + public void countDailyEquipNumByStatus(){ + + List deptList = sysDeptService.selectDeptAll(); + List factoryList = deptList.stream().filter(dept -> dept.getAncestors().split(",").length == 4).collect(Collectors.toList()); + for (SysDept sysDept : factoryList) { + int nums = 0; + //运行状态 + insertIpcDailyEquipNumByStatusAndDeptId(RUNNING,sysDept.getDeptId()); + //维修状态 + insertIpcDailyEquipNumByStatusAndDeptId(MAINTANANCE,sysDept.getDeptId()); + //停机状态 + insertIpcDailyEquipNumByStatusAndDeptId(STOP,sysDept.getDeptId()); + } + } + + private int insertIpcDailyEquipNumByStatusAndDeptId(Integer status,Long deptId){ + IpcDailyEquipNumByStatus ipcDailyEquipNumByStatus = new IpcDailyEquipNumByStatus(); + ipcDailyEquipNumByStatus.setStatus(status); + int nums = ipcEquipInfoMapper.selectIpcEquipInfoNumByStatusAndDeptId(status,deptId); + ipcDailyEquipNumByStatus.setNums(nums); + ipcDailyEquipNumByStatus.setDeptId(deptId); + ipcDailyEquipNumByStatus.setCreateDate(new Date()); + + return ipcDailyEquipNumByStatusMapper.insertIpcDailyEquipNumByStatus(ipcDailyEquipNumByStatus); + } + +} diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java index e8a4e21..ee19498 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java @@ -6,6 +6,7 @@ import com.inspur.common.annotation.DataSource; import com.inspur.common.enums.DataSourceType; import com.inspur.equip.domain.EquipTreeSelect; import com.inspur.equip.domain.IpcEquipInfo; +import org.apache.ibatis.annotations.Param; public interface IpcEquipInfoMapper @@ -53,6 +54,13 @@ public interface IpcEquipInfoMapper */ public List selectRunningIpcEquipInfoListByParentId(String parentEquipId); + /** + * 根据厂区id和设备状态查询设备数量 + */ + public Integer selectIpcEquipInfoNumByStatusAndDeptId(@Param("status")Integer status, + @Param("deptId")Long deptId); + + /** * 新增设备信息 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRecordMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRecordMapper.java index 6fae30e..bb0aa81 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRecordMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRecordMapper.java @@ -14,7 +14,7 @@ import org.apache.ibatis.annotations.Param; * @Author zhangjunwen * @create 2024/4/10 */ -@DataSource(DataSourceType.SLAVE) + public interface IpcAlarmRecordMapper { /** @@ -33,6 +33,11 @@ public interface IpcAlarmRecordMapper */ public List selectIpcAlarmRecordList(IpcAlarmRecord ipcAlarmRecord); + /** + * 查询厂区id下最新的报警记录 + */ + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId); + /** * 新增报警记录 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java index 4f067b8..450095a 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcAlarmRulesMapper.java @@ -6,13 +6,7 @@ import com.inspur.common.annotation.DataSource; import com.inspur.common.enums.DataSourceType; import com.inspur.industrial.domain.IpcAlarmRules; -/** - * 设备报警规则Mapper接口 - * - * @Author zhangjunwen - * @create 2024/4/9 - */ -@DataSource(DataSourceType.SLAVE) + public interface IpcAlarmRulesMapper { /** diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java index 2fbe93f..73da703 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcFaultTreeConfigMapper.java @@ -6,13 +6,7 @@ import com.inspur.industrial.domain.IpcFaultTreeConfig; import java.util.List; -/** - * 故障树配置Mapper接口 - * - * @author inspur - * @date 2024-04-02 - */ -@DataSource(DataSourceType.SLAVE) + public interface IpcFaultTreeConfigMapper { /** diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java index 1888063..ab5621a 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcMonitorDataInfoMapper.java @@ -6,13 +6,7 @@ import com.inspur.common.annotation.DataSource; import com.inspur.common.enums.DataSourceType; import com.inspur.industrial.domain.IpcMonitorDataInfo; -/** - * 监控数据信息Mapper接口 - * - * @author inspur - * @date 2024-04-09 - */ -@DataSource(DataSourceType.SLAVE) + public interface IpcMonitorDataInfoMapper { /** diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java index ffb6cd8..9d051b8 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java @@ -6,13 +6,7 @@ import com.inspur.common.annotation.DataSource; import com.inspur.common.enums.DataSourceType; import com.inspur.industrial.domain.IpcSysStatus; -/** - * 系统状态Mapper接口 - * - * @Author zhangjunwen - * @create 2024/4/3 - */ -@DataSource(DataSourceType.SLAVE) + public interface IpcSysStatusMapper { /** diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/PhmEquAlarmRecordMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/PhmEquAlarmRecordMapper.java index 415f420..de984c3 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/PhmEquAlarmRecordMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/PhmEquAlarmRecordMapper.java @@ -6,7 +6,6 @@ import com.inspur.industrial.domain.PhmEquAlarmRecord; import java.util.List; -@DataSource(DataSourceType.SLAVE) public interface PhmEquAlarmRecordMapper { /** * 查询超压顶缸报警记录列表 diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRecordService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRecordService.java index 76a064c..a528e8d 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRecordService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcAlarmRecordService.java @@ -29,6 +29,11 @@ public interface IIpcAlarmRecordService */ public List selectIpcAlarmRecordList(IpcAlarmRecord ipcAlarmRecord); + /** + * 查询厂区id下最新的报警记录 + */ + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId); + /** * 新增报警记录 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRecordServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRecordServiceImpl.java index 35f0f79..82dace4 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRecordServiceImpl.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRecordServiceImpl.java @@ -48,6 +48,13 @@ public class IpcAlarmRecordServiceImpl implements IIpcAlarmRecordService return ipcAlarmRecordMapper.selectIpcAlarmRecordList(ipcAlarmRecord); } + /** + * 查询厂区id下最新的报警记录 + */ + public List selectLatestIpcAlarmRecordByFactoryId(Long deptId){ + return ipcAlarmRecordMapper.selectLatestIpcAlarmRecordByFactoryId(deptId); + } + /** * 新增报警记录 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/mapper/SysDeptMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/mapper/SysDeptMapper.java index b426c5c..aa16af9 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/mapper/SysDeptMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/mapper/SysDeptMapper.java @@ -19,6 +19,11 @@ public interface SysDeptMapper */ public List selectDeptList(SysDept dept); + /** + * 查询所有的部门数据 + */ + public List selectDeptAll(); + /** * 根据角色ID查询部门树信息 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/ISysDeptService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/ISysDeptService.java index b593392..95b5e1d 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/ISysDeptService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/ISysDeptService.java @@ -19,6 +19,11 @@ public interface ISysDeptService */ public List selectDeptList(SysDept dept); + /** + * 查询所有部门数据 + */ + public List selectDeptAll(); + /** * 查询部门树结构信息 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/impl/SysDeptServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/impl/SysDeptServiceImpl.java index a870e07..fb0607e 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/impl/SysDeptServiceImpl.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/system/service/impl/SysDeptServiceImpl.java @@ -48,6 +48,14 @@ public class SysDeptServiceImpl implements ISysDeptService return deptMapper.selectDeptList(dept); } + + /** + * 查询所有部门数据 + */ + public List selectDeptAll(){ + return deptMapper.selectDeptAll(); + } + /** * 查询部门树结构信息 * diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/CompanyDashboardMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/CompanyDashboardMapper.xml new file mode 100644 index 0000000..c2ab1fb --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/CompanyDashboardMapper.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + 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/FactoryDashboardMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml new file mode 100644 index 0000000..47036cc --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/FactoryDashboardMapper.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + 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..7039758 --- /dev/null +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/bigscreen/IpcDailyEquipNumByStatusMapper.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + select id, nums, status, dept_id, create_date from ipc_daily_equip_num_by_status + + + + + + + + insert into ipc_daily_equip_num_by_status + + nums, + status, + dept_id, + create_date, + + + #{nums}, + #{status}, + #{deptId}, + #{createDate}, + + + + + update ipc_daily_equip_num_by_status + + nums = #{nums}, + 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-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 + +