qushaowei
2024-03-14 be3aa0812cb43be7484e162b4fece5344e9eb5c8
Merge branch 'master' of http://117.34.109.166:18448/r/mdc_430 into develop
已添加16个文件
已修改41个文件
1897 ■■■■■ 文件已修改
lxzn-boot-base-core/src/main/java/org/jeecg/common/system/vo/LoginUser.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/constant/MdcConstant.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcMessageApprovalController.java 212 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcOverrunAlarmController.java 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/EquipmentMachingDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipment.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentRunningSection.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcMessageApproval.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverrunAlarm.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunMonitoringSpeedJob.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningEquipmentStatusJob.java 129 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningMonitoringSpeedJob.java 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOvertimeDurationJob.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentLogMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcMessageApprovalMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOverrunAlarmMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentLogMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcMessageApprovalMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOverrunAlarmMapper.xml 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentLogService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcMessageApprovalService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOverrunAlarmService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentLogServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java 243 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentWorkLineServiceImpl.java 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcMessageApprovalServiceImpl.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverrunAlarmServiceImpl.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcCommonVo.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcEfficiencyReportQueryVo.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcEfficiencyReportShiftQueryVo.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcEquipmentStatusVo.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcEquipmentVo.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/MdcProduction.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/SysAnnouncementSendMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysAnnouncementSendMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/model/MdcProductionTreeModel.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysAnnouncementService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysAnnouncementServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-boot-base-core/src/main/java/org/jeecg/common/system/vo/LoginUser.java
@@ -51,6 +51,10 @@
      */
    private String orgCode;
    /**
     * ç”¨æˆ·ç±»åž‹
     */
    private Integer userType;
    /**
     * å¤´åƒ
     */
    @SensitiveField
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/constant/MdcConstant.java
@@ -57,4 +57,30 @@
    public static final String MONTH = "月";
    /**
     * è®¾å¤‡ç®¡ç†å‘˜
     */
    public static final String MDC_EQUIPMENT_MANAGER = "mdcEquipmentManager";
    /**
     * è®¾å¤‡è¶…级管理员
     */
    public static final String MDC_EQUIPMENT_SUPER_MANAGER = "mdcEquipmentSuperManager";
    /**
     * æ¶ˆæ¯çŠ¶æ€ï¼ˆ0待处理,1待确认, 2已确认,3已拒绝)
     */
    public static final String MSG_STATUS_0 = "0";
    public static final String MSG_STATUS_1 = "1";
    public static final String MSG_STATUS_2 = "2";
    public static final String MSG_STATUS_3 = "3";
    /**
     * ç”¨æˆ·ç±»åž‹(1 æ™®é€šæˆå‘˜ 2 å·¥æ®µ 3 è½¦é—´ 4 å…¬å¸ï¼‰
     */
    public static final Integer USER_TYPE_1 = 1;
    public static final Integer USER_TYPE_2 = 2;
    public static final Integer USER_TYPE_3 = 3;
    public static final Integer USER_TYPE_4 = 4;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -426,7 +426,7 @@
     * @param mdcEquipment
     */
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, MdcEquipment mdcEquipment) {
    public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentVo mdcEquipment) {
        // Step.1 ç»„装查询条件
        //QueryWrapper<MdcEquipment> queryWrapper = QueryGenerator.initQueryWrapper(mdcEquipment, request.getParameterMap());
        //Step.2 AutoPoi å¯¼å‡ºExcel
@@ -525,4 +525,20 @@
        }
        return Result.OK("反馈成功!");
    }
    @AutoLog(value = "设备表-通过车间ids获取设备树")
    @ApiOperation(value = "设备表-通过车间ids获取设备树", notes = "设备表-通过车间ids获取设备树")
    @GetMapping(value = "/loadTreeListByProductionIds")
    public Result<?> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) {
        Result<List<MdcEquipmentTree>> result = new Result<>();
        try {
            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProductionIds(ids);
            result.setSuccess(true);
            result.setResult(mdcEquipmentTreeList);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return result;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,66 @@
package org.jeecg.modules.mdc.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.mdc.constant.MdcConstant;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.vo.MdcCommonVo;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
 * @author Lius
 * @Description: MDC首页接口
 * @date 2024/3/13 14:27
 */
@Slf4j
@Api(tags = "MDC首页接口")
@RestController
@RequestMapping("/mdc/home")
public class MdcHomeController {
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @Resource
    private IMdcProductionService mdcProductionService;
    @ApiOperation(value = "MDC首页接口-设备运行状态统计", notes = "MDC首页接口-设备运行状态统计")
    @GetMapping("/equipmentStatusStatistics")
    public Result<?> equipmentStatusStatistics(String productionCode) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        Integer userType = user.getUserType();
        String userId = user.getId();
        String key = "";
        if (StringUtils.isNotBlank(productionCode)) {
            //厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()));
            key = mdcProduction.getId();
        } else {
            //判断是公司级还是厂区
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, ""));
            if (userType.equals(MdcConstant.USER_TYPE_4)) {
                //公司
                key = mdcProduction.getId();
            } else if (userType.equals(MdcConstant.USER_TYPE_3)) {
                //厂区
                key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId());
            }
        }
        List<MdcCommonVo> resultMap = mdcEquipmentService.getEquipmentStatusStatistics(userId, key);
        return Result.OK(resultMap);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcMessageApprovalController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,212 @@
package org.jeecg.modules.mdc.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.dto.message.MessageDTO;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.mdc.constant.MdcConstant;
import org.jeecg.modules.mdc.entity.MdcMessageApproval;
import org.jeecg.modules.mdc.service.IMdcMessageApprovalService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/**
 * @Description: mdc消息确认表
 * @Author: Lius
 * @Date: 2024-03-06
 * @Version: V1.0
 */
