已添加9个文件
已修改28个文件
1201 ■■■■ 文件已修改
lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/EquipmentBeilvAlarmController.java 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/EquipmentMachingDto.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/EquipmentBeilvAlarm.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentOvertime.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunMonitoringSpeedJob.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningEquipmentStatusJob.java 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOvertimeDurationJob.java 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentBeilvAlarmMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRunningSectionMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcTorqueConfigMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentBeilvAlarmMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcTorqueConfigMapper.xml 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentBeilvAlarmService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcTorqueConfigService.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentBeilvAlarmServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentWorkLineServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java
@@ -572,4 +572,30 @@
     */
    String DICT_USER_FIRST_LOGIN = "user_first_login";
    /**
     * è®¾å¤‡è¿è¡Œè½¬é€ŸèŒƒå›´å­—典编号
     */
    String DICT_OPERATING_SPEED_RANGE = "operating_speed_range";
    /**
     * åˆ©ç”¨çŽ‡åˆ¤å®šé—´éš”å­—å…¸ç¼–å·
     */
    String DICT_EQUIPMENT_RATE_JUDGE = "equipment_rate_judge";
    /**
     * è®¾å¤‡çŠ¶æ€åˆ¤æ–­é—´éš”å­—å…¸ç¼–å·
     */
    String DICT_EQUIPMENT_SPEED_JUDGE = "equipment_status_judge";
    /**
     * åˆ©ç”¨çŽ‡æ­£å¸¸å€¼å­—å…¸ç¼–å·
     */
    String DICT_EQUIPMENT_RATE_NORMAL = "equipment_rate_normal";
    /**
     * åŠ ç­æ•°æ® è‡ªåŠ¨è®¡ç®—æ ‡è¯† 1(是) 2(否)
     */
    Integer AUTO_FLAG_Y = 1;
    Integer AUTO_FLAG_N = 2;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/EquipmentBeilvAlarmController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,154 @@
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.EquipmentBeilvAlarm;
import org.jeecg.modules.mdc.service.IEquipmentBeilvAlarmService;
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: è®¾å¤‡å€çŽ‡æŠ¥è­¦
 * @Author: jeecg-boot
 * @Date: 2024-01-17
 * @Version: V1.0
 */
