From da82d77c6773f65aadfde810233615b602da655a Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期三, 12 三月 2025 15:54:33 +0800 Subject: [PATCH] 停机原因维护和上报功能 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeReasonMapper.xml | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/ScanDowntimeJob.java | 110 +++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java | 18 + lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDowntimeReasonController.java | 169 +++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDowntimeVo.java | 42 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeReasonServiceImpl.java | 25 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java | 6 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeReasonService.java | 17 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRunningSectionMapper.java | 3 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeReasonMapper.java | 13 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml | 26 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java | 73 ++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDowntime.java | 86 +++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml | 15 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDowntimeReason.java | 49 +++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java | 28 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDowntimeController.java | 161 ++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentWaitSectionDto.java | 16 + 21 files changed, 869 insertions(+), 4 deletions(-) diff --git a/lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java b/lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java index 5ffcb6c..a2a0bdb 100644 --- a/lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java +++ b/lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java @@ -597,5 +597,10 @@ */ Integer AUTO_FLAG_Y = 1; Integer AUTO_FLAG_N = 2; + /** + * 寰呮満鍘熷洜涓婃姤鐘舵�� 0(鏈笂鎶�) 1(宸蹭笂鎶�) + */ + Integer DOWNTIME_STATUS_0 = 0; + Integer DOWNTIME_STATUS_1 = 1; } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDowntimeController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDowntimeController.java new file mode 100644 index 0000000..c06b553 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDowntimeController.java @@ -0,0 +1,161 @@ +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.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.mdc.entity.MdcDowntime; +import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; +import org.jeecg.modules.mdc.service.IMdcDowntimeService; +import org.jeecg.modules.mdc.vo.MdcDowntimeVo; +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: lius + * @Date: 2025-03-12 + */ +@Slf4j +@Api(tags = "寰呮満鍋滄満琛�") +@RestController +@RequestMapping("/mdc/mdcDowntime") +public class MdcDowntimeController extends JeecgController<MdcDowntime, IMdcDowntimeService> { + + @Resource + private IMdcDowntimeService mdcDowntimeService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param mdcDowntimeVo + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "寰呮満鍋滄満琛�-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "寰呮満鍋滄満琛�-鍒嗛〉鍒楄〃鏌ヨ", notes = "寰呮満鍋滄満琛�-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(MdcDowntimeVo mdcDowntimeVo, + @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<MdcDowntime> page = new Page<MdcDowntime>(pageNo, pageSize); + IPage<MdcDowntime> pageList = mdcDowntimeService.pageList(userId, page, mdcDowntimeVo, req); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param mdcDowntime + * @return + */ + @AutoLog(value = "寰呮満鍋滄満琛�-娣诲姞") + @ApiOperation(value = "寰呮満鍋滄満琛�-娣诲姞", notes = "寰呮満鍋滄満琛�-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody MdcDowntime mdcDowntime) { + mdcDowntimeService.save(mdcDowntime); + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param mdcDowntime + * @return + */ + @AutoLog(value = "寰呮満鍋滄満琛�-缂栬緫") + @ApiOperation(value = "寰呮満鍋滄満琛�-缂栬緫", notes = "寰呮満鍋滄満琛�-缂栬緫") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> edit(@RequestBody MdcDowntime mdcDowntime) { + if (mdcDowntime.getReasonId() != null) { + mdcDowntime.setStatus(CommonConstant.DOWNTIME_STATUS_1); + } + mdcDowntimeService.updateById(mdcDowntime); + 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) { + mdcDowntimeService.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.mdcDowntimeService.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) { + MdcDowntime mdcDowntime = mdcDowntimeService.getById(id); + return Result.OK(mdcDowntime); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param mdcDowntime + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MdcDowntime mdcDowntime) { + return super.exportXls(request, mdcDowntime, MdcDowntime.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, MdcDowntime.class); + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDowntimeReasonController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDowntimeReasonController.java new file mode 100644 index 0000000..2bfc351 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDowntimeReasonController.java @@ -0,0 +1,169 @@ +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.MdcDowntimeReason; +import org.jeecg.modules.mdc.service.IMdcDowntimeReasonService; +import org.springframework.beans.factory.annotation.Autowired; +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: 鍋滄満鍘熷洜琛� + * @Author: lius + * @Date: 2025-03-11 + */ +@Slf4j +@Api(tags = "鍋滄満鍘熷洜琛�") +@RestController +@RequestMapping("/mdc/mdcDowntimeReason") +public class MdcDowntimeReasonController extends JeecgController<MdcDowntimeReason, IMdcDowntimeReasonService> { + + + @Resource + private IMdcDowntimeReasonService mdcDowntimeReasonService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param mdcDowntimeReason + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "鍋滄満鍘熷洜琛�-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "鍋滄満鍘熷洜琛�-鍒嗛〉鍒楄〃鏌ヨ", notes = "鍋滄満鍘熷洜琛�-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(MdcDowntimeReason mdcDowntimeReason, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<MdcDowntimeReason> queryWrapper = QueryGenerator.initQueryWrapper(mdcDowntimeReason, req.getParameterMap()); + Page<MdcDowntimeReason> page = new Page<MdcDowntimeReason>(pageNo, pageSize); + IPage<MdcDowntimeReason> pageList = mdcDowntimeReasonService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param mdcDowntimeReason + * @return + */ + @AutoLog(value = "鍋滄満鍘熷洜琛�-娣诲姞") + @ApiOperation(value = "鍋滄満鍘熷洜琛�-娣诲姞", notes = "鍋滄満鍘熷洜琛�-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody MdcDowntimeReason mdcDowntimeReason) { + mdcDowntimeReasonService.save(mdcDowntimeReason); + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param mdcDowntimeReason + * @return + */ + @AutoLog(value = "鍋滄満鍘熷洜琛�-缂栬緫") + @ApiOperation(value = "鍋滄満鍘熷洜琛�-缂栬緫", notes = "鍋滄満鍘熷洜琛�-缂栬緫") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> edit(@RequestBody MdcDowntimeReason mdcDowntimeReason) { + mdcDowntimeReasonService.updateById(mdcDowntimeReason); + 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) { + mdcDowntimeReasonService.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.mdcDowntimeReasonService.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) { + MdcDowntimeReason mdcDowntimeReason = mdcDowntimeReasonService.getById(id); + return Result.OK(mdcDowntimeReason); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param mdcDowntimeReason + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MdcDowntimeReason mdcDowntimeReason) { + return super.exportXls(request, mdcDowntimeReason, MdcDowntimeReason.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, MdcDowntimeReason.class); + } + + /** + * 鏍规嵁鍋滄満绫诲瀷鑾峰彇鍋滄満鍘熷洜鍒楄〃 + * + * @param downtimeType + * @return + */ + @AutoLog(value = "鍋滄満鍘熷洜琛�-鏍规嵁鍋滄満绫诲瀷鑾峰彇鍋滄満鍘熷洜鍒楄〃") + @ApiOperation(value = "鍋滄満鍘熷洜琛�-鏍规嵁鍋滄満绫诲瀷鑾峰彇鍋滄満鍘熷洜鍒楄〃", notes = "鍋滄満鍘熷洜琛�-鏍规嵁鍋滄満绫诲瀷鑾峰彇鍋滄満鍘熷洜鍒楄〃") + @GetMapping(value = "/downtimeReasonList") + public Result<?> downtimeReasonList(@RequestParam(name = "downtimeType", required = true) String downtimeType) { + List<MdcDowntimeReason> result = mdcDowntimeReasonService.downtimeReasonList(downtimeType); + return Result.OK(result); + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java index 29867c9..248d69a 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java @@ -14,7 +14,6 @@ import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcFeedback; import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; -import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.service.IMdcHomeService; import org.jeecg.modules.mdc.vo.MdcCommonVo; import org.jeecg.modules.mdc.vo.MdcHomeEfficiencyVo; @@ -40,9 +39,6 @@ @RestController @RequestMapping("/mdc/home") public class MdcHomeController { - - @Resource - private IMdcEquipmentService mdcEquipmentService; @Resource private IMdcProductionService mdcProductionService; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentWaitSectionDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentWaitSectionDto.java new file mode 100644 index 0000000..1e84aa1 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentWaitSectionDto.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; +import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; + +/** + * @Author: Lius + * @CreateTime: 2025-03-12 + * @Description: + */ +@Data +public class MdcEquipmentWaitSectionDto extends MdcEquipmentRunningSection { + + private String equipmentName; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDowntime.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDowntime.java new file mode 100644 index 0000000..88eebae --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDowntime.java @@ -0,0 +1,86 @@ +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.jeecg.common.aspect.annotation.Dict; +import org.jeecg.common.system.base.entity.JeecgEntity; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: 寰呮満鍋滄満琛� + * @Author: lius + * @Date: 2025-03-12 + */ +@Data +@TableName("mdc_downtime") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "mdc_downtime瀵硅薄", description = "寰呮満鍋滄満琛�") +public class MdcDowntime extends JeecgEntity implements Serializable { + + private static final long serialVersionUID = 7151231815767722285L; + + /** + * 璁惧缂栧彿 + */ + @Excel(name = "璁惧缂栧彿", width = 15) + @ApiModelProperty(value = "璁惧缂栧彿") + private String equipmentId; + /** + * 璁惧鍚嶇О + */ + @Excel(name = "璁惧鍚嶇О", width = 15) + @ApiModelProperty(value = "璁惧鍚嶇О") + private String equipmentName; + /** + * 寮�濮嬫椂闂� + */ + @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 startTime; + /** + * 缁撴潫鏃堕棿 + */ + @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 endTime; + /** + * 鍋滄満鍘熷洜id + */ + @Excel(name = "鍋滄満鍘熷洜id", width = 15) + @ApiModelProperty(value = "鍋滄満鍘熷洜id") + @Dict(dictTable = "mdc_downtime_reason",dicCode = "id",dicText = "downtime_type") + private String reasonId; + /** + * 鐘舵�侊紙0鏈笂鎶ワ紝1宸蹭笂鎶ワ級 + */ + @Excel(name = "鐘舵��", width = 15) + @ApiModelProperty(value = "鐘舵�侊紙0鏈笂鎶ワ紝1宸蹭笂鎶ワ級") + private Integer status = 0; + /** + * 鏃ユ湡 + */ + @Excel(name = "鏃ユ湡", width = 15) + @ApiModelProperty(value = "鏃ユ湡") + private String theDate; + /** + * 澶囨敞 + */ + @Excel(name = "澶囨敞", width = 15) + @ApiModelProperty(value = "澶囨敞") + private String remark; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDowntimeReason.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDowntimeReason.java new file mode 100644 index 0000000..ecce552 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDowntimeReason.java @@ -0,0 +1,49 @@ +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.aspect.annotation.Dict; +import org.jeecg.common.system.base.entity.JeecgEntity; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; + +/** + * @Description: 鍋滄満鍘熷洜琛� + * @Author: lius + * @Date: 2025-03-11 + */ +@Data +@TableName("mdc_downtime_reason") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "mdc_downtime_reason瀵硅薄", description = "鍋滄満鍘熷洜琛�") +public class MdcDowntimeReason extends JeecgEntity implements Serializable { + + private static final long serialVersionUID = -4421631921207859780L; + + /** + * 鍋滄満绫诲瀷锛�0锛氳鍒掑仠鏈� 1锛氶潪璁″垝鍋滄満锛� + */ + @Excel(name = "鍋滄満绫诲瀷锛�0锛氳鍒掑仠鏈� 1锛氶潪璁″垝鍋滄満锛�", width = 15) + @ApiModelProperty(value = "鍋滄満绫诲瀷锛�0锛氳鍒掑仠鏈� 1锛氶潪璁″垝鍋滄満锛�") + @Dict(dicCode = "mdc_downtime_type") + private Integer downtimeType; + /** + * 鍋滄満鍘熷洜鎻忚堪 + */ + @Excel(name = "鍋滄満鍘熷洜鎻忚堪", width = 15) + @ApiModelProperty(value = "鍋滄満鍘熷洜鎻忚堪") + private String downtimeDescription; + /** + * 澶囨敞 + */ + @Excel(name = "澶囨敞", width = 15) + @ApiModelProperty(value = "澶囨敞") + private String remark; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/ScanDowntimeJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/ScanDowntimeJob.java new file mode 100644 index 0000000..84d9da1 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/ScanDowntimeJob.java @@ -0,0 +1,110 @@ +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.dto.MdcEquipmentWaitSectionDto; +import org.jeecg.modules.mdc.entity.MdcDowntime; +import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; +import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; +import org.jeecg.modules.mdc.service.IMdcDowntimeService; +import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService; +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.quartz.*; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Author: Lius + * @CreateTime: 2025-03-12 + * @Description: 鎵弿鍋滄満浠诲姟 + */ +@PersistJobDataAfterExecution +@DisallowConcurrentExecution +@Slf4j +public class ScanDowntimeJob implements Job { + + /** + * 鑻ュ弬鏁板彉閲忓悕淇敼 QuartzJobController涓篃闇�瀵瑰簲淇敼 鏃堕棿锛� yyyyMMdd 渚嬶細 20230414 + */ + private String parameter; + + public void setParameter(String parameter) { + this.parameter = parameter; + } + + @Resource + private IQuartzJobService quartzJobService; + + @Resource + private ISysAnnouncementService sysAnnouncementService; + + @Resource + private ISysQuartzLogService sysQuartzLogService; + + @Resource + private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService; + + @Resource + private IMdcDowntimeService mdcDowntimeService; + + @Override + public void execute(JobExecutionContext context) 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("瀹氭椂鎵弿寰呮満鏃堕暱瓒�20鍒嗛挓璁惧浠诲姟 ScanDowntimeJob 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); + + } else { + date = DateUtils.format(DateUtils.getNow(), DateUtils.STR_DATE); + } + mdcDowntimeService.remove(new LambdaQueryWrapper<MdcDowntime>().eq(MdcDowntime::getTheDate, date).eq(MdcDowntime::getStatus, CommonConstant.DOWNTIME_STATUS_0)); + + List<MdcEquipmentWaitSectionDto> mdcEquipmentRunningSections = mdcEquipmentRunningSectionService.findWaitList(date); + + if (mdcEquipmentRunningSections != null && !mdcEquipmentRunningSections.isEmpty()) { + String finalDate = date; + List<MdcDowntime> downtimeList = mdcEquipmentRunningSections.stream().map(mdcEquipmentWaitSectionDto -> { + MdcDowntime downtime = new MdcDowntime(); + downtime.setEquipmentId(mdcEquipmentWaitSectionDto.getEquipmentId()); + downtime.setEquipmentName(mdcEquipmentWaitSectionDto.getEquipmentName()); + downtime.setTheDate(finalDate); + downtime.setStartTime(mdcEquipmentWaitSectionDto.getStartTime()); + downtime.setEndTime(mdcEquipmentWaitSectionDto.getEndTime()); + return downtime; + }).collect(Collectors.toList()); + if (!downtimeList.isEmpty()) { + mdcDowntimeService.saveBatch(downtimeList); + } + } + quartzLog.setIsSuccess(0); + } catch (Exception e) { + quartzLog.setIsSuccess(-1); + quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + // 鍙戦�佹秷鎭�氱煡 + sysAnnouncementService.jobSendMessage("瀹氭椂鎵弿寰呮満鏃堕暱瓒�20鍒嗛挓璁惧浠诲姟", quartzLog.getExceptionDetail()); + } + long endTime = System.currentTimeMillis(); + quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); + sysQuartzLogService.save(quartzLog); + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java new file mode 100644 index 0000000..59317b9 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java @@ -0,0 +1,18 @@ +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.MdcDowntime; +import org.jeecg.modules.mdc.vo.MdcDowntimeVo; + +/** + * @Description: 寰呮満鍋滄満琛� + * @Author: lius + * @Date: 2025-03-12 + */ +public interface MdcDowntimeMapper extends BaseMapper<MdcDowntime> { + + IPage<MdcDowntime> pageList(Page<MdcDowntime> page, @Param("mdcDowntimeVo") MdcDowntimeVo mdcDowntimeVo); +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeReasonMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeReasonMapper.java new file mode 100644 index 0000000..9bfefe7 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeReasonMapper.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.mdc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.mdc.entity.MdcDowntimeReason; + +/** + * @Description: 鍋滄満鍘熷洜琛� + * @Author: lius + * @Date: 2025-03-11 + */ +public interface MdcDowntimeReasonMapper extends BaseMapper<MdcDowntimeReason> { + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRunningSectionMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRunningSectionMapper.java index 769629f..3395eea 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRunningSectionMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRunningSectionMapper.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.dto.MdcAlarmListDto; +import org.jeecg.modules.mdc.dto.MdcEquipmentWaitSectionDto; import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; @@ -75,4 +76,6 @@ 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); + + List<MdcEquipmentWaitSectionDto> findWaitList(@Param("date") String date); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml new file mode 100644 index 0000000..3e9cef2 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml @@ -0,0 +1,26 @@ +<?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.MdcDowntimeMapper"> + + <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcDowntime"> + SELECT * FROM mdc_downtime + <where> + <if test="mdcDowntimeVo.equipmentId != null and mdcDowntimeVo.equipmentId != ''"> + AND equipment_id = #{ mdcDowntimeVo.equipmentId } + </if> + <if test="mdcDowntimeVo.equipmentName != null and mdcDowntimeVo.equipmentName != ''"> + AND equipment_name = #{ mdcDowntimeVo.equipmentName } + </if> + <if test="mdcDowntimeVo.startTime != null and mdcDowntimeVo.startTime != '' and mdcDowntimeVo.endTime != null and mdcDowntimeVo.endTime != ''"> + AND the_date BETWEEN #{ mdcDowntimeVo.startTime } AND #{ mdcDowntimeVo.endTime } + </if> + <if test="mdcDowntimeVo.equipmentIdList != null and mdcDowntimeVo.equipmentIdList.size() > 0 "> + AND equipment_id IN + <foreach collection="mdcDowntimeVo.equipmentIdList" item="equipmentId" index="index" open="(" close=")" separator=","> + #{ equipmentId } + </foreach> + </if> + </where> + ORDER BY create_time DESC + </select> +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeReasonMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeReasonMapper.xml new file mode 100644 index 0000000..9b4edba --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeReasonMapper.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.MdcDowntimeReasonMapper"> + +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml index a2b6082..dd35b9f 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml @@ -173,5 +173,20 @@ AND status IS NOT NULL </select> + <select id="findWaitList" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentWaitSectionDto"> + SELECT + t1.*, + t2.equipment_name + FROM + mdc_equipment_running_section t1 + LEFT JOIN mdc_equipment t2 ON t1.equipment_id = t2.equipment_id + WHERE + duration > 1200 + AND status = 2 + AND CONVERT ( VARCHAR, start_time, 120 ) LIKE CONCAT(#{date},'%') + ORDER BY + equipment_id, start_time DESC + </select> + </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeReasonService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeReasonService.java new file mode 100644 index 0000000..2b11693 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeReasonService.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.mdc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.mdc.entity.MdcDowntimeReason; + +import java.util.List; + +/** + * @Description: 鍋滄満鍘熷洜琛� + * @Author: lius + * @Date: 2025-03-11 + */ +public interface IMdcDowntimeReasonService extends IService<MdcDowntimeReason> { + + List<MdcDowntimeReason> downtimeReasonList(String downtimeType); +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java new file mode 100644 index 0000000..7e69746 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java @@ -0,0 +1,28 @@ +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.MdcDowntime; +import org.jeecg.modules.mdc.vo.MdcDowntimeVo; + +import javax.servlet.http.HttpServletRequest; + +/** + * @Description: 寰呮満鍋滄満琛� + * @Author: lius + * @Date: 2025-03-12 + */ +public interface IMdcDowntimeService extends IService<MdcDowntime> { + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param userId + * @param page + * @param mdcDowntimeVo + * @param req + * @return + */ + IPage<MdcDowntime> pageList(String userId, Page<MdcDowntime> page, MdcDowntimeVo mdcDowntimeVo, HttpServletRequest req); +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java index f326ac6..9cbf340 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.mdc.dto.MdcAlarmListDto; import org.jeecg.modules.mdc.dto.MdcEquipmentRunningSectionDto; +import org.jeecg.modules.mdc.dto.MdcEquipmentWaitSectionDto; import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; import org.jeecg.modules.mdc.vo.MdcEquipmentRunningSectionVo; @@ -88,4 +89,5 @@ List<Integer> getDataList(String equipmentId, Date date); + List<MdcEquipmentWaitSectionDto> findWaitList(String date); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeReasonServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeReasonServiceImpl.java new file mode 100644 index 0000000..2303af0 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeReasonServiceImpl.java @@ -0,0 +1,25 @@ +package org.jeecg.modules.mdc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.mdc.entity.MdcDowntimeReason; +import org.jeecg.modules.mdc.mapper.MdcDowntimeReasonMapper; +import org.jeecg.modules.mdc.service.IMdcDowntimeReasonService; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.List; + +/** + * @Description: 鍋滄満鍘熷洜琛� + * @Author: lius + * @Date: 2025-03-11 + */ +@Service +public class MdcDowntimeReasonServiceImpl extends ServiceImpl<MdcDowntimeReasonMapper, MdcDowntimeReason> implements IMdcDowntimeReasonService { + + @Override + public List<MdcDowntimeReason> downtimeReasonList(String downtimeType) { + return this.baseMapper.selectList(new LambdaQueryWrapper<MdcDowntimeReason>().eq(MdcDowntimeReason::getDowntimeType, downtimeType)); + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java new file mode 100644 index 0000000..285bb7c --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java @@ -0,0 +1,73 @@ +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.apache.commons.lang3.StringUtils; +import org.jeecg.modules.mdc.entity.MdcDowntime; +import org.jeecg.modules.mdc.mapper.MdcDowntimeMapper; +import org.jeecg.modules.mdc.service.IMdcDowntimeService; +import org.jeecg.modules.mdc.service.IMdcEquipmentService; +import org.jeecg.modules.mdc.vo.MdcDowntimeVo; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * @Description: 寰呮満鍋滄満琛� + * @Author: lius + * @Date: 2025-03-12 + */ +@Service +public class MdcDowntimeServiceImpl extends ServiceImpl<MdcDowntimeMapper, MdcDowntime> implements IMdcDowntimeService { + + @Resource + private IMdcEquipmentService mdcEquipmentService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param userId + * @param page + * @param mdcDowntimeVo + * @param req + * @return + */ + @Override + public IPage<MdcDowntime> pageList(String userId, Page<MdcDowntime> page, MdcDowntimeVo mdcDowntimeVo, HttpServletRequest req) { + // 鑾峰彇璁惧ID鍒楄〃 + List<String> equipmentIds = getEquipmentIds(userId, mdcDowntimeVo); + + // 濡傛灉璁惧ID鍒楄〃涓虹┖锛岀洿鎺ヨ繑鍥炵┖鍒嗛〉 + if (equipmentIds == null || equipmentIds.isEmpty()) { + return new Page<>(page.getCurrent(), page.getSize(), 0); + } + + // 璁剧疆璁惧ID鍒楄〃鍒版煡璇㈡潯浠朵腑 + mdcDowntimeVo.setEquipmentIdList(equipmentIds); + + // 鎵ц鍒嗛〉鏌ヨ + return this.baseMapper.pageList(page, mdcDowntimeVo); + } + + private List<String> getEquipmentIds(String userId, MdcDowntimeVo mdcDowntimeVo) { + if (StringUtils.isNotEmpty(mdcDowntimeVo.getEquipmentId())) { + return Collections.singletonList(mdcDowntimeVo.getEquipmentId()); + } + + if (StringUtils.isNotEmpty(mdcDowntimeVo.getParentId())) { + return "2".equals(mdcDowntimeVo.getTypeTree()) + ? mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcDowntimeVo.getParentId()) + : mdcEquipmentService.getEquipmentIdsProduction(userId, mdcDowntimeVo.getParentId()); + } + + return "2".equals(mdcDowntimeVo.getTypeTree()) + ? mdcEquipmentService.getEquipmentIdsByDepart(userId, null) + : mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java index 28ebc28..47fe41c 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java @@ -7,6 +7,7 @@ import org.jeecg.modules.mdc.dto.EquipmentMachingDto; import org.jeecg.modules.mdc.dto.MdcAlarmListDto; import org.jeecg.modules.mdc.dto.MdcEquipmentRunningSectionDto; +import org.jeecg.modules.mdc.dto.MdcEquipmentWaitSectionDto; import org.jeecg.modules.mdc.entity.*; import org.jeecg.modules.mdc.mapper.MdcEquipmentRunningSectionMapper; import org.jeecg.modules.mdc.service.*; @@ -740,6 +741,11 @@ return this.baseMapper.getDataList(equipmentId, date); } + @Override + public List<MdcEquipmentWaitSectionDto> findWaitList(String date) { + return this.baseMapper.findWaitList(date); + } + private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) { Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>(); List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>(); diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDowntimeVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDowntimeVo.java new file mode 100644 index 0000000..cd87368 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDowntimeVo.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; +import org.jeecg.modules.mdc.entity.MdcDowntime; + +import java.util.List; + +/** + * @Author: Lius + * @CreateTime: 2025-03-12 + * @Description: + */ +@Data +public class MdcDowntimeVo extends MdcDowntime { + /** + * 寮�濮嬫椂闂� -> 20220101 + */ + private String startTime; + /** + * 缁撴潫鏃堕棿 -> 20220101 + */ + private String endTime; + private String effectiveDate; + /** + * 鏍戠被鍨� -> 1:杞﹂棿灞傜骇 2:閮ㄩ棬灞傜骇 + */ + private String typeTree; + /** + * 灞傜骇ID + */ + private String parentId; + /** + * 璁惧Id + */ + private String equipmentId; + + /** + * 璁惧ids + */ + private List<String> equipmentIdList; + private List<String> mdcSectionIds; +} -- Gitblit v1.9.3