@Slf4j
@Api(tags = "mdc消息确认表")
@RestController
@RequestMapping("/mdc/mdcMessageApproval")
public class MdcMessageApprovalController extends JeecgController<MdcMessageApproval, IMdcMessageApprovalService> {
    @Resource
    private IMdcMessageApprovalService mdcMessageApprovalService;
    @Resource
    private ISysBaseAPI sysBaseApi;
    /**
     * åˆ†é¡µåˆ—表查询
     *
     * @param mdcMessageApproval
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @AutoLog(value = "mdc消息确认表-分页列表查询")
    @ApiOperation(value = "mdc消息确认表-分页列表查询", notes = "mdc消息确认表-分页列表查询")
    @GetMapping(value = "/list")
    public Result<?> queryPageList(MdcMessageApproval mdcMessageApproval,
                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                   HttpServletRequest req) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        Page<MdcMessageApproval> page = new Page<MdcMessageApproval>(pageNo, pageSize);
        IPage<MdcMessageApproval> pageList = mdcMessageApprovalService.pageList(userId, page, mdcMessageApproval, req);
        return Result.OK(pageList);
    }
    /**
     * æ·»åŠ 
     *
     * @param mdcMessageApproval
     * @return
     */
    @AutoLog(value = "mdc消息确认表-添加")
    @ApiOperation(value = "mdc消息确认表-添加", notes = "mdc消息确认表-添加")
    @PostMapping(value = "/add")
    public Result<?> add(@RequestBody MdcMessageApproval mdcMessageApproval) {
        mdcMessageApprovalService.save(mdcMessageApproval);
        return Result.OK("添加成功!");
    }
    /**
     * ç¼–辑
     *
     * @param mdcMessageApproval
     * @return
     */
    @AutoLog(value = "mdc消息确认表-编辑")
    @ApiOperation(value = "mdc消息确认表-编辑", notes = "mdc消息确认表-编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<?> edit(@RequestBody MdcMessageApproval mdcMessageApproval) {
        mdcMessageApprovalService.updateById(mdcMessageApproval);
        return Result.OK("编辑成功!");
    }
    /**
     * é€šè¿‡id删除
     *
     * @param id
     * @return
     */
    @AutoLog(value = "mdc消息确认表-通过id删除")
    @ApiOperation(value = "mdc消息确认表-通过id删除", notes = "mdc消息确认表-通过id删除")
    @DeleteMapping(value = "/delete")
    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
        mdcMessageApprovalService.removeById(id);
        return Result.OK("删除成功!");
    }
    /**
     * æ‰¹é‡åˆ é™¤
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "mdc消息确认表-批量删除")
    @ApiOperation(value = "mdc消息确认表-批量删除", notes = "mdc消息确认表-批量删除")
    @DeleteMapping(value = "/deleteBatch")
    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        this.mdcMessageApprovalService.removeByIds(Arrays.asList(ids.split(",")));
        return Result.OK("批量删除成功!");
    }
    /**
     * é€šè¿‡id查询
     *
     * @param id
     * @return
     */
    @AutoLog(value = "mdc消息确认表-通过id查询")
    @ApiOperation(value = "mdc消息确认表-通过id查询", notes = "mdc消息确认表-通过id查询")
    @GetMapping(value = "/queryById")
    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
        MdcMessageApproval mdcMessageApproval = mdcMessageApprovalService.getById(id);
        return Result.OK(mdcMessageApproval);
    }
    /**
     * å¯¼å‡ºexcel
     *
     * @param request
     * @param mdcMessageApproval
     */
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, MdcMessageApproval mdcMessageApproval) {
        return super.exportXls(request, mdcMessageApproval, MdcMessageApproval.class, "mdc消息确认表");
    }
    /**
     * é€šè¿‡excel导入数据
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        return super.importExcel(request, response, MdcMessageApproval.class);
    }
    /**
     * ä¸ŠæŠ¥åŽŸå› 
     */
    @AutoLog(value = "mdc消息确认表-上报原因")
    @ApiOperation(value = "mdc消息确认表-上报原因", notes = "mdc消息确认表-上报原因")
    @RequestMapping(value = "/reportReason", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<?> reportReason(@RequestBody MdcMessageApproval mdcMessageApproval) {
        mdcMessageApproval.setMsgStatus(MdcConstant.MSG_STATUS_1);
        mdcMessageApprovalService.updateById(mdcMessageApproval);
        List<String> approverIdList = Arrays.asList(mdcMessageApproval.getApproverIds().split(","));
        for (String approverId : approverIdList) {
            //上报原因发送消息给确认人
            MessageDTO messageDTO = new MessageDTO();
            messageDTO.setTitle("设备状态长时间未变化原因上报确认!");
            messageDTO.setCategory("消息");
            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
            messageDTO.setFromUser(user.getUsername());
            LoginUser userById = sysBaseApi.getUserById(approverId);
            messageDTO.setToUser(userById.getUsername());
            messageDTO.setContent("设备编号为 [" + mdcMessageApproval.getEquipmentId() + "] çš„设备状态长时间未变化原因上报待确认!");
            sysBaseApi.sendSysAnnouncement(messageDTO);
        }
        return Result.OK("上报成功!");
    }
    /**
     * å¤„理确认
     */
    @AutoLog(value = "mdc消息确认表-处理确认")
    @ApiOperation(value = "mdc消息确认表-处理确认", notes = "mdc消息确认表-处理确认")
    @RequestMapping(value = "/handleConfirm", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<?> handleConfirm(@RequestBody MdcMessageApproval mdcMessageApproval) {
        if (mdcMessageApproval.getMsgStatus().equals(MdcConstant.MSG_STATUS_3)) {
            //处理被拒绝,需重新上报原因
            //上报原因发送消息给确认人
            MessageDTO messageDTO = new MessageDTO();
            messageDTO.setTitle("设备状态消息!");
            messageDTO.setCategory("消息");
            messageDTO.setFromUser("admin");
            messageDTO.setToUser(mdcMessageApproval.getUpdateBy());
            messageDTO.setContent("您的设备编号为 [" + mdcMessageApproval.getEquipmentId() + "] çš„设备状态长时间未变化上报已被设备超级管理员拒绝,请重新填写上报原因!");
            sysBaseApi.sendSysAnnouncement(messageDTO);
        }
        mdcMessageApprovalService.updateById(mdcMessageApproval);
        return Result.OK("成功!");
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcOverrunAlarmController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,155 @@
package org.jeecg.modules.mdc.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcOverrunAlarm;
import org.jeecg.modules.mdc.service.IMdcOverrunAlarmService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
/**
 * @Description: mdc超限报警
 * @Author: Lius
 * @Date: 2024-03-01
 * @Version: V1.0
 */
@Slf4j
@Api(tags = "mdc超限报警")
@RestController
@RequestMapping("/mdc/mdcOverrunAlarm")
public class MdcOverrunAlarmController extends JeecgController<MdcOverrunAlarm, IMdcOverrunAlarmService> {
    @Resource
    private IMdcOverrunAlarmService mdcOverrunAlarmService;
    /**
     * åˆ†é¡µåˆ—表查询
     *
     * @param mdcEquipment
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @AutoLog(value = "mdc超限报警-分页列表查询")
    @ApiOperation(value = "mdc超限报警-分页列表查询", notes = "mdc超限报警-分页列表查询")
    @GetMapping(value = "/list")
    public Result<?> queryPageList(MdcEquipment mdcEquipment,
                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                   HttpServletRequest req) {
        //QueryWrapper<MdcOverrunAlarm> queryWrapper = QueryGenerator.initQueryWrapper(mdcOverrunAlarm, req.getParameterMap());
        Page<MdcOverrunAlarm> page = new Page<MdcOverrunAlarm>(pageNo, pageSize);
        IPage<MdcOverrunAlarm> pageList = mdcOverrunAlarmService.pageList(page, mdcEquipment, req);
        return Result.OK(pageList);
    }
    /**
     * æ·»åŠ 
     *
     * @param mdcOverrunAlarm
     * @return
     */
    @AutoLog(value = "mdc超限报警-添加")
    @ApiOperation(value = "mdc超限报警-添加", notes = "mdc超限报警-添加")
    @PostMapping(value = "/add")
    public Result<?> add(@RequestBody MdcOverrunAlarm mdcOverrunAlarm) {
        mdcOverrunAlarmService.save(mdcOverrunAlarm);
        return Result.OK("添加成功!");
    }
    /**
     * ç¼–辑
     *
     * @param mdcOverrunAlarm
     * @return
     */
    @AutoLog(value = "mdc超限报警-编辑")
    @ApiOperation(value = "mdc超限报警-编辑", notes = "mdc超限报警-编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<?> edit(@RequestBody MdcOverrunAlarm mdcOverrunAlarm) {
        mdcOverrunAlarmService.updateById(mdcOverrunAlarm);
        return Result.OK("编辑成功!");
    }
    /**
     * é€šè¿‡id删除
     *
     * @param id
     * @return
     */
    @AutoLog(value = "mdc超限报警-通过id删除")
    @ApiOperation(value = "mdc超限报警-通过id删除", notes = "mdc超限报警-通过id删除")
    @DeleteMapping(value = "/delete")
    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
        mdcOverrunAlarmService.removeById(id);
        return Result.OK("删除成功!");
    }
    /**
     * æ‰¹é‡åˆ é™¤
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "mdc超限报警-批量删除")
    @ApiOperation(value = "mdc超限报警-批量删除", notes = "mdc超限报警-批量删除")
    @DeleteMapping(value = "/deleteBatch")
    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        this.mdcOverrunAlarmService.removeByIds(Arrays.asList(ids.split(",")));
        return Result.OK("批量删除成功!");
    }
    /**
     * é€šè¿‡id查询
     *
     * @param id
     * @return
     */
    @AutoLog(value = "mdc超限报警-通过id查询")
    @ApiOperation(value = "mdc超限报警-通过id查询", notes = "mdc超限报警-通过id查询")
    @GetMapping(value = "/queryById")
    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
        MdcOverrunAlarm mdcOverrunAlarm = mdcOverrunAlarmService.getById(id);
        return Result.OK(mdcOverrunAlarm);
    }
    /**
     * å¯¼å‡ºexcel
     *
     * @param request
     * @param mdcOverrunAlarm
     */
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, MdcOverrunAlarm mdcOverrunAlarm) {
        return super.exportXls(request, mdcOverrunAlarm, MdcOverrunAlarm.class, "mdc超限报警");
    }
    /**
     * é€šè¿‡excel导入数据
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        return super.importExcel(request, response, MdcOverrunAlarm.class);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/EquipmentMachingDto.java
@@ -7,6 +7,7 @@
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.modules.mdc.entity.MdcDriveTypeParamConfig;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@@ -153,6 +154,7 @@
    private String collectData;
    private BigDecimal spindleCurrent;
    /*测试使用*/
    private String dataLine1;
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipment.java
@@ -131,6 +131,27 @@
    @ApiModelProperty(value = "设备状态")
    private Integer equipmentStatus;
    /**
     * ç³»ç»Ÿç±»åž‹
     */
    @Excel(name = "系统类型", width = 15)
    @ApiModelProperty(value = "系统类型")
    private String systemType;
    /**
     * è®¾å¤‡çº§åˆ«
     */
    @Excel(name = "设备级别", width = 15)
    @ApiModelProperty(value = "设备级别")
    private String deviceLevel;
    /**
     * è®¾å¤‡ç§ç±»
     */
    @Excel(name = "设备种类", width = 15)
    @ApiModelProperty(value = "设备种类")
    private String deviceCategory;
    /**部门名称*/
    @Excel(name = "部门名称", width = 15)
    private transient String orgCodeTxt;
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentRunningSection.java
@@ -1,23 +1,20 @@
package org.jeecg.modules.mdc.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
/**
 * @Description: è®¾å¤‡è¿è¡Œæ—¶æ®µçŠ¶æ€è¡¨
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcMessageApproval.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,97 @@
package org.jeecg.modules.mdc.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
 * @Description: mdc消息确认表
 * @Author: Lius
 * @Date: 2024-03-06
 * @Version: V1.0
 */
@Data
@TableName("mdc_message_approval")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "mdc_message_approval对象", description = "mdc消息确认表")
public class MdcMessageApproval extends JeecgEntity implements Serializable {
    private static final long serialVersionUID = 3826726426360323366L;
    /**
     * è®¾å¤‡ç¼–码
     */
    @Excel(name = "设备编码", width = 15)
    @ApiModelProperty(value = "设备编码")
    private String equipmentId;
    /**
     * æ ‡é¢˜
     */
    @Excel(name = "标题", width = 15)
    @ApiModelProperty(value = "标题")
    private String titile;
    /**
     * å†…容
     */
    @Excel(name = "内容", width = 15)
    @ApiModelProperty(value = "内容")
    private String msgContent;
    /**
     * å¤„理人ids
     */
    @ApiModelProperty(value = "处理人ids")
    private String senderIds;
    /**
     * å¤„理人姓名
     */
    @Excel(name = "处理人姓名", width = 15)
    @ApiModelProperty(value = "处理人姓名")
    private String senderNames;
    /**
     * æ¶ˆæ¯çŠ¶æ€ï¼ˆ0待处理,1待确认, 2已确认,3已拒绝)
     */
    @Excel(name = "消息状态(0待处理,1待确认, 2已确认,3已拒绝)", width = 15)
    @ApiModelProperty(value = "消息状态(0待处理,1待确认, 2已确认,3已拒绝)")
    @Dict(dicCode = "mdcMsgStatus")
    private String msgStatus;
    /**
     * æ¶ˆæ¯ç¡®è®¤äººids
     */
    @Excel(name = "消息确认人ids", width = 15)
    @ApiModelProperty(value = "消息确认人ids")
    private String approverIds;
    /**
     * æ¶ˆæ¯ç¡®è®¤äººå§“名
     */
    @Excel(name = "消息确认人姓名", width = 15)
    @ApiModelProperty(value = "消息确认人姓名")
    private String approverNames;
    /**
     * ä¸ŠæŠ¥å†…容
     */
    @Excel(name = "上报内容", width = 15)
    @ApiModelProperty(value = "上报内容")
    private String reportContent;
    /**
     * å¤„理按钮
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "处理按钮")
    private Boolean hasProcess = false;
    /**
     * ç¡®è®¤æŒ‰é’®
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "确认按钮")
    private Boolean hasConfirm = false;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverrunAlarm.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,54 @@
package org.jeecg.modules.mdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
 * @Description: mdc超限报警
 * @Author: Lius
 * @Date: 2024-03-01
 * @Version: V1.0
 */
@Data
@TableName("mdc_overrun_alarm")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "mdc_overrun_alarm对象", description = "mdc超限报警")
public class MdcOverrunAlarm extends JeecgEntity implements Serializable {
    private static final long serialVersionUID = 3633764093859258849L;
    /**
     * è®¾å¤‡ç¼–码
     */
    @Excel(name = "设备编码", width = 15)
    @ApiModelProperty(value = "设备编码")
    private String equipmentId;
    /**
     * è®¾å®šèŒƒå›´
     */
    @Excel(name = "设定范围", width = 15)
    @ApiModelProperty(value = "设定范围")
    private String setValue;
    /**
     * å®žé™…值
     */
    @Excel(name = "实际值", width = 15)
    @ApiModelProperty(value = "实际值")
    private String realValue;
    /**
     * æŠ¥è­¦å†…容
     */
    @Excel(name = "报警内容", width = 15)
    @ApiModelProperty(value = "报警内容")
    private String alarmContent;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunMonitoringSpeedJob.java
@@ -17,7 +17,7 @@
/**
 * @author Lius
 * @Description: ç›‘控设备转速任务
 * @Description: ç›‘控设备运行参数任务
 * @date 2024/1/16 17:36
 */
@PersistJobDataAfterExecution
@@ -45,7 +45,7 @@
        if (byJobClassName != null && !byJobClassName.isEmpty()) {
            quartzLog.setJobId(byJobClassName.get(0).getId());
        }
        log.info("监控设备转速任务 RunMonitoringSpeedJob start!  æ—¶é—´:" + DateUtils.now());
        log.info("监控设备运行参数任务 RunMonitoringSpeedJob start!  æ—¶é—´:" + DateUtils.now());
        long startTime = System.currentTimeMillis();
        try {
            mdcEquipmentService.monitoringSpeedProcess();
@@ -54,7 +54,7 @@
            quartzLog.setIsSuccess(-1);
            quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
            // å‘送消息通知
            sysAnnouncementService.jobSendMessage("监控设备转速任务失败!", quartzLog.getExceptionDetail());
            sysAnnouncementService.jobSendMessage("监控设备运行参数任务!", quartzLog.getExceptionDetail());
        }
        long endTime = System.currentTimeMillis();
        quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningEquipmentStatusJob.java
@@ -6,9 +6,12 @@
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.modules.mdc.constant.MdcConstant;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcMessageApproval;
import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.IMdcMessageApprovalService;
import org.jeecg.modules.mdc.service.MdcEfficiencyReportService;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.util.ThrowableUtil;
@@ -16,8 +19,11 @@
import org.jeecg.modules.quartz.entity.SysQuartzLog;
import org.jeecg.modules.quartz.service.IQuartzJobService;
import org.jeecg.modules.quartz.service.ISysQuartzLogService;
import org.jeecg.modules.system.entity.SysAnnouncement;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysAnnouncementService;
import org.jeecg.modules.system.service.ISysDictService;
import org.jeecg.modules.system.service.ISysUserService;
import org.quartz.*;
import javax.annotation.Resource;
@@ -26,6 +32,7 @@
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
 * @author Lius
@@ -61,6 +68,12 @@
    @Resource
    private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService;
    @Resource
    private IMdcMessageApprovalService mdcMessageApprovalService;
    @Resource
    private ISysUserService sysUserService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        SysQuartzLog quartzLog = new SysQuartzLog();
@@ -73,7 +86,7 @@
        long startTime = System.currentTimeMillis();
        try {
            List<MdcEquipment> equipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<>());
            //List<MdcEquipment> equipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, "2140198"));
//            List<MdcEquipment> equipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, "3140045"));
            // èŽ·å–åˆ©ç”¨çŽ‡åˆ¤å®šå¤©æ•°
            List<DictModel> dictModelList1 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_RATE_JUDGE);
            Integer equipmentRateJudge = 5;
