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 <= #{ 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 >= #{ 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); } }