@Slf4j
@Api(tags = "设备倍率报警")
@RestController
@RequestMapping("/mdc/equipmentBeilvAlarm")
public class EquipmentBeilvAlarmController extends JeecgController<EquipmentBeilvAlarm, IEquipmentBeilvAlarmService> {
    @Resource
    private IEquipmentBeilvAlarmService equipmentBeilvAlarmService;
    /**
     * åˆ†é¡µåˆ—表查询
     *
     * @param equipmentBeilvAlarm
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @AutoLog(value = "设备倍率报警-分页列表查询")
    @ApiOperation(value = "设备倍率报警-分页列表查询", notes = "设备倍率报警-分页列表查询")
    @GetMapping(value = "/list")
    public Result<?> queryPageList(EquipmentBeilvAlarm equipmentBeilvAlarm,
                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                   HttpServletRequest req) {
        QueryWrapper<EquipmentBeilvAlarm> queryWrapper = QueryGenerator.initQueryWrapper(equipmentBeilvAlarm, req.getParameterMap());
        queryWrapper.notLike("AlarmContent", "正常");
        Page<EquipmentBeilvAlarm> page = new Page<EquipmentBeilvAlarm>(pageNo, pageSize);
        IPage<EquipmentBeilvAlarm> pageList = equipmentBeilvAlarmService.page(page, queryWrapper);
        return Result.OK(pageList);
    }
    /**
     * æ·»åŠ 
     *
     * @param equipmentBeilvAlarm
     * @return
     */
    @AutoLog(value = "设备倍率报警-添加")
    @ApiOperation(value = "设备倍率报警-添加", notes = "设备倍率报警-添加")
    @PostMapping(value = "/add")
    public Result<?> add(@RequestBody EquipmentBeilvAlarm equipmentBeilvAlarm) {
        equipmentBeilvAlarmService.save(equipmentBeilvAlarm);
        return Result.OK("添加成功!");
    }
    /**
     * ç¼–辑
     *
     * @param equipmentBeilvAlarm
     * @return
     */
    @AutoLog(value = "设备倍率报警-编辑")
    @ApiOperation(value = "设备倍率报警-编辑", notes = "设备倍率报警-编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<?> edit(@RequestBody EquipmentBeilvAlarm equipmentBeilvAlarm) {
        equipmentBeilvAlarmService.updateById(equipmentBeilvAlarm);
        return Result.OK("编辑成功!");
    }
    /**
     * é€šè¿‡id删除
     *
     * @param id
     * @return
     */
    @AutoLog(value = "设备倍率报警-通过id删除")
    @ApiOperation(value = "设备倍率报警-通过id删除", notes = "设备倍率报警-通过id删除")
    @DeleteMapping(value = "/delete")
    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
        equipmentBeilvAlarmService.removeById(id);
        return Result.OK("删除成功!");
    }
    /**
     * æ‰¹é‡åˆ é™¤
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "设备倍率报警-批量删除")
    @ApiOperation(value = "设备倍率报警-批量删除", notes = "设备倍率报警-批量删除")
    @DeleteMapping(value = "/deleteBatch")
    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        this.equipmentBeilvAlarmService.removeByIds(Arrays.asList(ids.split(",")));
        return Result.OK("批量删除成功!");
    }
    /**
     * é€šè¿‡id查询
     *
     * @param id
     * @return
     */
    @AutoLog(value = "设备倍率报警-通过id查询")
    @ApiOperation(value = "设备倍率报警-通过id查询", notes = "设备倍率报警-通过id查询")
    @GetMapping(value = "/queryById")
    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
        EquipmentBeilvAlarm equipmentBeilvAlarm = equipmentBeilvAlarmService.getById(id);
        return Result.OK(equipmentBeilvAlarm);
    }
    /**
     * å¯¼å‡ºexcel
     *
     * @param request
     * @param equipmentBeilvAlarm
     */
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, EquipmentBeilvAlarm equipmentBeilvAlarm) {
        return super.exportXls(request, equipmentBeilvAlarm, EquipmentBeilvAlarm.class, "设备倍率报警");
    }
    /**
     * é€šè¿‡excel导入数据
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        return super.importExcel(request, response, EquipmentBeilvAlarm.class);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java
@@ -1,7 +1,6 @@
package org.jeecg.modules.mdc.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
@@ -14,15 +13,15 @@
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime;
import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService;
import org.jeecg.modules.mdc.util.DateUtils;
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.ArrayList;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
/**
 * @Description: è®¾å¤‡åŠ ç­ç®¡ç†
@@ -72,18 +71,13 @@
    @ApiOperation(value = "设备加班管理-添加", notes = "设备加班管理-添加")
    @PostMapping(value = "/add")
    public Result<?> add(@RequestBody MdcEquipmentOvertime mdcEquipmentOvertime) {
        String[] calendarIdList = mdcEquipmentOvertime.getCalendarId().split(",");
        List<MdcEquipmentOvertime> equipmentOvertimeList = new ArrayList<>();
        mdcEquipmentOvertimeService.remove(new LambdaQueryWrapper<MdcEquipmentOvertime>().in(MdcEquipmentOvertime::getCalendarId, Arrays.asList(calendarIdList)));
        for (String calendarId : calendarIdList) {
            MdcEquipmentOvertime equipmentOvertime = new MdcEquipmentOvertime();
            equipmentOvertime.setCalendarId(calendarId);
            equipmentOvertime.setStartTime(mdcEquipmentOvertime.getStartTime());
            equipmentOvertime.setEndTime(mdcEquipmentOvertime.getEndTime());
            equipmentOvertime.setRemark(mdcEquipmentOvertime.getRemark());
            equipmentOvertimeList.add(equipmentOvertime);
        if (org.apache.commons.lang3.StringUtils.isBlank(mdcEquipmentOvertime.getEquipmentId())) {
            return Result.error("未选择设备,请排查!");
        }
        mdcEquipmentOvertimeService.saveBatch(equipmentOvertimeList);
        boolean result = mdcEquipmentOvertimeService.addOvertime(mdcEquipmentOvertime);
        if (!result) {
            return Result.error("添加失败!");
        }
        return Result.OK("添加成功!");
    }
@@ -97,6 +91,10 @@
    @ApiOperation(value = "设备加班管理-编辑", notes = "设备加班管理-编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<?> edit(@RequestBody MdcEquipmentOvertime mdcEquipmentOvertime) {
        String startTime = mdcEquipmentOvertime.getStartTime();
        String endTime = mdcEquipmentOvertime.getEndTime();
        long duration = DateUtils.differentSecond(DateUtils.setTimeForDay(DateUtils.getNow(), startTime), DateUtils.setTimeForDay(DateUtils.getNow(), endTime));
        mdcEquipmentOvertime.setDuration(new BigDecimal(duration));
        mdcEquipmentOvertimeService.updateById(mdcEquipmentOvertime);
        return Result.OK("编辑成功!");
    }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcTorqueConfigController.java
@@ -19,7 +19,6 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * @Description: æ‰­çŸ©é…ç½®ç®¡ç†
@@ -141,21 +140,6 @@
    @RequestMapping("/importExcel")
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        return super.importExcel(request, response, MdcTorqueConfig.class);
    }
    /**
     * æ ¹æ®æ‰­çŸ©å€¼ç”Ÿæˆä¸»è½´è¿è¡Œæ›²çº¿
     *
     * @param torqueValue
     * @return
     */
    @AutoLog(value = "扭矩配置管理-根据扭矩值生成主轴运行曲线")
    @ApiOperation(value = "扭矩配置管理-根据扭矩值生成主轴运行曲线", notes = "扭矩配置管理-根据扭矩值生成主轴运行曲线")
    @GetMapping("/findSpindleRunningCurve")
    public Result<List<MdcTorqueConfig>> findSpindleRunningCurve(@RequestParam(name = "torqueValue", required = true) float torqueValue,
                                                                 @RequestParam(name = "equipmentId", required = true) String equipmentId) {
        List<MdcTorqueConfig> list = mdcTorqueConfigService.findSpindleRunningCurve(torqueValue, equipmentId);
        return Result.ok(list);
    }
    /**
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/EquipmentMachingDto.java
@@ -467,6 +467,12 @@
    //备注
    private String remark;
    //扭矩值
    private float torque;
    //进给参数
    private String feedParameter;
    // è®¾å¤‡é©±åŠ¨å‚æ•°
    private List<MdcDriveTypeParamConfig> mdcDriveTypeParamConfigList;
@@ -990,6 +996,21 @@
        this.remark = remark;
    }
    public float getTorque() {
        return torque;
    }
    public void setTorque(float torqueValue) {
        this.torque = torqueValue;
    }
    public String getFeedParameter() {
        return feedParameter;
    }
    public void setFeedParameter(String feedParameter) {
        this.feedParameter = feedParameter;
    }
    public void setMdcDriveTypeParamConfigList(List<MdcDriveTypeParamConfig> mdcDriveTypeParamConfigList) {
        this.mdcDriveTypeParamConfigList = mdcDriveTypeParamConfigList;
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/EquipmentBeilvAlarm.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,98 @@
package org.jeecg.modules.mdc.entity;
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 org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
 * @Description: è®¾å¤‡å€çŽ‡æŠ¥è­¦
 * @Author: jeecg-boot
 * @Date: 2024-01-17
 * @Version: V1.0
 */