@@ -94,28 +107,53 @@
            }
            for (MdcEquipment mdcEquipment : equipmentList) {
                // åˆ¤æ–­åˆ©ç”¨çއ
                String date = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-equipmentRateJudge).toString(), DateUtils.STR_DATE), DateUtils.STRDATE);
                List<BigDecimal> efficiencyRateList = mdcEfficiencyReportService.getEfficiencyRate(mdcEquipment.getEquipmentId(), date);
                if (efficiencyRateList != null && !efficiencyRateList.isEmpty()) {
                    boolean flag = true;
                    for (BigDecimal processLong : efficiencyRateList) {
                        BigDecimal efficiencyRate = processLong.divide(new BigDecimal("86400"), 4, RoundingMode.HALF_UP);
                        if (efficiencyRate.compareTo(new BigDecimal(equipmentRateNormal)) > -1) {
                            flag = false;
                        }
                    }
                    if (flag) {
                        // ä¸ŠæŠ¥
                        MessageDTO messageDTO = new MessageDTO();
                        messageDTO.setTitle("设备利用率报警!");
                        messageDTO.setCategory("预警消息");
                        messageDTO.setFromUser("admin");
                        messageDTO.setToUser("admin");
                        messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备利用率低于正常值报警!");
                        sysBaseApi.sendSysAnnouncement(messageDTO);
                // step.1 æŸ¥è¯¢æ¶ˆæ¯ä¸­æ­¤è®¾å¤‡æŠ¥è­¦æ—¶é—´
                SysAnnouncement sysAnnouncement = sysAnnouncementService.findLastMessage("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备利用率低于正常值报警!");
                boolean flag1 = true;
                if (sysAnnouncement != null) {
                    Date createTime = sysAnnouncement.getCreateTime();
                    Date msgDate = DateUtils.toDate(DateUtils.format(createTime, DateUtils.STR_DATE), DateUtils.STR_DATE);
                    Date now = DateUtils.toDate(LocalDate.now().toString(), DateUtils.STR_DATE);
                    Integer days = DateUtils.getDays(msgDate, now);
                    if (days < equipmentRateJudge) {
                        flag1 = false;
                    }
                }
                // åˆ¤æ–­è®¾å¤‡çŠ¶æ€
                if (flag1) {
                    String date = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-equipmentRateJudge).toString(), DateUtils.STR_DATE), DateUtils.STRDATE);
                    List<BigDecimal> efficiencyRateList = mdcEfficiencyReportService.getEfficiencyRate(mdcEquipment.getEquipmentId(), date);
                    if (efficiencyRateList != null && !efficiencyRateList.isEmpty()) {
                        boolean flag = true;
                        for (BigDecimal processLong : efficiencyRateList) {
                            BigDecimal efficiencyRate = processLong.divide(new BigDecimal("86400"), 4, RoundingMode.HALF_UP);
                            if (efficiencyRate.compareTo(new BigDecimal(equipmentRateNormal)) > -1) {
                                flag = false;
                            }
                        }
                        if (flag) {
                            // ä¸ŠæŠ¥
                            MessageDTO messageDTO = new MessageDTO();
                            messageDTO.setTitle("设备利用率报警!");
                            messageDTO.setCategory("预警消息");
                            messageDTO.setFromUser("admin");
                            messageDTO.setToUser("admin");
                            messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备利用率低于正常值报警!");
                            sysBaseApi.sendSysAnnouncement(messageDTO);
                        }
                    }
                }
                // åˆ¤æ–­è®¾å¤‡çŠ¶æ€é•¿æ—¶é—´æ— å˜åŒ–å®¡æ‰¹äºº
                SysAnnouncement sysAnnouncement1 = sysAnnouncementService.findLastMessage("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备状态长期无变化报警!");
                if (sysAnnouncement1 != null) {
                    Date createTime = sysAnnouncement1.getCreateTime();
                    Date msgDate = DateUtils.toDate(DateUtils.format(createTime, DateUtils.STR_DATE), DateUtils.STR_DATE);
                    Date now = DateUtils.toDate(LocalDate.now().toString(), DateUtils.STR_DATE);
                    Integer days = DateUtils.getDays(msgDate, now);
                    if (days < equipmentStatusJudge) {
                        continue;
                    }
                }
                Date date1 = DateUtils.toDate(LocalDate.now().plusDays(-equipmentStatusJudge).toString(), DateUtils.STR_DATE);
                List<Integer> sectionList = mdcEquipmentRunningSectionService.getDataList(mdcEquipment.getEquipmentId(), date1);
                if (sectionList != null && !sectionList.isEmpty() && sectionList.size() > 1) {
@@ -128,13 +166,46 @@
                    }
                    if (flag) {
                        // ä¸ŠæŠ¥
                        MessageDTO messageDTO = new MessageDTO();
                        messageDTO.setTitle("设备状态长期无变化报警!");
                        messageDTO.setCategory("预警消息");
                        messageDTO.setFromUser("admin");
                        messageDTO.setToUser("admin");
                        messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备状态长期无变化报警!");
                        sysBaseApi.sendSysAnnouncement(messageDTO);
                        // æŸ¥è¯¢è®¾å¤‡ç®¡ç†å‘˜
                        List<SysUser> adminList = sysUserService.getEquipmentAdmin(MdcConstant.MDC_EQUIPMENT_MANAGER, mdcEquipment.getEquipmentId());
                        // æŸ¥è¯¢è®¾å¤‡è¶…级管理员
                        List<SysUser> superList = sysUserService.getEquipmentAdmin(MdcConstant.MDC_EQUIPMENT_SUPER_MANAGER, mdcEquipment.getEquipmentId());
                        if (adminList != null && !adminList.isEmpty()) {
                            for (SysUser sysUser : adminList) {
                                MessageDTO messageDTO = new MessageDTO();
                                messageDTO.setTitle("设备状态长期无变化报警!");
                                messageDTO.setCategory("预警消息");
                                messageDTO.setFromUser("admin");
                                messageDTO.setToUser(sysUser.getUsername());
                                messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备状态长期无变化报警!");
                                sysBaseApi.sendSysAnnouncement(messageDTO);
                            }
                        } else {
                            MessageDTO messageDTO = new MessageDTO();
                            messageDTO.setTitle("设备状态长期无变化报警!");
                            messageDTO.setCategory("预警消息");
                            messageDTO.setFromUser("admin");
                            messageDTO.setToUser("admin");
                            messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备状态长期无变化报警!");
                            sysBaseApi.sendSysAnnouncement(messageDTO);
                        }
                        if (adminList != null && !adminList.isEmpty() && superList != null && !superList.isEmpty()) {
                            MdcMessageApproval mdcMessageApproval = new MdcMessageApproval();
                            mdcMessageApproval.setEquipmentId(mdcEquipment.getEquipmentId());
                            mdcMessageApproval.setTitile("设备状态长期无变化报警!");
                            mdcMessageApproval.setMsgContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备状态长期无变化报警!");
                            List<String> senderIdList = adminList.stream().map(SysUser::getId).collect(Collectors.toList());
                            mdcMessageApproval.setSenderIds(String.join(",", senderIdList));
                            List<String> senderNameList = adminList.stream().map(SysUser::getRealname).collect(Collectors.toList());
                            mdcMessageApproval.setSenderNames(String.join(",", senderNameList));
                            List<String> superIdList = superList.stream().map(SysUser::getId).collect(Collectors.toList());
                            mdcMessageApproval.setApproverIds(String.join(",", superIdList));
                            List<String> superNameList = superList.stream().map(SysUser::getRealname).collect(Collectors.toList());
                            mdcMessageApproval.setApproverNames(String.join(",", superNameList));
                            mdcMessageApproval.setMsgStatus(MdcConstant.MSG_STATUS_0);
                            mdcMessageApprovalService.save(mdcMessageApproval);
                        }
                    }
                }
            }
@@ -143,7 +214,7 @@
            quartzLog.setIsSuccess(-1);
            quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
            // å‘送消息通知
            sysAnnouncementService.jobSendMessage("设备状态长期无变化报警任务失败!", quartzLog.getExceptionDetail());
            sysAnnouncementService.jobSendMessage("设备状态长期无变化报警任务", quartzLog.getExceptionDetail());
        }
        long endTime = System.currentTimeMillis();
        quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningMonitoringSpeedJob.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,154 @@
package org.jeecg.modules.mdc.job;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.dto.message.MessageDTO;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcOverrunAlarm;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.IMdcOverrunAlarmService;
import org.jeecg.modules.mdc.util.ThrowableUtil;
import org.jeecg.modules.quartz.entity.QuartzJob;
import org.jeecg.modules.quartz.entity.SysQuartzLog;
import org.jeecg.modules.quartz.service.IQuartzJobService;
import org.jeecg.modules.quartz.service.ISysQuartzLogService;
import org.jeecg.modules.system.service.ISysAnnouncementService;
import org.jeecg.modules.system.service.ISysDictService;
import org.quartz.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
/**
 * @author Lius
 * @Description: ç›‘控设备运行转速与NC程序设定转速对比
 * @date 2024/3/4 16:14
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningMonitoringSpeedJob implements Job {
    @Resource
    private IQuartzJobService quartzJobService;
    @Resource
    private ISysQuartzLogService sysQuartzLogService;
    @Resource
    private ISysAnnouncementService sysAnnouncementService;
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @Resource
    private ISysDictService sysDictService;
    @Resource
    private ISysBaseAPI sysBaseApi;
    @Resource
    private IMdcOverrunAlarmService mdcOverrunAlarmService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        SysQuartzLog quartzLog = new SysQuartzLog();
        quartzLog.setCreateTime(new Date());
        List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName());
        if (byJobClassName != null && !byJobClassName.isEmpty()) {
            quartzLog.setJobId(byJobClassName.get(0).getId());
        }
        log.info("监控设备运行转速与NC程序设定转速对比 RunningMonitoringSpeedJob start!  æ—¶é—´:" + DateUtils.now());
        long startTime = System.currentTimeMillis();
        try {
            List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().ne(MdcEquipment::getDriveType, "ZUOLAN"));
            // èŽ·å–å­—å…¸æ•°æ®
            List<DictModel> dictModelList = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_OPERATING_SPEED_RANGE);
            BigDecimal range = BigDecimal.ZERO;
            if (dictModelList != null && !dictModelList.isEmpty()) {
                range = new BigDecimal(dictModelList.get(0).getValue());
            }
            for (MdcEquipment mdcEquipment : mdcEquipmentList) {
                String saveTableName = mdcEquipment.getSaveTableName();
                MdcEquipmentDto mdcEquipmentDto = new MdcEquipmentDto();
                try {
                    //查询单表数据
                    mdcEquipmentDto = mdcEquipmentService.getWorkLineLast(saveTableName);
                } catch (Exception e) {
                    log.error("查询单表数据失败!", e);
                }
                if (mdcEquipmentDto != null && StringUtils.isNotBlank(mdcEquipmentDto.getSpindlespeed()) && StringUtils.isNotBlank(mdcEquipmentDto.getActualspindlespeed())) {
                    MessageDTO messageDTO = new MessageDTO();
                    messageDTO.setTitle("设备运行转速报警!");
                    messageDTO.setCategory("预警消息");
                    messageDTO.setFromUser("admin");
                    messageDTO.setToUser("admin");
                    //设定
                    BigDecimal spindlespeed = new BigDecimal(mdcEquipmentDto.getSpindlespeed());
                    //实际
                    BigDecimal actualspindlespeed = new BigDecimal(mdcEquipmentDto.getActualspindlespeed());
                    MdcOverrunAlarm mdcOverrunAlarm = new MdcOverrunAlarm();
                    mdcOverrunAlarm.setEquipmentId(mdcEquipment.getEquipmentId());
                    mdcOverrunAlarm.setSetValue(spindlespeed.toString());
                    mdcOverrunAlarm.setRealValue(actualspindlespeed.toString());
                    if (range.equals(BigDecimal.ZERO)) {
                        if (spindlespeed.compareTo(actualspindlespeed) == 1) {
                            // è®¾å®šå€¼å¤§äºŽå®žé™…值   ä½Ž
                            messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备运行转速低报警!");
                            sysBaseApi.sendSysAnnouncement(messageDTO);
                            mdcOverrunAlarm.setAlarmContent("设备运行转速比NC代码设定值低报警");
                            mdcOverrunAlarmService.save(mdcOverrunAlarm);
                        } else if (spindlespeed.compareTo(actualspindlespeed) == -1) {
                            // è®¾å®šå€¼å°äºŽå®žé™…值   é«˜
                            messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备运行转速高报警!");
                            sysBaseApi.sendSysAnnouncement(messageDTO);
                            mdcOverrunAlarm.setAlarmContent("设备运行转速比NC代码设定值高报警");
                            mdcOverrunAlarmService.save(mdcOverrunAlarm);
                        }
                    } else {
                        BigDecimal multiply = spindlespeed.multiply(range.divide(new BigDecimal(100), 4, RoundingMode.HALF_UP));
                        BigDecimal max = spindlespeed.add(multiply);
                        BigDecimal min = spindlespeed.subtract(multiply);
                        if (actualspindlespeed.compareTo(max) == 1 || actualspindlespeed.compareTo(min) == -1) {
                            if (spindlespeed.compareTo(actualspindlespeed) == 1) {
                                // è®¾å®šå€¼å¤§äºŽå®žé™…值   ä½Ž
                                messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备运行转速低报警!");
                                sysBaseApi.sendSysAnnouncement(messageDTO);
                                mdcOverrunAlarm.setAlarmContent("设备运行转速比NC代码设定值低报警");
                                mdcOverrunAlarmService.save(mdcOverrunAlarm);
                            } else if (spindlespeed.compareTo(actualspindlespeed) == -1) {
                                // è®¾å®šå€¼å°äºŽå®žé™…值   é«˜
                                messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备运行转速高报警!");
                                sysBaseApi.sendSysAnnouncement(messageDTO);
                                mdcOverrunAlarm.setAlarmContent("设备运行转速比NC代码设定值高报警");
                                mdcOverrunAlarmService.save(mdcOverrunAlarm);
                            }
                        }
                    }
                }
            }
            quartzLog.setIsSuccess(0);
        } catch (Exception e) {
            quartzLog.setIsSuccess(-1);
            quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
            // å‘送消息通知
            sysAnnouncementService.jobSendMessage("监控设备运行转速与NC程序设定转速对比!", quartzLog.getExceptionDetail());
        }
        long endTime = System.currentTimeMillis();
        quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
        sysQuartzLogService.save(quartzLog);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOvertimeDurationJob.java
@@ -79,8 +79,8 @@
        quartzLog.setParams(this.parameter);
        log.info(String.format("定时统计设备加班时长任务 param: %s RunningOvertimeDurationJob start!  æ—¶é—´:" + DateUtils.getNow(), this.parameter));
        long startTime = System.currentTimeMillis();
        String date = "";
        try {
            String date = "";
            if (StringUtils.isNotBlank(this.parameter)) {
                date = DateUtils.format(DateUtils.toDate(this.parameter, DateUtils.STRDATE), DateUtils.STR_DATE);
                Date initDate = DateUtils.toDate(this.parameter, DateUtils.STRDATE);
@@ -99,7 +99,7 @@
            List<MdcEquipmentOvertime> result = new ArrayList<>();
            for (MdcEquipment mdcEquipment : equipmentList) {
                // èŽ·å–è®¾å¤‡å·¥ä½œæ—¥åŽ†
                List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = mdcDeviceCalendarService.listByEquipmentIdAndDate(mdcEquipment.getEquipmentId(), this.parameter);
                List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = mdcDeviceCalendarService.listByEquipmentIdAndDate(mdcEquipment.getEquipmentId(), DateUtils.format(DateUtils.toDate(date, DateUtils.STR_DATE),DateUtils.STRDATE));
                if (mdcDeviceCalendarVos != null && !mdcDeviceCalendarVos.isEmpty()) {
                    //获取最后一个班次结束时间
                    Date startDate = this.getCalendarEndDate(mdcDeviceCalendarVos, date);
@@ -121,7 +121,7 @@
                        mdcEquipmentOvertime.setEquipmentId(mdcEquipment.getEquipmentId());
                        mdcEquipmentOvertime.setDuration(duration);
                        mdcEquipmentOvertime.setAutoFlag(CommonConstant.AUTO_FLAG_Y);
                        mdcEquipmentOvertime.setTheDate(this.parameter);
                        mdcEquipmentOvertime.setTheDate(DateUtils.format(DateUtils.toDate(date, DateUtils.STR_DATE),DateUtils.STRDATE));
                        result.add(mdcEquipmentOvertime);
                    }
@@ -146,7 +146,7 @@
                        mdcEquipmentOvertime.setEquipmentId(mdcEquipment.getEquipmentId());
                        mdcEquipmentOvertime.setDuration(duration);
                        mdcEquipmentOvertime.setAutoFlag(CommonConstant.AUTO_FLAG_Y);
                        mdcEquipmentOvertime.setTheDate(this.parameter);
                        mdcEquipmentOvertime.setTheDate(DateUtils.format(DateUtils.toDate(date, DateUtils.STR_DATE),DateUtils.STRDATE));
                        result.add(mdcEquipmentOvertime);
                    }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentLogMapper.java
@@ -15,5 +15,5 @@
    EquipmentLog getRow(@Param("equipmentid") String equipmentid, @Param("startTime") Date startTime);
    Integer selectEquipmentOporation(@Param("equipmentId") String equipmentId);
    EquipmentLog selectEquipmentOporation(@Param("equipmentId") String equipmentId);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -5,9 +5,11 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.mdc.dto.MdcEquDepDto;
import org.jeecg.modules.mdc.dto.MdcEquProDto;
import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
import org.jeecg.modules.mdc.entity.EquipmentLog;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor;
import org.jeecg.modules.mdc.vo.MdcEquipmentDepVo;
@@ -16,6 +18,7 @@
import org.jeecg.modules.mdc.vo.WorkshopEquipmentVo;
import java.util.List;
import java.util.Map;
/**
 * @Description: è®¾å¤‡è¡¨
@@ -97,12 +100,23 @@
    IPage<MdcEquipment> pageList(Page<MdcEquipment> page, @Param("mdcEquipment") MdcEquipmentVo mdcEquipment);
    @InterceptorIgnore(tenantLine = "1")
    MdcEquipmentDto getWorkLineLast(@Param("tableName") String saveTableName);
    @Select("select TOP 1 CollectTime ${columns} from [${tableName}] order by CollectTime desc")
    Map<String, Object> getWorkLineLast(Map<String, Object> param);
    /**
     * å¯¼å‡ºlist
     * @param mdcEquipment
     * @return
     */
    List<MdcEquipment> exportXlsList(@Param("mdcEquipment") MdcEquipment mdcEquipment);
    List<MdcEquipment> exportXlsList(@Param("mdcEquipment") MdcEquipmentVo mdcEquipment);
    /**
     * æŸ¥è¯¢å•表数据
     * @param tableName
     * @return
     */
    @InterceptorIgnore(tenantLine = "1")
    MdcEquipmentDto findWorkLineLast(@Param("tableName") String tableName);
    List<EquipmentLog> getEquipmentStatusList(@Param("equipmentIdList") List<String> equipmentIdList);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcMessageApprovalMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package org.jeecg.modules.mdc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.entity.MdcMessageApproval;
/**
 * @Description: mdc消息确认表
 * @Author: Lius
 * @Date:   2024-03-06
 * @Version: V1.0
 */