@Data
@TableName("EquipmentBeilvAlarm")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "EquipmentBeilvAlarm对象", description = "设备倍率报警")
public class EquipmentBeilvAlarm {
    /**
     * è®¾å¤‡ç¼–号
     */
    @Excel(name = "设备编号", width = 15)
    @ApiModelProperty(value = "设备编号")
    private String equipmentid;
    /**
     * æŠ¥è­¦æ—¶é—´
     */
    @Excel(name = "报警时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "报警时间")
    private Date collecttime;
    /**
     * è®¾å®šå€¼
     */
    @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 alarmno;
    /**
     * æŠ¥è­¦å†…容
     */
    @Excel(name = "报警内容", width = 15)
    @ApiModelProperty(value = "报警内容")
    private String alarmcontent;
    /**
     * isexamine
     */
    @Excel(name = "isexamine", width = 15)
    @ApiModelProperty(value = "isexamine")
    private Integer isexamine;
    /**
     * iseffective
     */
    @Excel(name = "iseffective", width = 15)
    @ApiModelProperty(value = "iseffective")
    private Integer iseffective;
    /**
     * examinetime
     */
    @Excel(name = "examinetime", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "examinetime")
    private Date examinetime;
    /**
     * examineperson
     */
    @Excel(name = "examineperson", width = 15)
    @ApiModelProperty(value = "examineperson")
    private String examineperson;
    /**
     * remark
     */
    @Excel(name = "备注", width = 15)
    @ApiModelProperty(value = "备注")
    private String remark;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentOvertime.java
@@ -7,10 +7,12 @@
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -28,42 +30,22 @@
    private static final long serialVersionUID = -7163039765166584824L;
    @TableField(exist = false)
    @Excel(name = "设备编号", width = 20)
    @ApiModelProperty("设备编号")
    private String equipmentId;
    @TableField(exist = false)
    @Excel(name = "设备名称", width = 20)
    @ApiModelProperty("设备名称")
    private String equipmentName;
    /**
     * ç”Ÿæ•ˆæ—¥æœŸ
     */
    @Excel(name = "生效日期", width = 15)
    @TableField(exist = false)
    private String effectiveDate;
    @ApiModelProperty("日期")
    @Excel(name = "日期", width = 20)
    private String theDate;
    /**
     * ç­æ¬¡å¼€å§‹æ—¶é—´
     */
    @Excel(name = "班次开始时间", width = 20)
    @ApiModelProperty("班次开始时间")
    @TableField(exist = false)
    private String startDate;
    /**
     * ç­æ¬¡ç»“束时间
     */
    @Excel(name = "班次结束时间", width = 20)
    @ApiModelProperty("班次结束时间")
    @TableField(exist = false)
    private String endDate;
    /**
     * å·¥ä½œæ—¥åކid
     */
    @ApiModelProperty(value = "工作日历id")
    private String calendarId;
//    @Excel(name = "自动计算标识", width = 15)
    @ApiModelProperty("自动计算标识")
    private Integer autoFlag = CommonConstant.AUTO_FLAG_N;
    /**
     * åŠ ç­å¼€å§‹æ—¶é—´
@@ -79,6 +61,13 @@
    private String endTime;
    /**
     * åŠ ç­æ—¶é•¿
     */
    @Excel(name = "时长", width = 20)
    @ApiModelProperty(value = "时长")
    private BigDecimal duration;
    /**
     * å¤‡æ³¨
     */
    @Excel(name = "备注")
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunMonitoringSpeedJob.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package org.jeecg.modules.mdc.job;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
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.quartz.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
 * @author Lius
 * @Description: ç›‘控设备转速任务
 * @date 2024/1/16 17:36
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunMonitoringSpeedJob implements Job {
    @Resource
    private IQuartzJobService quartzJobService;
    @Resource
    private ISysQuartzLogService sysQuartzLogService;
    @Resource
    private ISysAnnouncementService sysAnnouncementService;
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @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("监控设备转速任务 RunMonitoringSpeedJob start!  æ—¶é—´:" + DateUtils.now());
        long startTime = System.currentTimeMillis();
        try {
            mdcEquipmentService.monitoringSpeedProcess();
            quartzLog.setIsSuccess(0);
        } catch (Exception e) {
            quartzLog.setIsSuccess(-1);
            quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
            // å‘送消息通知
            sysAnnouncementService.jobSendMessage("监控设备转速任务失败!", 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/RunningEquipmentStatusJob.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,150 @@
package org.jeecg.modules.mdc.job;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.MdcEfficiencyReportService;
import org.jeecg.modules.mdc.util.DateUtils;
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.time.LocalDate;
import java.util.Date;
import java.util.List;
/**
 * @author Lius
 * @Description: åˆ©ç”¨çŽ‡æ­£å¸¸å€¼ï¼Œè®¾å¤‡çŠ¶æ€é•¿æœŸæ— å˜åŒ–æŠ¥è­¦
 * @date 2024/1/17 14:10
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningEquipmentStatusJob implements Job {
    @Resource
    private IQuartzJobService quartzJobService;
    @Resource
    private ISysQuartzLogService sysQuartzLogService;
    @Resource
    private ISysAnnouncementService sysAnnouncementService;
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @Resource
    private ISysDictService sysDictService;
    @Resource
    private MdcEfficiencyReportService mdcEfficiencyReportService;
    @Resource
    private ISysBaseAPI sysBaseApi;
    @Resource
    private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService;
    @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("设备状态长期无变化报警任务 RunningEquipmentStatusJob start!  æ—¶é—´:" + DateUtils.getNow());
        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<DictModel> dictModelList1 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_RATE_JUDGE);
            Integer equipmentRateJudge = 5;
            if (dictModelList1 != null && !dictModelList1.isEmpty()) {
                equipmentRateJudge = Integer.valueOf(dictModelList1.get(0).getValue());
            }
            // èŽ·å–åˆ©ç”¨çŽ‡æ­£å¸¸å€¼
            List<DictModel> dictModelList2 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_SPEED_JUDGE);
            Integer equipmentRateNormal = 20;
            if (dictModelList2 != null && !dictModelList2.isEmpty()) {
                equipmentRateNormal = Integer.valueOf(dictModelList2.get(0).getValue());
            }
            // èŽ·å–è®¾å¤‡çŠ¶æ€å¤©æ•°
            List<DictModel> dictModelList3 = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_EQUIPMENT_RATE_NORMAL);
            Integer equipmentStatusJudge = 5;
            if (dictModelList3 != null && !dictModelList3.isEmpty()) {
                equipmentStatusJudge = Integer.valueOf(dictModelList3.get(0).getValue());
            }
            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.setCategory("预警消息");
                        messageDTO.setFromUser("admin");
                        messageDTO.setToUser("admin");
                        messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备利用率低于正常值报警!");
                        sysBaseApi.sendSysAnnouncement(messageDTO);
                    }
                }
                // åˆ¤æ–­è®¾å¤‡çŠ¶æ€
                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) {
                    boolean flag = true;
                    Integer integer = sectionList.get(0);
                    for (Integer integer1 : sectionList) {
                        if (!integer.equals(integer1)) {
                            flag = false;
                        }
                    }
                    if (flag) {
                        // ä¸ŠæŠ¥
                        MessageDTO messageDTO = new MessageDTO();
                        messageDTO.setCategory("预警消息");
                        messageDTO.setFromUser("admin");
                        messageDTO.setToUser("admin");
                        messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备状态长期无变化报警!");
                        sysBaseApi.sendSysAnnouncement(messageDTO);
                    }
                }
            }
            quartzLog.setIsSuccess(0);
        } catch (Exception e) {
            quartzLog.setIsSuccess(-1);
            quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
            // å‘送消息通知
            sysAnnouncementService.jobSendMessage("设备状态长期无变化报警任务失败!", 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
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,194 @@
package org.jeecg.modules.mdc.job;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime;
import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection;
import org.jeecg.modules.mdc.entity.MdcSystemParameters;
import org.jeecg.modules.mdc.service.*;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.util.ThrowableUtil;
import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo;
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.quartz.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * @author Lius
 * @Description: è®¾å¤‡åŠ ç­æ—¶é•¿ç®—æ³•ç»Ÿè®¡
 * @date 2024/1/24 17:12
 */
@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class RunningOvertimeDurationJob implements Job {
    @Resource
    private IQuartzJobService quartzJobService;
    @Resource
    private ISysQuartzLogService sysQuartzLogService;
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @Resource
    private IMdcEquipmentOvertimeService mdcEquipmentOvertimeService;
    /**
     * è‹¥å‚数变量名修改 QuartzJobController中也需对应修改  æ—¶é—´ï¼š yyyyMMdd ä¾‹ï¼š 20230414
     */
    private String parameter;
    public void setParameter(String parameter) {
        this.parameter = parameter;
    }
    @Resource
    private ISysAnnouncementService sysAnnouncementService;
    @Resource
    private IMdcDeviceCalendarService mdcDeviceCalendarService;
    @Resource
    private IMdcSystemParametersService mdcSystemParametersService;
    @Resource
    private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService;
    @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());
        }
        quartzLog.setParams(this.parameter);
        log.info(String.format("定时统计设备加班时长任务 param: %s RunningOvertimeDurationJob start!  æ—¶é—´:" + DateUtils.getNow(), this.parameter));
        long startTime = System.currentTimeMillis();
        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);
                if (initDate != null) {
                    mdcEquipmentOvertimeService.remove(new LambdaQueryWrapper<MdcEquipmentOvertime>().eq(MdcEquipmentOvertime::getTheDate, this.parameter).eq(MdcEquipmentOvertime::getAutoFlag, CommonConstant.AUTO_FLAG_Y));
                }
            } else {
                date = DateUtils.format(DateUtils.getNow(), DateUtils.STR_DATE);
            }
            List<MdcEquipment> equipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<>());
            MdcSystemParameters mdcSystemParameters = mdcSystemParametersService.getOne(new LambdaQueryWrapper<MdcSystemParameters>().eq(MdcSystemParameters::getCode, "equip_log_statis_time"));
            if (mdcSystemParameters == null) {
                throw new JobExecutionException("mdc_system_parameters è¡¨ä¸­æ•°æ®ç¼ºå¤±");
            }
            String value = mdcSystemParameters.getValue();
            List<MdcEquipmentOvertime> result = new ArrayList<>();
            for (MdcEquipment mdcEquipment : equipmentList) {
                // èŽ·å–è®¾å¤‡å·¥ä½œæ—¥åŽ†
                List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = mdcDeviceCalendarService.listByEquipmentIdAndDate(mdcEquipment.getEquipmentId(), this.parameter);
                if (mdcDeviceCalendarVos != null && !mdcDeviceCalendarVos.isEmpty()) {
                    //获取最后一个班次结束时间
                    Date startDate = this.getCalendarEndDate(mdcDeviceCalendarVos, date);
                    Date endDate = DateUtils.plusTime(DateUtils.toDate(date + " " + value, DateUtils.STR_DATE_TIME_SMALL), 1);
                    List<MdcEquipmentRunningSection> equipmentRunningSectionList = mdcEquipmentRunningSectionService.selectRunningData(mdcEquipment.getEquipmentId(), startDate, endDate);
                    if (equipmentRunningSectionList != null && !equipmentRunningSectionList.isEmpty()) {
                        // æ—¶é—´ä¿®æ­£
                        if (equipmentRunningSectionList.get(0).getStartTime().before(startDate)) {
                            equipmentRunningSectionList.get(0).setStartTime(startDate);
                        }
                        if (equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).getEndTime().after(endDate)) {
                            equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).setEndTime(endDate);
                        }
                        BigDecimal duration = BigDecimal.ZERO;
                        for (MdcEquipmentRunningSection mdcEquipmentRunningSection : equipmentRunningSectionList) {
                            duration = duration.add(new BigDecimal(DateUtils.differentSecond(mdcEquipmentRunningSection.getStartTime(), mdcEquipmentRunningSection.getEndTime())));
                        }
                        MdcEquipmentOvertime mdcEquipmentOvertime = new MdcEquipmentOvertime();
                        mdcEquipmentOvertime.setEquipmentId(mdcEquipment.getEquipmentId());
                        mdcEquipmentOvertime.setDuration(duration);
                        mdcEquipmentOvertime.setAutoFlag(CommonConstant.AUTO_FLAG_Y);
                        mdcEquipmentOvertime.setTheDate(this.parameter);
                        result.add(mdcEquipmentOvertime);
                    }
                } else {
                    // æ²¡æœ‰ç­æ¬¡é…ç½®ï¼Œè®¡ç®—全天的设备加工状态
                    Date startDate = DateUtils.toDate(date + " " + value, DateUtils.STR_DATE_TIME_SMALL);
                    Date endDate = DateUtils.plusTime(startDate, 1);
                    List<MdcEquipmentRunningSection> equipmentRunningSectionList = mdcEquipmentRunningSectionService.selectRunningData(mdcEquipment.getEquipmentId(), startDate, endDate);
                    if (equipmentRunningSectionList != null && !equipmentRunningSectionList.isEmpty()) {
                        // æ—¶é—´ä¿®æ­£
                        if (equipmentRunningSectionList.get(0).getStartTime().before(startDate)) {
                            equipmentRunningSectionList.get(0).setStartTime(startDate);
                        }
                        if (equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).getEndTime().after(endDate)) {
                            equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).setEndTime(endDate);
                        }
                        BigDecimal duration = BigDecimal.ZERO;
                        for (MdcEquipmentRunningSection mdcEquipmentRunningSection : equipmentRunningSectionList) {
                            duration = duration.add(new BigDecimal(DateUtils.differentSecond(mdcEquipmentRunningSection.getStartTime(), mdcEquipmentRunningSection.getEndTime())));
                        }
                        MdcEquipmentOvertime mdcEquipmentOvertime = new MdcEquipmentOvertime();
                        mdcEquipmentOvertime.setEquipmentId(mdcEquipment.getEquipmentId());
                        mdcEquipmentOvertime.setDuration(duration);
                        mdcEquipmentOvertime.setAutoFlag(CommonConstant.AUTO_FLAG_Y);
                        mdcEquipmentOvertime.setTheDate(this.parameter);
                        result.add(mdcEquipmentOvertime);
                    }
                }
            }
            if (!result.isEmpty()) {
                mdcEquipmentOvertimeService.saveBatch(result);
            }
            quartzLog.setIsSuccess(0);
        } catch (Exception e) {
            quartzLog.setIsSuccess(-1);
            quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
            // å‘送消息通知
            sysAnnouncementService.jobSendMessage("定时统计设备加班时长任务失败", quartzLog.getExceptionDetail());
        }
        long endTime = System.currentTimeMillis();
        quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
        sysQuartzLogService.save(quartzLog);
    }
    private Date getCalendarEndDate(List<MdcDeviceCalendarVo> mdcDeviceCalendarVos, String date) {
        date = DateUtils.format(DateUtils.toDate(date, DateUtils.STRDATE), DateUtils.STR_DATE);
        String endDate = "";
        for (MdcDeviceCalendarVo mdcDeviceCalendarVo : mdcDeviceCalendarVos) {
            String shiftEndDate = "";
            if ("true".equals(mdcDeviceCalendarVo.getIsDaySpan())) {
                shiftEndDate = DateUtils.format(DateUtils.plusTime(DateUtils.toDate(date, DateUtils.STR_DATE), 1), DateUtils.STR_DATE) + " " + mdcDeviceCalendarVo.getEndDate();
            } else {
                shiftEndDate = date + " " + mdcDeviceCalendarVo.getEndDate();
            }
            if (StringUtils.isBlank(endDate)) {
                endDate = shiftEndDate;
            } else {
                // endDate
                Date date1 = DateUtils.toDate(endDate, DateUtils.STR_DATE_TIME_SMALL);
                // shiftEndDate
                Date date2 = DateUtils.toDate(shiftEndDate, DateUtils.STR_DATE_TIME_SMALL);
                if (date2.after(date1)) {
                    endDate = shiftEndDate;
                }
            }
        }
        return DateUtils.toDate(endDate, DateUtils.STR_DATE_TIME_SMALL);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentBeilvAlarmMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package org.jeecg.modules.mdc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.mdc.entity.EquipmentBeilvAlarm;
/**
 * @Description: è®¾å¤‡è¿è¡Œæ•°æ®æŠ¥è­¦
 * @Author: jeecg-boot
 * @Date:   2024-01-17
 * @Version: V1.0
 */
public interface EquipmentBeilvAlarmMapper extends BaseMapper<EquipmentBeilvAlarm> {
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java
@@ -3,12 +3,12 @@
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.dto.MdcComAnaDto;
import org.jeecg.modules.mdc.dto.MdcEfficiencyDto;
import org.jeecg.modules.mdc.dto.MdcEfficiencyResultDto;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo;
import org.jeecg.modules.mdc.vo.ComparativeAnalysisQueryVo;
import org.jeecg.modules.mdc.vo.MdcEfficiencyReportQueryVo;
import org.jeecg.modules.mdc.vo.MdcEfficiencyReportShiftQueryVo;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -48,4 +48,6 @@
     * @return
     */
    List<MdcComAnaDto> comparativeAnalysis(@Param("vo") ComparativeAnalysisQueryVo vo);
    List<BigDecimal> getEfficiencyRate(@Param("equipmentId") String equipmentId, @Param("date") String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -1,11 +1,13 @@
package org.jeecg.modules.mdc.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
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.dto.MdcEquDepDto;
import org.jeecg.modules.mdc.dto.MdcEquProDto;
import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor;
import org.jeecg.modules.mdc.vo.MdcEquipmentDepVo;
@@ -93,4 +95,7 @@
     * åˆ†é¡µåˆ—表
     */
    IPage<MdcEquipment> pageList(Page<MdcEquipment> page, @Param("mdcEquipment") MdcEquipmentVo mdcEquipment);
    @InterceptorIgnore(tenantLine = "1")
    MdcEquipmentDto getWorkLineLast(@Param("tableName") String saveTableName);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRunningSectionMapper.java
@@ -73,4 +73,6 @@
    List<MdcEquipmentRunningSection> selectRunningData(@Param("equipmentId") String equipmentId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
    List<MdcAlarmListDto> selectAlarmList(@Param("vo") MdcAlarmAnalyzeQueryVo mdcAlarmAnalyzeQueryVo, @Param("startDate") String startDate, @Param("endDate") String endDate);
    List<Integer> getDataList(@Param("equipmentId") String equipmentId, @Param("date") Date date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcTorqueConfigMapper.java
@@ -4,8 +4,10 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.dto.EquipmentMachingDto;
import org.jeecg.modules.mdc.entity.MdcTorqueConfig;
import java.util.Date;
import java.util.List;
/**
@@ -17,14 +19,6 @@
public interface MdcTorqueConfigMapper extends BaseMapper<MdcTorqueConfig> {
    /**
     * æ ¹æ®æ‰­çŸ©å€¼å’Œè®¾å¤‡ç¼–号生成主轴运行曲线
     * @param torqueValue
     * @return
     */
    List<MdcTorqueConfig> findSpindleRunningCurve(@Param("torqueValue") float torqueValue, @Param("equipmentId") String equipmentId);
    /**
     * åˆ†é¡µæŸ¥è¯¢
     * @param pageData
     * @param mdcTorqueConfig
@@ -33,4 +27,6 @@
    IPage<MdcTorqueConfig> pageList(IPage<MdcTorqueConfig> pageData, @Param("mdcTorqueConfig") MdcTorqueConfig mdcTorqueConfig);
    MdcTorqueConfig findLast(@Param("equipmentId") String equipmentId);
    List<EquipmentMachingDto> getWorkLineList(@Param("equipmentId") String equipmentId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentBeilvAlarmMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
<?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.EquipmentBeilvAlarmMapper">
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml
@@ -148,4 +148,15 @@
        GROUP BY
            mesi.equipment_id
    </select>
    <select id="getEfficiencyRate" resultType="java.math.BigDecimal">
        SELECT
            process_long
        FROM
            mdc_equipment_statistical_info
        WHERE
            equipment_id = #{ equipmentId } AND the_date &gt;= #{ date }
        ORDER BY the_date ASC
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -246,4 +246,8 @@
    </select>
    <select id="getWorkLineLast" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
        select top 1 spindlespeed, actualspindlespeed from [${tableName}] order by CollectTime  desc
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml
@@ -6,13 +6,12 @@
    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime">
        SELECT
            t1.id,
            t2.equipment_id equipmentId,
            t4.equipment_name equipmentName,
            t2.effective_date effectiveDate,
            t3.start_date startDate,
            t3.end_date endDate,
            t1.equipment_id equipmentId,
            t2.equipment_name equipmentName,
            t1.the_date theDate,
            t1.start_time startTime,
            t1.end_time endTime,
            t1.duration duration,
            t1.remark remark,
            t1.create_by createBy,
            t1.create_time createTime,
@@ -20,37 +19,37 @@
            t1.update_time updateTime
        FROM
            mdc_equipment_overtime t1
            LEFT JOIN mdc_device_calendar t2 ON t1.calendar_id = t2.id
            LEFT JOIN mdc_shift_sub t3 ON t3.id = t2.shift_sub_id
            LEFT JOIN mdc_equipment t4 ON t4.equipment_id = t2.equipment_id
            LEFT JOIN mdc_equipment t2 ON t2.equipment_id = t1.equipment_id
        <where>
            <if test="mdcEquipmentOvertime.equipmentName != null and mdcEquipmentOvertime.equipmentName != '' ">
                AND t4.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%')
                AND t2.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%')
            </if>
            <if test="mdcEquipmentOvertime.equipmentId != null and mdcEquipmentOvertime.equipmentId != '' ">
                AND t2.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%')
                AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%')
            </if>
            <if test="mdcEquipmentOvertime.mdcSectionIds != null and mdcEquipmentOvertime.mdcSectionIds.size() > 0 ">
                AND t2.equipment_id IN
                AND t1.equipment_id IN
                <foreach collection="mdcEquipmentOvertime.mdcSectionIds" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
            <if test="mdcEquipmentOvertime.startTime != null and mdcEquipmentOvertime.startTime != '' and mdcEquipmentOvertime.endTime != null and mdcEquipmentOvertime.endTime != ''">
                AND t1.the_date BETWEEN #{ mdcEquipmentOvertime.startTime } AND #{ mdcEquipmentOvertime.endTime }
            </if>
        </where>
        order by t2.effective_date asc
        order by t1.the_date asc
    </select>
    <!--list列表-->
    <select id="list" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime">
        SELECT
            t1.id,
            t2.equipment_id equipmentId,
            t4.equipment_name equipmentName,
            t2.effective_date effectiveDate,
            t3.start_date startDate,
            t3.end_date endDate,
            t1.equipment_id equipmentId,
            t2.equipment_name equipmentName,
            t1.the_date theDate,
            t1.start_time startTime,
            t1.end_time endTime,
            t1.duration duration,
            t1.remark remark,
            t1.create_by createBy,
            t1.create_time createTime,
@@ -58,35 +57,34 @@
            t1.update_time updateTime
        FROM
            mdc_equipment_overtime t1
            LEFT JOIN mdc_device_calendar t2 ON t1.calendar_id = t2.id
            LEFT JOIN mdc_shift_sub t3 ON t3.id = t2.shift_sub_id
            LEFT JOIN mdc_equipment t4 ON t4.equipment_id = t2.equipment_id
            LEFT JOIN mdc_equipment t2 ON t2.equipment_id = t1.equipment_id
        <where>
            <if test="mdcEquipmentOvertime.equipmentName != null and mdcEquipmentOvertime.equipmentName != '' ">
                AND t4.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%')
                AND t2.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%')
            </if>
            <if test="mdcEquipmentOvertime.equipmentId != null and mdcEquipmentOvertime.equipmentId != '' ">
                AND t2.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%')
                AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%')
            </if>
            <if test="mdcEquipmentOvertime.mdcSectionIds != null and mdcEquipmentOvertime.mdcSectionIds.size() > 0 ">
                AND t2.equipment_id IN
                AND t1.equipment_id IN
                <foreach collection="mdcEquipmentOvertime.mdcSectionIds" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
            <if test="mdcEquipmentOvertime.startTime != null and mdcEquipmentOvertime.startTime != '' and mdcEquipmentOvertime.endTime != null and mdcEquipmentOvertime.endTime != ''">
                AND t1.the_date BETWEEN #{ mdcEquipmentOvertime.startTime } AND #{ mdcEquipmentOvertime.endTime }
            </if>
        </where>
        order by t2.effective_date asc
            order by t1.the_date asc
    </select>
    <!--查询加班时长-->
    <select id="computeOvertime" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime">
        SELECT
            meo.*
            *
        FROM
            mdc_equipment_overtime meo
            LEFT JOIN mdc_device_calendar mdc ON meo.calendar_id = mdc.id
            mdc_equipment_overtime
        WHERE
            mdc.effective_date LIKE CONCAT(#{ validDate }, '%')
            AND mdc.equipment_id = #{ equipmentId }
            the_date LIKE CONCAT(#{ validDate }, '%') AND equipment_id = #{ equipmentId }
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml
@@ -162,5 +162,16 @@
        </where>
    </select>
    <select id="getDataList" resultType="java.lang.Integer">
        SELECT
            status
        FROM
            mdc_equipment_running_section
        WHERE
            equipment_id = #{ equipmentId }
          AND start_time &gt; #{date}
          AND status IS NOT NULL
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcTorqueConfigMapper.xml
@@ -1,10 +1,6 @@
<?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.MdcTorqueConfigMapper">
    <!--根据扭矩值生成主轴运行曲线-->
    <select id="findSpindleRunningCurve" resultType="org.jeecg.modules.mdc.entity.MdcTorqueConfig">
        select mtc.* from mdc_torque_config mtc where mtc.torque_value=#{torqueValue} and mtc.equipment_id=#{equipmentId}
    </select>
    <!--根据车间层级查询扭矩配置列表-->
    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcTorqueConfig">
@@ -39,4 +35,18 @@
        ORDER BY
            torque_date DESC
    </select>
    <!--生成工作曲线-->
    <select id="getWorkLineList" resultType="org.jeecg.modules.mdc.dto.EquipmentMachingDto">
        SELECT
            torque_date CollectTime,
            torque_value torque,
            feed_parameter
        FROM
            mdc_torque_config
        WHERE
            equipment_id = #{ equipmentId } AND torque_date BETWEEN #{ startTime } AND #{ endTime }
        ORDER BY
            torque_date ASC
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentBeilvAlarmService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package org.jeecg.modules.mdc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.mdc.entity.EquipmentBeilvAlarm;
/**
 * @Description: è®¾å¤‡è¿è¡Œæ•°æ®æŠ¥è­¦
 * @Author: jeecg-boot
 * @Date:   2024-01-17
 * @Version: V1.0
 */
public interface IEquipmentBeilvAlarmService extends IService<EquipmentBeilvAlarm> {
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java
@@ -71,4 +71,6 @@
    void generateDeviceCalendar();
    MdcDeviceCalendar getFirstData(String equipmentId);
    List<MdcDeviceCalendarVo> listByEquipmentIdAndDate(String equipmentId, String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java
@@ -46,4 +46,12 @@
     * @return
     */
    BigDecimal computeOvertime(String equipmentId, String validDate);
    /**
     * æ·»åŠ 
     * @param mdcEquipmentOvertime
     * @return
     */
    boolean addOvertime(MdcEquipmentOvertime mdcEquipmentOvertime);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java
@@ -85,4 +85,7 @@
    List<MdcEquipmentRunningSection> selectRunningData(String equipmentId, Date startDate, Date endDate);
    List<MdcAlarmListDto> selectAlarmList(MdcAlarmAnalyzeQueryVo mdcAlarmAnalyzeQueryVo, String startDate, String endDate);
    List<Integer> getDataList(String equipmentId, Date date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -176,4 +176,11 @@
     * åˆ—表查询
     */
    IPage<MdcEquipment> pageList(Page<MdcEquipment> page, MdcEquipmentVo mdcEquipment, HttpServletRequest req);
    /**
     * ç›‘控设备转速任务
     */
    void monitoringSpeedProcess();
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcTorqueConfigService.java
@@ -3,10 +3,12 @@
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.dto.EquipmentMachingDto;
import org.jeecg.modules.mdc.entity.MdcTorqueConfig;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
/**
@@ -58,15 +60,6 @@
    Boolean deleteBatchTorque(String ids);
    /**
     * ç”Ÿæˆä¸»è½´è¿è¡Œæ›²çº¿
     *
     * @param torqueValue
     * @return
     */
    List<MdcTorqueConfig> findSpindleRunningCurve(float torqueValue, String equipmentId);
    /**
     * åˆ†é¡µæŸ¥è¯¢
     *
     * @param userId
@@ -85,4 +78,14 @@
     * @return
     */
    ModelAndView exportXls(String userId, MdcTorqueConfig mdcTorqueConfig);
    /**
     * èŽ·å–å·¥ä½œæ›²çº¿
     * @param equipmentId
     * @param startTime
     * @param endTime
     * @return
     */
    List<EquipmentMachingDto> getWorkLineList(String equipmentId, Date startTime, Date endTime);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java
@@ -4,6 +4,9 @@
import org.jeecg.modules.mdc.dto.DayUtilizationRateDto;
import org.jeecg.modules.mdc.vo.*;
import java.math.BigDecimal;
import java.util.List;
/**
 * @author: LiuS
 * @create: 2023-06-15 17:25
@@ -90,4 +93,13 @@
     * @return
     */
    MdcUtilizationRateDto utilizationRateTrendAnalyze(String userId, DayUtilizationRateContrastQueryVo vo);
    /**
     * èŽ·å–åˆ©ç”¨çŽ‡
     *
     * @param equipmentId
     * @param date
     * @return
     */
    List<BigDecimal> getEfficiencyRate(String equipmentId, String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentBeilvAlarmServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package org.jeecg.modules.mdc.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.mdc.entity.EquipmentBeilvAlarm;
import org.jeecg.modules.mdc.mapper.EquipmentBeilvAlarmMapper;
import org.jeecg.modules.mdc.service.IEquipmentBeilvAlarmService;
import org.springframework.stereotype.Service;
/**
 * @Description: è®¾å¤‡è¿è¡Œæ•°æ®æŠ¥è­¦
 * @Author: jeecg-boot
 * @Date:   2024-01-17
 * @Version: V1.0
 */
@Service
public class EquipmentBeilvAlarmServiceImpl extends ServiceImpl<EquipmentBeilvAlarmMapper, EquipmentBeilvAlarm> implements IEquipmentBeilvAlarmService {
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java
@@ -210,4 +210,9 @@
        return this.baseMapper.getFirstData(equipmentId);
    }
    @Override
    public List<MdcDeviceCalendarVo> listByEquipmentIdAndDate(String equipmentId, String date) {
        return this.baseMapper.listByEquipmentAndDate(equipmentId, date);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
@@ -1160,8 +1160,11 @@
                    mdcEfficiencyShiftResultDto.setCloseLong(equipmentStatisticalShiftInfo.getCloseLong());
                    mdcEfficiencyShiftResultDto.setOpenLong(equipmentStatisticalShiftInfo.getOpenLong());
                    mdcEfficiencyShiftResultDto.setWaitLong(equipmentStatisticalShiftInfo.getWaitLong());
                    mdcEfficiencyShiftResultDto.setOpenRate(equipmentStatisticalShiftInfo.getOpenLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, RoundingMode.HALF_UP));
                    if (equipmentStatisticalShiftInfo.getTotalLong().compareTo(BigDecimal.ZERO) == 0) {
                        mdcEfficiencyShiftResultDto.setOpenRate(BigDecimal.ZERO);
                    } else {
                        mdcEfficiencyShiftResultDto.setOpenRate(equipmentStatisticalShiftInfo.getOpenLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, RoundingMode.HALF_UP));
                    }
                    long rate = mdcEfficiencyShiftResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue();
                    for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                        if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -1729,6 +1732,11 @@
        return result;
    }
    @Override
    public List<BigDecimal> getEfficiencyRate(String equipmentId, String date) {
        return mdcEfficiencyReportMapper.getEfficiencyRate(equipmentId, date);
    }
    private MdcUtilizationResultDto utilizationRate(String equipmentId, String equipmentName, String equipmentType, Date startTime, Date endTime, String date, List<MdcUtilizationRate> mdcUtilizationRateList) {
        MdcUtilizationResultDto dto = new MdcUtilizationResultDto();
        dto.setEquipmentId(equipmentId);
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime;
import org.jeecg.modules.mdc.mapper.MdcEquipmentOvertimeMapper;
@@ -21,9 +22,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -142,15 +141,36 @@
        BigDecimal result = new BigDecimal("0");
        if (list != null && !list.isEmpty()) {
            for (MdcEquipmentOvertime equipmentOvertime : list) {
                String date = DateUtils.format(DateUtils.toDate(validDate + "-01", DateUtils.STR_DATE), DateUtils.STR_DATE) + " ";
                String startTime = date + equipmentOvertime.getStartTime();
                String endTime = date + equipmentOvertime.getEndTime();
                LocalDateTime localStartTime = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern(DateUtils.STR_DATE_TIME_SMALL));
                LocalDateTime localEndTime = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern(DateUtils.STR_DATE_TIME_SMALL));
                int minutes = Math.toIntExact(Duration.between(localStartTime, localEndTime).toMinutes());
                result = result.add(new BigDecimal(minutes));
                result = result.add(equipmentOvertime.getDuration().divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP));
            }
        }
        return result;
    }
    /**
     * æ·»åŠ 
     *
     * @param mdcEquipmentOvertime
     * @return
     */
    @Override
    public boolean addOvertime(MdcEquipmentOvertime mdcEquipmentOvertime) {
        String[] equipmentIds = mdcEquipmentOvertime.getEquipmentId().split(",");
        List<MdcEquipmentOvertime> mdcEquipmentOvertimes = new ArrayList<>();
        // è®¡ç®—æ—¶é•¿(秒)
        String startTime = mdcEquipmentOvertime.getStartTime();
        String endTime = mdcEquipmentOvertime.getEndTime();
        long duration = DateUtils.differentSecond(DateUtils.setTimeForDay(DateUtils.getNow(), startTime), DateUtils.setTimeForDay(DateUtils.getNow(), endTime));
        for (String equipmentId : equipmentIds) {
            MdcEquipmentOvertime equipmentOvertime = new MdcEquipmentOvertime();
            equipmentOvertime.setEquipmentId(equipmentId);
            equipmentOvertime.setTheDate(mdcEquipmentOvertime.getTheDate());
            equipmentOvertime.setAutoFlag(CommonConstant.AUTO_FLAG_N);
            equipmentOvertime.setStartTime(mdcEquipmentOvertime.getStartTime());
            equipmentOvertime.setEndTime(mdcEquipmentOvertime.getEndTime());
            equipmentOvertime.setDuration(new BigDecimal(duration));
            mdcEquipmentOvertimes.add(equipmentOvertime);
        }
        return super.saveBatch(mdcEquipmentOvertimes);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java
@@ -697,6 +697,11 @@
        return this.baseMapper.selectAlarmList(mdcAlarmAnalyzeQueryVo, startDate, endDate);
    }
    @Override
    public List<Integer> getDataList(String equipmentId, Date date) {
        return this.baseMapper.getDataList(equipmentId, date);
    }
    private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) {
        Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>();
        List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>();
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -6,7 +6,10 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
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;
@@ -19,17 +22,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.*;
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.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.IMdcProductionService;
import org.jeecg.modules.system.service.IMdcUserProductionService;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysUserDepartService;
import org.jeecg.modules.system.service.*;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -77,6 +80,13 @@
    @Resource
    private IEquipmentBaseInfoService equipmentBaseInfoService;
    @Resource
    private ISysDictService sysDictService;
    @Resource
    private ISysBaseAPI sysBaseApi;
    @Override
    public Map<String, String> getDepNamesByEquipmentIds(List<String> equipmentIds) {
@@ -700,4 +710,60 @@
        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::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() + "] çš„设备运行转速高报警!");
                            sysBaseApi.sendSysAnnouncement(messageDTO);
                        } else if (spindlespeed < actualspindlespeed) {
                            // å®žé™…值小于设定值   ä½Ž
                            messageDTO.setContent("设备编号为 [" + mdcEquipment.getEquipmentId() + "] çš„设备运行转速低报警!");
                            sysBaseApi.sendSysAnnouncement(messageDTO);
                        }
                    }
                }
            }
        }
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentWorkLineServiceImpl.java
@@ -9,6 +9,7 @@
import org.jeecg.modules.mdc.service.IMdcDriveTypeParamConfigService;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.IMdcEquipmentWorkLineService;
import org.jeecg.modules.mdc.service.IMdcTorqueConfigService;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.vo.MdcWorkChartVo;
import org.springframework.stereotype.Service;
@@ -35,6 +36,9 @@
    @Resource
    private EquipmentWorklineMapper equipmentWorklineMapper;
    @Resource
    private IMdcTorqueConfigService mdcTorqueConfigService;
    /**
     * æŸ¥æ‰¾æŒ‡å®šæ—¥æœŸçš„æ•°æ®
     */
@@ -49,7 +53,7 @@
            endTime = DateUtils.toDateMedium(mdcWorkChartVo.getDate() + " " + mdcWorkChartVo.getEnd() + ":00");
        }
        if (startTime != null && endTime != null && (startTime.getTime() > endTime.getTime() || startTime.getTime() > new Date().getTime())) {
        if (startTime != null && endTime != null && (startTime.getTime() > endTime.getTime() || startTime.getTime() > System.currentTimeMillis())) {
            return Collections.emptyList();
        }
        MdcEquipment mdcEquipment = mdcEquipmentService.getOne(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, mdcWorkChartVo.getEquipmentId()));
@@ -66,6 +70,12 @@
            return null;
        }
        List<EquipmentMachingDto> result = this.getWorkLineList(saveTableName, mdcDriveTypeParamConfigs, mdcWorkChartVo, startTime, endTime);
        // æŸ¥æ‰¾æ‰­çŸ©å’Œè¿›ç»™å‚æ•°
        List<EquipmentMachingDto> torqueList = mdcTorqueConfigService.getWorkLineList(mdcWorkChartVo.getEquipmentId(), startTime, endTime);
        if (torqueList != null && !torqueList.isEmpty()) {
            result.addAll(torqueList);
            result = result.stream().sorted(Comparator.comparing(EquipmentMachingDto::getCollectTime)).collect(Collectors.toList());
        }
        if (result == null || result.isEmpty()) {
            return null;
        }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java