public interface MdcMessageApprovalMapper extends BaseMapper<MdcMessageApproval> {
    /**
     * åˆ—表查询
     */
    IPage<MdcMessageApproval> pageList(@Param("userId") String userId, Page<MdcMessageApproval> page, @Param("mdcMessageApproval") MdcMessageApproval mdcMessageApproval);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOverrunAlarmMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package org.jeecg.modules.mdc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcOverrunAlarm;
/**
 * @Description: mdc超限报警
 * @Author: Lius
 * @Date: 2024-03-01
 * @Version: V1.0
 */
public interface MdcOverrunAlarmMapper extends BaseMapper<MdcOverrunAlarm> {
    /**
     * åˆ†é¡µæŸ¥è¯¢
     *
     * @param page
     * @param mdcEquipment
     * @return
     */
    IPage<MdcOverrunAlarm> pageList(Page<MdcOverrunAlarm> page, @Param("mdcEquipment") MdcEquipment mdcEquipment);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentLogMapper.xml
@@ -6,7 +6,7 @@
        SELECT top 1 * FROM EquipmentLog WHERE EquipmentID = #{ equipmentid } AND CollectTime &lt;= #{ startTime } AND Oporation in ('0','1','2','3') ORDER BY CollectTime ASC
    </select>
    <select id="selectEquipmentOporation" resultType="java.lang.Integer">
        SELECT TOP 1 Oporation FROM EquipmentLog WHERE EquipmentID = #{ equipmentId } ORDER BY CollectTime DESC
    <select id="selectEquipmentOporation" resultType="org.jeecg.modules.mdc.entity.EquipmentLog">
        SELECT TOP 1 * FROM EquipmentLog WHERE EquipmentID = #{ equipmentId } ORDER BY CollectTime DESC
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml
@@ -52,15 +52,12 @@
            t3.sleep_start_date,
            t3.sleep_end_date,
            t3.is_day_span,
            t4.equipment_name,
            t5.start_time overtimeStartTime,
            t5.end_time overtimeEndTime
            t4.equipment_name
        FROM
            mdc_device_calendar t1
            LEFT JOIN mdc_shift t2 ON t1.shift_id = t2.id
            LEFT JOIN mdc_shift_sub t3 ON t1.shift_sub_id = t3.id
            LEFT JOIN mdc_equipment t4 ON t1.equipment_id = t4.equipment_id
            LEFT JOIN mdc_equipment_overtime t5 ON t5.calendar_id = t1.id
        <where>
            <if test="equipmentId != null and equipmentId != ''">
                AND t4.equipment_id = #{ equipmentId }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml
@@ -28,6 +28,9 @@
        <if test="vo.equipmentType != null and vo.equipmentType != '' ">
            AND t2.equipment_type = #{ vo.equipmentType }
        </if>
        <if test="vo.driveType != null and vo.driveType != '' ">
            AND t2.drive_type = #{ vo.driveType }
        </if>
        <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 ">
            AND t2.equipment_id IN
            <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
@@ -65,6 +68,9 @@
            AND t1.the_date &gt;= #{ vo.startTime }
        <if test="vo.equipmentType != null and vo.equipmentType != '' ">
            AND t2.equipment_type = #{ vo.equipmentType }
        </if>
        <if test="vo.driveType != null and vo.driveType != '' ">
            AND t2.drive_type = #{ vo.driveType }
        </if>
        <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 ">
            AND t2.equipment_id IN
@@ -110,6 +116,9 @@
            <if test="vo.equipmentType != null and vo.equipmentType != '' ">
                AND t2.equipment_type = #{ vo.equipmentType }
            </if>
            <if test="vo.driveType != null and vo.driveType != '' ">
                AND t2.drive_type = #{ vo.driveType }
            </if>
        </where>
        GROUP BY
            t2.equipment_id,
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -238,16 +238,14 @@
            <if test="mdcEquipment.driveType != null and mdcEquipment.driveType != '' ">
                AND t1.drive_type = #{mdcEquipment.driveType}
            </if>
            <if test="mdcEquipment.productionName != null and mdcEquipment.productionName != '' ">
                AND t3.id = #{ mdcEquipment.productionName } OR t3.parent_id = #{ mdcEquipment.productionName }
            <if test="mdcEquipment.productionIds != null and mdcEquipment.productionIds.size() > 0 ">
                AND t3.id IN
                <foreach collection="mdcEquipment.productionIds" index="index" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
        </where>
        order by t1.sort_no
    </select>
    <select id="getWorkLineLast" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
        select top 1 spindlespeed, actualspindlespeed from [${tableName}] order by CollectTime  desc
    </select>
    <select id="exportXlsList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
@@ -268,16 +266,40 @@
                AND t1.equipment_name = #{mdcEquipment.equipmentModel}
            </if>
            <if test="mdcEquipment.equipmentType != null and mdcEquipment.equipmentType != '' ">
                AND t1.equipmentType = #{mdcEquipment.equipmentType}
                AND t1.equipment_type = #{mdcEquipment.equipmentType}
            </if>
            <if test="mdcEquipment.driveType != null and mdcEquipment.driveType != '' ">
                AND t1.drive_type = #{mdcEquipment.driveType}
            </if>
            <if test="mdcEquipment.productionName != null and mdcEquipment.productionName != '' ">
                AND t3.id = #{ mdcEquipment.productionName } OR t3.parent_id = #{ mdcEquipment.productionName }
            <if test="mdcEquipment.productionIds != null and mdcEquipment.productionIds.size() > 0 ">
                AND t3.id IN
                <foreach collection="mdcEquipment.productionIds" index="index" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
        </where>
        order by t1.sort_no
    </select>
    <!--查询单表数据-->
    <select id="findWorkLineLast" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
        select top 1 spindlespeed, actualspindlespeed from [${tableName}] order by CollectTime  desc
    </select>
    <!--查询设备最新一条数据-->
    <select id="getEquipmentStatusList" resultType="org.jeecg.modules.mdc.entity.EquipmentLog">
        SELECT
            t1.*
        FROM
            EquipmentLog t1
            INNER JOIN ( SELECT MAX ( CollectTime ) AS CollectTime, EquipmentID FROM EquipmentLog GROUP BY EquipmentID ) t2 ON t1.CollectTime= t2.CollectTime
            AND t1.EquipmentID= t2.EquipmentID
        <if test="equipmentIdList != null and equipmentIdList.size() > 0">
            AND t1.EquipmentID IN
            <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </if>
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcMessageApprovalMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mdc.mapper.MdcMessageApprovalMapper">
    <!--列表查询-->
    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcMessageApproval">
        SELECT
            *
        FROM
            mdc_message_approval
        <where>
            (sender_ids LIKE CONCAT(CONCAT('%',#{userId}),'%') OR approver_ids LIKE CONCAT(CONCAT('%',#{userId}),'%'))
            <if test="mdcMessageApproval.equipmentId != null and mdcMessageApproval.equipmentId != ''">
                AND equipment_id = #{mdcMessageApproval.equipmentId}
            </if>
            <if test="mdcMessageApproval.msgStatus != null and mdcMessageApproval.msgStatus != ''">
                AND msg_status = #{mdcMessageApproval.msgStatus}
            </if>
        </where>
        ORDER BY create_time DESC
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOverrunAlarmMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mdc.mapper.MdcOverrunAlarmMapper">
    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcOverrunAlarm">
        SELECT
            t1.*
        FROM
            mdc_overrun_alarm t1
                LEFT JOIN mdc_equipment t2 ON t1.equipment_id = t2.equipment_id
        <where>
            <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' ">
                AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%')
            </if>
            <if test="mdcEquipment.equipmentType != null and mdcEquipment.equipmentType != '' ">
                AND t2.equipment_type = #{mdcEquipment.equipmentType}
            </if>
            <if test="mdcEquipment.driveType != null and mdcEquipment.driveType != '' ">
                AND t2.drive_type = #{mdcEquipment.driveType}
            </if>
        </where>
        ORDER BY
            t1.create_time DESC
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentLogService.java
@@ -27,5 +27,5 @@
     */
    EquipmentLog getRow(String equipmentid, Date startTime);
    Integer selectEquipmentOporation(String equipmentId);
    EquipmentLog selectEquipmentOporation(String equipmentId);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -9,6 +9,7 @@
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor;
import org.jeecg.modules.mdc.model.MdcEquipmentTree;
import org.jeecg.modules.mdc.vo.MdcCommonVo;
import org.jeecg.modules.mdc.vo.MdcEquipmentVo;
import org.jeecg.modules.mdc.vo.WorkshopEquipmentVo;
@@ -178,7 +179,7 @@
    IPage<MdcEquipment> pageList(Page<MdcEquipment> page, MdcEquipmentVo mdcEquipment, HttpServletRequest req);
    /**
     * ç›‘控设备转速任务
     * ç›‘控设备运行参数任务
     */
    void monitoringSpeedProcess();
@@ -187,6 +188,24 @@
     * @param mdcEquipment
     * @return
     */
    List<MdcEquipment> exportXlsList(MdcEquipment mdcEquipment);
    List<MdcEquipment> exportXlsList(MdcEquipmentVo mdcEquipment);
    /**
     * é€šè¿‡è½¦é—´ids获取设备树
     * @param ids
     * @return
     */
    List<MdcEquipmentTree> loadTreeListByProductionIds(String ids);
    /**
     * æŸ¥è¯¢å•表数据
     * @param tableName
     * @return
     */
    MdcEquipmentDto getWorkLineLast(String tableName);
    /**
     * è®¾å¤‡è¿è¡ŒçŠ¶æ€ç»Ÿè®¡
     */
    List<MdcCommonVo> getEquipmentStatusStatistics(String userId, String key);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcMessageApprovalService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package org.jeecg.modules.mdc.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.mdc.entity.MdcMessageApproval;
import javax.servlet.http.HttpServletRequest;
/**
 * @Description: mdc消息确认表
 * @Author: Lius
 * @Date: 2024-03-06
 * @Version: V1.0
 */
public interface IMdcMessageApprovalService extends IService<MdcMessageApproval> {
    /**
     * åˆ—表查询
     */
    IPage<MdcMessageApproval> pageList(String userId, Page<MdcMessageApproval> page, MdcMessageApproval mdcMessageApproval, HttpServletRequest req);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOverrunAlarmService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
package org.jeecg.modules.mdc.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcOverrunAlarm;
import javax.servlet.http.HttpServletRequest;
/**
 * @Description: mdc超限报警
 * @Author: Lius
 * @Date: 2024-03-01
 * @Version: V1.0
 */
public interface IMdcOverrunAlarmService extends IService<MdcOverrunAlarm> {
    /**
     * åˆ†é¡µåˆ—表查询
     *
     * @param page
     * @param mdcEquipment
     * @param req
     * @return
     */
    IPage<MdcOverrunAlarm> pageList(Page<MdcOverrunAlarm> page, MdcEquipment mdcEquipment, HttpServletRequest req);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentLogServiceImpl.java
@@ -50,7 +50,7 @@
    }
    @Override
    public Integer selectEquipmentOporation(String equipmentId) {
    public EquipmentLog selectEquipmentOporation(String equipmentId) {
        return this.baseMapper.selectEquipmentOporation(equipmentId);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java
@@ -7,10 +7,7 @@
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.mdc.entity.*;
import org.jeecg.modules.mdc.mapper.MdcDeviceCalendarMapper;
import org.jeecg.modules.mdc.service.IMdcDeviceCalendarService;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.IMdcShiftSubService;
import org.jeecg.modules.mdc.service.IMdcVacationManagementService;
import org.jeecg.modules.mdc.service.*;
import org.jeecg.modules.mdc.vo.EquipmentCalendarVo;
import org.jeecg.modules.mdc.vo.MdcDeviceCalendarQueryVo;
import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo;
@@ -41,6 +38,9 @@
    @Resource
    private IMdcVacationManagementService mdcVacationManagementService;
    @Resource
    private IMdcEquipmentOvertimeService mdcEquipmentOvertimeService;
    /**
     * åˆ†é¡µåˆ—表查询
@@ -212,7 +212,17 @@
    @Override
    public List<MdcDeviceCalendarVo> listByEquipmentIdAndDate(String equipmentId, String date) {
        return this.baseMapper.listByEquipmentAndDate(equipmentId, date);
        List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = this.baseMapper.listByEquipmentAndDate(equipmentId, date);
        if (mdcDeviceCalendarVos != null && !mdcDeviceCalendarVos.isEmpty()) {
            for (MdcDeviceCalendarVo mdcDeviceCalendarVo : mdcDeviceCalendarVos) {
                List<MdcEquipmentOvertime> list = mdcEquipmentOvertimeService.list(new LambdaQueryWrapper<MdcEquipmentOvertime>().eq(MdcEquipmentOvertime::getEquipmentId, mdcDeviceCalendarVo.getEquipmentId()).eq(MdcEquipmentOvertime::getTheDate, mdcDeviceCalendarVo.getEndDate()));
                if (list != null && !list.isEmpty()) {
                    mdcDeviceCalendarVo.setOvertimeStartTime(list.get(0).getStartTime());
                    mdcDeviceCalendarVo.setOvertimeEndTime(list.get(0).getEndTime());
                }
            }
        }
        return mdcDeviceCalendarVos;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java
@@ -1,11 +1,15 @@
package org.jeecg.modules.mdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.mdc.dto.MdcAlarmAnalyzeDto;
import org.jeecg.modules.mdc.dto.MdcAlarmDto;
import org.jeecg.modules.mdc.dto.MdcAlarmListDto;
import org.jeecg.modules.mdc.dto.MdcAlarmTrendDto;
import org.jeecg.modules.mdc.entity.MdcAlarmInfo;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection;
import org.jeecg.modules.mdc.service.IMdcAlarmInfoService;
import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.MdcEquipmentAlarmAnalyzeService;
@@ -29,6 +33,9 @@
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @Resource
    private IMdcAlarmInfoService mdcAlarmInfoService;
    @Override
    public List<MdcAlarmAnalyzeDto> alarmList(String userId, MdcAlarmAnalyzeQueryVo vo) {
@@ -77,6 +84,12 @@
                    mdcAlarmAnalyzeDto.setAlarmCode(mdcEquipmentRunningSection.getAlarm());
                    mdcAlarmAnalyzeDto.setCount(1);
                    mdcAlarmAnalyzeDto.setTimeCount(new BigDecimal(mdcEquipmentRunningSection.getDuration()));
                    //查询报警号内容
                    List<MdcEquipment> list = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, mdcEquipmentRunningSection.getEquipmentId()));
                    List<MdcAlarmInfo> mdcAlarmInfo = mdcAlarmInfoService.list(new LambdaQueryWrapper<MdcAlarmInfo>().eq(MdcAlarmInfo::getDriveType, list.get(0).getDriveType()).eq(MdcAlarmInfo::getAlarmCode, mdcEquipmentRunningSection.getAlarm()).eq(MdcAlarmInfo::getIsUse, 0));
                    if (mdcAlarmInfo != null && !mdcAlarmInfo.isEmpty()) {
                        mdcAlarmAnalyzeDto.setAlarmContent(mdcAlarmInfo.get(0).getAlarmContent());
                    }
                    map.put(mdcEquipmentRunningSection.getAlarm(), mdcAlarmAnalyzeDto);
                }
            }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java
@@ -49,6 +49,9 @@
    @Resource
    private IEquipmentRunningTraceService equipmentRunningTraceService;
    @Resource
    private IMdcAlarmInfoService mdcAlarmInfoService;
    @Override
    public List<MdcEquipmentRunningSectionDto> logList(MdcEquipmentRunningSectionVo equipmentRunningSectionVo) {
@@ -60,9 +63,9 @@
        List<MdcEquipmentRunningSection> running = loadEquipmentRunningTrace(equipmentRunningSectionVo.getEquipmentId(), equipmentRunningSectionVo.getCollectTimeStr());
        //查询报警数据
        List<MdcEquipmentRunningSection> errs = loadEquipmentErrorTrace(equipmentRunningSectionVo.getEquipmentId(), equipmentRunningSectionVo.getCollectTimeStr());
        Equipment equip = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getEquipmentid, equipmentRunningSectionVo.getEquipmentId()));
        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) {
@@ -88,21 +91,54 @@
            for (MdcEquipmentRunningSection entity : errs) {
                dto = new MdcEquipmentRunningSectionDto();
                BeanUtils.copyProperties(entity, dto);
                Set<TmpEquipmentAlarm> set = entity.getTmpEquipmentAlarmSet();
                if (entity.getStatus() == 22 && set != null && !set.isEmpty()) {
                    Iterator<TmpEquipmentAlarm> iterator = entity.getTmpEquipmentAlarmSet().iterator();
                    //获取报警编号相同的报警信息
                    while (iterator.hasNext()) {
                        TmpEquipmentAlarm next = iterator.next();
                        if (StringUtils.isNotBlank(next.getAlarmNo()) && next.getAlarmNo().equals(entity.getStatus())) {
                            dto.setAlarmContent(next.getAlarmContent());
                if (entity.getStatus() == 22) {
                    if (equip != null) {
                        List<MdcAlarmInfo> mdcAlarmInfo = mdcAlarmInfoService.list(new LambdaQueryWrapper<MdcAlarmInfo>().eq(MdcAlarmInfo::getDriveType, equip.getDrivetype()).eq(MdcAlarmInfo::getAlarmCode, entity.getAlarm()).eq(MdcAlarmInfo::getIsUse, 0));
                        if (mdcAlarmInfo != null && !mdcAlarmInfo.isEmpty()) {
                            dto.setAlarmContent(mdcAlarmInfo.get(0).getAlarmContent());
                        }
                    }
                }
//                Set<TmpEquipmentAlarm> set = entity.getTmpEquipmentAlarmSet();
//                if (entity.getStatus() == 22 && set != null && !set.isEmpty()) {
//                    Iterator<TmpEquipmentAlarm> iterator = entity.getTmpEquipmentAlarmSet().iterator();
//                    //获取报警编号相同的报警信息
//                    while (iterator.hasNext()) {
//                        TmpEquipmentAlarm next = iterator.next();
//                        if (StringUtils.isNotBlank(next.getAlarmNo()) && next.getAlarmNo().equals(entity.getStatus())) {
//                            dto.setAlarmContent(next.getAlarmContent());
//                        }
//                    }
//                }
                dtos.add(dto);
            }
        }
        return dtos;
        List<MdcEquipmentRunningSectionDto> result = new ArrayList<>();
        //合并相同状态数据
        for (int i = 0; i < dtos.size() - 1; i++) {
            MdcEquipmentRunningSectionDto mdcEquipmentRunningSectionDto = dtos.get(i);
            MdcEquipmentRunningSectionDto next = dtos.get(i + 1);
            if (mdcEquipmentRunningSectionDto.getStatus().equals(next.getStatus()) && mdcEquipmentRunningSectionDto.getEndTime().equals(next.getStartTime())) {
                MdcEquipmentRunningSectionDto equipmentRunningSectionDto = new MdcEquipmentRunningSectionDto();
                BeanUtils.copyProperties(mdcEquipmentRunningSectionDto, equipmentRunningSectionDto);
                equipmentRunningSectionDto.setEndTime(next.getEndTime());
                equipmentRunningSectionDto.setDuration(mdcEquipmentRunningSectionDto.getDuration() + next.getDuration());
                result.add(equipmentRunningSectionDto);
                i++;
            } else {
                result.add(mdcEquipmentRunningSectionDto);
            }
        }
        if (dtos.size() > 1) {
            MdcEquipmentRunningSectionDto a = dtos.get(dtos.size() - 2);
            MdcEquipmentRunningSectionDto b = dtos.get(dtos.size() - 1);
            if (!a.getStatus().equals(b.getStatus()) && a.getEndTime().equals(b.getStartTime())) {
                result.add(dtos.get(dtos.size() - 1));
            }
        }
        return result;
    }
    /**
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -9,7 +9,6 @@
import org.jeecg.common.api.dto.message.MessageDTO;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.mdc.dto.MdcEquDepDto;
import org.jeecg.modules.mdc.dto.MdcEquProDto;
@@ -22,17 +21,17 @@
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.util.FindsEquipmentDepartUtil;
import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil;
import org.jeecg.modules.mdc.vo.MdcEquipmentDepVo;
import org.jeecg.modules.mdc.vo.MdcEquipmentProVo;
import org.jeecg.modules.mdc.vo.MdcEquipmentVo;
import org.jeecg.modules.mdc.vo.WorkshopEquipmentVo;
import org.jeecg.modules.mdc.vo.*;
import org.jeecg.modules.system.entity.MdcEquipmentDepart;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.entity.MdcProductionEquipment;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.mapper.MdcEquipmentDepartMapper;
import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper;
import org.jeecg.modules.system.service.*;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.jeecg.modules.system.service.IMdcUserProductionService;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysUserDepartService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -82,10 +81,16 @@
    private IEquipmentBaseInfoService equipmentBaseInfoService;
    @Resource
    private ISysDictService sysDictService;
    private ISysBaseAPI sysBaseApi;
    @Resource
    private ISysBaseAPI sysBaseApi;
    private IMdcAlarmInfoService mdcAlarmInfoService;
    @Resource
    private IMdcEquipmentThresholdService mdcEquipmentThresholdService;
    @Resource
    private IMdcOverrunAlarmService mdcOverrunAlarmService;
    @Override
@@ -369,7 +374,8 @@
        mdcEquipmentDto.setDataFlag(Integer.parseInt(CommonConstant.STATUS_1));
        ControlSystem controlSystem = controlSystemService.getByDriveType(mdcEquipmentDto.getDriveType());
        // æŸ¥è¯¢è®¾å¤‡çŠ¶æ€
        Integer oporation = equipmentLogService.selectEquipmentOporation(mdcEquipment.getEquipmentId());
        EquipmentLog equipmentLog = equipmentLogService.selectEquipmentOporation(mdcEquipment.getEquipmentId());
        Integer oporation = equipmentLog.getOporation();
        if (controlSystem != null) {
            //获取工作数据并初始化
@@ -439,6 +445,21 @@
                                value = String.valueOf(mdcTorqueConfig.getTorqueValue());
                            } else {
                                value = "0";
                            }
                        } else if ("alarm".equals(englishName)) {
                            if (oporation == 22) {
                                value = equipmentLog.getAlarm();
                            } else {
                                value = "无";
                            }
                        } else if ("alarmContent".equals(englishName)) {
                            if (oporation == 22) {
                                List<MdcAlarmInfo> mdcAlarmInfo = mdcAlarmInfoService.list(new LambdaQueryWrapper<MdcAlarmInfo>().eq(MdcAlarmInfo::getDriveType, mdcEquipment.getDriveType()).eq(MdcAlarmInfo::getAlarmCode, equipmentLog.getAlarm()).eq(MdcAlarmInfo::getIsUse, 0));
                                if (mdcAlarmInfo != null && !mdcAlarmInfo.isEmpty()) {
                                    value = mdcAlarmInfo.get(0).getAlarmContent();
                                }
                            } else {
                                value = "无";
                            }
                        } else {
                            value = result == null ? null : result.toString();
@@ -707,60 +728,69 @@
    @Override
    public IPage<MdcEquipment> pageList(Page<MdcEquipment> page, MdcEquipmentVo mdcEquipment, HttpServletRequest req) {
        if (StringUtils.isNotBlank(mdcEquipment.getProductionName())) {
            // é€’归查询所有子节点
            List<String> productionIds = mdcProductionService.recursionChildren(mdcEquipment.getProductionName());
            mdcEquipment.setProductionIds(productionIds);
        }
        return this.baseMapper.pageList(page, mdcEquipment);
    }
    /**
     * ç›‘控设备转速任务
     * ç›‘控设备运行参数任务
     */
    @Override
    public void monitoringSpeedProcess() {
        List<MdcEquipment> equipmentList = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getDriveType, "FANUC"));
//        List<MdcEquipment> equipmentList = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getDriveType, "FANUC"));
        List<MdcEquipment> equipmentList = super.list();
        //List<MdcEquipment> equipmentList = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, "2140198"));
        // èŽ·å–å­—å…¸æ•°æ®
        List<DictModel> dictModelList = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_OPERATING_SPEED_RANGE);
        Integer range = 0;
        if (dictModelList != null && !dictModelList.isEmpty()) {
            range = Integer.valueOf(dictModelList.get(0).getValue());
        }
        for (MdcEquipment mdcEquipment : equipmentList) {
            String saveTableName = mdcEquipment.getSaveTableName();
            //查询单表数据
            MdcEquipmentDto mdcEquipmentDto = this.baseMapper.getWorkLineLast(saveTableName);
            if (mdcEquipmentDto != null) {
                MessageDTO messageDTO = new MessageDTO();
                messageDTO.setTitle("设备运行转速报警!");
                messageDTO.setCategory("预警消息");
                messageDTO.setFromUser("admin");
                messageDTO.setToUser("admin");
                Integer spindlespeed = Integer.valueOf(mdcEquipmentDto.getSpindlespeed());
                Integer actualspindlespeed = Integer.valueOf(mdcEquipmentDto.getActualspindlespeed());
                if (range.equals(0)) {
                    if (spindlespeed > actualspindlespeed) {
                        // å®žé™…值大于设定值   é«˜
                        messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备运行转速高报警!");
                        sysBaseApi.sendSysAnnouncement(messageDTO);
                    } else if (spindlespeed < actualspindlespeed) {
                        // å®žé™…值小于设定值   ä½Ž
                        messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备运行转速低报警!");
                        sysBaseApi.sendSysAnnouncement(messageDTO);
                    }
                } else {
                    int max = actualspindlespeed + actualspindlespeed * (range / 100);
                    int min = actualspindlespeed - actualspindlespeed * (range / 100);
                    if (spindlespeed > max || spindlespeed < min) {
                        if (spindlespeed > actualspindlespeed) {
                            // å®žé™…值大于设定值   é«˜
                            messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备运行转速高报警!");
            List<MdcEquipmentThreshold> mdcEquipmentThresholdList = mdcEquipmentThresholdService.list(new LambdaQueryWrapper<MdcEquipmentThreshold>().eq(MdcEquipmentThreshold::getControlSystemType, mdcEquipment.getDriveType()));
            if (mdcEquipmentThresholdList != null && !mdcEquipmentThresholdList.isEmpty()) {
                String saveTableName = mdcEquipment.getSaveTableName();
                StringBuilder builder = new StringBuilder();
                for (MdcEquipmentThreshold mdcEquipmentThreshold : mdcEquipmentThresholdList) {
                    builder.append(",").append(mdcEquipmentThreshold.getEnglishName()).append(" as \"").append(mdcEquipmentThreshold.getEnglishName()).append("\"  ");
                }
                Map<String, Object> param = new HashMap<>();
                param.put("columns", builder.toString());
                param.put("tableName", saveTableName);
                Map<String, Object> map = new HashMap<>();
                try {
                    map = this.baseMapper.getWorkLineLast(param);
                } catch (Exception e) {
                    log.error("查询单表数据出差!", e);
                }
                if (!map.isEmpty()) {
                    for (MdcEquipmentThreshold mdcEquipmentThreshold : mdcEquipmentThresholdList) {
                        Integer actualValue = Integer.valueOf(map.get(mdcEquipmentThreshold.getEnglishName()).toString());
                        Integer max = mdcEquipmentThreshold.getMaxThreshold();
                        Integer min = mdcEquipmentThreshold.getMinThreshold();
                        MessageDTO messageDTO = new MessageDTO();
                        messageDTO.setTitle("设备" + mdcEquipmentThreshold.getChineseName() + "报警!");
                        messageDTO.setCategory("预警消息");
                        messageDTO.setFromUser("admin");
                        messageDTO.setToUser("admin");
                        MdcOverrunAlarm mdcOverrunAlarm = new MdcOverrunAlarm();
                        mdcOverrunAlarm.setEquipmentId(mdcEquipment.getEquipmentId());
                        mdcOverrunAlarm.setSetValue(min + "-" + max);
                        mdcOverrunAlarm.setRealValue(actualValue.toString());
                        if (actualValue > max) {
                            // é«˜
                            messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备" + mdcEquipmentThreshold.getChineseName() + "高报警!");
                            sysBaseApi.sendSysAnnouncement(messageDTO);
                        } else if (spindlespeed < actualspindlespeed) {
                            // å®žé™…值小于设定值   ä½Ž
                            messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备运行转速低报警!");
                            mdcOverrunAlarm.setAlarmContent(mdcEquipmentThreshold.getChineseName() + "高报警");
                            mdcOverrunAlarmService.save(mdcOverrunAlarm);
                        } else if (actualValue < min) {
                            // ä½Ž
                            messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备" + mdcEquipmentThreshold.getChineseName() + "低报警!");
                            sysBaseApi.sendSysAnnouncement(messageDTO);
                            mdcOverrunAlarm.setAlarmContent(mdcEquipmentThreshold.getChineseName() + "低报警");
                            mdcOverrunAlarmService.save(mdcOverrunAlarm);
                        }
                    }
                }
            }
        }
@@ -773,8 +803,121 @@
     * @return
     */
    @Override
    public List<MdcEquipment> exportXlsList(MdcEquipment mdcEquipment) {
    public List<MdcEquipment> exportXlsList(MdcEquipmentVo mdcEquipment) {
        if (StringUtils.isNotBlank(mdcEquipment.getProductionName())) {
            // é€’归查询所有子节点
            List<String> productionIds = mdcProductionService.recursionChildren(mdcEquipment.getProductionName());
            mdcEquipment.setProductionIds(productionIds);
        }
        return this.baseMapper.exportXlsList(mdcEquipment);
    }
    /**
     * é€šè¿‡è½¦é—´ids获取设备树
     *
     * @param ids
     * @return
     */
    @Override
    public List<MdcEquipmentTree> loadTreeListByProductionIds(String ids) {
        List<String> productionIds = Arrays.asList(ids.split(","));
        //获取所有产线数据
        List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
        List<String> allProductionIds = new ArrayList<>();
        //找到所有产线id的上级id
        if (!productionIds.isEmpty()) {
            for (String productionId : productionIds) {
                this.getAllProductionIds(productionList, productionId, allProductionIds);
            }
        }
        //过滤产线数据
        List<MdcProduction> list = productionList.stream().filter((MdcProduction mdcProduction) -> allProductionIds.contains(mdcProduction.getId())).collect(Collectors.toList());
        //组装产线设备树
        List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
        //填充设备数据
        FillEquipmentByProduction(treeList);
        return treeList;
    }
    /**
     * æŸ¥è¯¢å•表数据
     * @param tableName
     * @return
     */
    @Override
    public MdcEquipmentDto getWorkLineLast(String tableName) {
        return this.baseMapper.findWorkLineLast(tableName);
    }
    /**
     * è®¾å¤‡è¿è¡ŒçŠ¶æ€ç»Ÿè®¡
     */
    @Override
    public List<MdcCommonVo> getEquipmentStatusStatistics(String userId, String key) {
        List<MdcCommonVo> result = new ArrayList<>();
        MdcCommonVo mdcCommonVo1 = new MdcCommonVo();
        mdcCommonVo1.setName("关机");
        mdcCommonVo1.setValue(0);
        result.add(mdcCommonVo1);
        MdcCommonVo mdcCommonVo2 = new MdcCommonVo();
        mdcCommonVo2.setName("报警");
        mdcCommonVo2.setValue(0);
        result.add(mdcCommonVo2);
        MdcCommonVo mdcCommonVo3 = new MdcCommonVo();
        mdcCommonVo3.setName("待机");
        mdcCommonVo3.setValue(0);
        result.add(mdcCommonVo3);
        MdcCommonVo mdcCommonVo4 = new MdcCommonVo();
        mdcCommonVo4.setName("运行");
        mdcCommonVo4.setValue(0);
        result.add(mdcCommonVo4);
        MdcEquipmentStatusVo mdcEquipmentStatusVo = new MdcEquipmentStatusVo();
        List<String> equipmentIdList = this.getEquipmentIdsProduction(userId, key);
        if (equipmentIdList == null || equipmentIdList.isEmpty()) {
            return result;
        }
        List<EquipmentLog> logList = this.baseMapper.getEquipmentStatusList(equipmentIdList);
        if (logList != null && !logList.isEmpty()) {
            for (EquipmentLog equipmentLog : logList) {
                if (equipmentLog.getOporation() != null) {
                    switch (equipmentLog.getOporation()) {
                        case 1:
                        case 2:
                            mdcEquipmentStatusVo.setWaitCount(mdcEquipmentStatusVo.getWaitCount() + 1);
                            break;
                        case 3:
                            mdcEquipmentStatusVo.setRunCount(mdcEquipmentStatusVo.getRunCount() + 1);
                            break;
                        case 22:
                            mdcEquipmentStatusVo.setAlarmCount(mdcEquipmentStatusVo.getAlarmCount() + 1);
                            break;
                        default:
                            mdcEquipmentStatusVo.setCloseCount(mdcEquipmentStatusVo.getCloseCount() + 1);
                            break;
                    }
                } else {
                    mdcEquipmentStatusVo.setCloseCount(mdcEquipmentStatusVo.getCloseCount() + 1);
                }
            }
        }
        result.clear();
        MdcCommonVo mdcCommonVo5 = new MdcCommonVo();
        mdcCommonVo5.setName("关机");
        mdcCommonVo5.setValue(mdcEquipmentStatusVo.getCloseCount());
        result.add(mdcCommonVo5);
        MdcCommonVo mdcCommonVo6 = new MdcCommonVo();
        mdcCommonVo6.setName("报警");
        mdcCommonVo6.setValue(mdcEquipmentStatusVo.getAlarmCount());
        result.add(mdcCommonVo6);
        MdcCommonVo mdcCommonVo7 = new MdcCommonVo();
        mdcCommonVo7.setName("待机");
        mdcCommonVo7.setValue(mdcEquipmentStatusVo.getWaitCount());
        result.add(mdcCommonVo7);
        MdcCommonVo mdcCommonVo8 = new MdcCommonVo();
        mdcCommonVo8.setName("运行");
        mdcCommonVo8.setValue(mdcEquipmentStatusVo.getRunCount());
        result.add(mdcCommonVo8);
        return result;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentWorkLineServiceImpl.java
@@ -15,6 +15,7 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -111,6 +112,20 @@
            }
        }
        resultList = resultList.stream().sorted(Comparator.comparing(EquipmentMachingDto::getCollectTime)).collect(Collectors.toList());
        for (MdcDriveTypeParamConfig mdcDriveTypeParamConfig : mdcDriveTypeParamConfigs) {
            if ("spindleCurrent".equals(mdcDriveTypeParamConfig.getEnglishName())) {
                for (EquipmentMachingDto equipmentMachingDto : resultList) {
                    String devicePower = mdcEquipment.getDevicePower();
                    if (StringUtils.isNotBlank(devicePower)) {
                        devicePower = "2500";
                    }
                    String spindleload = equipmentMachingDto.getSpindleload();
                    if (StringUtils.isNotBlank(spindleload)) {
                        equipmentMachingDto.setSpindleCurrent(new BigDecimal(devicePower).divide(new BigDecimal("380"), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(spindleload)));
                    }
                }
            }
        }
        return resultList;
    }
@@ -157,35 +172,56 @@
            }
            for (int i = 1; i <= collentParams.size(); i++) {
                try {
                    switch (i) {
                        case 1:
                            ei.setDataLine1(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                    switch (collentParams.get(i - 1).getEnglishName()) {
                        case "spindlespeed":
                            ei.setSpindlespeed(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 2:
                            ei.setDataLine2(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                        case "spindleload":
                            ei.setSpindleload(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 3:
                            ei.setDataLine3(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                        case "spindlebeilv":
                            ei.setSpindlebeilv(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 4:
                            ei.setDataLine4(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                        case "feedrate":
                            ei.setFeedrate(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 5:
                            ei.setDataLine5(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 6:
                            ei.setDataLine6(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 7:
                            ei.setDataLine7(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 8:
                            ei.setDataLine8(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                        case "feedbeilv":
                            ei.setFeedbeilv(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
//                try {
//                    switch (i) {
//                        case 1:
//                            ei.setDataLine1(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 2:
//                            ei.setDataLine2(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 3:
//                            ei.setDataLine3(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 4:
//                            ei.setDataLine4(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 5:
//                            ei.setDataLine5(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 6:
//                            ei.setDataLine6(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 7:
//                            ei.setDataLine7(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 8:
//                            ei.setDataLine8(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                    }
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
            }
            dto.add(ei);
        }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcMessageApprovalServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
package org.jeecg.modules.mdc.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.mdc.constant.MdcConstant;
import org.jeecg.modules.mdc.entity.MdcMessageApproval;
import org.jeecg.modules.mdc.mapper.MdcMessageApprovalMapper;
import org.jeecg.modules.mdc.service.IMdcMessageApprovalService;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
 * @Description: mdc消息确认表
 * @Author: Lius
 * @Date: 2024-03-06
 * @Version: V1.0
 */
@Service
public class MdcMessageApprovalServiceImpl extends ServiceImpl<MdcMessageApprovalMapper, MdcMessageApproval> implements IMdcMessageApprovalService {
    /**
     * åˆ«è¡¨æŸ¥è¯¢
     */
    @Override
    public IPage<MdcMessageApproval> pageList(String userId, Page<MdcMessageApproval> page, MdcMessageApproval mdcMessageApproval, HttpServletRequest req) {
        IPage<MdcMessageApproval> pageList = this.baseMapper.pageList(userId, page, mdcMessageApproval);
        List<MdcMessageApproval> mdcMessageApprovalList = pageList.getRecords();
        if (mdcMessageApprovalList != null && !mdcMessageApprovalList.isEmpty()) {
            pageList.getRecords().forEach(item -> {
                if (item.getSenderIds().contains(userId) && (item.getMsgStatus().equals(MdcConstant.MSG_STATUS_0) || item.getMsgStatus().equals(MdcConstant.MSG_STATUS_3))) {
                    item.setHasProcess(true);
                }
                if (item.getApproverIds().contains(userId) && item.getMsgStatus().equals(MdcConstant.MSG_STATUS_1)) {
                    item.setHasConfirm(true);
                }
            });
        }
        return pageList;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverrunAlarmServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
package org.jeecg.modules.mdc.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcOverrunAlarm;
import org.jeecg.modules.mdc.mapper.MdcOverrunAlarmMapper;
import org.jeecg.modules.mdc.service.IMdcOverrunAlarmService;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
/**
 * @Description: mdc超限报警
 * @Author: Lius
 * @Date: 2024-03-01
 * @Version: V1.0
 */
@Service
public class MdcOverrunAlarmServiceImpl extends ServiceImpl<MdcOverrunAlarmMapper, MdcOverrunAlarm> implements IMdcOverrunAlarmService {
    @Override
    public IPage<MdcOverrunAlarm> pageList(Page<MdcOverrunAlarm> page, MdcEquipment mdcEquipment, HttpServletRequest req) {
        return this.baseMapper.pageList(page, mdcEquipment);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcCommonVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
package org.jeecg.modules.mdc.vo;
import lombok.Data;
/**
 * @author Lius
 * @date 2024/3/13 18:02
 */
@Data
public class MdcCommonVo {
    private Integer value;
    private String name;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcEfficiencyReportQueryVo.java
@@ -46,4 +46,9 @@
     */
    private String equipmentType;
    /**
     * é©±åŠ¨ç±»åž‹
     */
    private String driveType;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcEfficiencyReportShiftQueryVo.java
@@ -49,4 +49,9 @@
     */
    private String equipmentType;
    /**
     * é©±åŠ¨ç±»åž‹
     */
    private String driveType;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcEquipmentStatusVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package org.jeecg.modules.mdc.vo;
import lombok.Data;
/**
 * @author Lius
 * @date 2024/3/13 15:43
 */
@Data
public class MdcEquipmentStatusVo {
    /**
     * è¿è¡Œ
     */
    private Integer runCount = 0;
    /**
     * å…³æœº
     */
    private Integer closeCount = 0;
    /**
     * æŠ¥è­¦
     */
    private Integer alarmCount = 0;
    /**
     * å¾…机
     */
    private Integer waitCount = 0;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcEquipmentVo.java
@@ -2,6 +2,8 @@
import lombok.Data;
import java.util.List;
/**
 * @author: LiuS
 * @create: 2023-04-11 10:34
@@ -16,4 +18,5 @@
    private String equipmentType;
    private String driveType;
    private String productionName;
    private List<String> productionIds;
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/MdcProduction.java
@@ -64,6 +64,11 @@
    @ApiModelProperty(value = "产线编码")
    private String orgCode;
    /**
     * äº§çº¿ç¼–码
     */
    @ApiModelProperty(value = "车间编码")
    private String productionCode;
    /**
     * åœ°å€
     */
    @Excel(name = "地址", width = 15)
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java
@@ -169,6 +169,12 @@
    private Integer userIdentity;
    /**
     * ç”¨æˆ·ç±»åž‹ï¼ˆ1 æ™®é€šæˆå‘˜ 2 å·¥æ®µ 3 è½¦é—´ 4 å…¬å¸ï¼‰
     */
    @Excel(name="(1普通成员 2工段 3车间 4公司)",width = 15)
    private Integer userType;
    /**
     * è´Ÿè´£éƒ¨é—¨
     */
    @Excel(name="负责部门",width = 15,dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
@@ -210,5 +216,7 @@
     */
    private Date passwordTime;
    private String equipmentIds;
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java
@@ -21,4 +21,17 @@
     */
    @Select("SELECT * FROM mdc_production where del_flag ='0' AND parent_id = #{parentId,jdbcType=VARCHAR}")
    List<MdcProduction> queryProdByPid(@Param("parentId") String parentId);
    /**
     * é€’归查询所有子节点
     */
    List<String> recursionChildren(@Param("productionId") String productionId);
    /**
     * æ ¹æ®ç”¨æˆ·id和车间id获取用户拥有的车间id
     * @param userId
     * @param productionId
     * @return
     */
    String findFirstProduction(@Param("userId") String userId, @Param("productionId") String productionId);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/SysAnnouncementSendMapper.java
@@ -1,13 +1,13 @@
package org.jeecg.modules.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.system.entity.SysAnnouncement;
import org.jeecg.modules.system.entity.SysAnnouncementSend;
import org.jeecg.modules.system.model.AnnouncementSendModel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
 * @Description: ç”¨æˆ·é€šå‘Šé˜…读标记表
@@ -48,4 +48,9 @@
     * èŽ·å–é¦–é¡µæ¶ˆæ¯
     */
    List<SysAnnouncementSend> getPrimaryInfo(@Param("userId") String userId,@Param("msgCategoryList")List<String> msgCategoryList);
    /**
     * æ ¹æ®æ¶ˆæ¯å†…容查询消息通知
     */
    SysAnnouncement findLastMessage(@Param("messageContent") String messageContent);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java
@@ -178,4 +178,9 @@
     * æ ¹æ®è§’色编码查询用户id集合
     */
    List<String> getUserByRoleCode(@Param("roleCode") String roleCode);
    /**
     * æ ¹æ®è§’色编码和设备编号查询用户
     */
    List<SysUser> getEquipmentAdmin(@Param("roleCode") String roleCode, @Param("equipmentId") String equipmentId);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml
@@ -2,4 +2,28 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.system.mapper.MdcProductionMapper">
    <!--递归查询所有子节点-->
    <select id="recursionChildren" resultType="java.lang.String">
        WITH temp ( id ) AS (
            SELECT
                id
            FROM
                mdc_production
            WHERE
                id = #{ productionId } UNION ALL
            SELECT
                a.id
            FROM
                mdc_production a
                    INNER JOIN temp ON a.parent_id = temp.id
        ) SELECT
            *
        FROM
            temp
    </select>
    <!--根据用户id和车间id获取用户拥有的车间id-->
    <select id="findFirstProduction" resultType="java.lang.String">
        SELECT TOP 1 id FROM mdc_user_production t1 LEFT JOIN mdc_production t2 ON t1.pro_id = t2.id WHERE t1.user_id = #{ userId } AND t2.parent_id = #{productionId}
    </select>
</mapper>
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysAnnouncementSendMapper.xml
@@ -125,4 +125,8 @@
            </if>
    </select>
    <select id="findLastMessage" resultType="org.jeecg.modules.system.entity.SysAnnouncement">
        SELECT TOP 1 * FROM sys_announcement WHERE msg_content = #{messageContent} ORDER BY create_time DESC;
    </select>
</mapper>
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml
@@ -206,4 +206,15 @@
        WHERE
            sr.role_code = #{ roleCode }
    </select>
    <!--根据角色编码和设备编号查询用户-->
    <select id="getEquipmentAdmin" resultType="org.jeecg.modules.system.entity.SysUser">
        SELECT
            t1.*
        FROM
            sys_user t1
                LEFT JOIN sys_user_role t2 ON t1.id = t2.user_id
                LEFT JOIN sys_role t3 ON t2.role_id = t3.id
        WHERE
            t3.role_code = #{roleCode} AND equipment_ids LIKE concat(concat('%',#{equipmentId}),'%')
    </select>
</mapper>
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/model/MdcProductionTreeModel.java
@@ -57,6 +57,8 @@
    private String orgCode;
    private String productionCode;
    private String address;
    private String memo;
@@ -101,6 +103,7 @@
        this.description = mdcProduction.getDescription();
        this.orgType = mdcProduction.getOrgType();
        this.orgCode = mdcProduction.getOrgCode();
        this.productionCode = mdcProduction.getProductionCode();
        this.address = mdcProduction.getAddress();
        this.memo = mdcProduction.getMemo();
        this.status = mdcProduction.getStatus();
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java
@@ -64,4 +64,18 @@
     * æ ¹æ®ç”¨æˆ·id获取产线下拉树选项
     */
    List<ProductionIdModel> loadProductionTreeOptions(String userId);
    /**
     * é€’归查询所有子节点
     */
    List<String> recursionChildren(String productionId);
    /**
     * æ ¹æ®ç”¨æˆ·id和车间id获取用户拥有的车间id
     * @param userId
     * @param productionId
     * @return
     */
    String findFirstProduction(String userId, String productionId);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysAnnouncementService.java
@@ -67,4 +67,8 @@
    void jobSendMessage(String jobDescription, String exceptionDetail);
    /**
     * æ ¹æ®æ¶ˆæ¯å†…容查询消息通知时间
     */
    SysAnnouncement findLastMessage(String messageContent);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java
@@ -318,4 +318,6 @@
    public List<SysUser> getAllUsersByRoleId(String roleId);
    List<String> getUserByRoleCode(String roleCode);
    List<SysUser> getEquipmentAdmin(String roleCode, String equipmentId);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -217,6 +217,25 @@
    }
    /**
     * é€’归查询所有子节点id
     */
    @Override
    public List<String> recursionChildren(String productionId) {
        return this.baseMapper.recursionChildren(productionId);
    }
    /**
     * æ ¹æ®ç”¨æˆ·id和车间id获取用户拥有的车间id
     * @param userId
     * @param productionId
     * @return
     */
    @Override
    public String findFirstProduction(String userId, String productionId) {
        return this.baseMapper.findFirstProduction(userId, productionId);
    }
    /**
     * delete æ–¹æ³•调用 é€’归查找子集id
     */
    private void checkChildrenExists(String id, List<String> idList) {
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysAnnouncementServiceImpl.java
@@ -251,4 +251,12 @@
    }
    /**
     * æ ¹æ®æ¶ˆæ¯å†…容查询消息通知
     */
    @Override
    public SysAnnouncement findLastMessage(String messageContent) {
        return sysAnnouncementSendMapper.findLastMessage(messageContent);
    }
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
@@ -705,4 +705,12 @@
    public List<String> getUserByRoleCode(String roleCode) {
        return this.baseMapper.getUserByRoleCode(roleCode);
    }
    /**
     * æ ¹æ®è§’色编码和设备编号查询用户
     */
    @Override
    public List<SysUser> getEquipmentAdmin(String roleCode, String equipmentId) {
        return this.baseMapper.getEquipmentAdmin(roleCode, equipmentId);
    }
}