@@ -108,9 +108,13 @@
            }
//            BigDecimal shiftTimeCount = mdcDeviceCalendarService.computeShiftTimeCount(equipmentId, validDate);
            mdcOverallEquipmentEfficiency.setShiftTimeCount(new BigDecimal("8"));
            if (StringUtils.isEmpty(mdcOverallEquipmentEfficiency.getShift())) {
                mdcOverallEquipmentEfficiency.setShiftTimeCount(BigDecimal.ZERO);
            } else {
                mdcOverallEquipmentEfficiency.setShiftTimeCount(new BigDecimal("8"));
            }
            // è®¡ç®—加班时间
            // TODO è®¡ç®—加班时间
            BigDecimal overtime = mdcEquipmentOvertimeService.computeOvertime(equipmentId, validDate);
            mdcOverallEquipmentEfficiency.setOvertime(overtime);
@@ -119,7 +123,7 @@
            mdcOverallEquipmentEfficiency.setActualWorkDayCount(actualWorkDayCount);
            // æœˆåº¦å®žé™…班产总时间(分钟)
            mdcOverallEquipmentEfficiency.setMonthActualWorkDayTimeCount(mdcOverallEquipmentEfficiency.getShiftTimeCount().add(overtime));
            mdcOverallEquipmentEfficiency.setMonthActualWorkDayTimeCount(mdcOverallEquipmentEfficiency.getShiftTimeCount().multiply(actualWorkDayCount).multiply(new BigDecimal("60")).add(overtime));
            // æ•…障停机时长统计(分钟)
            BigDecimal breakdownDownDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.BREAKDOWN_DOWN);
@@ -156,7 +160,7 @@
            // mdcOverallEquipmentEfficiency.getShiftTimeCount() - plannedMaintenanceDuration - conferenceTrainingDuration - otherRestDuration
            // è´Ÿè·æ—¶é—´(分钟)
            BigDecimal loadTime = mdcOverallEquipmentEfficiency.getShiftTimeCount().subtract(plannedMaintenanceDuration).subtract(conferenceTrainingDuration).subtract(otherRestDuration);
            if (loadTime.compareTo(BigDecimal.ZERO) > -1) {
            if (loadTime.compareTo(BigDecimal.ZERO) < 0) {
                loadTime = BigDecimal.ZERO;
            }
            mdcOverallEquipmentEfficiency.setLoadTime(loadTime.divide(new BigDecimal("60"), 1, RoundingMode.HALF_UP));
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java
@@ -7,6 +7,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.mdc.dto.EquipmentMachingDto;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcTorqueConfig;
import org.jeecg.modules.mdc.mapper.MdcTorqueConfigMapper;
@@ -20,10 +21,7 @@
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.*;
/**
 * @Description: æ‰­çŸ©é…ç½®ç®¡ç†
@@ -75,11 +73,6 @@
    @Override
    public Boolean deleteBatchTorque(String ids) {
        return this.removeBatchByIds(Arrays.asList(ids.split(",")));
    }
    @Override
    public List<MdcTorqueConfig> findSpindleRunningCurve(float torqueValue, String equipmentId) {
        return this.baseMapper.findSpindleRunningCurve(torqueValue, equipmentId);
    }
    @Override
@@ -178,4 +171,9 @@
        mv.addObject(NormalExcelConstants.DATA_LIST, mdcTorqueConfigs);
        return mv;
    }
    @Override
    public List<EquipmentMachingDto> getWorkLineList(String equipmentId, Date startTime, Date endTime) {
        return this.baseMapper.getWorkLineList(equipmentId, startTime, endTime);
    }
}