From f84d9e69907cb678150eaa6393fd74cf042fcca4 Mon Sep 17 00:00:00 2001 From: zenglf <18502938215@163.com> Date: 星期四, 28 九月 2023 14:39:03 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' into develop --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java | 159 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java | 11 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/mapper/SysQuartzLogMapper.java | 23 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java | 20 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentOvertimeMapper.java | 36 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationResultDto.java | 37 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentAlarmAnalyzeController.java | 54 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcAlarmAnalyzeQueryVo.java | 42 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java | 12 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcUtilizationRateServiceImpl.java | 10 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcComAnaDto.java | 20 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java | 20 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/entity/QuartzJob.java | 3 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftServiceImpl.java | 34 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmDto.java | 18 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRunningSectionService.java | 39 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java | 127 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/GenerateWeekDaysJob.java | 35 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcAlarmInfoServiceImpl.java | 18 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java | 123 + lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java | 26 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentSealController.java | 14 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRepairService.java | 11 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayUtilizationRateQueryVo.java | 35 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/controller/SysQuartzLogController.java | 61 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcShiftDateVo.java | 106 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/OptionsDto.java | 16 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftSubServiceImpl.java | 33 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcAlarmInfo.java | 56 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDriveTypeParamConfigMapper.java | 6 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java | 2 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentScrapController.java | 16 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentLogMapper.xml | 8 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MeterDto.java | 21 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java | 775 +++++++ lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysAnnouncementServiceImpl.java | 66 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcVacationManagementServiceImpl.java | 63 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayRateDto.java | 17 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java | 151 + lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml | 9 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDeviceCalendarController.java | 42 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDateVo.java | 17 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentLogService.java | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentOvertime.java | 109 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java | 46 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPassRate.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/GraphicsDto.java | 33 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml | 52 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml | 80 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcShiftSubService.java | 14 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPassRateController.java | 44 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java | 21 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcStandardProcessDuration.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/DayUtilizationRateDto.java | 23 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmTrendDto.java | 21 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/entity/SysQuartzLog.java | 77 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/service/impl/SysQuartzLogServiceImpl.java | 50 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationRateDto.java | 21 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java | 6 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java | 717 ++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java | 73 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRepairServiceImpl.java | 11 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java | 19 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/mapper/xml/SysQuartzLogMapper.xml | 70 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml | 71 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/dto/SysQuartzLogDto.java | 37 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDeviceCalendar.java | 10 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentTraceProcessJob.java | 35 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalShiftInfo.java | 96 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml | 9 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/ComparativeAnalysisDto.java | 27 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcAlarmInfoMapper.xml | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPassRateServiceImpl.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDeviceCalendarVo.java | 2 lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java | 361 ++- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRepairMapper.xml | 22 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java | 7 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmAnalyzeDto.java | 30 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDriveTypeParamConfig.java | 4 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/service/ISysQuartzLogService.java | 36 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDriveTypeParamConfigMapper.xml | 7 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java | 16 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java | 40 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java | 72 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentLogServiceImpl.java | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationRateListDto.java | 30 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java | 7 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java | 52 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentRepairController.java | 81 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayUtilizationRateContrastQueryVo.java | 48 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysAnnouncementService.java | 5 lxzn-module-system/lxzn-system-start/src/main/resources/application-prod.yml | 22 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentDisposalController.java | 67 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcShiftSub.java | 8 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfo.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRepairMapper.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcShiftSubController.java | 40 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyShiftListDto.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcAlarmInfoMapper.java | 14 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/PieChartDto.java | 29 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentDto.java | 42 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRunningSectionMapper.java | 31 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcShiftService.java | 14 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentUnsealController.java | 37 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcVacationManagementController.java | 6 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentStatisticalProcessJob.java | 36 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java | 153 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEquipmentAlarmAnalyzeService.java | 31 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/UtilizationRateDto.java | 21 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcVacationManagementService.java | 18 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcStandardProcessDurationServiceImpl.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java | 9 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcShiftController.java | 31 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/ComparativeAnalysisQueryVo.java | 44 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java | 124 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcAlarmInfoController.java | 154 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyShiftResultDto.java | 49 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/ThrowableUtil.java | 25 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcAlarmInfoService.java | 14 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentCalendarVo.java | 24 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/vo/SysQuartzLogVo.java | 24 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentLogMapper.java | 6 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDeviceCalendarMapper.java | 8 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml | 94 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcProcessQuantityDto.java | 2 130 files changed, 5,688 insertions(+), 523 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 6b6ac6f..53ce0fd 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 @@ -6,127 +6,149 @@ */ public interface CommonConstant { - /** - * 姝e父鐘舵�� - */ - Integer STATUS_NORMAL = 0; + /** + * 姝e父鐘舵�� + */ + Integer STATUS_NORMAL = 0; - /** - * 绂佺敤鐘舵�� - */ - Integer STATUS_DISABLE = -1; + /** + * 绂佺敤鐘舵�� + */ + Integer STATUS_DISABLE = -1; - /** - * 鍒犻櫎鏍囧織 - */ - Integer DEL_FLAG_1 = 1; + /** + * 鍒犻櫎鏍囧織 + */ + Integer DEL_FLAG_1 = 1; - /** - * 鏈垹闄� - */ - Integer DEL_FLAG_0 = 0; + /** + * 鏈垹闄� + */ + Integer DEL_FLAG_0 = 0; - /** - * 绯荤粺鏃ュ織绫诲瀷锛� 鐧诲綍 - */ - int LOG_TYPE_1 = 1; - - /** - * 绯荤粺鏃ュ織绫诲瀷锛� 鎿嶄綔 - */ - int LOG_TYPE_2 = 2; + /** + * 绯荤粺鏃ュ織绫诲瀷锛� 鐧诲綍 + */ + int LOG_TYPE_1 = 1; - /** - * 鎿嶄綔鏃ュ織绫诲瀷锛� 鏌ヨ - */ - int OPERATE_TYPE_1 = 1; - - /** - * 鎿嶄綔鏃ュ織绫诲瀷锛� 娣诲姞 - */ - int OPERATE_TYPE_2 = 2; - - /** - * 鎿嶄綔鏃ュ織绫诲瀷锛� 鏇存柊 - */ - int OPERATE_TYPE_3 = 3; - - /** - * 鎿嶄綔鏃ュ織绫诲瀷锛� 鍒犻櫎 - */ - int OPERATE_TYPE_4 = 4; - - /** - * 鎿嶄綔鏃ュ織绫诲瀷锛� 鍊掑叆 - */ - int OPERATE_TYPE_5 = 5; - - /** - * 鎿嶄綔鏃ュ織绫诲瀷锛� 瀵煎嚭 - */ - int OPERATE_TYPE_6 = 6; - - - /** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */ + /** + * 绯荤粺鏃ュ織绫诲瀷锛� 鎿嶄綔 + */ + int LOG_TYPE_2 = 2; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 鏌ヨ + */ + int OPERATE_TYPE_1 = 1; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 娣诲姞 + */ + int OPERATE_TYPE_2 = 2; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 鏇存柊 + */ + int OPERATE_TYPE_3 = 3; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 鍒犻櫎 + */ + int OPERATE_TYPE_4 = 4; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 鍊掑叆 + */ + int OPERATE_TYPE_5 = 5; + + /** + * 鎿嶄綔鏃ュ織绫诲瀷锛� 瀵煎嚭 + */ + int OPERATE_TYPE_6 = 6; + + + /** + * {@code 500 Server Error} (HTTP/1.0 - RFC 1945) + */ Integer SC_INTERNAL_SERVER_ERROR_500 = 500; - /** {@code 200 OK} (HTTP/1.0 - RFC 1945) */ + /** + * {@code 200 OK} (HTTP/1.0 - RFC 1945) + */ Integer SC_OK_200 = 200; - - /**璁块棶鏉冮檺璁よ瘉鏈�氳繃 510*/ - Integer SC_JEECG_NO_AUTHZ=510; - /** 鐧诲綍鐢ㄦ埛Shiro鏉冮檺缂撳瓨KEY鍓嶇紑 */ - public static String PREFIX_USER_SHIRO_CACHE = "shiro:cache:org.jeecg.config.shiro.ShiroRealm.authorizationCache:"; - /** 鐧诲綍鐢ㄦ埛Token浠ょ墝缂撳瓨KEY鍓嶇紑 */ - String PREFIX_USER_TOKEN = "prefix_user_token_"; + /** + * 璁块棶鏉冮檺璁よ瘉鏈�氳繃 510 + */ + Integer SC_JEECG_NO_AUTHZ = 510; + + /** + * 鐧诲綍鐢ㄦ埛Shiro鏉冮檺缂撳瓨KEY鍓嶇紑 + */ + public static String PREFIX_USER_SHIRO_CACHE = "shiro:cache:org.jeecg.config.shiro.ShiroRealm.authorizationCache:"; + /** + * 鐧诲綍鐢ㄦ埛Token浠ょ墝缂撳瓨KEY鍓嶇紑 + */ + String PREFIX_USER_TOKEN = "prefix_user_token_"; // /** Token缂撳瓨鏃堕棿锛�3600绉掑嵆涓�灏忔椂 */ // int TOKEN_EXPIRE_TIME = 3600; - /** 鐧诲綍浜岀淮鐮� */ - String LOGIN_QRCODE_PRE = "QRCODELOGIN:"; - String LOGIN_QRCODE = "LQ:"; - /** 鐧诲綍浜岀淮鐮乼oken */ - String LOGIN_QRCODE_TOKEN = "LQT:"; + /** + * 鐧诲綍浜岀淮鐮� + */ + String LOGIN_QRCODE_PRE = "QRCODELOGIN:"; + String LOGIN_QRCODE = "LQ:"; + /** + * 鐧诲綍浜岀淮鐮乼oken + */ + String LOGIN_QRCODE_TOKEN = "LQT:"; /** - * 0锛氫竴绾ц彍鍗� + * 0锛氫竴绾ц彍鍗� */ - Integer MENU_TYPE_0 = 0; - /** - * 1锛氬瓙鑿滃崟 - */ - Integer MENU_TYPE_1 = 1; + Integer MENU_TYPE_0 = 0; /** - * 2锛氭寜閽潈闄� + * 1锛氬瓙鑿滃崟 */ - Integer MENU_TYPE_2 = 2; + Integer MENU_TYPE_1 = 1; + /** + * 2锛氭寜閽潈闄� + */ + Integer MENU_TYPE_2 = 2; - /**閫氬憡瀵硅薄绫诲瀷锛圲SER:鎸囧畾鐢ㄦ埛锛孉LL:鍏ㄤ綋鐢ㄦ埛锛�*/ - String MSG_TYPE_UESR = "USER"; - String MSG_TYPE_ALL = "ALL"; - - /**鍙戝竷鐘舵�侊紙0鏈彂甯冿紝1宸插彂甯冿紝2宸叉挙閿�锛�*/ - String NO_SEND = "0"; - String HAS_SEND = "1"; - String HAS_CANCLE = "2"; - - /**闃呰鐘舵�侊紙0鏈锛�1宸茶锛�*/ - String HAS_READ_FLAG = "1"; - String NO_READ_FLAG = "0"; - - /**浼樺厛绾э紙L浣庯紝M涓紝H楂橈級*/ - String PRIORITY_L = "L"; - String PRIORITY_M = "M"; - String PRIORITY_H = "H"; - + /** + * 閫氬憡瀵硅薄绫诲瀷锛圲SER:鎸囧畾鐢ㄦ埛锛孉LL:鍏ㄤ綋鐢ㄦ埛锛� + */ + String MSG_TYPE_UESR = "USER"; + String MSG_TYPE_ALL = "ALL"; + + /** + * 鍙戝竷鐘舵�侊紙0鏈彂甯冿紝1宸插彂甯冿紝2宸叉挙閿�锛� + */ + String NO_SEND = "0"; + String HAS_SEND = "1"; + String HAS_CANCLE = "2"; + + /** + * 闃呰鐘舵�侊紙0鏈锛�1宸茶锛� + */ + String HAS_READ_FLAG = "1"; + String NO_READ_FLAG = "0"; + + /** + * 浼樺厛绾э紙L浣庯紝M涓紝H楂橈級 + */ + String PRIORITY_L = "L"; + String PRIORITY_M = "M"; + String PRIORITY_H = "H"; + /** * 鐭俊妯℃澘鏂瑰紡 0 .鐧诲綍妯℃澘銆�1.娉ㄥ唽妯℃澘銆�2.蹇樿瀵嗙爜妯℃澘 */ - String SMS_TPL_TYPE_0 = "0"; - String SMS_TPL_TYPE_1 = "1"; - String SMS_TPL_TYPE_2 = "2"; - + String SMS_TPL_TYPE_0 = "0"; + String SMS_TPL_TYPE_1 = "1"; + String SMS_TPL_TYPE_2 = "2"; + /** * 鐘舵��(0鏃犳晥1鏈夋晥) */ @@ -156,7 +178,7 @@ */ String MSG_CATEGORY_1 = "1"; String MSG_CATEGORY_2 = "2"; - + /** * 鏄惁閰嶇疆鑿滃崟鐨勬暟鎹潈闄� 1鏄�0鍚� */ @@ -168,8 +190,10 @@ */ Integer USER_UNFREEZE = 1; Integer USER_FREEZE = 2; - - /**瀛楀吀缈昏瘧鏂囨湰鍚庣紑*/ + + /** + * 瀛楀吀缈昏瘧鏂囨湰鍚庣紑 + */ String DICT_TEXT_SUFFIX = "_dictText"; /** @@ -245,26 +269,46 @@ Integer USER_IDENTITY_1 = 1; Integer USER_IDENTITY_2 = 2; - /** sys_user 琛� username 鍞竴閿储寮� */ + /** + * sys_user 琛� username 鍞竴閿储寮� + */ String SQL_INDEX_UNIQ_SYS_USER_USERNAME = "uniq_sys_user_username"; - /** sys_user 琛� work_no 鍞竴閿储寮� */ + /** + * sys_user 琛� work_no 鍞竴閿储寮� + */ String SQL_INDEX_UNIQ_SYS_USER_WORK_NO = "uniq_sys_user_work_no"; - /** sys_user 琛� phone 鍞竴閿储寮� */ + /** + * sys_user 琛� phone 鍞竴閿储寮� + */ String SQL_INDEX_UNIQ_SYS_USER_PHONE = "uniq_sys_user_phone"; - /** 杈炬ⅵ鏁版嵁搴撳崌鎻愮ず銆傝繚鍙嶈〃[SYS_USER]鍞竴鎬х害鏉� */ + /** + * 杈炬ⅵ鏁版嵁搴撳崌鎻愮ず銆傝繚鍙嶈〃[SYS_USER]鍞竴鎬х害鏉� + */ String SQL_INDEX_UNIQ_SYS_USER = "鍞竴鎬х害鏉�"; - /** sys_user 琛� email 鍞竴閿储寮� */ + /** + * sys_user 琛� email 鍞竴閿储寮� + */ String SQL_INDEX_UNIQ_SYS_USER_EMAIL = "uniq_sys_user_email"; - /** sys_quartz_job 琛� job_class_name 鍞竴閿储寮� */ + /** + * sys_quartz_job 琛� job_class_name 鍞竴閿储寮� + */ String SQL_INDEX_UNIQ_JOB_CLASS_NAME = "uniq_job_class_name"; - /** sys_position 琛� code 鍞竴閿储寮� */ + /** + * sys_position 琛� code 鍞竴閿储寮� + */ String SQL_INDEX_UNIQ_CODE = "uniq_code"; - /** sys_role 琛� code 鍞竴閿储寮� */ + /** + * sys_role 琛� code 鍞竴閿储寮� + */ String SQL_INDEX_UNIQ_SYS_ROLE_CODE = "uniq_sys_role_role_code"; - /** sys_depart 琛� code 鍞竴閿储寮� */ + /** + * sys_depart 琛� code 鍞竴閿储寮� + */ String SQL_INDEX_UNIQ_DEPART_ORG_CODE = "uniq_depart_org_code"; - /** sys_category 琛� code 鍞竴閿储寮� */ + /** + * sys_category 琛� code 鍞竴閿储寮� + */ String SQL_INDEX_UNIQ_CATEGORY_CODE = "idx_sc_code"; /** * 鍦ㄧ嚎鑱婂ぉ 鏄惁涓洪粯璁ゅ垎缁� @@ -304,7 +348,7 @@ * 鍏枃鏂囨。涓婁紶鑷畾涔夎矾寰� */ String UPLOAD_CUSTOM_PATH_OFFICIAL = "officialdoc"; - /** + /** * 鍏枃鏂囨。涓嬭浇鑷畾涔夎矾寰� */ String DOWNLOAD_CUSTOM_PATH_OFFICIAL = "officaldown"; @@ -312,11 +356,11 @@ /** * WPS瀛樺偍鍊肩被鍒�(1 code鏂囧彿 2 text锛圵PS妯℃澘杩樻槸鍏枃鍙戞枃妯℃澘锛�) */ - String WPS_TYPE_1="1"; - String WPS_TYPE_2="2"; + String WPS_TYPE_1 = "1"; + String WPS_TYPE_2 = "2"; - String YN_Y="Y"; - String YN_N="N"; + String YN_Y = "Y"; + String YN_N = "N"; /**===============================================================================================*/ @@ -327,9 +371,13 @@ String X_ACCESS_TOKEN = "X-Access-Token"; String X_SIGN = "X-Sign"; String X_TIMESTAMP = "X-TIMESTAMP"; - /** 绉熸埛 璇锋眰澶�*/ + /** + * 绉熸埛 璇锋眰澶� + */ String TENANT_ID = "tenant-id"; - /**===============================================================================================*/ + /** + * =============================================================================================== + */ String TOKEN_IS_INVALID_MSG = "Token澶辨晥锛岃閲嶆柊鐧诲綍!"; String X_FORWARDED_SCHEME = "X-Forwarded-Scheme"; @@ -354,39 +402,63 @@ */ String THIRD_SYNC_TO_LOCAL = "SYNC_TO_LOCAL"; - /** 绯荤粺閫氬憡娑堟伅鐘舵�侊細0=鏈彂甯� */ + /** + * 绯荤粺閫氬憡娑堟伅鐘舵�侊細0=鏈彂甯� + */ String ANNOUNCEMENT_SEND_STATUS_0 = "0"; - /** 绯荤粺閫氬憡娑堟伅鐘舵�侊細1=宸插彂甯� */ + /** + * 绯荤粺閫氬憡娑堟伅鐘舵�侊細1=宸插彂甯� + */ String ANNOUNCEMENT_SEND_STATUS_1 = "1"; - /** 绯荤粺閫氬憡娑堟伅鐘舵�侊細2=宸叉挙閿� */ + /** + * 绯荤粺閫氬憡娑堟伅鐘舵�侊細2=宸叉挙閿� + */ String ANNOUNCEMENT_SEND_STATUS_2 = "2"; - /**ONLINE 鎶ヨ〃鏉冮檺鐢� 浠巖equest涓幏鍙栧湴鍧�鏍忓悗鐨勫弬鏁�*/ - String ONL_REP_URL_PARAM_STR="onlRepUrlParamStr"; + /** + * ONLINE 鎶ヨ〃鏉冮檺鐢� 浠巖equest涓幏鍙栧湴鍧�鏍忓悗鐨勫弬鏁� + */ + String ONL_REP_URL_PARAM_STR = "onlRepUrlParamStr"; - /**POST璇锋眰*/ + /** + * POST璇锋眰 + */ String HTTP_POST = "POST"; - /**PUT璇锋眰*/ + /** + * PUT璇锋眰 + */ String HTTP_PUT = "PUT"; - /**PATCH璇锋眰*/ + /** + * PATCH璇锋眰 + */ String HTTP_PATCH = "PATCH"; - /**鏈煡鐨�*/ + /** + * 鏈煡鐨� + */ String UNKNOWN = "unknown"; - /**瀛楃涓瞙ttp*/ + /** + * 瀛楃涓瞙ttp + */ String STR_HTTP = "http"; - /**String 绫诲瀷鐨勭┖鍊�*/ + /** + * String 绫诲瀷鐨勭┖鍊� + */ String STRING_NULL = "null"; - /**鍓嶇vue3鐗堟湰Header鍙傛暟鍚�*/ - String VERSION="X-Version"; + /** + * 鍓嶇vue3鐗堟湰Header鍙傛暟鍚� + */ + String VERSION = "X-Version"; - /**瀛樺偍鍦ㄧ嚎绋嬪彉閲忛噷鐨勫姩鎬佽〃鍚�*/ - String DYNAMIC_TABLE_NAME="DYNAMIC_TABLE_NAME"; + /** + * 瀛樺偍鍦ㄧ嚎绋嬪彉閲忛噷鐨勫姩鎬佽〃鍚� + */ + String DYNAMIC_TABLE_NAME = "DYNAMIC_TABLE_NAME"; /** * http:// http鍗忚 */ @@ -396,10 +468,14 @@ * https:// https鍗忚 */ String HTTPS_PROTOCOL = "https://"; - - /** 閮ㄩ棬琛ㄥ敮涓�key锛宨d */ + + /** + * 閮ㄩ棬琛ㄥ敮涓�key锛宨d + */ String DEPART_KEY_ID = "id"; - /** 閮ㄩ棬琛ㄥ敮涓�key锛宱rgCode */ + /** + * 閮ㄩ棬琛ㄥ敮涓�key锛宱rgCode + */ String DEPART_KEY_ORG_CODE = "orgCode"; /** @@ -432,7 +508,9 @@ */ String DATA_LOG_TYPE_JSON = "json"; - /** 娑堟伅妯℃澘锛歮arkdown */ + /** + * 娑堟伅妯℃澘锛歮arkdown + */ String MSG_TEMPLATE_TYPE_MD = "5"; /** @@ -440,4 +518,9 @@ */ String PHONE_REDIS_KEY_PRE = "phone_msg"; + /** + * 瀹氭椂浠诲姟澶辫触鎺ユ敹瑙掕壊瀛楀吀缂栧彿 + */ + String JOB_SEND_MSG = "job_fail_send_msg_role"; + } diff --git a/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java b/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java index 92e962e..87c7bf5 100644 --- a/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java +++ b/lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java @@ -76,7 +76,31 @@ .build() .securitySchemes(Collections.singletonList(securityScheme())) .securityContexts(securityContexts()) - .globalOperationParameters(setHeaderToken()); + .globalOperationParameters(setHeaderToken()) + .groupName("default"); + } + + /** + * swagger2鐨勯厤缃枃浠讹紝杩欓噷鍙互閰嶇疆swagger2鐨勪竴浜涘熀鏈殑鍐呭锛屾瘮濡傛壂鎻忕殑鍖呯瓑绛� 锛圡DC锛� + * + * @return Docket + */ + @Bean(value = "defaultApi") + public Docket defaultApi() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + //姝ゅ寘璺緞涓嬬殑绫伙紝鎵嶇敓鎴愭帴鍙f枃妗� + .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.mdc")) + //鍔犱簡ApiOperation娉ㄨВ鐨勭被锛屾墠鐢熸垚鎺ュ彛鏂囨。 + .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .paths(PathSelectors.any()) + .build() + .securitySchemes(Collections.singletonList(securityScheme())) + .securityContexts(securityContexts()) + .globalOperationParameters(setHeaderToken()) + .groupName("MDC"); } /*** diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentDisposalController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentDisposalController.java index 52707d0..7a08329 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentDisposalController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentDisposalController.java @@ -1,38 +1,5 @@ package org.jeecg.modules.eam.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.commons.lang3.StringUtils; -import org.apache.shiro.SecurityUtils; -import org.jeecg.common.api.vo.Result; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.eam.entity.EquipmentDisposal; -import org.jeecg.modules.eam.entity.EquipmentDisposalDetail; -import org.jeecg.modules.eam.service.IEamEquipmentService; -import org.jeecg.modules.eam.service.IEquipmentDisposalDetailService; -import org.jeecg.modules.eam.service.IEquipmentDisposalService; -import org.jeecg.modules.eam.vo.EquipmentDisposalPage; -import org.jeecgframework.poi.excel.ExcelImportUtil; -import org.jeecgframework.poi.excel.def.NormalExcelConstants; -import org.jeecgframework.poi.excel.entity.ExportParams; -import org.jeecgframework.poi.excel.entity.ImportParams; -import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -40,6 +7,40 @@ import java.util.Map; import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.jeecg.modules.eam.service.IEamEquipmentService; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.vo.LoginUser; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.eam.entity.EquipmentDisposalDetail; +import org.jeecg.modules.eam.entity.EquipmentDisposal; +import org.jeecg.modules.eam.vo.EquipmentDisposalPage; +import org.jeecg.modules.eam.service.IEquipmentDisposalService; +import org.jeecg.modules.eam.service.IEquipmentDisposalDetailService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + /** * @Description: 璁惧澶勭疆 * @Author: jeecg-boot diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentScrapController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentScrapController.java index f974d55..177f795 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentScrapController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentScrapController.java @@ -13,7 +13,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; -import org.jeecg.modules.eam.entity.EquipmentSeal; +import org.jeecg.modules.eam.entity.*; +import org.jeecg.modules.eam.service.IEamEquipmentService; import org.jeecg.modules.eam.vo.EquipmentDisposalPage; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; @@ -25,8 +26,6 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.eam.entity.EquipmentScrapDetail; -import org.jeecg.modules.eam.entity.EquipmentScrap; import org.jeecg.modules.eam.vo.EquipmentScrapPage; import org.jeecg.modules.eam.service.IEquipmentScrapService; import org.jeecg.modules.eam.service.IEquipmentScrapDetailService; @@ -60,6 +59,8 @@ private IEquipmentScrapService equipmentScrapService; @Autowired private IEquipmentScrapDetailService equipmentScrapDetailService; + @Autowired + private IEamEquipmentService equipmentService; /** * 鍒嗛〉鍒楄〃鏌ヨ @@ -421,6 +422,15 @@ @PostMapping(value = "/approve") public Result<String> approve(@RequestBody EquipmentScrap equipmentScrap) { equipmentScrapService.updateById(equipmentScrap); + //瀹℃壒閫氳繃鍚庢洿鏂拌澶囩姸鎬� + if("Approved".equals(equipmentScrap.getAuditStatus())){ + List<EquipmentScrapDetail> equipmentSealDetailList = equipmentScrapDetailService.selectByMainId(equipmentScrap.getId()); + for(EquipmentScrapDetail equipmentScrapDetail : equipmentSealDetailList){ + Equipment equipment = equipmentService.getById(equipmentScrapDetail.getEquipmentId()); + equipment.setEquipmentStatus("3"); + equipmentService.updateById(equipment); + } + } return Result.OK("鎿嶄綔鎴愬姛锛�"); } } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentSealController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentSealController.java index 7027fb4..1cc0bc2 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentSealController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentSealController.java @@ -8,6 +8,8 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.eam.entity.Equipment; +import org.jeecg.modules.eam.service.IEamEquipmentService; import org.jeecg.modules.eam.vo.EquipmentDisposalPage; import org.jeecg.modules.eam.vo.EquipmentSealPage; //import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; @@ -64,6 +66,9 @@ @Autowired private IEquipmentSealDetailService equipmentSealDetailService; + + @Autowired + private IEamEquipmentService equipmentService; // @Autowired // private IFlowMyBusinessService flowMyBusinessService; @@ -520,6 +525,15 @@ @PostMapping(value = "/approve") public Result<String> approve(@RequestBody EquipmentSeal equipmentSeal) { equipmentSealService.updateById(equipmentSeal); + //瀹℃壒閫氳繃鍚庢洿鏂拌澶囩姸鎬� + if("Approved".equals(equipmentSeal.getAuditStatus())){ + List<EquipmentSealDetail> equipmentSealDetailList = equipmentSealDetailService.selectByMainId(equipmentSeal.getId()); + for(EquipmentSealDetail equipmentSealDetail : equipmentSealDetailList){ + Equipment equipment = equipmentService.getById(equipmentSealDetail.getEquipmentId()); + equipment.setEquipmentStatus("2"); + equipmentService.updateById(equipment); + } + } return Result.OK("鎿嶄綔鎴愬姛锛�"); } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentUnsealController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentUnsealController.java index 77d76e5..8eeb992 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentUnsealController.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentUnsealController.java @@ -1,12 +1,17 @@ package org.jeecg.modules.eam.controller; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; +import java.io.UnsupportedEncodingException; +import java.io.IOException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; @@ -14,12 +19,8 @@ import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; -import org.jeecg.modules.eam.entity.Equipment; -import org.jeecg.modules.eam.entity.EquipmentUnseal; import org.jeecg.modules.eam.entity.EquipmentUnsealDetail; -import org.jeecg.modules.eam.service.IEamEquipmentService; -import org.jeecg.modules.eam.service.IEquipmentUnsealDetailService; -import org.jeecg.modules.eam.service.IEquipmentUnsealService; +import org.jeecg.modules.eam.entity.EquipmentUnseal; import org.jeecg.modules.eam.vo.EquipmentUnsealPage; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; @@ -93,7 +94,7 @@ IPage<EquipmentUnseal> pageList = equipmentUnsealService.page(page, queryWrapper); return Result.OK(pageList); } - + /** * 娣诲姞 * @@ -110,7 +111,7 @@ equipmentUnsealService.saveMain(equipmentUnseal, equipmentUnsealPage.getEquipmentUnsealDetailList()); return Result.OK("娣诲姞鎴愬姛锛�"); } - + /** * 缂栬緫 * @@ -131,7 +132,7 @@ equipmentUnsealService.updateMain(equipmentUnseal, equipmentUnsealPage.getEquipmentUnsealDetailList()); return Result.OK("缂栬緫鎴愬姛!"); } - + /** * 閫氳繃id鍒犻櫎 * @@ -146,7 +147,7 @@ equipmentUnsealService.delMain(id); return Result.OK("鍒犻櫎鎴愬姛!"); } - + /** * 鎵归噺鍒犻櫎 * @@ -161,7 +162,7 @@ this.equipmentUnsealService.delBatchMain(Arrays.asList(ids.split(","))); return Result.OK("鎵归噺鍒犻櫎鎴愬姛锛�"); } - + /** * 閫氳繃id鏌ヨ * @@ -179,7 +180,7 @@ return Result.OK(equipmentUnseal); } - + /** * 閫氳繃id鏌ヨ * diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcAlarmInfoController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcAlarmInfoController.java new file mode 100644 index 0000000..7680d69 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcAlarmInfoController.java @@ -0,0 +1,154 @@ +package org.jeecg.modules.mdc.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.mdc.entity.MdcAlarmInfo; +import org.jeecg.modules.mdc.service.IMdcAlarmInfoService; +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; + +/** + * @Description: 鎶ヨ鍙风鐞� + * @Author: Lius + * @Date: 2023-09-05 + * @Version: V1.0 + */ +@Slf4j +@Api(tags = "鎶ヨ鍙风鐞�") +@RestController +@RequestMapping("/mdc/mdcAlarmInfo") +public class MdcAlarmInfoController extends JeecgController<MdcAlarmInfo, IMdcAlarmInfoService> { + + @Resource + private IMdcAlarmInfoService mdcAlarmInfoService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param mdcAlarmInfo + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "鎶ヨ鍙风鐞�-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "鎶ヨ鍙风鐞�-鍒嗛〉鍒楄〃鏌ヨ", notes = "鎶ヨ鍙风鐞�-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(MdcAlarmInfo mdcAlarmInfo, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<MdcAlarmInfo> queryWrapper = QueryGenerator.initQueryWrapper(mdcAlarmInfo, req.getParameterMap()); + Page<MdcAlarmInfo> page = new Page<MdcAlarmInfo>(pageNo, pageSize); + IPage<MdcAlarmInfo> pageList = mdcAlarmInfoService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param mdcAlarmInfo + * @return + */ + @AutoLog(value = "鎶ヨ鍙风鐞�-娣诲姞") + @ApiOperation(value = "鎶ヨ鍙风鐞�-娣诲姞", notes = "鎶ヨ鍙风鐞�-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody MdcAlarmInfo mdcAlarmInfo) { + mdcAlarmInfoService.save(mdcAlarmInfo); + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param mdcAlarmInfo + * @return + */ + @AutoLog(value = "鎶ヨ鍙风鐞�-缂栬緫") + @ApiOperation(value = "鎶ヨ鍙风鐞�-缂栬緫", notes = "鎶ヨ鍙风鐞�-缂栬緫") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> edit(@RequestBody MdcAlarmInfo mdcAlarmInfo) { + mdcAlarmInfoService.updateById(mdcAlarmInfo); + 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) { + mdcAlarmInfoService.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.mdcAlarmInfoService.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) { + MdcAlarmInfo mdcAlarmInfo = mdcAlarmInfoService.getById(id); + return Result.OK(mdcAlarmInfo); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param mdcAlarmInfo + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MdcAlarmInfo mdcAlarmInfo) { + return super.exportXls(request, mdcAlarmInfo, MdcAlarmInfo.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, MdcAlarmInfo.class); + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDeviceCalendarController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDeviceCalendarController.java index b3f55be..f0d7903 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDeviceCalendarController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDeviceCalendarController.java @@ -1,8 +1,10 @@ package org.jeecg.modules.mdc.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.apache.shiro.SecurityUtils; @@ -11,7 +13,10 @@ import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.entity.MdcDeviceCalendar; +import org.jeecg.modules.mdc.entity.MdcSystemParameters; import org.jeecg.modules.mdc.service.IMdcDeviceCalendarService; +import org.jeecg.modules.mdc.service.IMdcSystemParametersService; +import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.EquipmentCalendarVo; import org.jeecg.modules.mdc.vo.MdcDeviceCalendarQueryVo; import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; @@ -22,6 +27,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; +import java.util.Date; /** * @Description: 璁惧宸ヤ綔鏃ュ巻琛� @@ -37,6 +43,8 @@ @Resource private IMdcDeviceCalendarService mdcDeviceCalendarService; + @Resource + private IMdcSystemParametersService mdcSystemParametersService; /** * 鍒嗛〉鍒楄〃鏌ヨ @@ -70,13 +78,13 @@ @ApiOperation(value = "璁惧宸ヤ綔鏃ュ巻琛�-閰嶇疆", notes = "璁惧宸ヤ綔鏃ュ巻琛�-閰嶇疆") @PostMapping(value = "/add") public Result add(@RequestBody EquipmentCalendarVo calendarVo) { - if (StringUtils.isBlank(calendarVo.getEquipmentId())) { - return Result.error("鏈�夋嫨璁惧"); + if (StringUtils.isBlank(calendarVo.getEquipmentId()) || calendarVo.getDateList().isEmpty() || StringUtils.isBlank(calendarVo.getShiftId())) { + return Result.error("璇烽�夋嫨鏈夋晥鍙傛暟锛�"); } boolean result = mdcDeviceCalendarService.saveCalendar(calendarVo); - if(result){ + if (result) { return Result.OK("淇濆瓨鎴愬姛"); - }else{ + } else { return Result.error("鏈�夋嫨鐝锛�"); } } @@ -105,8 +113,30 @@ @ApiOperation(value = "璁惧宸ヤ綔鏃ュ巻琛�-閫氳繃id鍒犻櫎", notes = "璁惧宸ヤ綔鏃ュ巻琛�-閫氳繃id鍒犻櫎") @DeleteMapping(value = "/delete") public Result<?> delete(@RequestParam(name = "id", required = true) String id) { - mdcDeviceCalendarService.removeById(id); - return Result.OK("鍒犻櫎鎴愬姛!"); + Date date = new Date(); + MdcDeviceCalendar mdcDeviceCalendar = mdcDeviceCalendarService.getById(id); + String todayDay = DateUtils.format(date, DateUtils.STRDATE); + String effectiveDate = mdcDeviceCalendar.getEffectiveDate(); + MdcSystemParameters mdcSystemParameters = mdcSystemParametersService.getOne(new LambdaQueryWrapper<MdcSystemParameters>().eq(MdcSystemParameters::getCode, "equip_log_statis_time")); + if (mdcSystemParameters != null) { + String time = mdcSystemParameters.getValue(); + Date keyDate = DateUtils.setTimeForDay(date, time); + // 20230920 20230910 20230922 + if (Integer.parseInt(todayDay) <= Integer.parseInt(effectiveDate)) { + mdcDeviceCalendarService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } else if ((Integer.parseInt(todayDay) - Integer.parseInt(effectiveDate)) == 1 && keyDate.after(date)) { + mdcDeviceCalendarService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } + } else { + if (Integer.parseInt(todayDay) > Integer.parseInt(effectiveDate)) { + return Result.error("鍒犻櫎澶辫触!姝ら厤缃凡浣滀负璁惧鍩虹鏁版嵁璁$畻鏁堢巼锛�"); + } + mdcDeviceCalendarService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } + return Result.error("鍒犻櫎澶辫触!姝ら厤缃凡浣滀负璁惧鍩虹鏁版嵁璁$畻鏁堢巼锛�"); } /** diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java index c740de6..984bb08 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java @@ -11,6 +11,7 @@ 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.dto.OptionsDto; import org.jeecg.modules.mdc.entity.MdcDriveTypeParamConfig; import org.jeecg.modules.mdc.service.IMdcDriveTypeParamConfigService; import org.springframework.web.bind.annotation.*; @@ -160,4 +161,12 @@ return Result.OK(list); } + @AutoLog(value = "椹卞姩鍙傛暟閰嶇疆-鑾峰彇鎺у埗绯荤粺绫诲瀷涓嬫媺妗嗛�夐」") + @ApiOperation(value = "椹卞姩鍙傛暟閰嶇疆-鑾峰彇鎺у埗绯荤粺绫诲瀷涓嬫媺妗嗛�夐」", notes = "椹卞姩鍙傛暟閰嶇疆-鑾峰彇鎺у埗绯荤粺绫诲瀷涓嬫媺妗嗛�夐」") + @GetMapping(value = "/getDriveParamOptions") + public Result<List<OptionsDto>> getDriveParamOptions() { + List<OptionsDto> result = mdcDriveTypeParamConfigService.getDriveParamOptions(); + return Result.OK(result); + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java index b597903..96ef9b8 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java @@ -7,6 +7,8 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.mdc.dto.ComparativeAnalysisDto; +import org.jeecg.modules.mdc.dto.DayUtilizationRateDto; import org.jeecg.modules.mdc.service.MdcEfficiencyReportService; import org.jeecg.modules.mdc.vo.*; import org.springframework.web.bind.annotation.GetMapping; @@ -68,4 +70,54 @@ return Result.OK(result); } + @AutoLog(value = "璁惧鏁堢巼鎶ヨ〃-瀵规瘮鍒嗘瀽") + @ApiOperation(value = "璁惧鏁堢巼鎶ヨ〃-瀵规瘮鍒嗘瀽", notes = "璁惧鏁堢巼鎶ヨ〃-瀵规瘮鍒嗘瀽") + @GetMapping("/comparativeAnalysis") + public Result comparativeAnalysis(ComparativeAnalysisQueryVo vo) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + ComparativeAnalysisDto result = mdcEfficiencyReportService.comparativeAnalysis(userId, vo); + return Result.OK(result); + } + + @AutoLog(value = "璁惧鏁堢巼鎶ヨ〃-璁惧鏃ュ埄鐢ㄧ巼") + @ApiOperation(value = "璁惧鏁堢巼鎶ヨ〃-璁惧鏃ュ埄鐢ㄧ巼", notes = "璁惧鏁堢巼鎶ヨ〃-璁惧鏃ュ埄鐢ㄧ巼") + @GetMapping("/dayUtilizationRate") + public Result dayUtilizationRate(DayUtilizationRateQueryVo vo) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + DayUtilizationRateDto result = mdcEfficiencyReportService.dayUtilizationRate(userId, vo); + return Result.OK(result); + } + + @AutoLog(value = "璁惧鏁堢巼鎶ヨ〃-璁惧鏃ュ埄鐢ㄧ巼瀵规瘮") + @ApiOperation(value = "璁惧鏁堢巼鎶ヨ〃-璁惧鏃ュ埄鐢ㄧ巼瀵规瘮", notes = "璁惧鏁堢巼鎶ヨ〃-璁惧鏃ュ埄鐢ㄧ巼瀵规瘮") + @GetMapping("/dayUtilizationRateContrast") + public Result dayUtilizationRateContrast(DayUtilizationRateContrastQueryVo vo) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + DayUtilizationRateDto result = mdcEfficiencyReportService.dayUtilizationRateContrast(userId, vo); + return Result.OK(result); + } + + @AutoLog(value = "璁惧鏁堢巼鎶ヨ〃-鍒╃敤鐜囪蛋鍔垮垎鏋愬垪琛�") + @ApiOperation(value = "璁惧鏁堢巼鎶ヨ〃-鍒╃敤鐜囪蛋鍔垮垎鏋愬垪琛�", notes = "璁惧鏁堢巼鎶ヨ〃-鍒╃敤鐜囪蛋鍔垮垎鏋愬垪琛�") + @GetMapping("/utilizationRateTrendAnalyze") + public Result utilizationRateTrendAnalyze(DayUtilizationRateContrastQueryVo vo) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + MdcUtilizationRateDto result = mdcEfficiencyReportService.utilizationRateTrendAnalyze(userId, vo); + return Result.OK(result); + } + + @AutoLog(value = "璁惧鏁堢巼鎶ヨ〃-鍒╃敤鐜囧垎娈靛垎鏋愬垪琛�") + @ApiOperation(value = "璁惧鏁堢巼鎶ヨ〃-鍒╃敤鐜囧垎娈靛垎鏋愬垪琛�", notes = "璁惧鏁堢巼鎶ヨ〃-鍒╃敤鐜囧垎娈靛垎鏋愬垪琛�") + @GetMapping("/utilizationRateSectionAnalyze") + public Result utilizationRateSectionAnalyze(DayUtilizationRateContrastQueryVo vo) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + MdcUtilizationRateDto result = mdcEfficiencyReportService.utilizationRateSectionAnalyze(userId, vo); + return Result.OK(result); + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentAlarmAnalyzeController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentAlarmAnalyzeController.java new file mode 100644 index 0000000..e18ce6f --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentAlarmAnalyzeController.java @@ -0,0 +1,54 @@ +package org.jeecg.modules.mdc.controller; + +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.system.vo.LoginUser; +import org.jeecg.modules.mdc.dto.MdcAlarmAnalyzeDto; +import org.jeecg.modules.mdc.dto.MdcAlarmTrendDto; +import org.jeecg.modules.mdc.service.MdcEquipmentAlarmAnalyzeService; +import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; +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 + * @create: 2023-09-06 17:15 + */ +@Slf4j +@Api(tags = "鎶ヨ鍒嗘瀽") +@RestController +@RequestMapping("/mdc/alarmAnalyze") +public class MdcEquipmentAlarmAnalyzeController { + + @Resource + private MdcEquipmentAlarmAnalyzeService mdcEquipmentAlarmAnalyzeService; + + @AutoLog(value = "鎶ヨ鍒嗘瀽-鍒楄〃鏌ヨ") + @ApiOperation(value = "鎶ヨ鍒嗘瀽-鍒楄〃鏌ヨ", notes = "鎶ヨ鍒嗘瀽-鍒楄〃鏌ヨ") + @GetMapping("/alarmList") + public Result alarmList(MdcAlarmAnalyzeQueryVo vo) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + List<MdcAlarmAnalyzeDto> result = mdcEquipmentAlarmAnalyzeService.alarmList(userId, vo); + return Result.OK(result); + } + + @AutoLog(value = "鎶ヨ鍒嗘瀽-璧板娍鏌ヨ") + @ApiOperation(value = "鎶ヨ鍒嗘瀽-璧板娍鏌ヨ", notes = "鎶ヨ鍒嗘瀽-璧板娍鏌ヨ") + @GetMapping("/alarmTrend") + public Result alarmTrend(MdcAlarmAnalyzeQueryVo vo) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + MdcAlarmTrendDto result = mdcEquipmentAlarmAnalyzeService.alarmTrend(userId, vo); + return Result.OK(result); + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java index 36a2173..b3bcf11 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java @@ -453,4 +453,20 @@ MdcEquipment mdcEquipment = mdcEquipmentService.getEquipmentByPid(pid, userId); return Result.OK(mdcEquipment); } + + /** + * 鏍规嵁閮ㄩ棬灞傜骇鏌ヨ鍗曚釜璁惧 + * + * @param pid + * @return + */ + @AutoLog(value = "璁惧琛�-鏍规嵁閮ㄩ棬灞傜骇鏌ヨ鍗曚釜璁惧") + @ApiOperation(value = "璁惧琛�-鏍规嵁閮ㄩ棬灞傜骇鏌ヨ鍗曚釜璁惧", notes = "璁惧琛�-鏍规嵁閮ㄩ棬灞傜骇鏌ヨ鍗曚釜璁惧") + @GetMapping("/getEquipmentByDepPid") + public Result<MdcEquipment> getEquipmentByDepPid(@RequestParam(name = "pid", required = false) String pid) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + MdcEquipment mdcEquipment = mdcEquipmentService.getEquipmentByDepPid(pid, userId); + return Result.OK(mdcEquipment); + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java new file mode 100644 index 0000000..15326dc --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java @@ -0,0 +1,159 @@ +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.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; +import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService; +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: 2023-08-25 + * @Version: V1.0 + */ +@Slf4j +@Api(tags = "璁惧鍔犵彮绠$悊") +@RestController +@RequestMapping("/mdc/mdcEquipmentOvertime") +public class MdcEquipmentOvertimeController extends JeecgController<MdcEquipmentOvertime, IMdcEquipmentOvertimeService> { + + @Resource + private IMdcEquipmentOvertimeService mdcEquipmentOvertimeService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param mdcEquipmentOvertime + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "璁惧鍔犵彮绠$悊-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "璁惧鍔犵彮绠$悊-鍒嗛〉鍒楄〃鏌ヨ", notes = "璁惧鍔犵彮绠$悊-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(MdcEquipmentOvertime mdcEquipmentOvertime, + @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<MdcEquipmentOvertime> page = new Page<MdcEquipmentOvertime>(pageNo, pageSize); + IPage<MdcEquipmentOvertime> pageList = mdcEquipmentOvertimeService.pageList(userId, page, mdcEquipmentOvertime, req); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param mdcEquipmentOvertime + * @return + */ + @AutoLog(value = "璁惧鍔犵彮绠$悊-娣诲姞") + @ApiOperation(value = "璁惧鍔犵彮绠$悊-娣诲姞", notes = "璁惧鍔犵彮绠$悊-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody MdcEquipmentOvertime mdcEquipmentOvertime) { + mdcEquipmentOvertimeService.save(mdcEquipmentOvertime); + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param mdcEquipmentOvertime + * @return + */ + @AutoLog(value = "璁惧鍔犵彮绠$悊-缂栬緫") + @ApiOperation(value = "璁惧鍔犵彮绠$悊-缂栬緫", notes = "璁惧鍔犵彮绠$悊-缂栬緫") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> edit(@RequestBody MdcEquipmentOvertime mdcEquipmentOvertime) { + mdcEquipmentOvertimeService.updateById(mdcEquipmentOvertime); + 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) { + mdcEquipmentOvertimeService.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.mdcEquipmentOvertimeService.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) { + MdcEquipmentOvertime mdcEquipmentOvertime = mdcEquipmentOvertimeService.getById(id); + return Result.OK(mdcEquipmentOvertime); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param mdcEquipmentOvertime + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentOvertime mdcEquipmentOvertime) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + return mdcEquipmentOvertimeService.exportXls(userId, mdcEquipmentOvertime); + } + + /** + * 閫氳繃excel瀵煎叆鏁版嵁 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, MdcEquipmentOvertime.class); + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentRepairController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentRepairController.java index 1322366..d824faf 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentRepairController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentRepairController.java @@ -1,5 +1,6 @@ package org.jeecg.modules.mdc.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -11,17 +12,18 @@ import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.modules.mdc.entity.MdcDriveTypeParamConfig; import org.jeecg.modules.mdc.entity.MdcEquipmentRepair; +import org.jeecg.modules.mdc.entity.MdcSystemParameters; import org.jeecg.modules.mdc.service.IMdcEquipmentRepairService; +import org.jeecg.modules.mdc.service.IMdcSystemParametersService; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.MdcEquipmentRepairVo; -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 java.util.Date; /** * @Description: 璁惧缁翠慨浼戠彮 @@ -34,8 +36,10 @@ @RequestMapping("/mdc/mdcEquipmentRepair") public class MdcEquipmentRepairController extends JeecgController<MdcEquipmentRepair, IMdcEquipmentRepairService> { - @Autowired + @Resource private IMdcEquipmentRepairService mdcEquipmentRepairService; + @Resource + private IMdcSystemParametersService mdcSystemParametersService; /** * 璁惧缁翠慨浼戠彮-鏂板 @@ -49,9 +53,27 @@ if (StringUtils.isBlank(repairVo.getEquipmentIds())) { return Result.error("鏈�夋嫨璁惧锛岃鎺掓煡锛�"); } - boolean result = mdcEquipmentRepairService.addMdcRepair(repairVo); + boolean result = false; + Date date = new Date(); + String todayDay = DateUtils.format(date, DateUtils.STRDATE); + String startTime = DateUtils.format(DateUtils.getFormatDate(repairVo.getStartTime(), DateUtils.STR_DATE_TIME_SMALL), DateUtils.STRDATE); + MdcSystemParameters mdcSystemParameters = mdcSystemParametersService.getOne(new LambdaQueryWrapper<MdcSystemParameters>().eq(MdcSystemParameters::getCode, "equip_log_statis_time")); + if (mdcSystemParameters != null) { + String time = mdcSystemParameters.getValue(); + Date keyDate = DateUtils.setTimeForDay(date, time); + if (Integer.parseInt(todayDay) <= Integer.parseInt(startTime)) { + result = mdcEquipmentRepairService.addMdcRepair(repairVo); + } else if ((Integer.parseInt(todayDay) - Integer.parseInt(startTime)) == 1 && keyDate.after(date)) { + result = mdcEquipmentRepairService.addMdcRepair(repairVo); + } + } else { + if (Integer.parseInt(todayDay) > Integer.parseInt(startTime)) { + return Result.error("鏂板澶辫触!"); + } + result = mdcEquipmentRepairService.addMdcRepair(repairVo); + } if (!result) { - return Result.error("鏃堕棿娈垫暟鎹凡缁忓瓨鍦紝璇锋帓鏌ワ紒"); + return Result.error("鏂板澶辫触锛�"); } return Result.OK("鏂板鎴愬姛"); } @@ -97,7 +119,25 @@ return Result.error("淇敼澶辫触锛佸師绾綍寮�濮嬫椂闂村皬浜庡綋鍓嶆椂闂达紒"); } } - boolean result = mdcEquipmentRepairService.updateMdcRepair(repair); + boolean result = false; + Date date = new Date(); + String todayDay = DateUtils.format(date, DateUtils.STRDATE); + String startTime = DateUtils.format(repair.getStartTime(), DateUtils.STRDATE); + MdcSystemParameters mdcSystemParameters = mdcSystemParametersService.getOne(new LambdaQueryWrapper<MdcSystemParameters>().eq(MdcSystemParameters::getCode, "equip_log_statis_time")); + if (mdcSystemParameters != null) { + String time = mdcSystemParameters.getValue(); + Date keyDate = DateUtils.setTimeForDay(date, time); + if (Integer.parseInt(todayDay) <= Integer.parseInt(startTime)) { + result = mdcEquipmentRepairService.updateMdcRepair(repair); + } else if ((Integer.parseInt(todayDay) - Integer.parseInt(startTime)) == 1 && keyDate.after(date)) { + result = mdcEquipmentRepairService.updateMdcRepair(repair); + } + } else { + if (Integer.parseInt(todayDay) > Integer.parseInt(startTime)) { + return Result.error("鍒犻櫎澶辫触!姝ら厤缃凡浣滀负璁惧鍩虹鏁版嵁璁$畻鏁堢巼锛�"); + } + result = mdcEquipmentRepairService.updateMdcRepair(repair); + } if (!result) { return Result.error("鏃堕棿娈垫暟鎹凡缁忓瓨鍦紝璇锋帓鏌ワ紒"); } @@ -115,19 +155,30 @@ @DeleteMapping(value = "/delete") public Result<?> delete(@RequestParam(name = "id", required = true) String id) { boolean b = false; + Date date = new Date(); MdcEquipmentRepair mdcEquipmentRepair = mdcEquipmentRepairService.getById(id); - if (mdcEquipmentRepair.getStartTime().before(DateUtils.getTodayZero(DateUtils.getNow()))) { - //璁板綍寮�濮嬫椂闂村湪浠婂ぉ涔嬪墠 - return Result.error("鍒犻櫎澶辫触!褰撳墠璁板綍宸茶绠楃粺璁℃暟鎹紒"); + String todayDay = DateUtils.format(date, DateUtils.STRDATE); + String startTime = DateUtils.format(mdcEquipmentRepair.getStartTime(), DateUtils.STRDATE); + MdcSystemParameters mdcSystemParameters = mdcSystemParametersService.getOne(new LambdaQueryWrapper<MdcSystemParameters>().eq(MdcSystemParameters::getCode, "equip_log_statis_time")); + if (mdcSystemParameters != null) { + String time = mdcSystemParameters.getValue(); + Date keyDate = DateUtils.setTimeForDay(date, time); + // 20230920 20230910 20230922 + if (Integer.parseInt(todayDay) <= Integer.parseInt(startTime)) { + mdcEquipmentRepairService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } else if ((Integer.parseInt(todayDay) - Integer.parseInt(startTime)) == 1 && keyDate.after(date)) { + mdcEquipmentRepairService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } } else { - //姝e父鍒犻櫎 - b = mdcEquipmentRepairService.removeById(id); - } - if (b) { + if (Integer.parseInt(todayDay) > Integer.parseInt(startTime)) { + return Result.error("鍒犻櫎澶辫触!姝ら厤缃凡浣滀负璁惧鍩虹鏁版嵁璁$畻鏁堢巼锛�"); + } + mdcEquipmentRepairService.removeById(id); return Result.OK("鍒犻櫎鎴愬姛!"); - } else { - return Result.error("鍒犻櫎澶辫触"); } + return Result.error("鍒犻櫎澶辫触!姝ら厤缃凡浣滀负璁惧鍩虹鏁版嵁璁$畻鏁堢巼锛�"); } /** diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPassRateController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPassRateController.java index 06775cc..fc17afb 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPassRateController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPassRateController.java @@ -1,6 +1,10 @@ package org.jeecg.modules.mdc.controller; +import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; +import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -22,7 +26,11 @@ import org.jeecg.modules.mdc.service.IMdcPassRateService; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.entity.ImportParams; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -160,7 +168,41 @@ */ @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, MdcPassRate.class); + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { + // 鑾峰彇涓婁紶鏂囦欢瀵硅薄 + MultipartFile file = entity.getValue(); + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List<MdcPassRate> list = ExcelImportUtil.importExcel(file.getInputStream(), MdcPassRate.class, params); + for (MdcPassRate passRate : list) { + if (passRate.getProcessQuantity() == null || passRate.getProcessQuantity() == 0) { + passRate.setPassRate(new BigDecimal("0")); + } else { + if (passRate.getUnqualifiedQuantity() == null || passRate.getUnqualifiedQuantity() == 0) { + passRate.setPassRate(new BigDecimal("1")); + } else { + passRate.setPassRate(new BigDecimal("1").subtract(new BigDecimal(passRate.getUnqualifiedQuantity()).divide(new BigDecimal(passRate.getProcessQuantity()), 4, BigDecimal.ROUND_HALF_UP))); + } + } + } + mdcPassRateService.saveBatch(list); + } catch (Exception e) { + log.error(e.getMessage(), e); + return Result.error("鏂囦欢瀵煎叆澶辫触锛�" + e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + return Result.error("鏂囦欢瀵煎叆澶辫触锛�"); } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcShiftController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcShiftController.java index 5c02507..c41f551 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcShiftController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcShiftController.java @@ -35,6 +35,7 @@ /** * 鐝埗琛�(涓昏〃)-鍒嗛〉鏌ヨ + * * @param mdcShift * @param pageNo * @param pageSize @@ -45,7 +46,7 @@ @GetMapping("/queryPageList") public Result<?> queryPageList(MdcShift mdcShift, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize){ + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { Page page = new Page(pageNo, pageSize); IPage<MdcShift> mdcShiftIPage = mdcShiftService.queryPageList(page, mdcShift); return Result.OK(mdcShiftIPage); @@ -53,52 +54,56 @@ /** * 鐝埗琛�(涓昏〃)-鏂板(鐝埗鍚嶉噸澶嶆牎楠�/鐘舵�侀粯璁や负鍚敤) + * * @param mdcShift * @return */ @AutoLog("鐝埗琛�(涓昏〃)-鏂板") @ApiOperation(value = "鐝埗琛�(涓昏〃)-鏂板(鐝埗鍚嶉噸澶嶆牎楠�/鐘舵�侀粯璁や负鍚敤)", notes = "鐝埗琛�(涓昏〃)-鏂板(鐝埗鍚嶉噸澶嶆牎楠�/鐘舵�侀粯璁や负鍚敤)") @PostMapping("/addShift") - public Result<?> addShift(@RequestBody MdcShift mdcShift){ + public Result<?> addShift(@RequestBody MdcShift mdcShift) { Boolean flag = mdcShiftService.addShift(mdcShift); return flag ? Result.OK("鏂板鎴愬姛") : Result.error("鐝埗鍚嶉噸澶�"); } /** * 鐝埗琛�(涓昏〃)-淇敼 + * * @param mdcShift * @return */ @AutoLog("鐝埗琛�(涓昏〃)-淇敼") @ApiOperation(value = "鐝埗琛�(涓昏〃)-淇敼", notes = "鐝埗琛�(涓昏〃)-淇敼") @PutMapping("/editShift") - public Result<?> editShift(@RequestBody MdcShift mdcShift){ + public Result<?> editShift(@RequestBody MdcShift mdcShift) { Boolean flag = mdcShiftService.editShift(mdcShift); return flag ? Result.OK("淇敼鎴愬姛") : Result.error("鏁版嵁搴撴棤璇ユ暟鎹�"); } /** * 鏍规嵁id淇敼 + * * @param * @return */ @AutoLog("鐝埗琛�(涓昏〃)-鏍规嵁id淇敼鐘舵��") @ApiOperation(value = "鐝埗琛�(涓昏〃)-鏍规嵁id淇敼鐘舵��", notes = "鐝埗琛�(涓昏〃)-鏍规嵁id淇敼鐘舵��") @PutMapping("/changeStatus") - public Result<?> changeStatus(@RequestBody JSONObject jsonObject){ + public Result<?> changeStatus(@RequestBody JSONObject jsonObject) { Boolean flag = mdcShiftService.changeStatus(jsonObject); return flag ? Result.OK("淇敼鎴愬姛") : Result.error("鏁版嵁搴撴棤璇ユ暟鎹�"); } /** * 鐝埗琛�(涓昏〃)-鏍规嵁id鍒犻櫎 + * * @param id * @return */ @AutoLog("鐝埗琛�(涓昏〃)-鏍规嵁id鍒犻櫎") @ApiOperation(value = "鐝埗琛�(涓昏〃)-鏍规嵁id鍒犻櫎", notes = "鐝埗琛�(涓昏〃)-鏍规嵁id鍒犻櫎") @DeleteMapping("/deleteShift") - public Result<?> deleteShift(@RequestParam(name = "id", required = true) String id){ + public Result<?> deleteShift(@RequestParam(name = "id", required = true) String id) { return mdcShiftService.deleteShift(id); } @@ -107,9 +112,23 @@ */ @AutoLog("鐝埗琛�(涓昏〃)-鍔犺浇鐝埗涓嬫媺閫夐」") @ApiOperation(value = "鐝埗琛�(涓昏〃)-鍔犺浇鐝埗涓嬫媺閫夐」", notes = "鐝埗琛�(涓昏〃)-鍔犺浇鐝埗涓嬫媺閫夐」") - @GetMapping("/deleteShift") + @GetMapping("/initShiftList") public Result<List<Map<String, String>>> initShiftList() { List<Map<String, String>> result = mdcShiftService.initShiftList(); return Result.OK(result); } + + /** + * 璁剧疆榛樿鐝埗 + * + * @param id + * @return + */ + @AutoLog("鐝埗琛�(涓昏〃)-璁剧疆榛樿鐝埗") + @ApiOperation(value = "鐝埗琛�(涓昏〃)-璁剧疆榛樿鐝埗", notes = "鐝埗琛�(涓昏〃)-璁剧疆榛樿鐝埗") + @PostMapping("/changeDefaultShift") + public Result<?> changeDefaultShift(@RequestParam(name = "id", required = true) String id) { + boolean result = mdcShiftService.changeDefaultShift(id); + return result ? Result.OK("璁剧疆鎴愬姛锛�") : Result.error("璁剧疆澶辫触锛�"); + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcShiftSubController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcShiftSubController.java index f2871ac..1de3bf9 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcShiftSubController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcShiftSubController.java @@ -7,6 +7,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; @@ -15,6 +16,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.List; +import java.util.Map; /** * @Description: 鐝琛�(娆¤〃) @@ -32,6 +35,7 @@ /** * 鐝琛�(娆¤〃)-鍒嗛〉鏌ヨ + * * @param shiftId * @param pageNo * @param pageSize @@ -41,8 +45,8 @@ @ApiOperation(value = "鐝琛�(娆¤〃)-鍒嗛〉鏌ヨ", notes = "鐝琛�(娆¤〃)-鍒嗛〉鏌ヨ") @GetMapping("/queryPageList") public Result<?> queryPageList(@RequestParam String shiftId, - @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize){ + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { Page page = new Page<>(pageNo, pageSize); IPage<MdcShiftSub> mdcShiftSubIPage = mdcShiftSubService.queryPageList(shiftId, page); return Result.OK(mdcShiftSubIPage); @@ -50,58 +54,76 @@ /** * 鐝琛�(娆¤〃)-鏂板 + * * @param mdcShiftSub * @return */ @AutoLog(value = "鐝琛�(娆¤〃)-鏂板") @ApiOperation(value = "鐝琛�(娆¤〃)-鏂板", notes = "鐝琛�(娆¤〃)-鏂板") @PostMapping("/addShiftSub") - public Result<?> addShiftSub(@RequestBody JSONObject jsonbject) { + public Result<?> addShiftSub(@RequestBody MdcShiftSub mdcShiftSub) { //澶勭悊鏄惁瀛樺湪绌哄�� - if (jsonbject.getDate("sleepStartDate") != null || jsonbject.getDate("sleepEndDate") != null ) { - if (jsonbject.getDate("sleepEndDate") == null || jsonbject.getDate("sleepStartDate") == null) { + if (StringUtils.isNotEmpty(mdcShiftSub.getSleepStartDate()) || StringUtils.isNotEmpty(mdcShiftSub.getSleepEndDate())) { + if (StringUtils.isEmpty(mdcShiftSub.getSleepEndDate()) || StringUtils.isEmpty(mdcShiftSub.getSleepStartDate())) { return Result.error("鏂板澶辫触锛屼紤鎭椂闂撮�夋嫨涓嶅"); } } - MdcShiftSub result = mdcShiftSubService.addMdcShiftSub(jsonbject); + MdcShiftSub result = mdcShiftSubService.addMdcShiftSub(mdcShiftSub); return Result.OK(result); } /** * 鐝琛�(娆¤〃)-淇敼 + * * @param mdcShiftSub * @return */ @AutoLog(value = "鐝琛�(娆¤〃)-淇敼") @ApiOperation(value = "鐝琛�(娆¤〃)-淇敼", notes = "鐝琛�(娆¤〃)-淇敼") @PutMapping("/editMdcShiftSub") - public Result<?> editShiftSub(@RequestBody MdcShiftSub mdcShiftSub){ + public Result<?> editShiftSub(@RequestBody MdcShiftSub mdcShiftSub) { Boolean flag = mdcShiftSubService.editMdcShiftSub(mdcShiftSub); return flag ? Result.OK("淇敼鎴愬姛") : Result.error("淇敼澶辫触"); } /** * 鐝琛�(娆¤〃)-鏍规嵁id淇敼瀛愯〃鐘舵�� + * * @param jsonObject * @return */ @AutoLog(value = "鐝琛�(娆¤〃)-鏍规嵁id淇敼瀛愯〃鐘舵��") @ApiOperation(value = "鐝琛�(娆¤〃)-鏍规嵁id淇敼瀛愯〃鐘舵��", notes = "鏍规嵁id淇敼瀛愯〃鐘舵��") @PutMapping("/updateSubStatusById") - public Result<?> updateSubStatusById(@RequestBody JSONObject jsonObject){ + public Result<?> updateSubStatusById(@RequestBody JSONObject jsonObject) { Boolean flag = mdcShiftSubService.updateSubStatusById(jsonObject); return flag ? Result.OK("淇敼鎴愬姛") : Result.error("淇敼澶辫触"); } /** * 鐝琛�(娆¤〃)-鏍规嵁id鍒犻櫎 + * * @param id * @return */ @AutoLog(value = "鐝琛�(娆¤〃)-鏍规嵁id鍒犻櫎") @ApiOperation(value = "鐝琛�(娆¤〃)-鏍规嵁id鍒犻櫎", notes = "鐝琛�(娆¤〃)-鏍规嵁id鍒犻櫎") @DeleteMapping("/deleteMdcShiftSub") - public Result<?> deleteMdcShiftSub(@RequestParam String id){ + public Result<?> deleteMdcShiftSub(@RequestParam String id) { return mdcShiftSubService.deleteMdcShiftSub(id); } + + /** + * 鐝琛�(娆¤〃)-鏍规嵁id鍒犻櫎 + * + * @param shiftId + * @return + */ + @AutoLog(value = "鐝琛�(娆¤〃)-鏍规嵁鐝埗id鑾峰彇鐝涓嬫媺鍒楄〃") + @ApiOperation(value = "鐝琛�(娆¤〃)-鏍规嵁鐝埗id鑾峰彇鐝涓嬫媺鍒楄〃", notes = "鐝琛�(娆¤〃)-鏍规嵁鐝埗id鑾峰彇鐝涓嬫媺鍒楄〃") + @GetMapping("/initShiftSubList") + public Result<?> initShiftSubList(@RequestParam(name = "shiftId", required = true) String shiftId) { + List<Map<String, String>> result = mdcShiftSubService.initShiftSubList(shiftId); + return Result.OK(result); + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcVacationManagementController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcVacationManagementController.java index 495ae4d..46f902d 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcVacationManagementController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcVacationManagementController.java @@ -115,9 +115,13 @@ * @param mdcVacationManagement * @return */ + @AutoLog(value = "鍋囨湡绠$悊-瀵煎嚭excel") + @ApiOperation(value = "鍋囨湡绠$悊-瀵煎嚭excel",notes = "鍋囨湡绠$悊-瀵煎嚭excel") @RequestMapping("/exportXls") public ModelAndView exportXls(HttpServletRequest request, MdcVacationManagement mdcVacationManagement) { - return super.exportXls(request, mdcVacationManagement, MdcVacationManagement.class, "鍋囨湡绠$悊瀵煎嚭"); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + return mdcVacationManagementService.exportXls(userId, mdcVacationManagement); } /** diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/ComparativeAnalysisDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/ComparativeAnalysisDto.java new file mode 100644 index 0000000..5317e7d --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/ComparativeAnalysisDto.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.mdc.dto; + +import javafx.scene.chart.PieChart; +import lombok.Data; + +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-07-31 10:06 + */ +@Data +public class ComparativeAnalysisDto { + + /** + * 鍥惧舰椤甸潰鏁版嵁 + */ + private List<GraphicsDto> graphics; + /** + * 浠〃椤甸潰鏁版嵁 + */ + private MeterDto meters; + /** + * 楗煎浘椤甸潰鏁版嵁 + */ + private PieChartDto pieCharts; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/DayUtilizationRateDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/DayUtilizationRateDto.java new file mode 100644 index 0000000..faf0e7b --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/DayUtilizationRateDto.java @@ -0,0 +1,23 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; +import org.jeecg.modules.mdc.vo.DayRateDto; + +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-08-01 14:44 + */ +@Data +public class DayUtilizationRateDto { + + private String equipmentId; + + private String equipmentName; + + private List<String> dateList; + + private List<DayRateDto> dayRateDto; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/GraphicsDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/GraphicsDto.java new file mode 100644 index 0000000..696d8f3 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/GraphicsDto.java @@ -0,0 +1,33 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author: LiuS + * @create: 2023-07-31 10:09 + */ +@Data +public class GraphicsDto { + /** + * 璁惧缂栫爜 + */ + private String equipmentId; + /** + * 鍒╃敤鐜� + */ + private BigDecimal utilizationRate; + /** + * 寮�鏈虹巼 + */ + private BigDecimal openRate; + /** + * 寮�鏈烘椂闀� + */ + private BigDecimal openLong; + /** + * 鍏虫満鏃堕暱 + */ + private BigDecimal closeLong; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmAnalyzeDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmAnalyzeDto.java new file mode 100644 index 0000000..1672690 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmAnalyzeDto.java @@ -0,0 +1,30 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author: LiuS + * @create: 2023-09-06 17:25 + */ +@Data +public class MdcAlarmAnalyzeDto { + + /** + * 鎶ヨ鍙� + */ + private String alarmCode; + /** + * 鍑虹幇娆℃暟 + */ + private Integer count; + /** + * 鍚堣鎸佺画鏃堕棿锛堢锛� + */ + private BigDecimal timeCount; + /** + * 鎶ヨ淇℃伅 + */ + private String alarmContent; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmDto.java new file mode 100644 index 0000000..970cb70 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmDto.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; + +/** + * @author: LiuS + * @create: 2023-09-07 13:55 + */ +@Data +public class MdcAlarmDto { + + private String key; + + /** + * 鍑虹幇娆℃暟 + */ + private Integer count; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmTrendDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmTrendDto.java new file mode 100644 index 0000000..94bf344 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcAlarmTrendDto.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-09-07 13:47 + */ +@Data +public class MdcAlarmTrendDto { + + List<String> dateList; + + List<String> equipmentList; + + List<MdcAlarmDto> dateCountList; + + List<MdcAlarmDto> equipmentCountList; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcComAnaDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcComAnaDto.java new file mode 100644 index 0000000..c96fb72 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcComAnaDto.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author: LiuS + * @create: 2023-07-31 14:08 + */ +@Data +public class MdcComAnaDto { + + private String equipmentId; + private BigDecimal openLong; + private BigDecimal closeLong; + private BigDecimal waitLong; + private BigDecimal processLong; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyShiftListDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyShiftListDto.java index 200180d..105506d 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyShiftListDto.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyShiftListDto.java @@ -36,5 +36,5 @@ /** * 鍒╃敤鐜囨暟鎹� */ - private List<MdcEfficiencyResultDto> dataList; + private List<MdcEfficiencyShiftResultDto> dataList; } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyShiftResultDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyShiftResultDto.java new file mode 100644 index 0000000..aa92a72 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyShiftResultDto.java @@ -0,0 +1,49 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author: LiuS + * @create: 2023-07-26 16:04 + */ +@Data +public class MdcEfficiencyShiftResultDto { + /** + * 鏈夋晥鏃ユ湡 + */ + private String theDate; + /** + * 鍔犲伐鏃堕暱 + */ + private BigDecimal processLong; + /** + * 鍒╃敤鐜� + */ + private BigDecimal utilizationRate; + /** + * 寮�鍔ㄧ巼 + */ + private BigDecimal startRate; + /** + * 寮�鏈虹巼 + */ + private BigDecimal openRate; + /** + * 寮�鏈烘椂闀� + */ + private BigDecimal openLong; + /** + * 寰呮満鏃堕暱 + */ + private BigDecimal waitLong; + /** + * 鍏虫満鏃堕暱 + */ + private BigDecimal closeLong; + /** + * 棰滆壊 + */ + private String color; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentDto.java index e5c2999..796493d 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentDto.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentDto.java @@ -1,5 +1,6 @@ package org.jeecg.modules.mdc.dto; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; import org.jeecg.modules.mdc.entity.MdcDriveTypeParamConfig; import org.jeecg.modules.mdc.entity.XYZAliases; @@ -17,6 +18,7 @@ private String equipmentModel; //閲囬泦鏃堕棿 + @JSONField(name = "CollectTime") private Date CollectTime; //璁惧缂栧彿 private String equipmentID; @@ -39,8 +41,10 @@ //瀹為檯杩涚粰閫熷害 private String actualfeedrate; //绋嬪簭鎵ц琛屾暟 + @JSONField(name = "Programnumber") private String Programnumber; //搴忓垪鍙� + @JSONField(name = "Sequencenumber") private String Sequencenumber; //鎵ц浠g爜 private String executingcode; @@ -53,36 +57,55 @@ //宸ヤ綔鐘舵�� private String workstate; //鎶ヨ鐘舵�� + @JSONField(name = "ALRMstate") private String ALRMstate; //宸ヤ欢鍚嶇О + @JSONField(name = "ProductName") private String ProductName; + //宸ヤ欢鏁伴噺 + @JSONField(name = "ProductCount") + private String ProductCount; //鏈哄簥X杞村潗鏍� + @JSONField(name = "Xmachine") private String Xmachine; //鏈哄簥Y杞村潗鏍� + @JSONField(name = "Ymachine") private String Ymachine; //鏈哄簥Y杞村潗鏍� + @JSONField(name = "Zmachine") private String Zmachine; //鏈哄簥Z杞村潗鏍� + @JSONField(name = "Amachine") private String Amachine; //鏈哄簥A杞村潗鏍� + @JSONField(name = "Bmachine") private String Bmachine; //X杞村潗鏍囩粷瀵瑰潗鏍� + @JSONField(name = "Xabsolute") private String Xabsolute; //X杞村潗鏍囩粷瀵瑰潗鏍� + @JSONField(name = "Yabsolute") private String Yabsolute; //X杞村潗鏍囩粷瀵瑰潗鏍� + @JSONField(name = "Zabsolute") private String Zabsolute; //X杞村潗鏍囩粷瀵瑰潗鏍� + @JSONField(name = "Aabsolute") private String Aabsolute; //X杞村潗鏍囩粷瀵瑰潗鏍� + @JSONField(name = "Babsolute") private String Babsolute; //绯荤粺鐗堟湰鍙� + @JSONField(name = "SystemVersion") private String SystemVersion; //鏁版帶绯荤粺鍨嬪彿 + @JSONField(name = "SystemType") private String SystemType; //鏈�澶ц酱鏁� + @JSONField(name = "MaxAxis") private String MaxAxis; //鏈夋晥杞存暟 + @JSONField(name = "ValidAxis") private String ValidAxis; //璁惧鍔熺巼 @@ -176,43 +199,62 @@ private String equipmentNormalTime; // 璁惧ID + @JSONField(name = "EquipmentID") private String EquipmentID; // KI1鐘舵�� + @JSONField(name = "P1001") private String P1001; // KI2鐘舵�� + @JSONField(name = "P1002") private String P1002; // KI3鐘舵�� + @JSONField(name = "P1003") private String P1003; // KI4鐘舵�� + @JSONField(name = "P1004") private String P1004; // AI1鏁版嵁 + @JSONField(name = "P1005") private String P1005; // AI2鏁版嵁 + @JSONField(name = "P1006") private String P1006; // KI1璁℃暟 + @JSONField(name = "P1007") private String P1007; // KI2璁℃暟 + @JSONField(name = "P1008") private String P1008; // KI3璁℃暟 + @JSONField(name = "P1009") private String P1009; // KI4璁℃暟 + @JSONField(name = "P1010") private String P1010; // KO1杈撳嚭 + @JSONField(name = "P1011") private String P1011; // KO2杈撳嚭 + @JSONField(name = "P1012") private String P1012; //璁惧杩愯鏃堕棿 + @JSONField(name = "EquipmentTime") private String EquipmentTime; //褰撳墠鍒�鍏峰彿 + @JSONField(name = "ToolNum") private String ToolNum; //NC鐗堟湰 + @JSONField(name = "NCVersion") private String NCVersion; //TNC鐗堟湰 + @JSONField(name = "TNCVersion") private String TNCVersion; //OPT鐗堟湰 + @JSONField(name = "OPTVersion") private String OPTVersion; //PLC鐗堟湰 + @JSONField(name = "PLCVersion") private String PLCVersion; //澶囨敞 diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcProcessQuantityDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcProcessQuantityDto.java index 4ae2e90..16aa346 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcProcessQuantityDto.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcProcessQuantityDto.java @@ -16,7 +16,7 @@ private String id; @Excel(name = "璁惧缂栧彿", width = 15) private String equipmentId; - @Excel(name = "璁惧鍚嶇О", width = 15) + @Excel(name = "璁惧鍚嶇О", width = 20) private String equipmentName; @Excel(name = "闆朵欢鍙�", width = 15) private String partsCode; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MeterDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MeterDto.java new file mode 100644 index 0000000..6f39ab4 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MeterDto.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-07-31 10:12 + */ +@Data +public class MeterDto { + /** + * 鍓嶄簲鎺掕 + */ + private List<UtilizationRateDto> tops; + /** + * 鍚庝簲鎺掕 + */ + private List<UtilizationRateDto> lasts; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/OptionsDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/OptionsDto.java new file mode 100644 index 0000000..079103c --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/OptionsDto.java @@ -0,0 +1,16 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; + +/** + * @author: LiuS + * @create: 2023-09-18 10:35 + */ +@Data +public class OptionsDto { + + private String value; + + private String label; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/PieChartDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/PieChartDto.java new file mode 100644 index 0000000..605809d --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/PieChartDto.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author: LiuS + * @create: 2023-07-31 10:16 + */ +@Data +public class PieChartDto { + /** + * 寮�鏈虹巼 + */ + private BigDecimal openRate; + /** + * 鍏虫満鐜� + */ + private BigDecimal closeRate; + /** + * 鍔犲伐鐜� + */ + private BigDecimal processRate; + /** + * 寰呮満鐜� + */ + private BigDecimal waitRate; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/UtilizationRateDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/UtilizationRateDto.java new file mode 100644 index 0000000..150fdf8 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/UtilizationRateDto.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.mdc.dto; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author: LiuS + * @create: 2023-07-31 10:13 + */ +@Data +public class UtilizationRateDto { + /** + * 璁惧缂栫爜 + */ + private String equipmentId; + /** + * 鍒╃敤鐜� + */ + private BigDecimal utilizationRate; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcAlarmInfo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcAlarmInfo.java new file mode 100644 index 0000000..3ca588e --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcAlarmInfo.java @@ -0,0 +1,56 @@ +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: 2023-09-05 + * @Version: V1.0 + */ +@Data +@TableName("mdc_alarm_info") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "mdc_alarm_info瀵硅薄", description = "鎶ヨ鍙风鐞�") +public class MdcAlarmInfo extends JeecgEntity implements Serializable { + + private static final long serialVersionUID = 953864495681756550L; + + /** + * 鎶ヨ鍙� + */ + @Excel(name = "鎶ヨ鍙�", width = 15) + @ApiModelProperty(value = "鎶ヨ鍙�") + private String alarmCode; + /** + * 鎶ヨ鍐呭 + */ + @Excel(name = "鎶ヨ鍐呭", width = 15) + @ApiModelProperty(value = "鎶ヨ鍐呭") + private String alarmContent; + /** + * 璁惧椹卞姩绫诲瀷 + */ + @Excel(name = "璁惧椹卞姩绫诲瀷", width = 15) + @ApiModelProperty(value = "璁惧椹卞姩绫诲瀷") + private String driveType; + /** + * 鏄惁鍚敤 + */ + @Excel(name = "鏄惁鍚敤", width = 15) + @ApiModelProperty(value = "鏄惁鍚敤") + @Dict(dicCode = "alarm_is_use") + private Integer isUse; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDeviceCalendar.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDeviceCalendar.java index a158b6f..dbb45dd 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDeviceCalendar.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDeviceCalendar.java @@ -42,7 +42,7 @@ */ @Excel(name = "璁惧缂栧彿", width = 15) @ApiModelProperty(value = "璁惧缂栧彿") - private String equmentId; + private String equipmentId; /** * 鐝ID @@ -50,11 +50,5 @@ @Excel(name = "鐝ID", width = 15) @ApiModelProperty(value = "鐝ID") private String shiftSubId; - /** - * 鏄熸湡鏍囪瘑 - */ - @Excel(name = "鏄熸湡鏍囪瘑", width = 15) - @ApiModelProperty(value = "鏄熸湡鏍囪瘑") - @Dict(dicCode = "week_number_type") - private String weekNumber; + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDriveTypeParamConfig.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDriveTypeParamConfig.java index 600fc4f..e661818 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDriveTypeParamConfig.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDriveTypeParamConfig.java @@ -50,13 +50,13 @@ /** * 灞曠ず鏍囧織 */ - @Excel(name = "灞曠ず鏍囧織", width = 15) + @Excel(name = "灞曠ず鏍囧織", width = 15, replace = {"鏄痏Y", "鍚N"}) @ApiModelProperty(value = "灞曠ず鏍囧織") private String showFlag; /** * 宸ヤ綔鏇茬嚎鐢熸垚鏍囪 */ - @Excel(name = "宸ヤ綔鏇茬嚎鐢熸垚鏍囪", width = 15) + @Excel(name = "宸ヤ綔鏇茬嚎鐢熸垚鏍囪", width = 15, replace = {"鏄痏Y", "鍚N"}) @ApiModelProperty(value = "宸ヤ綔鏇茬嚎鐢熸垚鏍囪") private String curveGenerationFlags; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentOvertime.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentOvertime.java new file mode 100644 index 0000000..bf2d75d --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentOvertime.java @@ -0,0 +1,109 @@ +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.system.base.entity.JeecgEntity; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description: 璁惧鍔犵彮绠$悊 + * @Author: Lius + * @Date: 2023-08-25 + * @Version: V1.0 + */ +@Data +@TableName("mdc_equipment_overtime") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "mdc_equipment_overtime瀵硅薄", description = "璁惧鍔犵彮绠$悊") +public class MdcEquipmentOvertime extends JeecgEntity implements Serializable { + + private static final long serialVersionUID = -7163039765166584824L; + + @TableField(exist = false) + @Excel(name = "璁惧缂栧彿", width = 20) + private String equipmentId; + + @TableField(exist = false) + @Excel(name = "璁惧鍚嶇О", width = 20) + private String equipmentName; + + /** + * 鐢熸晥鏃ユ湡 + */ + @Excel(name = "鐢熸晥鏃ユ湡", width = 15) + @TableField(exist = false) + private String effectiveDate; + + /** + * 鐝寮�濮嬫椂闂� + */ + @Excel(name = "鐝寮�濮嬫椂闂�", width = 20) + @ApiModelProperty("鐝寮�濮嬫椂闂�") + @TableField(exist = false) + private String startDate; + + /** + * 鐝缁撴潫鏃堕棿 + */ + @Excel(name = "鐝缁撴潫鏃堕棿", width = 20) + @ApiModelProperty("鐝缁撴潫鏃堕棿") + @TableField(exist = false) + private String endDate; + + /** + * 宸ヤ綔鏃ュ巻id + */ + @ApiModelProperty(value = "宸ヤ綔鏃ュ巻id") + private String calendarId; + + /** + * 鍔犵彮寮�濮嬫椂闂� + */ + @Excel(name = "鍔犵彮寮�濮嬫椂闂�", width = 20) + @ApiModelProperty(value = "鍔犵彮寮�濮嬫椂闂�") + private String startTime; + /** + * 鍔犵彮缁撴潫鏃堕棿 + */ + @Excel(name = "鍔犵彮缁撴潫鏃堕棿", width = 20) + @ApiModelProperty(value = "鍔犵彮缁撴潫鏃堕棿") + private String endTime; + + /** + * 澶囨敞 + */ + @Excel(name = "澶囨敞") + @ApiModelProperty(value = "澶囨敞") + private String remark; + + /** + * 鍓嶅彴浼犲叆 鍒ゆ柇姣忎釜id + */ + @TableField(exist = false) + private String parentId; + + /** + * 鍓嶅彴浼犲叆 杞﹂棿灞傜骇:1 閮ㄩ棬灞傜骇:2 + */ + @TableField(exist = false) + private String typeTree; + + /** + * 閮ㄩ棬parentId 鍏宠仈瀛愰泦id + */ + @TableField(exist = false) + private List<String> mdcSectionIds; + + @TableField(exist = false) + private String equipmentIds; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfo.java index 9cfa67c..04a9afb 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfo.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfo.java @@ -17,7 +17,7 @@ /** * @Description: 璁惧鍗曟棩杩愯鏁版嵁琛� - * @Author: jeecg-boot + * @Author: LiuS * @Date: 2023-04-14 * @Version: V1.0 */ @@ -28,6 +28,8 @@ @ApiModel(value = "mdc_equipment_statistical_info瀵硅薄", description = "璁惧鍗曟棩杩愯鏁版嵁琛�") public class MdcEquipmentStatisticalInfo implements Serializable { + private static final long serialVersionUID = -4733120585358211415L; + /** * 涓婚敭 */ diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalShiftInfo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalShiftInfo.java new file mode 100644 index 0000000..3feb581 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalShiftInfo.java @@ -0,0 +1,96 @@ +package org.jeecg.modules.mdc.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +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.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @Description: 璁惧鐝鍗曟棩杩愯鏁版嵁琛� + * @author: LiuS + * @create: 2023-07-24 11:13 + */ +@Data +@TableName("mdc_equipment_statistical_shift_info") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "mdc_equipment_statistical_shift_info瀵硅薄", description = "璁惧鐝鍗曟棩杩愯鏁版嵁琛�") +public class MdcEquipmentStatisticalShiftInfo implements Serializable { + + private static final long serialVersionUID = 1519876512924700514L; + + /** + * 涓婚敭 + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "涓婚敭") + private String id; + /** + * 璁惧id + */ + @ApiModelProperty(value = "璁惧id") + private String equipmentId; + /** + * 鐝埗id + */ + @ApiModelProperty(value = "鐝埗id") + private String shiftId; + /** + * 鐝id + */ + @ApiModelProperty(value = "鐝id") + private String shiftSubId; + /** + * 寮�鏈烘椂闀� + */ + @ApiModelProperty(value = "寮�鏈烘椂闀�") + private BigDecimal openLong = new BigDecimal("0"); + /** + * 鍏虫満鏃堕暱 + */ + @ApiModelProperty(value = "鍏虫満鏃堕暱") + private BigDecimal closeLong = new BigDecimal("0"); + /** + * 寰呮満鏃堕暱 + */ + @ApiModelProperty(value = "寰呮満鏃堕暱") + private BigDecimal waitLong = new BigDecimal("0"); + /** + * 鍔犲伐鏃堕暱 + */ + @ApiModelProperty(value = "鍔犲伐鏃堕暱") + private BigDecimal processLong = new BigDecimal("0"); + /** + * 鎶ヨ鏃堕暱 + */ + @ApiModelProperty(value = "鎶ヨ鏃堕暱") + private BigDecimal errorLong = new BigDecimal("0"); + /** + * 鏈夋晥鎬绘椂闀� + */ + @ApiModelProperty(value = "鏈夋晥鎬绘椂闀�") + private BigDecimal totalLong = new BigDecimal("0"); + /** + * 鏈夋晥鏃ユ湡 + */ + @ApiModelProperty(value = "鏈夋晥鏃ユ湡") + private String theDate; + /** + * 鍒涘缓鏃堕棿 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "鍒涘缓鏃堕棿") + private Date createTime; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPassRate.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPassRate.java index 3fff2ff..9a16144 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPassRate.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPassRate.java @@ -41,7 +41,7 @@ /** * 璁惧鍚嶇О */ - @Excel(name = "璁惧鍚嶇О", width = 15) + @Excel(name = "璁惧鍚嶇О", width = 20) @ApiModelProperty(value = "璁惧鍚嶇О") private String equipmentName; /** @@ -73,7 +73,7 @@ /** * 澶囨敞 */ - @Excel(name = "澶囨敞", width = 15) + @Excel(name = "澶囨敞", width = 25) @ApiModelProperty(value = "澶囨敞") private String remark; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcShiftSub.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcShiftSub.java index dafb565..50f29e5 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcShiftSub.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcShiftSub.java @@ -50,24 +50,32 @@ /** * 寮�濮嬫椂闂� */ + @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss") + @DateTimeFormat(pattern="HH:mm:ss") @ApiModelProperty("寮�濮嬫椂闂�") private String startDate; /** * 缁撴潫鏃堕棿 */ + @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss") + @DateTimeFormat(pattern="HH:mm:ss") @ApiModelProperty("缁撴潫鏃堕棿") private String endDate; /** * 寮�濮嬩紤鎭椂闂� */ + @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss") + @DateTimeFormat(pattern="HH:mm:ss") @ApiModelProperty("寮�濮嬩紤鎭椂闂�") private String sleepStartDate; /** * 缁撴潫浼戞伅鏃堕棿 */ + @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss") + @DateTimeFormat(pattern="HH:mm:ss") @ApiModelProperty("缁撴潫浼戞伅鏃堕棿") private String sleepEndDate; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcStandardProcessDuration.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcStandardProcessDuration.java index a08388f..8f5d307 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcStandardProcessDuration.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcStandardProcessDuration.java @@ -38,7 +38,7 @@ /** * 璁惧鍚嶇О */ - @Excel(name = "璁惧鍚嶇О", width = 15) + @Excel(name = "璁惧鍚嶇О", width = 20) @ApiModelProperty(value = "璁惧鍚嶇О") private String equipmentName; /** @@ -68,7 +68,7 @@ /** * 澶囨敞 */ - @Excel(name = "澶囨敞", width = 15) + @Excel(name = "澶囨敞", width = 25) @ApiModelProperty(value = "澶囨敞") private String remark; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/GenerateWeekDaysJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/GenerateWeekDaysJob.java index 6d2114e..b186708 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/GenerateWeekDaysJob.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/GenerateWeekDaysJob.java @@ -3,11 +3,19 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.common.util.DateUtils; import org.jeecg.modules.mdc.service.IMdcVacationManagementService; +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.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import javax.annotation.Resource; +import java.util.Date; +import java.util.List; /** * 鐢熸垚鍙屼紤鏃ュ畾鏃朵换鍔� @@ -21,15 +29,36 @@ @Resource private IMdcVacationManagementService mdcVacationManagementService; + @Resource + private ISysQuartzLogService sysQuartzLogService; + + @Resource + private IQuartzJobService quartzJobService; + + @Resource + private ISysAnnouncementService sysAnnouncementService; + @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("瀹氭椂鐢熸垚鍙屼紤鏃ヤ换鍔� GenerateWeekDaysJob start! 鏃堕棿:" + DateUtils.now()); + long startTime = System.currentTimeMillis(); try { mdcVacationManagementService.generateWeekDays(); - log.info("瀹氭椂鐢熸垚鍙屼紤鏃ヤ换鍔� GenerateWeekDaysJob 鎵ц鎴愬姛!"); + quartzLog.setIsSuccess(0); } catch (Exception e) { - log.error("瀹氭椂鐢熸垚鍙屼紤鏃ヤ换鍔� GenerateWeekDaysJob 鎵ц澶辫触!"); - log.error(e.getMessage(), e); + quartzLog.setIsSuccess(-1); + quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + // 鍙戦�佹秷鎭�氱煡 + sysAnnouncementService.jobSendMessage("瀹氭椂鐢熸垚鍙屼紤鏃ヤ换鍔�", quartzLog.getExceptionDetail()); } + long endTime = System.currentTimeMillis(); + quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); + sysQuartzLogService.save(quartzLog); } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java new file mode 100644 index 0000000..003509b --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java @@ -0,0 +1,73 @@ +package org.jeecg.modules.mdc.job; + +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.DateUtils; +import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalShiftInfoService; +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; + +/** + * @Description: 瀹氭椂缁熻鍗曟棩鐝鏁版嵁浠诲姟 + * @author: LiuS + * @create: 2023-07-24 10:26 + */ +@PersistJobDataAfterExecution +@DisallowConcurrentExecution +@Slf4j +public class RunningAllEquipmentShiftStatisticalProcessJob implements Job { + + /** + * 鑻ュ弬鏁板彉閲忓悕淇敼 QuartzJobController涓篃闇�瀵瑰簲淇敼 鏃堕棿锛� yyyyMMdd 渚嬶細 20230414 + */ + private String parameter; + + public void setParameter(String parameter) { + this.parameter = parameter; + } + + @Resource + private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService; + + @Resource + private ISysQuartzLogService sysQuartzLogService; + + @Resource + private IQuartzJobService quartzJobService; + + @Resource + private ISysAnnouncementService sysAnnouncementService; + + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + SysQuartzLog quartzLog = new SysQuartzLog(); + quartzLog.setCreateTime(new Date()); + List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); + if (byJobClassName != null && !byJobClassName.isEmpty()) { + quartzLog.setJobId(byJobClassName.get(0).getId()); + } + quartzLog.setParams(this.parameter); + log.info(String.format("瀹氭椂缁熻鍗曟棩鐝鏁版嵁浠诲姟 param: %s RunningAllEquipmentShiftStatisticalProcessJob start! 鏃堕棿:" + DateUtils.now(), this.parameter)); + long startTime = System.currentTimeMillis(); + try { + mdcEquipmentStatisticalShiftInfoService.runningAllEquipmentShiftStatisticalProcess(this.parameter); + quartzLog.setIsSuccess(0); + } catch (Exception e) { + quartzLog.setIsSuccess(-1); + quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + // 鍙戦�佹秷鎭�氱煡 + sysAnnouncementService.jobSendMessage("瀹氭椂缁熻鍗曟棩鐝鏁版嵁浠诲姟", quartzLog.getExceptionDetail()); + } + long endTime = System.currentTimeMillis(); + quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); + sysQuartzLogService.save(quartzLog); + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentStatisticalProcessJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentStatisticalProcessJob.java index 6994ef8..79f88a5 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentStatisticalProcessJob.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentStatisticalProcessJob.java @@ -3,9 +3,17 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.common.util.DateUtils; import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoService; +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; /** * @Description: 瀹氭椂缁熻鍗曟棩鏁版嵁浠诲姟 @@ -29,15 +37,37 @@ @Resource private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService; + @Resource + private ISysQuartzLogService sysQuartzLogService; + + @Resource + private IQuartzJobService quartzJobService; + + @Resource + private ISysAnnouncementService sysAnnouncementService; + @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + SysQuartzLog quartzLog = new SysQuartzLog(); + quartzLog.setCreateTime(new Date()); + List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); + if (byJobClassName != null && !byJobClassName.isEmpty()) { + quartzLog.setJobId(byJobClassName.get(0).getId()); + } + quartzLog.setParams(this.parameter); log.info(String.format("瀹氭椂缁熻鍗曟棩鏁版嵁浠诲姟 param: %s RunningAllEquipmentStatisticalProcessJob start! 鏃堕棿:" + DateUtils.now(), this.parameter)); + long startTime = System.currentTimeMillis(); try { mdcEquipmentStatisticalInfoService.runningAllEquipmentStatisticalProcess(this.parameter); - log.info("瀹氭椂缁熻鍗曟棩鏁版嵁浠诲姟 RunningAllEquipmentStatisticalProcessJob 鎵ц鎴愬姛!"); + quartzLog.setIsSuccess(0); } catch (Exception e) { - log.error("瀹氭椂缁熻鍗曟棩鏁版嵁浠诲姟 RunningAllEquipmentStatisticalProcessJob 鎵ц澶辫触!"); - log.error(e.getMessage(), e); + quartzLog.setIsSuccess(-1); + quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + // 鍙戦�佹秷鎭�氱煡 + sysAnnouncementService.jobSendMessage("瀹氭椂缁熻鍗曟棩鏁版嵁浠诲姟", quartzLog.getExceptionDetail()); } + long endTime = System.currentTimeMillis(); + quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); + sysQuartzLogService.save(quartzLog); } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentTraceProcessJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentTraceProcessJob.java index 2ca3212..89de345 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentTraceProcessJob.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentTraceProcessJob.java @@ -3,9 +3,17 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.common.util.DateUtils; import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService; +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; /** * @Description: 瀹氭椂璁$畻娈垫椂闂� @@ -20,15 +28,36 @@ @Resource private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService; + @Resource + private ISysQuartzLogService sysQuartzLogService; + + @Resource + private IQuartzJobService quartzJobService; + + @Resource + private ISysAnnouncementService sysAnnouncementService; + @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("瀹氭椂缁熻娈垫椂闂翠换鍔� RunningAllEquipmentTraceProcessJob start! 鏃堕棿:" + DateUtils.now()); + long startTime = System.currentTimeMillis(); try { mdcEquipmentRunningSectionService.runningAllEquipmentTraceProcess(); - log.info("瀹氭椂缁熻娈垫椂闂翠换鍔� RunningAllEquipmentTraceProcessJob 鎵ц鎴愬姛!"); + quartzLog.setIsSuccess(0); } catch (Exception e) { - log.error("瀹氭椂缁熻娈垫椂闂翠换鍔� RunningAllEquipmentTraceProcessJob 鎵ц澶辫触!"); - log.error(e.getMessage(), e); + quartzLog.setIsSuccess(-1); + quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + // 鍙戦�佹秷鎭�氱煡 + sysAnnouncementService.jobSendMessage("瀹氭椂缁熻娈垫椂闂翠换鍔�", quartzLog.getExceptionDetail()); } + long endTime = System.currentTimeMillis(); + quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); + sysQuartzLogService.save(quartzLog); } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentLogMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentLogMapper.java index bfe738d..9b13b82 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentLogMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentLogMapper.java @@ -1,11 +1,17 @@ package org.jeecg.modules.mdc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.EquipmentLog; + +import java.util.Date; /** * @author: LiuS * @create: 2023-04-12 14:44 */ public interface EquipmentLogMapper extends BaseMapper<EquipmentLog> { + + + EquipmentLog getRow(@Param("equipmentid") String equipmentid, @Param("startTime") Date startTime); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java index 20d8e9a..4e2248e 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java @@ -23,7 +23,7 @@ List<MdcEquipmentDto> getMacingDataList(@Param("tableName") String tableName); @InterceptorIgnore(tenantLine = "1") - @Select("select Sequencenumber,CollectTime from ${tableName} " + + @Select("select Sequencenumber,CollectTime from [${tableName}] " + " where CollectTime > #{startTime} and CollectTime <= #{endTime} and Sequencenumber is not null" + " order by CollectTime desc ") List<Map<String, Object>> getEquipmentSequenceNumber(@Param("tableName") String tableName, @Param("startTime") Date startTime, @Param("endTime") Date endTime); @@ -32,4 +32,8 @@ @InterceptorIgnore(tenantLine = "1") @Select("select CollectTime ${columns} from [${tableName}] where CollectTime > #{startTime} and CollectTime <= #{endTime} order by CollectTime asc") List<Map<String, Object>> getWorkLineList(Map<String, Object> param); + + @InterceptorIgnore(tenantLine = "1") + @Select("SELECT COUNT(*) FROM SysObjects WHERE XType='U' AND name = '${tableName}'") + Integer isTableExist(@Param("tableName") String tableName); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcAlarmInfoMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcAlarmInfoMapper.java new file mode 100644 index 0000000..67a2a02 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcAlarmInfoMapper.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.mdc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.mdc.entity.MdcAlarmInfo; + +/** + * @Description: 鎶ヨ鍙风鐞� + * @Author: Lius + * @Date: 2023-09-05 + * @Version: V1.0 + */ +public interface MdcAlarmInfoMapper extends BaseMapper<MdcAlarmInfo> { + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDeviceCalendarMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDeviceCalendarMapper.java index 4fe2636..4c332a2 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDeviceCalendarMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDeviceCalendarMapper.java @@ -7,6 +7,9 @@ import org.jeecg.modules.mdc.vo.MdcDeviceCalendarQueryVo; import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; +import java.util.Date; +import java.util.List; + /** * @Description: 璁惧宸ヤ綔鏃ュ巻琛� * @Author: jeecg-boot @@ -16,4 +19,9 @@ public interface MdcDeviceCalendarMapper extends BaseMapper<MdcDeviceCalendar> { IPage<MdcDeviceCalendarVo> pageList(IPage<MdcDeviceCalendarVo> pageData, @Param("deviceCalendar") MdcDeviceCalendarQueryVo mdcDeviceCalendarQueryVo); + + List<MdcDeviceCalendarVo> listByEquipmentAndDate(@Param("equipmentId") String equipmentId, @Param("stringDate") String stringDate); + + List<MdcDeviceCalendarVo> findAcquiesceShift(); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDriveTypeParamConfigMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDriveTypeParamConfigMapper.java index 047ef43..c0db871 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDriveTypeParamConfigMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDriveTypeParamConfigMapper.java @@ -18,4 +18,10 @@ * 鏍规嵁璁惧缂栫爜鑾峰彇宸ヤ綔鏇茬嚎鍙傛暟 */ List<MdcDriveTypeParamConfig> findWorkCurveParamList(@Param("equipmentId") String equipmentId); + + /** + * 鑾峰彇鎺у埗绯荤粺绫诲瀷涓嬫媺妗嗛�夐」 + */ + List<String> getDriveParamOptions(); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java index 7462e8e..95064b3 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java @@ -1,8 +1,13 @@ package org.jeecg.modules.mdc.mapper; import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.mdc.dto.MdcComAnaDto; import org.jeecg.modules.mdc.dto.MdcEfficiencyDto; +import org.jeecg.modules.mdc.dto.MdcEfficiencyResultDto; +import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; +import org.jeecg.modules.mdc.vo.ComparativeAnalysisQueryVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyReportQueryVo; +import org.jeecg.modules.mdc.vo.MdcEfficiencyReportShiftQueryVo; import java.util.List; @@ -27,4 +32,20 @@ * @return */ List<MdcEfficiencyDto> efficiencyPOList(@Param("vo") MdcEfficiencyReportQueryVo vo); + + /** + * 寰楀埌鎵�鏈夌彮娆℃暟鎹箣鍜� + * + * @param vo + * @return + */ + List<MdcEquipmentStatisticalShiftInfo> efficiencyShiftSumList(@Param("vo") MdcEfficiencyReportShiftQueryVo vo); + + /** + * 鏌ヨ鍘熷鏁版嵁 + * + * @param vo + * @return + */ + List<MdcComAnaDto> comparativeAnalysis(@Param("vo") ComparativeAnalysisQueryVo vo); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentOvertimeMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentOvertimeMapper.java new file mode 100644 index 0000000..14f3a7c --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentOvertimeMapper.java @@ -0,0 +1,36 @@ +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.MdcEquipmentOvertime; + +import java.util.List; + +/** + * @Description: 璁惧鍔犵彮绠$悊 + * @Author: Lius + * @Date: 2023-08-25 + * @Version: V1.0 + */ +public interface MdcEquipmentOvertimeMapper extends BaseMapper<MdcEquipmentOvertime> { + + /** + * 鍒嗛〉鏌ヨ + * + * @param page + * @param mdcEquipmentOvertime + * @return + */ + IPage<MdcEquipmentOvertime> pageList(Page<MdcEquipmentOvertime> page, @Param("mdcEquipmentOvertime") MdcEquipmentOvertime mdcEquipmentOvertime); + + /** + * list鍒楄〃 + * @param mdcEquipmentOvertime + * @return + */ + List<MdcEquipmentOvertime> list(@Param("mdcEquipmentOvertime") MdcEquipmentOvertime mdcEquipmentOvertime); + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRepairMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRepairMapper.java index c02fd62..25a6e1f 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRepairMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentRepairMapper.java @@ -5,6 +5,9 @@ import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.MdcEquipmentRepair; +import java.util.Date; +import java.util.List; + /** * @Description: 璁惧缁翠慨浼戠彮 @@ -21,4 +24,5 @@ */ IPage<MdcEquipmentRepair> pageList(IPage<MdcEquipmentRepair> pageData, @Param("repair") MdcEquipmentRepair repair); + List<MdcEquipmentRepair> selectByIdAndTime(@Param("equipmentId") String equipmentid, @Param("startTime") Date startDate, @Param("endTime") Date endDate); } 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 aa32327..d152085 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.entity.MdcEquipmentRunningSection; +import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; import java.util.Date; import java.util.List; @@ -34,4 +35,34 @@ * 鏌ヨ璁惧鍗曟棩杩愯鐘舵�佹椂闂存璁板綍 */ List<MdcEquipmentRunningSection> listForEquipmentStatisticalInfo(@Param("equipmentId") String equipmentId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); + + /** + * 璁$畻涓�娈垫椂闂村唴鐨勬暟鎹� + */ + List<MdcEquipmentRunningSection> listEquipmentRunningSection(@Param("equipmentId") String equipmentid, @Param("startLong") long start, @Param("endLong") long end); + + /** + * 璁$畻涓�娈垫椂闂村唴鐨勮繍琛屾暟鎹� + */ + List<MdcEquipmentRunningSection> listEquipmentRunningSectionRun(@Param("equipmentId") String equipmentid, @Param("startLong") long start, @Param("endLong") long end); + + /** + * 璁$畻涓�娈垫椂闂村唴鐨勬晠闅滄暟鎹� + */ + List<MdcEquipmentRunningSection> listEquipmentRunningSectionError(@Param("equipmentId") String equipmentid, @Param("startLong") long start, @Param("endLong") long end); + + /** + * 鏌ヨ涓�娈垫椂闂村唴鐨勬姤璀︽暟鎹� + */ + List<MdcEquipmentRunningSection> findAlarmList(@Param("vo") MdcAlarmAnalyzeQueryVo vo); + + /** + * 鏌ヨ鏁伴噺 + */ + Integer findAlarmCount(@Param("equipmentId") String equipmentId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("alarmCode") String alarmCode); + + /** + * 鏍规嵁鏃ユ湡鏌ヨ鏁伴噺 + */ + Integer findAlarmCountByDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("vo") MdcAlarmAnalyzeQueryVo vo); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java new file mode 100644 index 0000000..8a3fc71 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.mdc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; + +/** + * @author: LiuS + * @create: 2023-07-24 11:23 + */ +public interface MdcEquipmentStatisticalShiftInfoMapper extends BaseMapper<MdcEquipmentStatisticalShiftInfo> { + + /** + * 鑾峰彇璁惧鏈�鏂版棩鏈熺殑杩愯鏁版嵁 + * + * @param equipmentid + * @return + */ + MdcEquipmentStatisticalShiftInfo getMaxStaticsData(@Param("equipmentId") String equipmentid); +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentLogMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentLogMapper.xml new file mode 100644 index 0000000..a14f8cf --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentLogMapper.xml @@ -0,0 +1,8 @@ +<?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.EquipmentLogMapper"> + + <select id="getRow" resultType="org.jeecg.modules.mdc.entity.EquipmentLog"> + SELECT top 1 * FROM EquipmentLog WHERE EquipmentID = #{ equipmentid } AND CollectTime <= #{ startTime } AND Oporation in ('0','1','2','3') ORDER BY CollectTime ASC + </select> +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcAlarmInfoMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcAlarmInfoMapper.xml new file mode 100644 index 0000000..00e233e --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcAlarmInfoMapper.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.MdcAlarmInfoMapper"> + +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml index 4e7d0b7..2528e52 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml @@ -13,19 +13,18 @@ t3.sleep_start_date, t3.sleep_end_date, t3.is_day_span, - t4.equipment_name, - t4.equipment_id + 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.equment_id = t4.equipment_id + LEFT JOIN mdc_equipment t4 ON t1.equipment_id = t4.equipment_id WHERE 1=1 <if test="deviceCalendar.effectiveDate != null and deviceCalendar.effectiveDate != ''"> AND t1.effective_date LIKE CONCAT('%',#{ deviceCalendar.effectiveDate },'%') </if> <if test="deviceCalendar.equipmentId != null and deviceCalendar.equipmentId != ''"> - AND t1.equment_id = #{ deviceCalendar.equipmentId } + AND t1.equipment_id = #{ deviceCalendar.equipmentId } </if> <if test="deviceCalendar.startTime != null and deviceCalendar.startTime != ''"> AND t1.effective_date >= #{ deviceCalendar.startTime } @@ -34,7 +33,7 @@ AND t1.effective_date <= #{ deviceCalendar.endTime } </if> <if test="deviceCalendar.equipmentIdList != null and deviceCalendar.equipmentIdList.size() > 0 "> - AND t1.equment_id IN + AND t1.equipment_id IN <foreach collection="deviceCalendar.equipmentIdList" item="id" index="index" open="(" close=")" separator=","> #{ id } </foreach> @@ -42,4 +41,47 @@ ORDER BY t4.equipment_name ASC, t1.EFFECTIVE_DATE ASC </select> + + <select id="listByEquipmentAndDate" resultType="org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo"> + SELECT + t1.*, + t2.shift_name, + t3.shift_sub_name, + t3.start_date, + t3.end_date, + t3.sleep_start_date, + t3.sleep_end_date, + t3.is_day_span, + 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 + <where> + <if test="equipmentId != null and equipmentId != ''"> + AND t4.equipment_id = #{ equipmentId } + </if> + <if test="stringDate != null and stringDate != ''"> + AND t1.effective_date = #{ stringDate } + </if> + </where> + </select> + + <select id="findAcquiesceShift" resultType="org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo"> + SELECT + t1.id shiftId, + t2.id shiftSubId, + t1.shift_name shiftName, + t2.shift_sub_name shiftSubName, + t2.start_date startDate, + t2.end_date endDate, + t2.sleep_start_date sleepStartDate, + t2.sleep_end_date sleepEndDate, + t2.is_day_span isDaySpan + FROM + mdc_shift t1 LEFT JOIN mdc_shift_sub t2 ON t2.shift_id = t1.id + WHERE t1.default_shift = 'true' + </select> + </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDriveTypeParamConfigMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDriveTypeParamConfigMapper.xml index af9a848..4eefc8f 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDriveTypeParamConfigMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDriveTypeParamConfigMapper.xml @@ -13,4 +13,11 @@ mdtpc.curve_generation_flags = 'Y' AND me.equipment_id = #{equipmentId} </select> + + <select id="getDriveParamOptions" resultType="java.lang.String"> + SELECT DISTINCT + control_system_type + FROM + mdc_drive_type_param_config + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml index d5d3516..78901bf 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml @@ -68,4 +68,75 @@ </if> ORDER BY t1.the_date </select> + + <!--寰楀埌鎵�鏈夌彮娆℃暟鎹箣鍜�--> + <select id="efficiencyShiftSumList" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo"> + SELECT + t2.equipment_id equipmentId, + t2.equipment_name equipmentName, + t2.equipment_type equipmentType, + t1.the_date theDate, + t1.shift_id shiftId, + t1.shift_sub_id shiftSubId, + SUM ( t1.process_long ) processLong, + SUM ( t1.open_long ) openLong, + SUM ( t1.wait_long ) waitLong, + SUM ( t1.close_long ) closeLong, + sum ( t1.total_long ) totalLong + FROM + mdc_equipment t2 + LEFT JOIN mdc_equipment_statistical_shift_info t1 ON t1.equipment_id = t2.equipment_id + <where> + AND t1.the_date <= #{ vo.endTime } + AND t1.the_date >= #{ vo.startTime } + <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=","> + #{ id } + </foreach> + </if> + <if test="vo.shiftId != null and vo.shiftId != ''"> + AND t1.shift_id = #{ vo.shiftId } + </if> + <if test="vo.shiftSubId != null and vo.shiftSubId != ''"> + AND t1.shift_sub_id = #{ vo.shiftSubId } + </if> + </where> + GROUP BY + t2.equipment_id, + t2.equipment_name, + t2.equipment_type, + t1.the_date, + t1.shift_id, + t1.shift_sub_id + ORDER BY + t1.the_date + </select> + + <!--鏌ヨ鍘熷鏁版嵁--> + <select id="comparativeAnalysis" resultType="org.jeecg.modules.mdc.dto.MdcComAnaDto"> + SELECT + mesi.equipment_id equipmentId, + SUM ( mesi.open_long ) openLong, + SUM ( mesi.close_long ) closeLong, + SUM ( mesi.wait_long ) waitLong, + SUM ( mesi.process_long ) processLong + FROM + mdc_equipment_statistical_info mesi + LEFT JOIN mdc_equipment me ON mesi.equipment_id = me.equipment_id + <where> + <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 "> + AND mesi.equipment_id IN + <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=","> + #{ id } + </foreach> + </if> + <if test="vo.driveType != null and vo.driveType != null"> + AND me.drive_type = #{ vo.driveType } + </if> + AND mesi.the_date BETWEEN #{ vo.startTime } AND #{ vo.endTime } + </where> + GROUP BY + mesi.equipment_id + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml new file mode 100644 index 0000000..65a66dd --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml @@ -0,0 +1,80 @@ +<?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.MdcEquipmentOvertimeMapper"> + + <!--鍒嗛〉鏌ヨ--> + <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime"> + SELECT + t1.id, + t2.equipment_id equipmentId, + t4.equipment_name equipmentName, + t2.effective_date effectiveDate, + t3.start_date startDate, + t3.end_date endDate, + t1.start_time startTime, + t1.end_time endTime, + t1.remark remark, + t1.create_by createBy, + t1.create_time createTime, + t1.update_by updateBy, + t1.update_time updateTime + FROM + mdc_equipment_overtime t1 + LEFT JOIN mdc_device_calendar t2 ON t1.calendar_id = t2.id + LEFT JOIN mdc_shift_sub t3 ON t3.id = t2.shift_sub_id + LEFT JOIN mdc_equipment t4 ON t4.equipment_id = t2.equipment_id + <where> + <if test="mdcEquipmentOvertime.equipmentName != null and mdcEquipmentOvertime.equipmentName != '' "> + AND t4.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%') + </if> + <if test="mdcEquipmentOvertime.equipmentId != null and mdcEquipmentOvertime.equipmentId != '' "> + AND t2.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%') + </if> + <if test="mdcEquipmentOvertime.mdcSectionIds != null and mdcEquipmentOvertime.mdcSectionIds.size() > 0 "> + AND t2.equipment_id IN + <foreach collection="mdcEquipmentOvertime.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> + #{ id } + </foreach> + </if> + </where> + order by t2.effective_date asc + </select> + + <!--list鍒楄〃--> + <select id="list" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime"> + SELECT + t1.id, + t2.equipment_id equipmentId, + t4.equipment_name equipmentName, + t2.effective_date effectiveDate, + t3.start_date startDate, + t3.end_date endDate, + t1.start_time startTime, + t1.end_time endTime, + t1.remark remark, + t1.create_by createBy, + t1.create_time createTime, + t1.update_by updateBy, + t1.update_time updateTime + FROM + mdc_equipment_overtime t1 + LEFT JOIN mdc_device_calendar t2 ON t1.calendar_id = t2.id + LEFT JOIN mdc_shift_sub t3 ON t3.id = t2.shift_sub_id + LEFT JOIN mdc_equipment t4 ON t4.equipment_id = t2.equipment_id + <where> + <if test="mdcEquipmentOvertime.equipmentName != null and mdcEquipmentOvertime.equipmentName != '' "> + AND t4.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentName}),'%') + </if> + <if test="mdcEquipmentOvertime.equipmentId != null and mdcEquipmentOvertime.equipmentId != '' "> + AND t2.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipmentOvertime.equipmentId}),'%') + </if> + <if test="mdcEquipmentOvertime.mdcSectionIds != null and mdcEquipmentOvertime.mdcSectionIds.size() > 0 "> + AND t2.equipment_id IN + <foreach collection="mdcEquipmentOvertime.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> + #{ id } + </foreach> + </if> + </where> + order by t2.effective_date asc + </select> +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRepairMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRepairMapper.xml index 9159e09..553523b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRepairMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRepairMapper.xml @@ -31,4 +31,26 @@ ORDER BY START_TIME ASC </select> + <!--鏌ヨ鏌愭鏃堕棿鍐呮槸鍚︽湁缁翠慨浼戠彮鏁版嵁--> + <select id="selectByIdAndTime" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRepair"> + SELECT + * + FROM + mdc_equipment_repair + <where> + <if test="equipmentId != null and equipmentId!= ''"> + AND equipment_id = #{ equipmentId } + </if> + <if test="startTime != null and endTime!= null"> + AND ( + ( START_TIME <![CDATA[ >= ]]> #{ startTime } AND START_TIME <![CDATA[ <= ]]> #{ endTime } ) + OR ( START_TIME <![CDATA[ <= ]]> #{ startTime } AND END_TIME <![CDATA[ >= ]]> #{ endTime }) + OR ( END_TIME <![CDATA[ >= ]]> #{ startTime } AND END_TIME <![CDATA[ <= ]]> #{ endTime } ) + OR ( START_TIME <![CDATA[ <= ]]> #{ startTime } AND END_TIME <![CDATA[ >= ]]> #{ endTime } ) + ) + </if> + </where> + ORDER BY start_time ASC + </select> + </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 8d0ef8f..a733f7c 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 @@ -30,5 +30,99 @@ start_time </select> + <!--璁$畻涓�娈垫椂闂村唴鐨勬暟鎹�--> + <select id="listEquipmentRunningSection" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection"> + SELECT + * + FROM + mdc_equipment_running_section + WHERE + equipment_id = #{ equipmentId } + AND (start_long <= #{ endLong } AND end_long >= #{ startLong }) + ORDER BY + start_time + </select> + + <!--璁$畻涓�娈垫椂闂村唴鐨勮繍琛屾暟鎹�--> + <select id="listEquipmentRunningSectionRun" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection"> + SELECT + * + FROM + mdc_equipment_running_section + WHERE + equipment_id = #{ equipmentId } + AND status <![CDATA[ <> ]]> '22' + AND (start_long <= #{ endLong } AND end_long >= #{ startLong }) + ORDER BY + start_time + </select> + + <!--璁$畻涓�娈垫椂闂村唴鐨勬晠闅滄暟鎹�--> + <select id="listEquipmentRunningSectionError" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection"> + SELECT + * + FROM + mdc_equipment_running_section + WHERE + equipment_id = #{ equipmentId } + AND status = '22' + AND (start_long <= #{ endLong } AND end_long >= #{ startLong }) + ORDER BY + start_time + </select> + + <!--鏌ヨ涓�娈垫椂闂村唴鐨勬姤璀︽暟鎹�--> + <select id="findAlarmList" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection"> + SELECT + * + FROM + mdc_equipment_running_section + <where> + <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 "> + AND equipment_id IN + <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=","> + #{ id } + </foreach> + </if> + AND (start_time <= #{ vo.endDate } AND end_time >= #{ vo.startDate }) + AND status = '22' + </where> + ORDER BY + start_time + </select> + + <!--鏌ヨ鏁伴噺--> + <select id="findAlarmCount" resultType="java.lang.Integer"> + SELECT + COUNT(*) + FROM + mdc_equipment_running_section + <where> + AND status = '22' + AND alarm = #{ alarmCode } + AND (start_time <= #{ endDate } AND end_time >= #{ startDate }) + AND equipment_id = #{ equipmentId } + </where> + </select> + + <!--鏍规嵁鏃ユ湡鏌ヨ鏁伴噺--> + <select id="findAlarmCountByDate" resultType="java.lang.Integer"> + SELECT + COUNT(*) + FROM + mdc_equipment_running_section + <where> + AND status = '22' + AND alarm = #{ vo.alarmCode } + AND (start_time <= #{ endDate } AND end_time >= #{ startDate }) + <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 "> + AND equipment_id IN + <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=","> + #{ id } + </foreach> + </if> + </where> + </select> + </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml new file mode 100644 index 0000000..4168205 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml @@ -0,0 +1,9 @@ +<?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.MdcEquipmentStatisticalShiftInfoMapper"> + + + <select id="getMaxStaticsData" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo"> + SELECT TOP 1 * FROM mdc_equipment_statistical_shift_info WHERE equipment_id = #{equipmentId} ORDER BY the_date DESC + </select> +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentLogService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentLogService.java index cb204ac..8b0ea87 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentLogService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentLogService.java @@ -21,4 +21,9 @@ * 鏌ヨ鏌愪釜璁惧鏌愪釜鏃堕棿鐐逛箣鍚庣殑鏁版嵁(鎶ヨ鏁版嵁) */ List<EquipmentLog> findEquipmentLogByErrorEndTime(String equipmentId, Date endTime); + + /** + * 鑾峰彇璁惧鏌愪釜鏃堕棿鐐逛箣鍚庣殑鏈�鏂颁竴鏉℃暟鎹� + */ + EquipmentLog getRow(String equipmentid, Date startTime); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java index 0208a23..2db1122 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java @@ -19,5 +19,10 @@ /** * 鏌ユ壘瑗块棬瀛愮被鍨嬭澶囪繍琛屾椂娈电殑璁惧绋嬪簭鍙� */ - List<EquipmentMachingDto> getEquipmentSequencenumber(String drivetype, String equipmentid, Date startTime, Date endTime); + List<EquipmentMachingDto> getEquipmentSequencenumber(String tableName, Date startTime, Date endTime); + + /** + * 鍒ゆ柇琛ㄦ槸鍚﹀瓨鍦� + */ + Boolean isTableExist(String tableName); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcAlarmInfoService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcAlarmInfoService.java new file mode 100644 index 0000000..aee61dc --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcAlarmInfoService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.mdc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.mdc.entity.MdcAlarmInfo; + +/** + * @Description: 鎶ヨ鍙风鐞� + * @Author: Lius + * @Date: 2023-09-05 + * @Version: V1.0 + */ +public interface IMdcAlarmInfoService extends IService<MdcAlarmInfo> { + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java index dcaa656..659ea8d 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java @@ -8,11 +8,13 @@ import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; /** * @Description: 璁惧宸ヤ綔鏃ュ巻琛� * @Author: jeecg-boot - * @Date: 2023-04-10 + * @Date: 2023-04-10 * @Version: V1.0 */ public interface IMdcDeviceCalendarService extends IService<MdcDeviceCalendar> { @@ -27,4 +29,12 @@ */ boolean saveCalendar(EquipmentCalendarVo calendarVo); + /** + * 鏌ヨ鐝埗鏁版嵁 + * + * @param equipmentid + * @param stringDates + * @return + */ + List<MdcDeviceCalendarVo> listByEquipmentAndDate(String equipmentid, List<String> stringDates); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java index 32c5128..efcac99 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java @@ -1,6 +1,7 @@ package org.jeecg.modules.mdc.service; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.mdc.dto.OptionsDto; import org.jeecg.modules.mdc.entity.MdcDriveTypeParamConfig; import java.util.List; @@ -27,4 +28,10 @@ * 鏍规嵁鍙傛暟閰嶇疆鑾峰彇鏇茬嚎宸ヤ綔閰嶇疆 */ List<MdcDriveTypeParamConfig> getByTypeCodeMdcShowCode(String codeTypeId); + + /** + * 鑾峰彇鎺у埗绯荤粺绫诲瀷涓嬫媺妗嗛�夐」 + */ + List<OptionsDto> getDriveParamOptions(); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java new file mode 100644 index 0000000..6282eac --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java @@ -0,0 +1,40 @@ +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.MdcEquipmentOvertime; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; + +/** + * @Description: 璁惧鍔犵彮绠$悊 + * @Author: Lius + * @Date: 2023-08-25 + * @Version: V1.0 + */ +public interface IMdcEquipmentOvertimeService extends IService<MdcEquipmentOvertime> { + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param userId + * @param page + * @param mdcEquipmentOvertime + * @param req + * @return + */ + IPage<MdcEquipmentOvertime> pageList(String userId, Page<MdcEquipmentOvertime> page, MdcEquipmentOvertime mdcEquipmentOvertime, HttpServletRequest req); + + /** + * 瀵煎嚭 + * + * @param userId + * @param mdcEquipmentOvertime + * @return + */ + ModelAndView exportXls(String userId, MdcEquipmentOvertime mdcEquipmentOvertime); + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRepairService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRepairService.java index 7c8d353..ca3464c 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRepairService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentRepairService.java @@ -28,6 +28,7 @@ /** * 鍒嗛〉鏌ヨ + * * @param userId * @param page * @param repair @@ -43,4 +44,14 @@ * @return */ boolean updateMdcRepair(MdcEquipmentRepair repair); + + /** + * 鏌ヨ鏌愭鏃堕棿鍐呮槸鍚︽湁缁翠慨浼戠彮鏁版嵁 + * + * @param equipmentid + * @param startDate + * @param endDate + * @return + */ + List<MdcEquipmentRepair> mdcRepairListDate(String equipmentid, Date startDate, Date endDate); } 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 b4fa460..bcdb8fd 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.MdcEquipmentRunningSectionDto; import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; +import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; import org.jeecg.modules.mdc.vo.MdcEquipmentRunningSectionVo; import java.util.Date; @@ -12,7 +13,7 @@ /** * @Description: 璁惧杩愯鏃舵鐘舵�佽〃 * @Author: LiuS - * @Date: 2023-04-13 + * @Date: 2023-04-13 * @Version: V1.0 */ public interface IMdcEquipmentRunningSectionService extends IService<MdcEquipmentRunningSection> { @@ -38,8 +39,42 @@ List<MdcEquipmentRunningSection> listForEquipmentStatisticalInfo(String equipmentId, Date startDate, Date endDate); /** - * 鏌ヨ璁惧鍘嗗彶杩愯鐘舵�佽褰曟暟鎹� + * 鏌ヨ璁惧鍘嗗彶杩愯鐘舵�佽褰曟暟鎹� */ List<Map<String, Object>> logChart(MdcEquipmentRunningSectionVo equipmentRunningSectionVo); + /** + * 璁$畻涓�娈垫椂闂村唴鐨勬暟鎹� + */ + List<MdcEquipmentRunningSection> listEquipmentRunningSection(String equipmentid, long start, long end); + + /** + * 鏌ヨ鏌愪釜璁惧涓�娈垫椂闂村唴鐨勬暟鎹� + */ + List<MdcEquipmentRunningSection> listRunningSectionFromLog(String equipmentid, long start, long end); + + /** + * 鏌ヨ鎽镐釜璁惧涓�娈垫椂闂村唴鐨勮繍琛屾暟鎹� + */ + List<MdcEquipmentRunningSection> listEquipmentRunningSectionRun(String equipmentid, long start, long end); + + /** + * 鏌ヨ鎽镐釜璁惧涓�娈垫椂闂村唴鐨勬晠闅滄暟鎹� + */ + List<MdcEquipmentRunningSection> listEquipmentRunningSectionError(String equipmentid, long start, long end); + + /** + * 鏌ヨ鎶ヨ鏁版嵁 + */ + List<MdcEquipmentRunningSection> findAlarmList(MdcAlarmAnalyzeQueryVo vo); + + /** + * 鏌ヨ娆℃暟 + */ + Integer findAlarmCount(String equipmentId, String startDate, String endDate, String alarmCode); + + /** + * 鏍规嵁鏃ユ湡鏌ヨ娆℃暟 + */ + Integer findAlarmCountByDate(String startDate, String endDate, MdcAlarmAnalyzeQueryVo vo); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java index e57d140..d70061b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java @@ -157,4 +157,9 @@ * @return */ List<MdcEquProDto> findEquProList(List<String> equipmentIdList); + + /** + * 鏍规嵁閮ㄩ棬灞傜骇鏌ヨ璁惧鍗曚釜 + */ + MdcEquipment getEquipmentByDepPid(String pid, String userId); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java index 2ccf4dc..51473ea 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java @@ -5,7 +5,7 @@ /** * @Description: 璁惧鍗曟棩杩愯鏁版嵁琛� - * @Author: jeecg-boot + * @Author: lius * @Date: 2023-04-14 * @Version: V1.0 */ diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java new file mode 100644 index 0000000..1a5a86e --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.mdc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; + +/** + * @Description: 璁惧鍗曟棩鐝杩愯鏁版嵁琛� + * @author: LiuS + * @create: 2023-07-24 10:32 + */ +public interface IMdcEquipmentStatisticalShiftInfoService extends IService<MdcEquipmentStatisticalShiftInfo> { + + /** + * 璁$畻璁惧鍗曟棩鐝杩愯鏁版嵁 + * + * @param dateTime + */ + void runningAllEquipmentShiftStatisticalProcess(String dateTime); +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcShiftService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcShiftService.java index f5eb849..c8200b0 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcShiftService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcShiftService.java @@ -22,6 +22,7 @@ /** * 鍒嗛〉鏌ヨ + * * @param page * @param mdcShift * @return @@ -30,6 +31,7 @@ /** * 鏂板鐝埗 + * * @param mdcShift * @return */ @@ -37,6 +39,7 @@ /** * 鏂板鏃舵煡璇㈡槸鍚︽湁閲嶅鏁版嵁 + * * @param mdcShift * @return */ @@ -44,6 +47,7 @@ /** * 淇敼 + * * @param mdcShift * @return */ @@ -51,6 +55,7 @@ /** * 鏍规嵁id淇敼鐘舵�� + * * @param jsonObject * @return */ @@ -58,6 +63,7 @@ /** * 鍒犻櫎 + * * @param id * @return */ @@ -65,8 +71,16 @@ /** * 鍔犺浇鐝埗涓嬫媺閫夐」 + * * @return */ List<Map<String, String>> initShiftList(); + /** + * 璁剧疆榛樿鐝埗 + * + * @param id + * @return + */ + boolean changeDefaultShift(String id); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcShiftSubService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcShiftSubService.java index 49a37b1..1ca7f6b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcShiftSubService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcShiftSubService.java @@ -8,6 +8,9 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.modules.mdc.entity.MdcShiftSub; +import java.util.List; +import java.util.Map; + /** * @Description: 鐝琛�(娆¤〃) * @Author: Sake @@ -33,10 +36,10 @@ /** * 鏂板 - * @param jsonbject + * @param mdcShiftSub * @return */ - MdcShiftSub addMdcShiftSub(JSONObject jsonbject); + MdcShiftSub addMdcShiftSub(MdcShiftSub mdcShiftSub); /** * 淇敼 @@ -58,4 +61,11 @@ * @return */ Result deleteMdcShiftSub(String id); + + /** + * 鏍规嵁鐝埗id鑾峰彇鐝涓嬫媺鍒楄〃 + * @param shiftId + * @return + */ + List<Map<String, String>> initShiftSubList(String shiftId); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcVacationManagementService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcVacationManagementService.java index acc60c2..168835f 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcVacationManagementService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcVacationManagementService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.mdc.entity.MdcVacationManagement; +import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.util.List; @@ -17,6 +18,7 @@ /** * 鏍规嵁id鏌ヨ + * * @param id * @return */ @@ -24,6 +26,7 @@ /** * 鏂板鍋囨湡绠$悊 + * * @param mdcVacationManagement * @return */ @@ -31,6 +34,7 @@ /** * 缂栬緫鍋囨湡绠$悊 + * * @param mdcVacationManagement * @return */ @@ -38,6 +42,7 @@ /** * 鏍规嵁id鍒犻櫎 + * * @param id * @return */ @@ -45,6 +50,7 @@ /** * 鎵归噺鍒犻櫎 + * * @param ids * @return */ @@ -52,17 +58,27 @@ /** * 鍒嗛〉鏌ヨ + * * @param userId * @param page * @param req * @param mdcVacationManagement * @return */ - IPage<MdcVacationManagement> pageList(String userId, Page page, HttpServletRequest req,MdcVacationManagement mdcVacationManagement); + IPage<MdcVacationManagement> pageList(String userId, Page page, HttpServletRequest req, MdcVacationManagement mdcVacationManagement); /** * 鐢熸垚鍙屼紤鏃ヤ换鍔� */ void generateWeekDays(); + /** + * 瀵煎嚭 + * + * @param userId + * @param mdcVacationManagement + * @return + */ + ModelAndView exportXls(String userId, MdcVacationManagement mdcVacationManagement); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java index 3c3f982..a92007a 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java @@ -1,5 +1,7 @@ package org.jeecg.modules.mdc.service; +import org.jeecg.modules.mdc.dto.ComparativeAnalysisDto; +import org.jeecg.modules.mdc.dto.DayUtilizationRateDto; import org.jeecg.modules.mdc.vo.*; /** @@ -44,4 +46,48 @@ */ StatisticalAnalysisVo dayStatisticalRate(String userId, MdcEfficiencyReportQueryVo vo); + /** + * 瀵规瘮鍒嗘瀽 + * + * @param userId + * @param vo + * @return + */ + ComparativeAnalysisDto comparativeAnalysis(String userId, ComparativeAnalysisQueryVo vo); + + /** + * 璁惧鏃ュ埄鐢ㄧ巼鍒嗘璁$畻 + * + * @param userId + * @param vo + * @return + */ + DayUtilizationRateDto dayUtilizationRate(String userId, DayUtilizationRateQueryVo vo); + + /** + * 璁惧鏃ュ埄鐢ㄧ巼瀵规瘮璁$畻 + * + * @param userId + * @param vo + * @return + */ + DayUtilizationRateDto dayUtilizationRateContrast(String userId, DayUtilizationRateContrastQueryVo vo); + + /** + * 璁惧鍒╃敤鐜囧垎娈靛垎鏋� + * + * @param userId + * @param vo + * @return + */ + MdcUtilizationRateDto utilizationRateSectionAnalyze(String userId, DayUtilizationRateContrastQueryVo vo); + + /** + * 璁惧鍒╃敤鐜囪蛋鍔垮垎鏋� + * + * @param userId + * @param vo + * @return + */ + MdcUtilizationRateDto utilizationRateTrendAnalyze(String userId, DayUtilizationRateContrastQueryVo vo); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEquipmentAlarmAnalyzeService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEquipmentAlarmAnalyzeService.java new file mode 100644 index 0000000..f1272e2 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEquipmentAlarmAnalyzeService.java @@ -0,0 +1,31 @@ +package org.jeecg.modules.mdc.service; + +import org.jeecg.modules.mdc.dto.MdcAlarmAnalyzeDto; +import org.jeecg.modules.mdc.dto.MdcAlarmTrendDto; +import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; + +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-09-06 17:29 + */ +public interface MdcEquipmentAlarmAnalyzeService { + /** + * 鍒楄〃 + * + * @param userId + * @param vo + * @return + */ + List<MdcAlarmAnalyzeDto> alarmList(String userId, MdcAlarmAnalyzeQueryVo vo); + + /** + * 鍒嗘瀽 + * + * @param userId + * @param vo + * @return + */ + MdcAlarmTrendDto alarmTrend(String userId, MdcAlarmAnalyzeQueryVo vo); +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentLogServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentLogServiceImpl.java index dacfa5a..fe8e18b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentLogServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentLogServiceImpl.java @@ -43,4 +43,9 @@ lambdaQuery.orderByAsc(EquipmentLog::getCollectTime); return lambdaQuery.list(); } + + @Override + public EquipmentLog getRow(String equipmentid, Date startTime) { + return this.baseMapper.getRow(equipmentid, startTime); + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java index b5233df..ef07a3a 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java @@ -34,10 +34,15 @@ @Override @Transactional(readOnly = true) - public List<EquipmentMachingDto> getEquipmentSequencenumber(String drivetype, String equipmentid, Date startTime, Date endTime) { - String tableName = drivetype + "_" + equipmentid; + public List<EquipmentMachingDto> getEquipmentSequencenumber(String tableName, Date startTime, Date endTime) { List<Map<String, Object>> list = equipmentWorkLineMapper.getEquipmentSequenceNumber(tableName, startTime, endTime); return convertData(list); + } + + @Override + public Boolean isTableExist(String tableName) { + Integer count = equipmentWorkLineMapper.isTableExist(tableName); + return count != 0; } private List<EquipmentMachingDto> convertData(List<Map<String, Object>> list) { @@ -59,7 +64,7 @@ ei.setFeedrate(map.get("feedrate") == null ? null : map.get("feedrate").toString()); ei.setFeedbeilv(map.get("feedbeilv") == null ? null : map.get("feedbeilv").toString()); ei.setProgramnumber(map.get("Programnumber") == null ? null : map.get("Programnumber").toString()); - ei.setSequencenumber(map.get("SEQUENCENUMBER") == null ? null : map.get("SEQUENCENUMBER").toString()); + ei.setSequencenumber(map.get("Sequencenumber") == null ? null : map.get("Sequencenumber").toString()); ei.setExecutingcode(map.get("executingcode") == null ? null : map.get("executingcode").toString()); ei.setProductName(map.get("ProductName") == null ? null : map.get("ProductName").toString()); dto.add(ei); diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcAlarmInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcAlarmInfoServiceImpl.java new file mode 100644 index 0000000..4f20292 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcAlarmInfoServiceImpl.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.mdc.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.mdc.entity.MdcAlarmInfo; +import org.jeecg.modules.mdc.mapper.MdcAlarmInfoMapper; +import org.jeecg.modules.mdc.service.IMdcAlarmInfoService; +import org.springframework.stereotype.Service; + +/** + * @Description: 鎶ヨ鍙风鐞� + * @Author: Lius + * @Date: 2023-09-05 + * @Version: V1.0 + */ +@Service +public class MdcAlarmInfoServiceImpl extends ServiceImpl<MdcAlarmInfoMapper, MdcAlarmInfo> implements IMdcAlarmInfoService { + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java index afb0a78..db49109 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java @@ -2,7 +2,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; @@ -16,16 +15,11 @@ import org.jeecg.modules.mdc.vo.MdcDeviceCalendarQueryVo; import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import java.time.DayOfWeek; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; /** * @Description: 璁惧宸ヤ綔鏃ュ巻琛� @@ -81,95 +75,61 @@ } @Override + @Transactional(rollbackFor = Exception.class) public boolean saveCalendar(EquipmentCalendarVo calendarVo) { String[] equipmentIdList = calendarVo.getEquipmentId().split(","); - //鐢熸晥鏃堕棿 - LocalDate takeEffectDate = calendarVo.getTakeEffectDate(); - //澶辨晥鏃堕棿 - LocalDate invalidDate = calendarVo.getInvalidDate(); - //澶勭悊鏄熸湡 - Map<String, String> map = new HashMap<>(); - if (org.apache.commons.lang.StringUtils.isNotBlank(calendarVo.getMonShiftId())) { - map.put("1", calendarVo.getMonShiftId()); - } - if (org.apache.commons.lang.StringUtils.isNotBlank(calendarVo.getTueShiftId())) { - map.put("2", calendarVo.getTueShiftId()); - } - if (org.apache.commons.lang.StringUtils.isNotBlank(calendarVo.getWedShiftId())) { - map.put("3", calendarVo.getWedShiftId()); - } - if (org.apache.commons.lang.StringUtils.isNotBlank(calendarVo.getThuShiftId())) { - map.put("4", calendarVo.getThuShiftId()); - } - if (org.apache.commons.lang.StringUtils.isNotBlank(calendarVo.getFriShiftId())) { - map.put("5", calendarVo.getFriShiftId()); - } - if (org.apache.commons.lang.StringUtils.isNotBlank(calendarVo.getSatShiftId())) { - map.put("6", calendarVo.getSatShiftId()); - } - if (org.apache.commons.lang.StringUtils.isNotBlank(calendarVo.getSunShiftId())) { - map.put("7", calendarVo.getSunShiftId()); - } - if (map.isEmpty()) { - return false; - } + List<String> dateList = calendarVo.getDateList(); + List<MdcShiftSub> mdcShiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getShiftId, calendarVo.getShiftId()).eq(MdcShiftSub::getShiftSubStatus, "1")); List<MdcDeviceCalendar> calendarList = new ArrayList<>(); - map.forEach((key, value) -> { - List<MdcShiftSub> mdcShiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper - <MdcShiftSub>().eq(MdcShiftSub::getShiftId, value).eq(MdcShiftSub::getShiftSubStatus, "1")); - List<LocalDate> meetDayOfWeekLocalDates = getMeetDayOfWeekLocalDates(takeEffectDate, invalidDate, key); - if (!meetDayOfWeekLocalDates.isEmpty()) { - List<String> dates = meetDayOfWeekLocalDates.stream().map(localDate -> localDate.format(DateTimeFormatter.BASIC_ISO_DATE)).collect(Collectors.toList()); - LambdaUpdateChainWrapper<MdcDeviceCalendar> lambdaUpdate = this.lambdaUpdate(); - lambdaUpdate.in(MdcDeviceCalendar::getEffectiveDate, dates).in(MdcDeviceCalendar::getEqumentId, Arrays.asList(equipmentIdList)); - lambdaUpdate.remove(); - List<MdcDeviceCalendar> calendars = handleMdcDeviceCalendar(dates, equipmentIdList, mdcShiftSubList, key); - calendarList.addAll(calendars); + for (String equipmentId : equipmentIdList) { + for (String date : dateList) { + for (MdcShiftSub mdcShiftSub : mdcShiftSubList) { + this.baseMapper.delete(new LambdaQueryWrapper<MdcDeviceCalendar>().eq(MdcDeviceCalendar::getEquipmentId, equipmentId).eq(MdcDeviceCalendar::getEffectiveDate, date)); + MdcDeviceCalendar mdcDeviceCalendar = new MdcDeviceCalendar(); + mdcDeviceCalendar.setEffectiveDate(date); + mdcDeviceCalendar.setEquipmentId(equipmentId); + mdcDeviceCalendar.setShiftId(mdcShiftSub.getShiftId()); + mdcDeviceCalendar.setShiftSubId(mdcShiftSub.getId()); + calendarList.add(mdcDeviceCalendar); + } } - }); + } this.saveBatch(calendarList); return true; } /** - * 鑾峰彇涓�娈垫椂闂磋寖鍥村唴绗﹀悎鏄熸湡鍑犵殑鏃ユ湡闆嗗悎 + * 鏌ヨ鐝埗鏁版嵁 * - * @param startDate 寮�濮嬫椂闂� - * @param endDate 缁撴潫鏃堕棿 - * @param workDate 鍛ㄥ嚑 1,2,3,4 + * @param equipmentId + * @param stringDates + * @return */ - public static List<LocalDate> getMeetDayOfWeekLocalDates(LocalDate startDate, LocalDate endDate, String workDate) { + @Override + public List<MdcDeviceCalendarVo> listByEquipmentAndDate(String equipmentId, List<String> stringDates) { + List<MdcDeviceCalendarVo> result = new ArrayList<>(); + try { + //鏌ヨ榛樿鐝埗 + List<MdcDeviceCalendarVo> acquiesceShift = this.baseMapper.findAcquiesceShift(); - List<DayOfWeek> dayOfWeeks = Stream.of(workDate.split(",")) - .map(Integer::valueOf) - .map(DayOfWeek::of) - .collect(Collectors.toList()); - - long distance = ChronoUnit.DAYS.between(startDate, endDate); - - return Stream.iterate(startDate, d -> d.plusDays(1)) - .limit(distance + 1) - .filter(localDate -> dayOfWeeks.contains(localDate.getDayOfWeek())) - .collect(Collectors.toList()); - } - - public List<MdcDeviceCalendar> handleMdcDeviceCalendar(List<String> dates, String[] equipment, List<MdcShiftSub> mdcShiftSubList, String weekNumber) { - List<MdcDeviceCalendar> ds = new ArrayList<>(); - for (String date : dates) { - for (String equipmentId : equipment) { - for (MdcShiftSub temp : mdcShiftSubList) { - MdcDeviceCalendar mdcDeviceCalendar = new MdcDeviceCalendar(); - if (org.apache.commons.lang.StringUtils.isNotEmpty(equipmentId)) { - mdcDeviceCalendar.setEqumentId(equipmentId); - } - mdcDeviceCalendar.setShiftId(temp.getShiftId()); - mdcDeviceCalendar.setShiftSubId(temp.getId()); - mdcDeviceCalendar.setEffectiveDate(date); - mdcDeviceCalendar.setWeekNumber(weekNumber); - ds.add(mdcDeviceCalendar); + for (String stringDate : stringDates) { + List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = this.baseMapper.listByEquipmentAndDate(equipmentId, stringDate); + if (mdcDeviceCalendarVos != null && !mdcDeviceCalendarVos.isEmpty()) { + result.addAll(mdcDeviceCalendarVos); + } else { + acquiesceShift.forEach(mdcDeviceCalendarVo -> { + mdcDeviceCalendarVo.setEquipmentId(equipmentId); + mdcDeviceCalendarVo.setEffectiveDate(stringDate); + }); + // 璁剧疆榛樿鐝埗 + result.addAll(acquiesceShift); } } + } catch (Exception e) { + e.printStackTrace(); } - return ds; + + return result; } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java index 38d011c..f9d398c 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java @@ -2,11 +2,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.common.constant.CommonConstant; +import org.jeecg.modules.mdc.dto.OptionsDto; import org.jeecg.modules.mdc.entity.MdcDriveTypeParamConfig; import org.jeecg.modules.mdc.mapper.MdcDriveTypeParamConfigMapper; import org.jeecg.modules.mdc.service.IMdcDriveTypeParamConfigService; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -39,4 +41,22 @@ public List<MdcDriveTypeParamConfig> getByTypeCodeMdcShowCode(String codeTypeId) { return this.baseMapper.selectBatchIds(Arrays.asList(codeTypeId.split(","))); } + + /** + * 鑾峰彇鎺у埗绯荤粺绫诲瀷涓嬫媺妗嗛�夐」 + */ + @Override + public List<OptionsDto> getDriveParamOptions() { + List<OptionsDto> result = new ArrayList<>(); + List<String> driveParams = this.baseMapper.getDriveParamOptions(); + if (driveParams != null && !driveParams.isEmpty()) { + for (String driveParam : driveParams) { + OptionsDto optionsDto = new OptionsDto(); + optionsDto.setLabel(driveParam); + optionsDto.setValue(driveParam); + result.add(optionsDto); + } + } + return result; + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java index f7c0b2d..8244246 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java @@ -1,18 +1,18 @@ package org.jeecg.modules.mdc.service.impl; +import com.alipay.api.domain.NewsfeedMediaGiftInfo; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.apache.commons.lang3.StringUtils; +import org.checkerframework.checker.units.qual.A; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.mdc.dto.*; -import org.jeecg.modules.mdc.entity.MdcEquipment; -import org.jeecg.modules.mdc.entity.MdcUtilizationRate; +import org.jeecg.modules.mdc.entity.*; import org.jeecg.modules.mdc.mapper.MdcEfficiencyReportMapper; -import org.jeecg.modules.mdc.service.IMdcEquipmentService; -import org.jeecg.modules.mdc.service.IMdcUtilizationRateService; -import org.jeecg.modules.mdc.service.MdcEfficiencyReportService; +import org.jeecg.modules.mdc.service.*; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.*; +import org.jeecg.modules.mdc.vo.MdcUtilizationRateDto; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.service.IMdcProductionService; @@ -21,7 +21,13 @@ import javax.annotation.Resource; import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; import java.util.*; +import java.util.stream.Collectors; /** * @author: LiuS @@ -44,6 +50,12 @@ @Resource private IMdcProductionService mdcProductionService; + + @Resource + private IMdcShiftSubService mdcShiftSubService; + + @Resource + private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService; /** * 鍒╃敤鐜囨姤琛� @@ -98,7 +110,7 @@ // 閮ㄩ棬灞傜骇 List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList()); // 鏌ヨ鎵�鏈夐儴闂ㄤ俊鎭� - List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString())); + List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartName)); for (MdcEquDepDto mdcEquDepDto : equipmentList) { MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto(); @@ -278,7 +290,7 @@ // 閮ㄩ棬灞傜骇 List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList()); // 鏌ヨ鎵�鏈夐儴闂ㄤ俊鎭� - List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString())); + List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartName)); for (MdcEquDepDto mdcEquDepDto : equipmentList) { MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto(); @@ -449,10 +461,261 @@ result.setMdcEfficiencyList(listDtos); } else { // 鐝鍒╃敤鐜囩瓑绾� - List<MdcUtilizationRate> mdcUtilizationRateList = mdcUtilizationRateService.listByType("kdl"); + List<MdcUtilizationRate> mdcUtilizationRateList = mdcUtilizationRateService.listByType("bclyl"); + // 鐝鍒╃敤鐜囨暟鎹� + List<MdcEquipmentStatisticalShiftInfo> mdcEquipmentStatisticalShiftInfoList = mdcEfficiencyReportMapper.efficiencyShiftSumList(vo); + // 灏佽缁撴灉 + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList()); + // 鏌ヨ鎵�鏈夐儴闂ㄤ俊鎭� + List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartName)); + // 鐝鍚嶇О鏄剧ず澶勭悊 + String shiftSubName = ""; + if (StringUtils.isBlank(vo.getShiftId())) { + // 鍚堝苟璁惧姣忓ぉ鎵�鏈夌彮娆$殑鏁版嵁 + shiftSubName = "鍏ㄩ儴"; + } else { + List<MdcShiftSub> mdcShiftSubList = new ArrayList<>(); + if (StringUtils.isBlank(vo.getShiftSubId())) { + // 鎷兼帴鎵�閫夌彮鍒朵笅鐨勬墍鏈夌彮娆″悕绉� + mdcShiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getShiftId, vo.getShiftId()).eq(MdcShiftSub::getShiftSubStatus, "1")); + mdcEquipmentStatisticalShiftInfoList = mdcEquipmentStatisticalShiftInfoList.stream().filter(mdcEquipmentShiftRateVo -> mdcEquipmentShiftRateVo.getShiftId().equals(vo.getShiftId())).collect(Collectors.toList()); + } else { + // 璁剧疆褰撳墠閫夋嫨鐨勭彮娆″悕绉� + mdcShiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getId, vo.getShiftSubId()).eq(MdcShiftSub::getShiftSubStatus, "1")); + mdcEquipmentStatisticalShiftInfoList = mdcEquipmentStatisticalShiftInfoList.stream().filter(mdcEquipmentShiftRateVo -> mdcEquipmentShiftRateVo.getShiftId().equals(vo.getShiftId()) && mdcEquipmentShiftRateVo.getShiftSubId().equals(vo.getShiftSubId())).collect(Collectors.toList()); + } + List<String> shiftSubNames = mdcShiftSubList.stream().map(MdcShiftSub::getShiftSubName).collect(Collectors.toList()); + shiftSubName = String.join(",", shiftSubNames); + } + // 鍚堝苟鍚屼竴澶╁鐝鏁版嵁 + mdcEquipmentStatisticalShiftInfoList = this.handleEfficiencyShiftList(mdcEquipmentStatisticalShiftInfoList); + for (MdcEquDepDto mdcEquDepDto : equipmentList) { + MdcEfficiencyShiftListDto mdcEfficiencyShiftListDto = new MdcEfficiencyShiftListDto(); + mdcEfficiencyShiftListDto.setEquipmentId(mdcEquDepDto.getEquipmentId()); + mdcEfficiencyShiftListDto.setEquipmentName(mdcEquDepDto.getEquipmentName()); + mdcEfficiencyShiftListDto.setEquipmentType(mdcEquDepDto.getEquipmentType()); + mdcEfficiencyShiftListDto.setShiftSubName(shiftSubName); + switch (mdcEquDepDto.getOrgType()) { + case "1": + mdcEfficiencyShiftListDto.setLevel1(mdcEquDepDto.getDepartName()); + break; + case "2": + mdcEfficiencyShiftListDto.setLevel2(mdcEquDepDto.getDepartName()); + break; + case "3": + mdcEfficiencyShiftListDto.setLevel3(mdcEquDepDto.getDepartName()); + break; + default: + } + + SysDepart sysDepart = departList.stream().filter(depart -> depart.getId().equals(mdcEquDepDto.getParentId())).findAny().orElse(null); + if (sysDepart != null) { + switch (sysDepart.getOrgType()) { + case "1": + mdcEfficiencyShiftListDto.setLevel1(sysDepart.getDepartName()); + break; + case "2": + mdcEfficiencyShiftListDto.setLevel2(sysDepart.getDepartName()); + break; + case "3": + mdcEfficiencyShiftListDto.setLevel3(sysDepart.getDepartName()); + break; + default: + } + if (StringUtils.isNotEmpty(sysDepart.getParentId())) { + departList.stream().filter(depart -> depart.getId().equals(sysDepart.getParentId())).findAny().ifPresent(depart1 -> { + switch (depart1.getOrgType()) { + case "1": + mdcEfficiencyShiftListDto.setLevel1(depart1.getDepartName()); + break; + case "2": + mdcEfficiencyShiftListDto.setLevel2(depart1.getDepartName()); + break; + case "3": + mdcEfficiencyShiftListDto.setLevel3(depart1.getDepartName()); + break; + default: + } + }); + } + } + List<MdcEfficiencyShiftResultDto> list = new ArrayList<>(); + for (String date : dates) { + list.add(this.efficiencyShiftRate(mdcEquipmentStatisticalShiftInfoList, date, mdcEquDepDto.getEquipmentId(), mdcUtilizationRateList)); + } + mdcEfficiencyShiftListDto.setDataList(list); + listDtos.add(mdcEfficiencyShiftListDto); + } + } else { + // 浜х嚎灞傜骇 + List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList()); + // 鏌ヨ鎵�鏈変骇绾夸俊鎭� + List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString())); + + // 鐝鍚嶇О鏄剧ず澶勭悊 + String shiftSubName = ""; + if (StringUtils.isBlank(vo.getShiftId())) { + // 鍚堝苟璁惧姣忓ぉ鎵�鏈夌彮娆$殑鏁版嵁 + shiftSubName = "鍏ㄩ儴"; + } else { + List<MdcShiftSub> mdcShiftSubList = new ArrayList<>(); + if (StringUtils.isBlank(vo.getShiftSubId())) { + // 鎷兼帴鎵�閫夌彮鍒朵笅鐨勬墍鏈夌彮娆″悕绉� + mdcShiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getShiftId, vo.getShiftId()).eq(MdcShiftSub::getShiftSubStatus, "1")); + mdcEquipmentStatisticalShiftInfoList = mdcEquipmentStatisticalShiftInfoList.stream().filter(mdcEquipmentShiftRateVo -> mdcEquipmentShiftRateVo.getShiftId().equals(vo.getShiftId())).collect(Collectors.toList()); + } else { + // 璁剧疆褰撳墠閫夋嫨鐨勭彮娆″悕绉� + mdcShiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getId, vo.getShiftSubId()).eq(MdcShiftSub::getShiftSubStatus, "1")); + mdcEquipmentStatisticalShiftInfoList = mdcEquipmentStatisticalShiftInfoList.stream().filter(mdcEquipmentShiftRateVo -> mdcEquipmentShiftRateVo.getShiftId().equals(vo.getShiftId()) && mdcEquipmentShiftRateVo.getShiftSubId().equals(vo.getShiftSubId())).collect(Collectors.toList()); + } + List<String> shiftSubNames = mdcShiftSubList.stream().map(MdcShiftSub::getShiftSubName).collect(Collectors.toList()); + shiftSubName = String.join(",", shiftSubNames); + } + // 鍚堝苟鍚屼竴澶╁鐝鏁版嵁 + mdcEquipmentStatisticalShiftInfoList = this.handleEfficiencyShiftList(mdcEquipmentStatisticalShiftInfoList); + for (MdcEquProDto mdcEquProDto : equipmentList) { + MdcEfficiencyShiftListDto mdcEfficiencyShiftListDto = new MdcEfficiencyShiftListDto(); + mdcEfficiencyShiftListDto.setEquipmentId(mdcEquProDto.getEquipmentId()); + mdcEfficiencyShiftListDto.setEquipmentName(mdcEquProDto.getEquipmentName()); + mdcEfficiencyShiftListDto.setEquipmentType(mdcEquProDto.getEquipmentType()); + mdcEfficiencyShiftListDto.setShiftSubName(shiftSubName); + switch (mdcEquProDto.getOrgType()) { + case "1": + mdcEfficiencyShiftListDto.setLevel1(mdcEquProDto.getProductionName()); + break; + case "2": + mdcEfficiencyShiftListDto.setLevel2(mdcEquProDto.getProductionName()); + break; + case "3": + mdcEfficiencyShiftListDto.setLevel3(mdcEquProDto.getProductionName()); + break; + default: + } + MdcProduction mdcProduction = productionList.stream().filter(production -> production.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null); + if (mdcProduction != null) { + switch (mdcProduction.getOrgType()) { + case "1": + mdcEfficiencyShiftListDto.setLevel1(mdcProduction.getProductionName()); + break; + case "2": + mdcEfficiencyShiftListDto.setLevel2(mdcProduction.getProductionName()); + break; + case "3": + mdcEfficiencyShiftListDto.setLevel3(mdcProduction.getProductionName()); + break; + default: + } + if (StringUtils.isNotEmpty(mdcProduction.getParentId())) { + productionList.stream().filter(production -> production.getId().equals(mdcProduction.getParentId())).findAny().ifPresent(production1 -> { + switch (production1.getOrgType()) { + case "1": + mdcEfficiencyShiftListDto.setLevel1(production1.getProductionName()); + break; + case "2": + mdcEfficiencyShiftListDto.setLevel2(production1.getProductionName()); + break; + case "3": + mdcEfficiencyShiftListDto.setLevel3(production1.getProductionName()); + break; + default: + } + }); + } + } + List<MdcEfficiencyShiftResultDto> list = new ArrayList<>(); + for (String date : dates) { + list.add(this.efficiencyShiftRate(mdcEquipmentStatisticalShiftInfoList, date, mdcEquProDto.getEquipmentId(), mdcUtilizationRateList)); + } + mdcEfficiencyShiftListDto.setDataList(list); + listDtos.add(mdcEfficiencyShiftListDto); + } + } + result.setMdcEfficiencyList(listDtos); } + return result; + } + + private MdcEfficiencyShiftResultDto efficiencyShiftRate(List<MdcEquipmentStatisticalShiftInfo> mdcEquipmentStatisticalShiftInfoList, String date, String equipmentId, List<MdcUtilizationRate> mdcUtilizationRateList) { + MdcEfficiencyShiftResultDto mdcEfficiencyShiftResultDto = new MdcEfficiencyShiftResultDto(); + if (mdcEquipmentStatisticalShiftInfoList != null && !mdcEquipmentStatisticalShiftInfoList.isEmpty()) { + for (MdcEquipmentStatisticalShiftInfo equipmentStatisticalShiftInfo : mdcEquipmentStatisticalShiftInfoList) { + if (date.equals(equipmentStatisticalShiftInfo.getTheDate()) && equipmentStatisticalShiftInfo.getEquipmentId().equals(equipmentId)) { + mdcEfficiencyShiftResultDto.setTheDate(equipmentStatisticalShiftInfo.getTheDate()); + mdcEfficiencyShiftResultDto.setProcessLong(equipmentStatisticalShiftInfo.getProcessLong()); + mdcEfficiencyShiftResultDto.setUtilizationRate(equipmentStatisticalShiftInfo.getProcessLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, BigDecimal.ROUND_HALF_UP)); + mdcEfficiencyShiftResultDto.setCloseLong(equipmentStatisticalShiftInfo.getCloseLong()); + mdcEfficiencyShiftResultDto.setOpenLong(equipmentStatisticalShiftInfo.getOpenLong()); + mdcEfficiencyShiftResultDto.setWaitLong(equipmentStatisticalShiftInfo.getWaitLong()); + mdcEfficiencyShiftResultDto.setOpenRate(equipmentStatisticalShiftInfo.getOpenLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, BigDecimal.ROUND_HALF_UP)); + long rate = mdcEfficiencyShiftResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue(); + for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { + if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { + mdcEfficiencyShiftResultDto.setColor(mdcUtilizationRate.getRateParameterColor()); + } + } + } + } + } else { + mdcEfficiencyShiftResultDto.setTheDate(date); + mdcEfficiencyShiftResultDto.setProcessLong(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setUtilizationRate(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setStartRate(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setOpenRate(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setOpenLong(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setWaitLong(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setCloseLong(new BigDecimal("0")); + for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { + if (0 >= mdcUtilizationRate.getMinimumRange() && 0 < mdcUtilizationRate.getMaximumRange()) { + mdcEfficiencyShiftResultDto.setColor(mdcUtilizationRate.getRateParameterColor()); + } + } + } + if (StringUtils.isBlank(mdcEfficiencyShiftResultDto.getColor())) { + mdcEfficiencyShiftResultDto.setTheDate(date); + mdcEfficiencyShiftResultDto.setProcessLong(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setUtilizationRate(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setStartRate(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setOpenRate(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setOpenLong(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setWaitLong(new BigDecimal("0")); + mdcEfficiencyShiftResultDto.setCloseLong(new BigDecimal("0")); + for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { + if (0 >= mdcUtilizationRate.getMinimumRange() && 0 < mdcUtilizationRate.getMaximumRange()) { + mdcEfficiencyShiftResultDto.setColor(mdcUtilizationRate.getRateParameterColor()); + } + } + } + return mdcEfficiencyShiftResultDto; + } + + /** + * 鍚堝苟鍚屼竴澶╁悓鐝鏁版嵁 + * + * @param mdcEquipmentStatisticalShiftInfoList + * @return + */ + private List<MdcEquipmentStatisticalShiftInfo> handleEfficiencyShiftList(List<MdcEquipmentStatisticalShiftInfo> mdcEquipmentStatisticalShiftInfoList) { + List<MdcEquipmentStatisticalShiftInfo> result = new ArrayList<>(); + Map<String, MdcEquipmentStatisticalShiftInfo> map = new HashMap<>(); + for (MdcEquipmentStatisticalShiftInfo equipmentStatisticalShiftInfo : mdcEquipmentStatisticalShiftInfoList) { + if (map.containsKey(equipmentStatisticalShiftInfo.getEquipmentId() + "_" + equipmentStatisticalShiftInfo.getTheDate())) { + MdcEquipmentStatisticalShiftInfo vo = map.get(equipmentStatisticalShiftInfo.getEquipmentId() + "_" + equipmentStatisticalShiftInfo.getTheDate()); + vo.setProcessLong(vo.getProcessLong().add(equipmentStatisticalShiftInfo.getProcessLong())); + vo.setOpenLong(vo.getOpenLong().add(equipmentStatisticalShiftInfo.getOpenLong())); + vo.setWaitLong(vo.getWaitLong().add(equipmentStatisticalShiftInfo.getWaitLong())); + vo.setCloseLong(vo.getCloseLong().add(equipmentStatisticalShiftInfo.getCloseLong())); + vo.setTotalLong(vo.getTotalLong().add(equipmentStatisticalShiftInfo.getTotalLong())); + } else { + map.put(equipmentStatisticalShiftInfo.getEquipmentId() + "_" + equipmentStatisticalShiftInfo.getTheDate(), equipmentStatisticalShiftInfo); + } + } + for (String s : map.keySet()) { + result.add(map.get(s)); + } return result; } @@ -506,15 +769,487 @@ } result = this.efficiencyStatisticalRate(efficiencyList); if (result.getOpenRate().compareTo(new BigDecimal("0")) > 0) { - result.setOpenRate(result.getOpenRate().multiply(new BigDecimal("100")).divide(new BigDecimal(equipmentIds.size()), 2, BigDecimal.ROUND_HALF_UP)); + result.setOpenRate(result.getOpenRate().multiply(new BigDecimal("100")).divide(new BigDecimal(vo.getEquipmentIdList().size()), 2, BigDecimal.ROUND_HALF_UP)); } if (result.getUtilizationRate().compareTo(new BigDecimal("0")) > 0) { - result.setUtilizationRate(result.getUtilizationRate().multiply(new BigDecimal(100)).divide(new BigDecimal(equipmentIds.size()), 2, BigDecimal.ROUND_HALF_UP)); + result.setUtilizationRate(result.getUtilizationRate().multiply(new BigDecimal(100)).divide(new BigDecimal(vo.getEquipmentIdList().size()), 2, BigDecimal.ROUND_HALF_UP)); } if (result.getOpenLong().compareTo(new BigDecimal(0)) > 0 && result.getProcessLong().compareTo(new BigDecimal(0)) > 0) { result.setUsedOpenRate(result.getProcessLong().divide(result.getOpenLong(), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100))); } return result; + } + + /** + * 瀵规瘮鍒嗘瀽 + */ + @Override + public ComparativeAnalysisDto comparativeAnalysis(String userId, ComparativeAnalysisQueryVo vo) { + ComparativeAnalysisDto result = new ComparativeAnalysisDto(); + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(vo.getParentId()) && StringUtils.isEmpty(vo.getEquipmentId())) { + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, vo.getParentId()); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, vo.getParentId()); + } + } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) { + // 鍗曞彴璁惧淇℃伅 + vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId())); + } else { + // 鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + vo.setEquipmentIdList(equipmentIds); + } + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + return result; + } + + // 鏌ヨ鍘熷鏁版嵁 + List<MdcComAnaDto> resultDtos = mdcEfficiencyReportMapper.comparativeAnalysis(vo); + if (resultDtos != null && !resultDtos.isEmpty()) { + // 缁勮鍥惧舰鍜屼华琛ㄦ暟鎹� + List<GraphicsDto> graphicsDtos = new ArrayList<>(); + // 鑾峰彇澶╂暟 + long days = ChronoUnit.DAYS.between(LocalDate.parse(vo.getStartTime(), DateTimeFormatter.ofPattern("yyyyMMdd")), LocalDate.parse(vo.getEndTime(), DateTimeFormatter.ofPattern("yyyyMMdd"))) + 1; + BigDecimal time = new BigDecimal("24").multiply(new BigDecimal(days)).multiply(new BigDecimal("60")).multiply(new BigDecimal("60")); + for (MdcComAnaDto mdcComAnaDto : resultDtos) { + GraphicsDto graphicsDto = new GraphicsDto(); + graphicsDto.setEquipmentId(mdcComAnaDto.getEquipmentId()); + graphicsDto.setCloseLong(mdcComAnaDto.getCloseLong()); + graphicsDto.setOpenLong(mdcComAnaDto.getOpenLong()); + // 24灏忔椂鍒╃敤鐜� = 鍔犲伐鏃堕棿/24 + graphicsDto.setUtilizationRate(mdcComAnaDto.getProcessLong().divide(time, 6, BigDecimal.ROUND_HALF_UP)); + // 寮�鏈虹巼 = 寮�鏈烘椂闂� / 24 + graphicsDto.setOpenRate(mdcComAnaDto.getOpenLong().divide(time, 6, BigDecimal.ROUND_HALF_UP)); + graphicsDtos.add(graphicsDto); + } + result.setGraphics(graphicsDtos); + + List<UtilizationRateDto> tops = new ArrayList<>(); + List<UtilizationRateDto> lasts = new ArrayList<>(); + graphicsDtos.stream().sorted(Comparator.comparing(GraphicsDto::getUtilizationRate)).limit(5).forEach(graphicsDto -> { + UtilizationRateDto utilizationRateDto = new UtilizationRateDto(); + utilizationRateDto.setEquipmentId(graphicsDto.getEquipmentId()); + utilizationRateDto.setUtilizationRate(graphicsDto.getUtilizationRate()); + lasts.add(utilizationRateDto); + }); + graphicsDtos.stream().sorted(Comparator.comparing(GraphicsDto::getUtilizationRate).reversed()).limit(5).forEach(graphicsDto -> { + UtilizationRateDto utilizationRateDto = new UtilizationRateDto(); + utilizationRateDto.setEquipmentId(graphicsDto.getEquipmentId()); + utilizationRateDto.setUtilizationRate(graphicsDto.getUtilizationRate()); + tops.add(utilizationRateDto); + }); + MeterDto meterDto = new MeterDto(); + meterDto.setTops(tops); + meterDto.setLasts(lasts); + result.setMeters(meterDto); + // 缁勮楗煎浘鏁版嵁 + PieChartDto pieChartDto = new PieChartDto(); + BigDecimal openLong = new BigDecimal("0"); + BigDecimal closeLong = new BigDecimal("0"); + BigDecimal waitLong = new BigDecimal("0"); + BigDecimal processLong = new BigDecimal("0"); + for (MdcComAnaDto resultDto : resultDtos) { + openLong = openLong.add(resultDto.getOpenLong()); + closeLong = closeLong.add(resultDto.getCloseLong()); + waitLong = waitLong.add(resultDto.getWaitLong()); + processLong = processLong.add(resultDto.getProcessLong()); + } + // 寮�鏈虹巼 = 寮�鏈烘椂闀� / (24 脳 澶╂暟 脳 涓暟) + pieChartDto.setOpenRate(openLong.divide(time.multiply(new BigDecimal(resultDtos.size())), 6, BigDecimal.ROUND_HALF_UP)); + // 鍏虫満鐜� = 1 - 寮�鏈虹巼 + pieChartDto.setCloseRate(new BigDecimal("1").subtract(pieChartDto.getOpenRate())); + // 鍔犲伐鐜� = 鍔犲伐鏃堕棿 / (24 脳 澶╂暟 脳 涓暟) + pieChartDto.setProcessRate(processLong.divide(time.multiply(new BigDecimal(resultDtos.size())), 6, BigDecimal.ROUND_HALF_UP)); + // 寰呮満鐜� = 寮�鏈虹巼 - 鍔犲伐鐜� + pieChartDto.setWaitRate(pieChartDto.getOpenRate().subtract(pieChartDto.getProcessRate())); + result.setPieCharts(pieChartDto); + } + + return result; + } + + /** + * 璁惧鏃ュ埄鐢ㄧ巼 + * + * @param vo + * @return + */ + @Override + public DayUtilizationRateDto dayUtilizationRate(String userId, DayUtilizationRateQueryVo vo) { + DayUtilizationRateDto result = new DayUtilizationRateDto(); + if (StringUtils.isBlank(vo.getEquipmentId())) { + List<String> equipmentIds; + // 鑾峰彇鐢ㄦ埛鎷ユ湁璁惧鏉冮檺 + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + if (equipmentIds != null && !equipmentIds.isEmpty()) { + vo.setEquipmentId(equipmentIds.get(0)); + } + } + result.setEquipmentId(vo.getEquipmentId()); + MdcEquipment mdcEquipment = mdcEquipmentService.getOne(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, vo.getEquipmentId())); + result.setEquipmentName(mdcEquipment.getEquipmentName()); + List<String> dateList = new ArrayList<>(); + for (int i = 1; i <= 24 / vo.getTimeType(); i++) { + if (i * vo.getTimeType() < 10) { + dateList.add("0" + i * vo.getTimeType() + ":00"); + } else { + dateList.add(i * vo.getTimeType() + ":00"); + } + } + + dateList.add(0, "00:00"); + + List<DayRateDto> dayRateDtoList = new ArrayList<>(); + for (int i = 0; i < dateList.size() - 1; i++) { + DayRateDto dayRateDto = new DayRateDto(); + dayRateDto.setDateTime(dateList.get(i + 1)); + String dateTime = DateUtils.dateConvertion(vo.getDateTime()); + Date startTime = DateUtils.toDate(dateTime + " " + dateList.get(i) + ":00", DateUtils.STR_DATE_TIME_SMALL); + Date endTime = DateUtils.toDate(dateTime + " " + dateList.get(i + 1) + ":00", DateUtils.STR_DATE_TIME_SMALL); + List<MdcEquipmentRunningSection> runningSections = mdcEquipmentRunningSectionService.listEquipmentRunningSection(vo.getEquipmentId(), startTime.getTime(), endTime.getTime()); + if (runningSections != null && !runningSections.isEmpty()) { + // 鏃堕棿淇 + runningSections.get(0).setStartTime(startTime); + if (runningSections.size() > 1) { + runningSections.get(runningSections.size() - 1).setEndTime(endTime); + } else { + runningSections.get(0).setEndTime(endTime); + } + // 鍒╃敤鐜囪绠� + BigDecimal processLong = new BigDecimal("0"); + for (MdcEquipmentRunningSection runningSection : runningSections) { + if (runningSection.getStatus() == 3) { + long duration = DateUtils.differentSecond(runningSection.getStartTime(), runningSection.getEndTime()); + processLong = processLong.add(new BigDecimal(duration)); + } + } + BigDecimal totalLong = new BigDecimal(vo.getTimeType()).multiply(new BigDecimal("60")).multiply(new BigDecimal("60")); + BigDecimal utilizationRate = processLong.divide(totalLong, 6, BigDecimal.ROUND_HALF_UP); + dayRateDto.setUtilizationRate(utilizationRate); + } else { + dayRateDto.setUtilizationRate(new BigDecimal("0")); + } + dayRateDtoList.add(dayRateDto); + } + dateList.remove(0); + result.setDateList(dateList); + result.setDayRateDto(dayRateDtoList); + + return result; + } + + /** + * 璁惧鏃ュ埄鐢ㄧ巼瀵规瘮鍒嗘瀽 + * + * @param userId + * @param vo + * @return + */ + @Override + public DayUtilizationRateDto dayUtilizationRateContrast(String userId, DayUtilizationRateContrastQueryVo vo) { + DayUtilizationRateDto result = new DayUtilizationRateDto(); + if (StringUtils.isBlank(vo.getEquipmentId())) { + List<String> equipmentIds; + // 鑾峰彇鐢ㄦ埛鎷ユ湁璁惧鏉冮檺 + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + if (equipmentIds != null && !equipmentIds.isEmpty()) { + vo.setEquipmentId(equipmentIds.get(0)); + } + } + result.setEquipmentId(vo.getEquipmentId()); + MdcEquipment mdcEquipment = mdcEquipmentService.getOne(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, vo.getEquipmentId())); + result.setEquipmentName(mdcEquipment.getEquipmentName()); + Date start = DateUtils.toDate(vo.getStartDate(), DateUtils.STRDATE); + Date end = DateUtils.toDate(vo.getEndDate(), DateUtils.STRDATE); + List<String> dateList = DateUtils.getDatesStringLists(start, end); + result.setDateList(dateList); + List<String> datesStringList = DateUtils.getDatesStringList(start, end); + List<DayRateDto> dayRateDtoList = new ArrayList<>(); + for (String date : datesStringList) { + DayRateDto dayRateDto = new DayRateDto(); + String format = DateUtils.format(DateUtils.toDate(date, DateUtils.STR_DATE), DateUtils.STR_MMDD); + dayRateDto.setDateTime(format); + Date startTime = DateUtils.toDate(date + " " + vo.getStartTime() + ":00", DateUtils.STR_DATE_TIME_SMALL); + Date endTime = DateUtils.toDate(date + " " + vo.getEndTime() + ":00", DateUtils.STR_DATE_TIME_SMALL); + List<MdcEquipmentRunningSection> runningSections = mdcEquipmentRunningSectionService.listEquipmentRunningSection(vo.getEquipmentId(), startTime.getTime(), endTime.getTime()); + if (runningSections != null && !runningSections.isEmpty()) { + //鏃堕棿淇 + runningSections.get(0).setStartTime(startTime); + if (runningSections.size() > 1) { + runningSections.get(runningSections.size() - 1).setEndTime(endTime); + } else { + runningSections.get(0).setEndTime(endTime); + } + // 鍒╃敤鐜囪绠� + BigDecimal processLong = new BigDecimal("0"); + for (MdcEquipmentRunningSection runningSection : runningSections) { + if (runningSection.getStatus() == 3) { + long duration = DateUtils.differentSecond(runningSection.getStartTime(), runningSection.getEndTime()); + processLong = processLong.add(new BigDecimal(duration)); + } + } + BigDecimal totalLong = new BigDecimal(DateUtils.differentSecond(startTime, endTime)); + BigDecimal utilizationRate = processLong.divide(totalLong, 6, BigDecimal.ROUND_HALF_UP); + dayRateDto.setUtilizationRate(utilizationRate); + } else { + dayRateDto.setUtilizationRate(new BigDecimal("0")); + } + dayRateDtoList.add(dayRateDto); + } + result.setDayRateDto(dayRateDtoList); + return result; + } + + /** + * 璁惧鍒╃敤鐜囧垎娈靛垎鏋� + * + * @param userId + * @param vo + * @return + */ + @Override + public MdcUtilizationRateDto utilizationRateSectionAnalyze(String userId, DayUtilizationRateContrastQueryVo vo) { + MdcUtilizationRateDto result = new MdcUtilizationRateDto(); + List<MdcUtilizationRateListDto> listDtos = new ArrayList<>(); + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(vo.getParentId()) && StringUtils.isEmpty(vo.getEquipmentId())) { + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, vo.getParentId()); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, vo.getParentId()); + } + } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) { + // 鍗曞彴璁惧淇℃伅 + vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId())); + } else { + // 鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + vo.setEquipmentIdList(equipmentIds); + } + + List<String> dates = DateUtils.getDatesStringList2(DateUtils.getShortDate2(vo.getStartDate()), DateUtils.getShortDate2(vo.getEndDate())); + List<String> dateList = DateUtils.getDatesStringList(DateUtils.getShortDate2(vo.getStartDate()), DateUtils.getShortDate2(vo.getEndDate())); + result.setDates(dates); + String startString = vo.getStartTime(); + String endString = vo.getEndTime(); + + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + result.setMdcEfficiencyList(listDtos); + } else { + // 鍒╃敤鐜囩瓑绾� + List<MdcUtilizationRate> mdcUtilizationRateList = mdcUtilizationRateService.listByType("lyl"); + + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList()); + + for (MdcEquDepDto mdcEquDepDto : equipmentList) { + MdcUtilizationRateListDto mdcUtilizationRateListDto = new MdcUtilizationRateListDto(); + mdcUtilizationRateListDto.setEquipmentId(mdcEquDepDto.getEquipmentId()); + mdcUtilizationRateListDto.setEquipmentName(mdcEquDepDto.getEquipmentName()); + mdcUtilizationRateListDto.setEquipmentType(mdcEquDepDto.getEquipmentType()); + // + List<MdcUtilizationResultDto> list = new ArrayList<>(); + for (String date : dateList) { + Date startTime = DateUtils.toDate(date + " " + startString + ":00", DateUtils.STR_DATE_TIME_SMALL); + Date endTime = DateUtils.toDate(date + " " + endString + ":00", DateUtils.STR_DATE_TIME_SMALL); + list.add(this.utilizationRate(mdcEquDepDto.getEquipmentId(), mdcEquDepDto.getEquipmentName(), mdcEquDepDto.getEquipmentType(), startTime, endTime, date, mdcUtilizationRateList)); + } + mdcUtilizationRateListDto.setDataList(list); + listDtos.add(mdcUtilizationRateListDto); + } + + } else { + // 浜х嚎灞傜骇 + List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList()); + + for (MdcEquProDto mdcEquProDto : equipmentList) { + MdcUtilizationRateListDto mdcEfficiencyListDto = new MdcUtilizationRateListDto(); + mdcEfficiencyListDto.setEquipmentId(mdcEquProDto.getEquipmentId()); + mdcEfficiencyListDto.setEquipmentName(mdcEquProDto.getEquipmentName()); + mdcEfficiencyListDto.setEquipmentType(mdcEquProDto.getEquipmentType()); + // + List<MdcUtilizationResultDto> list = new ArrayList<>(); + for (String date : dateList) { + Date startTime = DateUtils.toDate(date + " " + startString + ":00", DateUtils.STR_DATE_TIME_SMALL); + Date endTime = DateUtils.toDate(date + " " + endString + ":00", DateUtils.STR_DATE_TIME_SMALL); + list.add(this.utilizationRate(mdcEquProDto.getEquipmentId(), mdcEquProDto.getEquipmentName(), mdcEquProDto.getEquipmentType(), startTime, endTime, date, mdcUtilizationRateList)); + } + mdcEfficiencyListDto.setDataList(list); + listDtos.add(mdcEfficiencyListDto); + } + } + result.setMdcEfficiencyList(listDtos); + } + return result; + } + + /** + * 璁惧鍒╃敤鐜囪蛋鍔垮垎鏋� + * + * @param userId + * @param vo + * @return + */ + @Override + public MdcUtilizationRateDto utilizationRateTrendAnalyze(String userId, DayUtilizationRateContrastQueryVo vo) { + MdcUtilizationRateDto result = new MdcUtilizationRateDto(); + List<MdcUtilizationRateListDto> listDtos = new ArrayList<>(); + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(vo.getParentId()) && StringUtils.isEmpty(vo.getEquipmentId())) { + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, vo.getParentId()); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, vo.getParentId()); + } + } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) { + // 鍗曞彴璁惧淇℃伅 + vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId())); + } else { + // 鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + vo.setEquipmentIdList(equipmentIds); + } + + List<String> dateList = DateUtils.getDatesStringList(DateUtils.getShortDate2(vo.getStartDate()), DateUtils.getShortDate2(vo.getEndDate())); + result.setDates(dateList); + + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + result.setMdcEfficiencyList(listDtos); + } else { + // 鍒╃敤鐜囩瓑绾� + List<MdcUtilizationRate> mdcUtilizationRateList = mdcUtilizationRateService.listByType("lyl"); + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList()); + + for (MdcEquDepDto mdcEquDepDto : equipmentList) { + MdcUtilizationRateListDto mdcEfficiencyListDto = new MdcUtilizationRateListDto(); + mdcEfficiencyListDto.setEquipmentId(mdcEquDepDto.getEquipmentId()); + mdcEfficiencyListDto.setEquipmentName(mdcEquDepDto.getEquipmentName()); + mdcEfficiencyListDto.setEquipmentType(mdcEquDepDto.getEquipmentType()); + + List<MdcUtilizationResultDto> list = new ArrayList<>(); + for (String date : dateList) { + Date startTime = DateUtils.toDate(date + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL); + Date endTime = DateUtils.toDate(date + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL); + endTime = DateUtils.addDays(endTime, 1); + list.add(this.utilizationRate(mdcEquDepDto.getEquipmentId(), mdcEquDepDto.getEquipmentName(), mdcEquDepDto.getEquipmentType(), startTime, endTime, date, mdcUtilizationRateList)); + } + mdcEfficiencyListDto.setDataList(list); + listDtos.add(mdcEfficiencyListDto); + } + + } else { + // 浜х嚎灞傜骇 + List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList()); + + for (MdcEquProDto mdcEquProDto : equipmentList) { + MdcUtilizationRateListDto mdcEfficiencyListDto = new MdcUtilizationRateListDto(); + mdcEfficiencyListDto.setEquipmentId(mdcEquProDto.getEquipmentId()); + mdcEfficiencyListDto.setEquipmentName(mdcEquProDto.getEquipmentName()); + mdcEfficiencyListDto.setEquipmentType(mdcEquProDto.getEquipmentType()); + List<MdcUtilizationResultDto> list = new ArrayList<>(); + for (String date : dateList) { + Date startTime = DateUtils.toDate(date + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL); + Date endTime = DateUtils.toDate(date + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL); + endTime = DateUtils.addDays(endTime, 1); + list.add(this.utilizationRate(mdcEquProDto.getEquipmentId(), mdcEquProDto.getEquipmentName(), mdcEquProDto.getEquipmentType(), startTime, endTime, date, mdcUtilizationRateList)); + } + mdcEfficiencyListDto.setDataList(list); + listDtos.add(mdcEfficiencyListDto); + } + } + result.setMdcEfficiencyList(listDtos); + } + + return result; + } + + private MdcUtilizationResultDto utilizationRate(String equipmentId, String equipmentName, String equipmentType, Date startTime, Date endTime, String date, List<MdcUtilizationRate> mdcUtilizationRateList) { + MdcUtilizationResultDto dto = new MdcUtilizationResultDto(); + dto.setEquipmentId(equipmentId); + dto.setEquipmentName(equipmentName); + dto.setEquipmentType(equipmentType); + dto.setTheDate(date); + List<MdcEquipmentRunningSection> runningSections = mdcEquipmentRunningSectionService.listEquipmentRunningSection(equipmentId, startTime.getTime(), endTime.getTime()); + if (runningSections != null && !runningSections.isEmpty()) { + // 鏃堕棿淇 + runningSections.get(0).setStartTime(startTime); + if (runningSections.size() > 1) { + runningSections.get(runningSections.size() - 1).setEndTime(endTime); + } else { + runningSections.get(0).setEndTime(endTime); + } + // 鍒╃敤鐜囪绠� + BigDecimal processLong = new BigDecimal("0"); + for (MdcEquipmentRunningSection runningSection : runningSections) { + if (runningSection.getStatus() == 3) { + long duration = DateUtils.differentSecond(runningSection.getStartTime(), runningSection.getEndTime()); + processLong = processLong.add(new BigDecimal(duration)); + } + } + BigDecimal totalLong = new BigDecimal(DateUtils.differentSecond(startTime, endTime)); + BigDecimal utilizationRate = processLong.divide(totalLong, 6, BigDecimal.ROUND_HALF_UP); + dto.setUtilizationRate(utilizationRate); + } else { + dto.setUtilizationRate(new BigDecimal("0")); + } + long rate = dto.getUtilizationRate().multiply(new BigDecimal("100")).longValue(); + for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { + if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { + dto.setColor(mdcUtilizationRate.getRateParameterColor()); + } + } + if (StringUtils.isBlank(dto.getColor())) { + dto.setColor(mdcUtilizationRateList.get(mdcUtilizationRateList.size() - 1).getRateParameterColor()); + } + return dto; } private StatisticalAnalysisVo efficiencyStatisticalRate(List<MdcEfficiencyDto> efficiencyList) { @@ -543,12 +1278,12 @@ mdcEfficiencyResultDto.setOpenLong(efficiencyDto.getOpenLong()); mdcEfficiencyResultDto.setWaitLong(efficiencyDto.getWaitLong()); mdcEfficiencyResultDto.setCloseLong(efficiencyDto.getCloseLong()); + long rate = efficiencyDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue(); for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { - if (efficiencyDto.getUtilizationRate().longValue() * 100 >= mdcUtilizationRate.getMinimumRange() && efficiencyDto.getUtilizationRate().longValue() * 100 < mdcUtilizationRate.getMaximumRange()) { + if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { mdcEfficiencyResultDto.setColor(mdcUtilizationRate.getRateParameterColor()); } } - } } } else { @@ -566,7 +1301,21 @@ } } } - + if (StringUtils.isBlank(mdcEfficiencyResultDto.getColor())) { + mdcEfficiencyResultDto.setTheDate(date); + mdcEfficiencyResultDto.setProcessLong(new BigDecimal("0")); + mdcEfficiencyResultDto.setUtilizationRate(new BigDecimal("0")); + mdcEfficiencyResultDto.setStartRate(new BigDecimal("0")); + mdcEfficiencyResultDto.setOpenRate(new BigDecimal("0")); + mdcEfficiencyResultDto.setOpenLong(new BigDecimal("0")); + mdcEfficiencyResultDto.setWaitLong(new BigDecimal("0")); + mdcEfficiencyResultDto.setCloseLong(new BigDecimal("0")); + for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { + if (0 >= mdcUtilizationRate.getMinimumRange() && 0 < mdcUtilizationRate.getMaximumRange()) { + mdcEfficiencyResultDto.setColor(mdcUtilizationRate.getRateParameterColor()); + } + } + } return mdcEfficiencyResultDto; } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java new file mode 100644 index 0000000..23303ef --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentAlarmAnalyzeServiceImpl.java @@ -0,0 +1,151 @@ +package org.jeecg.modules.mdc.service.impl; + +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.MdcAlarmTrendDto; +import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; +import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService; +import org.jeecg.modules.mdc.service.IMdcEquipmentService; +import org.jeecg.modules.mdc.service.MdcEquipmentAlarmAnalyzeService; +import org.jeecg.modules.mdc.util.DateUtils; +import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.*; + +/** + * @author: LiuS + * @create: 2023-09-06 17:31 + */ +@Service +public class MdcEquipmentAlarmAnalyzeServiceImpl implements MdcEquipmentAlarmAnalyzeService { + + @Resource + private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService; + + @Resource + private IMdcEquipmentService mdcEquipmentService; + + @Override + public List<MdcAlarmAnalyzeDto> alarmList(String userId, MdcAlarmAnalyzeQueryVo vo) { + List<MdcAlarmAnalyzeDto> result = new ArrayList<>(); + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(vo.getParentId()) && StringUtils.isEmpty(vo.getEquipmentId())) { + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, vo.getParentId()); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, vo.getParentId()); + } + } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) { + // 鍗曞彴璁惧淇℃伅 + vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId())); + } else { + // 鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + vo.setEquipmentIdList(equipmentIds); + } + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + return result; + } else { + vo.setStartDate(DateUtils.format(DateUtils.toDate(vo.getStartDate(), DateUtils.STRDATE), DateUtils.STR_DATE) + " 00:00:00"); + vo.setEndDate(DateUtils.format(DateUtils.addDays(DateUtils.toDate(vo.getEndDate(), DateUtils.STRDATE), 1), DateUtils.STR_DATE) + " 00:00:00"); + // 鏌ヨ + List<MdcEquipmentRunningSection> mdcEquipmentRunningSections = mdcEquipmentRunningSectionService.findAlarmList(vo); + Map<String, MdcAlarmAnalyzeDto> map = new HashMap<>(); + for (MdcEquipmentRunningSection mdcEquipmentRunningSection : mdcEquipmentRunningSections) { + if (map.containsKey(mdcEquipmentRunningSection.getAlarm())) { + MdcAlarmAnalyzeDto mdcAlarmAnalyzeDto = map.get(mdcEquipmentRunningSection.getAlarm()); + mdcAlarmAnalyzeDto.setCount(mdcAlarmAnalyzeDto.getCount() + 1); + mdcAlarmAnalyzeDto.setTimeCount(mdcAlarmAnalyzeDto.getTimeCount().add(new BigDecimal(mdcEquipmentRunningSection.getDuration()))); + map.put(mdcEquipmentRunningSection.getAlarm(), mdcAlarmAnalyzeDto); + } else { + MdcAlarmAnalyzeDto mdcAlarmAnalyzeDto = new MdcAlarmAnalyzeDto(); + mdcAlarmAnalyzeDto.setAlarmCode(mdcEquipmentRunningSection.getAlarm()); + mdcAlarmAnalyzeDto.setCount(1); + mdcAlarmAnalyzeDto.setTimeCount(new BigDecimal(mdcEquipmentRunningSection.getDuration())); + map.put(mdcEquipmentRunningSection.getAlarm(), mdcAlarmAnalyzeDto); + } + } + if (!map.isEmpty()) { + result = new ArrayList<>(map.values()); + } + } + return result; + } + + + @Override + public MdcAlarmTrendDto alarmTrend(String userId, MdcAlarmAnalyzeQueryVo vo) { + MdcAlarmTrendDto result = new MdcAlarmTrendDto(); + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(vo.getParentId()) && StringUtils.isEmpty(vo.getEquipmentId())) { + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, vo.getParentId()); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, vo.getParentId()); + } + } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) { + // 鍗曞彴璁惧淇℃伅 + vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId())); + } else { + // 鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(vo.getTypeTree())) { + // 閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + // 浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { + vo.setEquipmentIdList(equipmentIds); + } + if (vo.getEquipmentIdList() != null && !vo.getEquipmentIdList().isEmpty()) { + result.setEquipmentList(vo.getEquipmentIdList()); + List<MdcAlarmDto> equipmentCountList = new ArrayList<>(); + String startDate = DateUtils.format(DateUtils.toDate(vo.getStartDate(), DateUtils.STRDATE), DateUtils.STR_DATE) + " 00:00:00"; + String endDate = DateUtils.format(DateUtils.addDays(DateUtils.toDate(vo.getEndDate(), DateUtils.STRDATE), 1), DateUtils.STR_DATE) + " 00:00:00"; + for (String equipmentId : result.getEquipmentList()) { + MdcAlarmDto mdcAlarmDto = new MdcAlarmDto(); + mdcAlarmDto.setKey(equipmentId); + Integer count = mdcEquipmentRunningSectionService.findAlarmCount(equipmentId, startDate, endDate, vo.getAlarmCode()); + mdcAlarmDto.setCount(count); + equipmentCountList.add(mdcAlarmDto); + } + result.setEquipmentCountList(equipmentCountList); + } + + Date start = DateUtils.toDate(vo.getStartDate(), DateUtils.STRDATE); + Date end = DateUtils.toDate(vo.getEndDate(), DateUtils.STRDATE); + List<String> dateList = DateUtils.getDatesStringLists(start, end); + result.setDateList(dateList); + List<String> datesStringList = DateUtils.getDatesStringList(start, end); + List<MdcAlarmDto> dateCountList = new ArrayList<>(); + for (String date : datesStringList) { + MdcAlarmDto mdcAlarmDto = new MdcAlarmDto(); + mdcAlarmDto.setKey(DateUtils.format(DateUtils.toDate(date, DateUtils.STR_DATE), DateUtils.STR_MMDD)); + String startDate = date + " 00:00:00"; + String endDate = DateUtils.format(DateUtils.addDays(DateUtils.toDate(date, DateUtils.STR_DATE), 1), DateUtils.STR_DATE) + " 00:00:00"; + Integer count = mdcEquipmentRunningSectionService.findAlarmCountByDate(startDate, endDate, vo); + mdcAlarmDto.setCount(count); + dateCountList.add(mdcAlarmDto); + } + result.setDateCountList(dateCountList); + return result; + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java new file mode 100644 index 0000000..07d569a --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java @@ -0,0 +1,127 @@ +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.lang.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; +import org.jeecg.modules.mdc.entity.MdcNoplanClose; +import org.jeecg.modules.mdc.mapper.MdcEquipmentOvertimeMapper; +import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService; +import org.jeecg.modules.mdc.service.IMdcEquipmentService; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; + +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: 2023-08-25 + * @Version: V1.0 + */ +@Service +public class MdcEquipmentOvertimeServiceImpl extends ServiceImpl<MdcEquipmentOvertimeMapper, MdcEquipmentOvertime> implements IMdcEquipmentOvertimeService { + + @Resource + private IMdcEquipmentService mdcEquipmentService; + + @Override + public IPage<MdcEquipmentOvertime> pageList(String userId, Page<MdcEquipmentOvertime> page, MdcEquipmentOvertime mdcEquipmentOvertime, HttpServletRequest req) { + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(mdcEquipmentOvertime.getParentId()) && StringUtils.isEmpty(mdcEquipmentOvertime.getEquipmentId())) { + if ("2".equals(mdcEquipmentOvertime.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcEquipmentOvertime.getParentId()); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcEquipmentOvertime.getParentId()); + } + } else if (StringUtils.isNotEmpty(mdcEquipmentOvertime.getEquipmentId())) { + //鍗曞彴璁惧淇℃伅 + mdcEquipmentOvertime.setMdcSectionIds(Collections.singletonList(mdcEquipmentOvertime.getEquipmentId())); + } else { + //鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(mdcEquipmentOvertime.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + + if (mdcEquipmentOvertime.getMdcSectionIds() == null || mdcEquipmentOvertime.getMdcSectionIds().isEmpty()) { + mdcEquipmentOvertime.setMdcSectionIds(equipmentIds); + } + + if (mdcEquipmentOvertime.getMdcSectionIds() == null || mdcEquipmentOvertime.getMdcSectionIds().isEmpty()) { + return null; + } + return this.baseMapper.pageList(page, mdcEquipmentOvertime); + } + + /** + * 瀵煎嚭 + * + * @param userId + * @param mdcEquipmentOvertime + * @return + */ + @Override + public ModelAndView exportXls(String userId, MdcEquipmentOvertime mdcEquipmentOvertime) { + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(mdcEquipmentOvertime.getParentId()) && StringUtils.isEmpty(mdcEquipmentOvertime.getEquipmentId())) { + if ("2".equals(mdcEquipmentOvertime.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcEquipmentOvertime.getParentId()); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcEquipmentOvertime.getParentId()); + } + } else if (StringUtils.isNotEmpty(mdcEquipmentOvertime.getEquipmentId())) { + //鍗曞彴璁惧淇℃伅 + mdcEquipmentOvertime.setMdcSectionIds(Collections.singletonList(mdcEquipmentOvertime.getEquipmentId())); + } else { + //鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(mdcEquipmentOvertime.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + + if (mdcEquipmentOvertime.getMdcSectionIds() == null || mdcEquipmentOvertime.getMdcSectionIds().isEmpty()) { + mdcEquipmentOvertime.setMdcSectionIds(equipmentIds); + } + + if (mdcEquipmentOvertime.getMdcSectionIds() == null || mdcEquipmentOvertime.getMdcSectionIds().isEmpty()) { + return null; + } + // Step.2 AutoPoi 瀵煎嚭Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List<MdcEquipmentOvertime> mdcEquipmentOvertimes = this.baseMapper.list(mdcEquipmentOvertime); + // 瀵煎嚭鏂囦欢鍚嶇О + mv.addObject(NormalExcelConstants.FILE_NAME, "鍔犵彮绠$悊鍒楄〃"); + mv.addObject(NormalExcelConstants.CLASS, MdcEquipmentOvertime.class); + //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 + //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鍔犵彮绠$悊鍒楄〃鏁版嵁", "瀵煎嚭浜�:"+user.getRealname(), "鍔犵彮绠$悊")); + //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ + mv.addObject(NormalExcelConstants.DATA_LIST, mdcEquipmentOvertimes); + return mv; + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRepairServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRepairServiceImpl.java index 5b083fe..c74ce79 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRepairServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRepairServiceImpl.java @@ -12,9 +12,9 @@ import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.MdcEquipmentRepairVo; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.*; import java.util.stream.Collectors; @@ -26,8 +26,8 @@ */ @Service public class MdcEquipmentRepairServiceImpl extends ServiceImpl<MdcEquipmentRepairMapper, MdcEquipmentRepair> implements IMdcEquipmentRepairService { - //璁惧 - @Autowired + + @Resource private IMdcEquipmentService mdcEquipmentService; @Override @@ -239,4 +239,9 @@ return result; } + @Override + public List<MdcEquipmentRepair> mdcRepairListDate(String equipmentid, Date startDate, Date endDate) { + return this.baseMapper.selectByIdAndTime(equipmentid, startDate, endDate); + } + } \ No newline at end of file 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 865fa7e..2fa8719 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 @@ -10,6 +10,7 @@ import org.jeecg.modules.mdc.service.*; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.util.TimeFieldUtils; +import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; import org.jeecg.modules.mdc.vo.MdcEquipmentRunningSectionVo; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -52,23 +53,22 @@ List<MdcEquipmentRunningSection> errs = loadEquipmentErrorTrace(equipmentRunningSectionVo.getEquipmentId(), equipmentRunningSectionVo.getCollectTimeStr()); 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) { + if (StringUtils.isNotBlank(equip.getDrivetype())) { + tableName = equip.getDrivetype() + "_" + equip.getEquipmentid(); + isTableExist = equipmentWorkLineService.isTableExist(tableName); + } + } for (MdcEquipmentRunningSection entity : running) { dto = new MdcEquipmentRunningSectionDto(); BeanUtils.copyProperties(entity, dto); - if (entity.getStatus() == 3 && StringUtils.isBlank(entity.getSequenceNumber())) { - Equipment equip = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getEquipmentid, entity.getEquipmentId())); - if (equip != null) { - if (StringUtils.isNotBlank(equip.getDrivetype())) { - try { - List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipmentSequencenumber(equip.getDrivetype(), equip.getEquipmentid(), entity.getStartTime(), entity.getEndTime()); - if (esList != null && esList.size() > 1) { - dto.setSequenceNumber(esList.get(0).getSequencenumber()); - } - } catch (Exception e) { - continue; - } - - } + if (entity.getStatus() == 3 && StringUtils.isBlank(entity.getSequenceNumber()) && isTableExist) { + List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipmentSequencenumber(tableName, entity.getStartTime(), entity.getEndTime()); + if (esList != null && esList.size() > 1) { + dto.setSequenceNumber(esList.get(0).getSequencenumber()); } } dtos.add(dto); @@ -464,7 +464,7 @@ * 璁惧杩愯鐘舵�佺偣鏃堕棿杞负娈垫椂闂� */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void runningAllEquipmentTraceProcess() { //鑾峰彇鎵�鏈夎澶� List<Equipment> equipmentList = equipmentService.list(); @@ -519,8 +519,93 @@ return result; } + /** + * 璁$畻涓�娈垫椂闂村唴鐨勬暟鎹� + */ + @Override + public List<MdcEquipmentRunningSection> listEquipmentRunningSection(String equipmentid, long start, long end) { + return this.baseMapper.listEquipmentRunningSection(equipmentid, start, end); + } + + @Override + public List<MdcEquipmentRunningSection> listRunningSectionFromLog(String equipmentid, long start, long end) { + if (StringUtils.isBlank(equipmentid) || start <= 0 || end <= 0) { + return null; + } + Date startTime = DateUtils.toDate(DateUtils.longToDate(start), DateUtils.STR_DATE_TIME_SMALL); + Date endTime = DateUtils.toDate(DateUtils.longToDate(end), DateUtils.STR_DATE_TIME_SMALL); + EquipmentLog equipmentLog = equipmentLogService.getRow(equipmentid, startTime); + if (equipmentLog == null) { + return null; + } + List<EquipmentLog> logList = new ArrayList<>(); + EquipmentLog equipmentOne = new EquipmentLog(); + equipmentOne.setEquipmentId(equipmentid); + equipmentOne.setOporation(equipmentLog.getOporation()); + equipmentOne.setCollectTime(startTime); + logList.add(equipmentOne); + List<EquipmentLog> logListLast = equipmentLogService.findEquipmentLogByEndTime(equipmentid, startTime); + if (logListLast == null || logListLast.isEmpty()) { + EquipmentLog two = new EquipmentLog(); + two.setEquipmentId(equipmentid); + two.setOporation(equipmentLog.getOporation()); + two.setCollectTime(endTime); + logList.add(two); + } else { + for (EquipmentLog log : logListLast) { + if (log.getCollectTime().getTime() <= endTime.getTime()) { + logList.add(log); + } + } + } + if (logList.get(logList.size() - 1).getCollectTime().getTime() < endTime.getTime()) { + EquipmentLog two = new EquipmentLog(); + two.setEquipmentId(equipmentid); + two.setOporation(logList.get(logList.size() - 1).getOporation()); + two.setCollectTime(endTime); + logList.add(two); + } + //鐐规暟鎹浆涓烘鏁版嵁 + List<MdcEquipmentRunningSection> erts = parseLogToRunningTrace(logList); + if (erts.isEmpty()) { + return Collections.emptyList(); + } + //鏁村悎鍔犲伐鍜屽緟鏈烘椂闂村皬浜巒绉掔殑鏁版嵁 + erts = mergeLessMinTimeRecords(erts, null); + List<MdcEquipmentRunningSection> running = mergeRunningTrace(erts); + if (running != null || !running.isEmpty()) { + this.ergodicTrim(running); + } + return running; + } + + @Override + public List<MdcEquipmentRunningSection> listEquipmentRunningSectionRun(String equipmentid, long start, long end) { + return this.baseMapper.listEquipmentRunningSectionRun(equipmentid, start, end); + } + + @Override + public List<MdcEquipmentRunningSection> listEquipmentRunningSectionError(String equipmentid, long start, long end) { + return this.baseMapper.listEquipmentRunningSectionError(equipmentid, start, end); + } + + @Override + public List<MdcEquipmentRunningSection> findAlarmList(MdcAlarmAnalyzeQueryVo vo) { + return this.baseMapper.findAlarmList(vo); + } + + @Override + public Integer findAlarmCount(String equipmentId, String startDate, String endDate, String alarmCode) { + return this.baseMapper.findAlarmCount(equipmentId, startDate, endDate, alarmCode); + } + + @Override + public Integer findAlarmCountByDate(String startDate, String endDate, MdcAlarmAnalyzeQueryVo vo) { + return this.baseMapper.findAlarmCountByDate(startDate, endDate, vo); + } + private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) { - Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>(); + Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>(); List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>(); List<MdcEquipmentRunningSectionDto> waring = new ArrayList<>(); //杩愯 @@ -743,9 +828,9 @@ ert.setStartTime(logList.get(i).getCollectTime()); ert.setEndTime(logList.get(i + 1).getCollectTime()); ert.setDuration(DateUtils.differentSecond(ert.getStartTime(), ert.getEndTime())); - if (ert.getDuration() > 0) { - erts.add(ert); - } +// if (ert.getDuration() > 0) { + erts.add(ert); +// } } else { long count = differentSecond / 86400; if (count % 86400 > 0) { diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java index 45cca50..4a9d25f 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java @@ -18,6 +18,7 @@ import org.jeecg.modules.mdc.mapper.XYZAliasesMapper; import org.jeecg.modules.mdc.model.MdcEquipmentTree; import org.jeecg.modules.mdc.service.*; +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; @@ -379,76 +380,82 @@ String englishName = mdcDriveTypeParamConfig.getEnglishName(); JSONObject jsonObject = (JSONObject) JSONObject.toJSON(dto); Object result = jsonObject.get(englishName); - String value = result == null ? null : result.toString(); + String value = ""; + if ("CollectTime".equals(englishName)) { + Date date = result == null ? null : (Date) result; + value = DateUtils.format(date, DateUtils.STR_DATE_TIME_SMALL); + } else { + value = result == null ? null : result.toString(); + } mdcDriveTypeParamConfig.setValue(value); } mdcEquipmentDto.setMdcDriveTypeParamConfigList(mdcDriveTypeParamList); } } - // 璁惧鍧愭爣鏁� 鑾峰彇璁惧闇�瑕侀噰闆嗙殑鍧愭爣淇℃伅 - List<XYZAliases> equipmentCoordinateList = xyzAliasesMapper.getCoordinateByEquipmentId(mdcEquipment.getEquipmentId()); - // 璁惧閲囬泦鐨勫潗鏍囦俊鎭� - EquipmentXYZ equipmentXYZ = equipmentXYZService.getByEquipmentId(mdcEquipment.getEquipmentId()); - JSONObject jsonEquipmentXYZ = (JSONObject) JSONObject.toJSON(equipmentXYZ); - if (equipmentCoordinateList != null && !equipmentCoordinateList.isEmpty()) { - for (XYZAliases xyzAliases : equipmentCoordinateList) { - String englishName = xyzAliases.getXYZFieldName().toLowerCase(); - englishName = englishName.substring(0, 1) + "_" + englishName.substring(1, englishName.length()); - englishName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, englishName); - Object orgValue = jsonEquipmentXYZ.get(englishName); - String value = orgValue != null ? orgValue.toString() : null; - // 鍧愭爣鏁版嵁鐨則itle 鏉ヨ嚜 xyzAliases 琛�, 鏍规嵁 鏄惁鍖呭惈 absolute 鍜� machine 鍒ゆ柇鏄粷瀵瑰潗鏍囪繕鏄満搴婂潗鏍� - String title = englishName.substring(0, 1).toUpperCase(); - title = englishName.contains("absolute") ? "缁濆鍧愭爣" + title : "鏈哄簥鍧愭爣" + title; - xyzAliases.setTitle(title); - xyzAliases.setValue(value); - } - mdcEquipmentDto.setXyzAliasesList(equipmentCoordinateList); - } +// // 璁惧鍧愭爣鏁� 鑾峰彇璁惧闇�瑕侀噰闆嗙殑鍧愭爣淇℃伅 +// List<XYZAliases> equipmentCoordinateList = xyzAliasesMapper.getCoordinateByEquipmentId(mdcEquipment.getEquipmentId()); +// // 璁惧閲囬泦鐨勫潗鏍囦俊鎭� +// EquipmentXYZ equipmentXYZ = equipmentXYZService.getByEquipmentId(mdcEquipment.getEquipmentId()); +// JSONObject jsonEquipmentXYZ = (JSONObject) JSONObject.toJSON(equipmentXYZ); +// if (equipmentCoordinateList != null && !equipmentCoordinateList.isEmpty()) { +// for (XYZAliases xyzAliases : equipmentCoordinateList) { +// String englishName = xyzAliases.getXYZFieldName().toLowerCase(); +// englishName = englishName.substring(0, 1) + "_" + englishName.substring(1, englishName.length()); +// englishName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, englishName); +// Object orgValue = jsonEquipmentXYZ.get(englishName); +// String value = orgValue != null ? orgValue.toString() : null; +// // 鍧愭爣鏁版嵁鐨則itle 鏉ヨ嚜 xyzAliases 琛�, 鏍规嵁 鏄惁鍖呭惈 absolute 鍜� machine 鍒ゆ柇鏄粷瀵瑰潗鏍囪繕鏄満搴婂潗鏍� +// String title = englishName.substring(0, 1).toUpperCase(); +// title = englishName.contains("absolute") ? "缁濆鍧愭爣" + title : "鏈哄簥鍧愭爣" + title; +// xyzAliases.setTitle(title); +// xyzAliases.setValue(value); +// } +// mdcEquipmentDto.setXyzAliasesList(equipmentCoordinateList); +// } - if (equipmentXYZ != null) { - mdcEquipmentDto.setXmachine(equipmentXYZ.getXMachine()); - mdcEquipmentDto.setYmachine(equipmentXYZ.getYMachine()); - mdcEquipmentDto.setZmachine(equipmentXYZ.getZMachine()); - mdcEquipmentDto.setAmachine(equipmentXYZ.getAMachine()); - mdcEquipmentDto.setBmachine(equipmentXYZ.getBMachine()); - mdcEquipmentDto.setXabsolute(equipmentXYZ.getXAbsolute()); - mdcEquipmentDto.setYabsolute(equipmentXYZ.getYAbsolute()); - mdcEquipmentDto.setZabsolute(equipmentXYZ.getZAbsolute()); - mdcEquipmentDto.setAabsolute(equipmentXYZ.getAAbsolute()); - mdcEquipmentDto.setBabsolute(equipmentXYZ.getBAbsolute()); - } - EquipmentBaseInfo equipmentBaseInfo = equipmentBaseInfoService.getByEquipmentId(mdcEquipment.getEquipmentId()); - if (equipmentBaseInfo != null) { - mdcEquipmentDto.setMaxAxis(equipmentBaseInfo.getMaxAxis()); - mdcEquipmentDto.setValidAxis(equipmentBaseInfo.getValidAxis()); - } - if (controlSystem.getDriveType().equals("SIEMENS840DSL")) { - EquipmentTemperatureDto equipmentTemperature = equipmentTemperatureService.getEquipmentTemperature(mdcEquipment.getEquipmentId()); - if (equipmentTemperature != null) { - mdcEquipmentDto.setTemperatureX(equipmentTemperature.getX()); - mdcEquipmentDto.setTemperatureY(equipmentTemperature.getY()); - mdcEquipmentDto.setTemperatureZ(equipmentTemperature.getZ()); - mdcEquipmentDto.setTemperatureA(equipmentTemperature.getA()); - mdcEquipmentDto.setTemperatureB(equipmentTemperature.getB()); - } - EquipmentTemperatureDto equipmentLagError = equipmentTemperatureService.getEquipmentLagError(mdcEquipment.getEquipmentId()); - if (equipmentLagError != null) { - mdcEquipmentDto.setEquipmentLagErrorX(equipmentLagError.getX()); - mdcEquipmentDto.setEquipmentLagErrorY(equipmentLagError.getY()); - mdcEquipmentDto.setEquipmentLagErrorZ(equipmentLagError.getZ()); - mdcEquipmentDto.setEquipmentLagErrorA(equipmentLagError.getA()); - mdcEquipmentDto.setEquipmentLagErrorB(equipmentLagError.getB()); - } - } - EquipmentTemperatureDto equipmentCurrent = equipmentTemperatureService.getEquipmentCurrent(mdcEquipment.getEquipmentId()); - if (equipmentCurrent != null) { - mdcEquipmentDto.setEquipmentCurrentX(equipmentCurrent.getX()); - mdcEquipmentDto.setEquipmentCurrentY(equipmentCurrent.getY()); - mdcEquipmentDto.setEquipmentCurrentZ(equipmentCurrent.getZ()); - mdcEquipmentDto.setEquipmentCurrentA(equipmentCurrent.getA()); - mdcEquipmentDto.setEquipmentCurrentB(equipmentCurrent.getB()); - } +// if (equipmentXYZ != null) { +// mdcEquipmentDto.setXmachine(equipmentXYZ.getXMachine()); +// mdcEquipmentDto.setYmachine(equipmentXYZ.getYMachine()); +// mdcEquipmentDto.setZmachine(equipmentXYZ.getZMachine()); +// mdcEquipmentDto.setAmachine(equipmentXYZ.getAMachine()); +// mdcEquipmentDto.setBmachine(equipmentXYZ.getBMachine()); +// mdcEquipmentDto.setXabsolute(equipmentXYZ.getXAbsolute()); +// mdcEquipmentDto.setYabsolute(equipmentXYZ.getYAbsolute()); +// mdcEquipmentDto.setZabsolute(equipmentXYZ.getZAbsolute()); +// mdcEquipmentDto.setAabsolute(equipmentXYZ.getAAbsolute()); +// mdcEquipmentDto.setBabsolute(equipmentXYZ.getBAbsolute()); +// } +// EquipmentBaseInfo equipmentBaseInfo = equipmentBaseInfoService.getByEquipmentId(mdcEquipment.getEquipmentId()); +// if (equipmentBaseInfo != null) { +// mdcEquipmentDto.setMaxAxis(equipmentBaseInfo.getMaxAxis()); +// mdcEquipmentDto.setValidAxis(equipmentBaseInfo.getValidAxis()); +// } +// if (controlSystem.getDriveType().equals("SIEMENS840DSL")) { +// EquipmentTemperatureDto equipmentTemperature = equipmentTemperatureService.getEquipmentTemperature(mdcEquipment.getEquipmentId()); +// if (equipmentTemperature != null) { +// mdcEquipmentDto.setTemperatureX(equipmentTemperature.getX()); +// mdcEquipmentDto.setTemperatureY(equipmentTemperature.getY()); +// mdcEquipmentDto.setTemperatureZ(equipmentTemperature.getZ()); +// mdcEquipmentDto.setTemperatureA(equipmentTemperature.getA()); +// mdcEquipmentDto.setTemperatureB(equipmentTemperature.getB()); +// } +// EquipmentTemperatureDto equipmentLagError = equipmentTemperatureService.getEquipmentLagError(mdcEquipment.getEquipmentId()); +// if (equipmentLagError != null) { +// mdcEquipmentDto.setEquipmentLagErrorX(equipmentLagError.getX()); +// mdcEquipmentDto.setEquipmentLagErrorY(equipmentLagError.getY()); +// mdcEquipmentDto.setEquipmentLagErrorZ(equipmentLagError.getZ()); +// mdcEquipmentDto.setEquipmentLagErrorA(equipmentLagError.getA()); +// mdcEquipmentDto.setEquipmentLagErrorB(equipmentLagError.getB()); +// } +// } +// EquipmentTemperatureDto equipmentCurrent = equipmentTemperatureService.getEquipmentCurrent(mdcEquipment.getEquipmentId()); +// if (equipmentCurrent != null) { +// mdcEquipmentDto.setEquipmentCurrentX(equipmentCurrent.getX()); +// mdcEquipmentDto.setEquipmentCurrentY(equipmentCurrent.getY()); +// mdcEquipmentDto.setEquipmentCurrentZ(equipmentCurrent.getZ()); +// mdcEquipmentDto.setEquipmentCurrentA(equipmentCurrent.getA()); +// mdcEquipmentDto.setEquipmentCurrentB(equipmentCurrent.getB()); +// } } return mdcEquipmentDto; } @@ -469,6 +476,9 @@ } } //鏍规嵁浜х嚎闆嗗悎鏌ユ壘鎵�鏈夎澶噄d + if (allDepartIds.isEmpty()) { + return null; + } List<String> equipmentIds = this.baseMapper.queryIdsByDeparts(allDepartIds); if (StringUtils.isNotEmpty(key)) { //key涓嶄负绌猴紝鏌ヨ鎵�鏈変笅绾ч儴闂╥d @@ -515,6 +525,9 @@ } } //鏍规嵁浜х嚎闆嗗悎鏌ユ壘鎵�鏈夎澶噄d + if (allProductionIds.isEmpty()) { + return null; + } List<String> equipmentIds = this.baseMapper.queryIdsByProductions(allProductionIds); if (StringUtils.isNotEmpty(key)) { //key涓嶄负绌猴紝鏌ヨ鎵�鏈変笅绾т骇绾縤d @@ -669,4 +682,16 @@ return this.baseMapper.findEquProList(equipmentIdList); } + /** + * 鏍规嵁閮ㄩ棬灞傜骇鏌ヨ璁惧鍗曚釜 + */ + @Override + public MdcEquipment getEquipmentByDepPid(String pid, String userId) { + List<String> idsByDepart = this.getEquipmentIdsByDepart(userId, pid); + if (idsByDepart != null && !idsByDepart.isEmpty()) { + return super.getOne(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, idsByDepart.get(0))); + } + return null; + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java index 232c828..7d337b3 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java @@ -22,7 +22,7 @@ /** * @Description: 璁惧鍗曟棩杩愯鏁版嵁琛� - * @Author: jeecg-boot + * @Author: lius * @Date: 2023-04-14 * @Version: V1.0 */ diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java new file mode 100644 index 0000000..ac902e9 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java @@ -0,0 +1,717 @@ +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.apache.commons.lang.StringUtils; +import org.jeecg.modules.mdc.entity.Equipment; +import org.jeecg.modules.mdc.entity.MdcEquipmentRepair; +import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; +import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; +import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalShiftInfoMapper; +import org.jeecg.modules.mdc.service.*; +import org.jeecg.modules.mdc.util.DateUtils; +import org.jeecg.modules.mdc.vo.MdcDateVo; +import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; +import org.jeecg.modules.mdc.vo.MdcShiftDateVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Description: 璁惧鍗曟棩鐝杩愯鏁版嵁琛� + * @author: LiuS + * @create: 2023-07-24 11:19 + */ +@Service +public class MdcEquipmentStatisticalShiftInfoServiceImpl extends ServiceImpl<MdcEquipmentStatisticalShiftInfoMapper, MdcEquipmentStatisticalShiftInfo> implements IMdcEquipmentStatisticalShiftInfoService { + + @Resource + private IEquipmentService equipmentService; + + @Resource + private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService; + + @Resource + private IMdcDeviceCalendarService mdcDeviceCalendarService; + + @Resource + private IMdcEquipmentRepairService mdcEquipmentRepairService; + + /** + * 璁$畻璁惧鍗曟棩鐝杩愯鏁版嵁 + * + * @param dateTime + */ + @Override + @Transactional(rollbackFor = {Exception.class}) + public void runningAllEquipmentShiftStatisticalProcess(String dateTime) { + if (StringUtils.isNotBlank(dateTime)) { + try { + Date initDate = DateUtils.toDate(dateTime, "yyyyMMdd"); + if (initDate != null) { + this.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalShiftInfo>().eq(MdcEquipmentStatisticalShiftInfo::getTheDate, dateTime)); + } + } catch (Exception e) { + log.error("鍙傛暟鏍煎紡涓嶅", e); + } + } + List<Equipment> equipmentList = equipmentService.list(); + List<MdcEquipmentStatisticalShiftInfo> result = new ArrayList<>(); + for (Equipment equipment : equipmentList) { + List<MdcEquipmentStatisticalShiftInfo> equipmentStatisticalShiftInfoList = equipmentShiftStatisticalProcess(equipment, dateTime); + if (equipmentStatisticalShiftInfoList != null && !equipmentStatisticalShiftInfoList.isEmpty()) { + result.addAll(equipmentStatisticalShiftInfoList); + } + } + if (!result.isEmpty()) { + this.saveBatch(result); + } + } + + @Transactional(readOnly = true) + List<MdcEquipmentStatisticalShiftInfo> equipmentShiftStatisticalProcess(Equipment equipment, String dateTime) { + Date initDate = null; + //鍙栨渶鍚庣殑缁熻鏁版嵁 + if (StringUtils.isBlank(dateTime)) { + MdcEquipmentStatisticalShiftInfo nearestDate = this.baseMapper.getMaxStaticsData(equipment.getEquipmentid()); + if (nearestDate != null) { + initDate = DateUtils.toDate(nearestDate.getTheDate(), "yyyyMMdd"); + initDate = DateUtils.plusTime(initDate, 1); + } else { + //鍒濇鍙栧�� 鍙栨渶鏃╂椂闂� + MdcEquipmentRunningSection equipmentRunningSection = mdcEquipmentRunningSectionService.getFirstData(equipment.getEquipmentid()); + if (equipmentRunningSection != null) { + initDate = equipmentRunningSection.getStartTime(); + } + } + } else { + try { + initDate = DateUtils.toDate(dateTime, "yyyyMMdd"); + initDate = DateUtils.plusTime(initDate, 0); + } catch (Exception e) { + log.error("鍙傛暟鏍煎紡涓嶅", null); + return null; + } + } + if (initDate == null) { + return null; + } + Date endDate = DateUtils.plusTime(DateUtils.getNow(), 0); + if (!DateUtils.less(initDate, endDate)) { + return Collections.emptyList(); + } + //鑾峰彇涓や釜鏃堕棿娈电殑宸� + List<String> stringDates = DateUtils.getDatesStringList2(initDate, DateUtils.plusTime(endDate, -1)); + if (stringDates.isEmpty()) { + return Collections.emptyList(); + } + //鏌ヨ鐝埗鐝淇℃伅 + Map<String, List<MdcDeviceCalendarVo>> listMap = this.mdcDeviceCalendarMap(equipment.getEquipmentid(), stringDates); + if (listMap.isEmpty()) { + listMap = new HashMap<>(); + } + List<MdcEquipmentStatisticalShiftInfo> resultList = new ArrayList<>(); + for (String stringDate : stringDates) { + if (listMap.containsKey(stringDate)) { + List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = listMap.get(stringDate); + for (MdcDeviceCalendarVo mdcDeviceCalendarVo : mdcDeviceCalendarVos) { + //鐝埗鐝鏃堕棿闆嗗悎 + List<MdcShiftDateVo> datesListByMdcDeviceCalendarVo = this.getDatesListByMdcDeviceCalendarVo(mdcDeviceCalendarVo); + if (datesListByMdcDeviceCalendarVo == null || datesListByMdcDeviceCalendarVo.isEmpty()) { + break; + } + //鍚堝苟 + MdcEquipmentStatisticalShiftInfo equipmentStatisticalShiftInfo = new MdcEquipmentStatisticalShiftInfo(); + equipmentStatisticalShiftInfo.setEquipmentId(equipment.getEquipmentid()); + //澶勭悊鏃堕棿 + Date date = DateUtils.strToDate(stringDate, DateUtils.STRDATE); + equipmentStatisticalShiftInfo.setTheDate(DateUtils.format(date, DateUtils.STRDATE)); + equipmentStatisticalShiftInfo.setShiftId(mdcDeviceCalendarVo.getShiftId()); + equipmentStatisticalShiftInfo.setShiftSubId(mdcDeviceCalendarVo.getShiftSubId()); + equipmentStatisticalShiftInfo.setCreateTime(new Date()); + for (MdcShiftDateVo dates : datesListByMdcDeviceCalendarVo) { + //澶勭悊鏁版嵁 + MdcEquipmentStatisticalShiftInfo shiftInfo = this.selectRunningEquipment(dates, equipment.getEquipmentid()); + equipmentStatisticalShiftInfo.setWaitLong(equipmentStatisticalShiftInfo.getWaitLong().add(shiftInfo.getWaitLong())); + equipmentStatisticalShiftInfo.setProcessLong(equipmentStatisticalShiftInfo.getProcessLong().add(shiftInfo.getProcessLong())); + equipmentStatisticalShiftInfo.setCloseLong(equipmentStatisticalShiftInfo.getCloseLong().add(shiftInfo.getCloseLong())); + equipmentStatisticalShiftInfo.setOpenLong(equipmentStatisticalShiftInfo.getOpenLong().add(shiftInfo.getOpenLong())); + equipmentStatisticalShiftInfo.setErrorLong(equipmentStatisticalShiftInfo.getErrorLong().add(shiftInfo.getErrorLong())); + equipmentStatisticalShiftInfo.setTotalLong(equipmentStatisticalShiftInfo.getTotalLong().add(shiftInfo.getTotalLong())); + } + resultList.add(equipmentStatisticalShiftInfo); + } + } + } + return resultList; + } + + /** + * 鏌ヨ鏌愪竴澶╂煇涓彮娆$殑鏁版嵁 + * + * @param dates + * @param equipmentid + * @return + */ + private MdcEquipmentStatisticalShiftInfo selectRunningEquipment(MdcShiftDateVo dates, String equipmentid) { + if (dates == null || StringUtils.isBlank(equipmentid)) { + return null; + } + //鏌ヨ鏄惁闇�瑕佺淮淇殑璁惧 + List<MdcEquipmentRepair> repairs = mdcEquipmentRepairService.mdcRepairListDate(equipmentid, dates.getStartDate(), dates.getEndDate()); + //鍒跺害鏃堕棿娈靛唴鐨勪紤鐝拰缁翠慨鏃堕棿娈电瓫閫� + List<MdcEquipmentRepair> repairList = this.findSubRepairs(repairs, dates); + List<MdcDateVo> dateList = new ArrayList<>(); + if (repairList == null || repairList.isEmpty()) { + //鍒跺害鏃堕棿娈靛唴娌℃湁缁翠慨鍜屼紤鐝椂闂存 + MdcEquipmentStatisticalShiftInfo shiftInfo = mdcRateEquipment(equipmentid, dates.getStartDate(), dates.getEndDate()); + return shiftInfo; + } else { + if (repairList.size() == 1 ) { + long start = repairList.get(0).getStartTime().getTime(); + long end = repairList.get(0).getEndTime().getTime(); + if ( start > dates.getStart() && end < dates.getEnd() ) { + MdcDateVo d1 = new MdcDateVo(); + d1.setStartTime(dates.getStartDate()); + d1.setEndTime(repairList.get(0).getStartTime()); + dateList.add(d1); + MdcDateVo d2 = new MdcDateVo(); + d2.setStartTime(repairList.get(0).getEndTime()); + d2.setEndTime(dates.getEndDate()); + dateList.add(d2); + } else if (start == dates.getStart() && end < dates.getEnd()){ + MdcDateVo d2 = new MdcDateVo(); + d2.setStartTime(repairList.get(0).getEndTime()); + d2.setEndTime(dates.getEndDate()); + dateList.add(d2); + } else if (start > dates.getStart() && end == dates.getEnd()) { + MdcDateVo d1 = new MdcDateVo(); + d1.setStartTime(dates.getStartDate()); + d1.setEndTime(repairList.get(0).getStartTime()); + dateList.add(d1); + } else { + //浼戠彮 + MdcEquipmentStatisticalShiftInfo vo = new MdcEquipmentStatisticalShiftInfo(); + vo.setTotalLong(BigDecimal.ZERO); + vo.setErrorLong(BigDecimal.ZERO); + vo.setProcessLong(BigDecimal.ZERO); + vo.setWaitLong(BigDecimal.ZERO); + vo.setCloseLong(BigDecimal.ZERO); + vo.setOpenLong(BigDecimal.ZERO); + return vo; + } + } else { + long s = dates.getStartDate().getTime(); + for (int i = 0 ; i < repairList.size(); i ++) { + long start = repairList.get(i).getStartTime().getTime(); + long end = repairList.get(i).getEndTime().getTime(); + + if (start > s ) { + MdcDateVo d = new MdcDateVo(); + d.setStartTime(dates.getStartDate()); + d.setEndTime(repairList.get(i).getStartTime()); + if (d.getEndTime().getTime() != d.getStartTime().getTime()) { + dateList.add(d); + } + dates.setStartDate(repairList.get(i).getEndTime()); + } else if (start == s) { + dates.setStartDate(repairList.get(i).getEndTime()); + } + if(i == repairList.size() -1 ) { + if(dates.getStartDate().getTime() >= end) { + MdcDateVo d = new MdcDateVo(); + d.setStartTime(repairList.get(i).getEndTime()); + d.setEndTime(dates.getEndDate()); + if (d.getEndTime().getTime() != d.getStartTime().getTime()) { + dateList.add(d); + } + } + } + } + } + } + MdcEquipmentStatisticalShiftInfo shiftInfo = new MdcEquipmentStatisticalShiftInfo(); + for (MdcDateVo date : dateList) { + MdcEquipmentStatisticalShiftInfo v = mdcRateEquipment(equipmentid, date.getStartTime(), date.getEndTime()); + shiftInfo.setTotalLong(v.getTotalLong().add(shiftInfo.getTotalLong())); + shiftInfo.setOpenLong(v.getOpenLong().add(shiftInfo.getOpenLong())); + shiftInfo.setCloseLong(v.getCloseLong().add(shiftInfo.getCloseLong())); + shiftInfo.setWaitLong(v.getWaitLong().add(shiftInfo.getWaitLong())); + shiftInfo.setProcessLong(v.getProcessLong().add(shiftInfo.getProcessLong())); + shiftInfo.setErrorLong(v.getErrorLong().add(shiftInfo.getErrorLong())); + } + return shiftInfo; + } + + private MdcEquipmentStatisticalShiftInfo mdcRateEquipment(String equipmentid, Date startDate, Date endDate) { + MdcDateVo date = new MdcDateVo(); + date.setStartTime(startDate); + date.setEndTime(endDate); + List<MdcEquipmentRunningSection> runningSections = new ArrayList<>(); + runningSections = mdcEquipmentRunningSectionService.listEquipmentRunningSectionRun(equipmentid, startDate.getTime(), endDate.getTime()); + //鏌ヨ濡傛灉鏃犳暟鎹渶瑕� EquipmentLog 瑙f瀽 + if (runningSections == null || runningSections.isEmpty()) { + runningSections = mdcEquipmentRunningSectionService.listRunningSectionFromLog(equipmentid, startDate.getTime(), endDate.getTime()); + } + if(runningSections == null || runningSections.isEmpty()) { + runningSections = new ArrayList<>(); + } + List<MdcEquipmentRunningSection> sectionErrors = mdcEquipmentRunningSectionService.listEquipmentRunningSectionError(equipmentid, startDate.getTime(), endDate.getTime()); + + // 鎺掗櫎鍩虹閰嶇疆鎶ヨ鍙凤紙鍩虹閰嶇疆鎶ヨ鍙风殑涓嶇畻鎶ヨ锛� + //sectionErrors = filterSectionErrors(equipmentId, sectionErrors); + MdcEquipmentStatisticalShiftInfo shiftInfo = new MdcEquipmentStatisticalShiftInfo(); + BigDecimal totalLongRairs = new BigDecimal("0"); + List<MdcEquipmentRunningSection> sectionList = findStatsEquipment(null, runningSections, date, sectionErrors); + if (sectionList == null || sectionList.isEmpty()) { + shiftInfo.setEquipmentId(equipmentid); + return shiftInfo; + } + List<MdcEquipmentRunningSection> runs = new ArrayList<>(); + List<MdcEquipmentRunningSection> errs = new ArrayList<>(); + for (MdcEquipmentRunningSection section : sectionList) { + if (section.getStatus() == 22 || section.getStatus() == 0) { + errs.add(section); + } + if (section.getStatus() == 3) { + runs.add(section); + } + } + // 鍙婃�诲伐鏃� => 鏈夋晥鏃堕暱鍑� + BigDecimal totalLong = new BigDecimal(DateUtils.getSeconds(startDate, endDate)).subtract(totalLongRairs); + // 璁$畻鍔犲伐 + BigDecimal processLong = new BigDecimal("0"); + if (runs != null && !runs.isEmpty()) { + processLong = processLongInfo(runs); + } + // 鍏虫満鏁版嵁 + List<MdcEquipmentRunningSection> closes = errs.stream().filter(section -> section.getStatus() != 22).collect(Collectors.toList()); + + // 鍏虫満鏃堕暱 + BigDecimal closeLong = new BigDecimal("0"); + closeLong = closeLong(closes); + + /*鏁呴殰鏃堕棿 errs => 鍏虫満鏁版嵁 + 鎶ヨ鏁版嵁 */ + BigDecimal faultLong = new BigDecimal("0"); + faultLong = faultLongInfo(errs); + + //鎶ヨ鏁版嵁 + List<MdcEquipmentRunningSection> alarms = errs.stream().filter(section -> section.getStatus() == 22).collect(Collectors.toList()); + + //鎶ヨ鏃堕暱 + BigDecimal alarmLong = new BigDecimal("0"); + alarmLong = alarmLong(alarms); + + //寰呮満鏃堕暱 => 鏈夋晥鏃堕暱 - 杩愯鏃堕暱 - 鎶ヨ鏃堕暱 + BigDecimal waitLong = totalLong.subtract(processLong).subtract(alarmLong); + if (waitLong.compareTo(BigDecimal.ZERO) < 0) { + waitLong = new BigDecimal("0"); + } + + // 寮�鏈烘椂闀� => 鏈夋晥鏃堕暱 - 鍏虫満鏃堕暱 + BigDecimal openLong = totalLong.subtract(closeLong); + if (openLong.compareTo(BigDecimal.ZERO) < 0) { + openLong = new BigDecimal("0"); + } + + shiftInfo.setProcessLong(processLong); + shiftInfo.setTotalLong(totalLong); + shiftInfo.setWaitLong(waitLong); + shiftInfo.setErrorLong(alarmLong); + shiftInfo.setCloseLong(closeLong); + shiftInfo.setOpenLong(openLong); + return shiftInfo; + } + + /** + * 缁熻鍏虫満鏃堕暱 + */ + private BigDecimal closeLong(List<MdcEquipmentRunningSection> closes) { + BigDecimal closeLong = new BigDecimal("0"); + for (MdcEquipmentRunningSection alarm : closes) { + closeLong = closeLong.add(new BigDecimal(alarm.getDuration())); + } + return closeLong; + } + + /** + * 缁熻鎶ヨ鏃堕暱 + */ + private BigDecimal alarmLong(List<MdcEquipmentRunningSection> alarms) { + BigDecimal alarmLong = new BigDecimal("0"); + for (MdcEquipmentRunningSection alarm : alarms) { + alarmLong = alarmLong.add(new BigDecimal(alarm.getDuration())); + } + return alarmLong; + } + + /** + * 缁熻鏁呴殰鏃堕暱 + */ + private BigDecimal faultLongInfo(List<MdcEquipmentRunningSection> errs) { + BigDecimal faultLong = new BigDecimal("0"); + for (MdcEquipmentRunningSection e : errs) { + faultLong = faultLong.add(new BigDecimal(e.getDuration())); + } + return faultLong; + } + + /** + * 缁熻鍔犲伐鏃堕暱 + */ + private BigDecimal processLongInfo(List<MdcEquipmentRunningSection> runs) { + BigDecimal processLong = new BigDecimal("0"); + for (MdcEquipmentRunningSection se : runs) { + if (se.getStatus() == 3) { + processLong = processLong.add(new BigDecimal(se.getDuration())); + } + } + return processLong; + } + + private List<MdcEquipmentRunningSection> findStatsEquipment(List<MdcEquipmentRepair> repairs, List<MdcEquipmentRunningSection> sRun, MdcDateVo mdcDate, List<MdcEquipmentRunningSection> errors) { + if (sRun == null || sRun.isEmpty()) { + //鏃犳暟鎹鐞� + //TODO + return null; + } + Long startMdc = mdcDate.getStartTime().getTime(); + Long endMdc = mdcDate.getEndTime().getTime(); + if (sRun != null && !sRun.isEmpty()) { + for (int i = 0 ; i < sRun.size() ; i ++) { + Long start = sRun.get(i).getStartTime().getTime(); + Long end = sRun.get(i).getEndTime().getTime(); + if (startMdc <= start ) { + sRun.get(i).setStartTime( sRun.get(i).getStartTime()); + } else { + sRun.get(i).setStartTime(mdcDate.getStartTime()); + } + if (endMdc >= end) { + sRun.get(i).setEndTime( sRun.get(i).getEndTime()); + } else { + sRun.get(i).setEndTime(mdcDate.getEndTime()); + } + Long sen = DateUtils.differentSecond( sRun.get(i).getStartTime(), + sRun.get(i).getEndTime()); + if (sen <= 0) { + sRun.remove(i); + i--; + } else { + sRun.get(i).setDuration(sen); + sRun.get(i).setStartLong( sRun.get(i).getStartTime().getTime()); + sRun.get(i).setEndLong( sRun.get(i).getEndTime().getTime()); + } + } + } + //閮ㄥ垎鏁版嵁鏄淮淇� 1銆佽繍琛岀姸鎬佷笅鎶ヨ鎯呭喌 + List<MdcEquipmentRunningSection> faultRun = new ArrayList<>(); + //鍒跺害鏃堕棿娈靛唴鎶ヨ鏁版嵁 + if (errors != null && !errors.isEmpty() ) { + for (int i = 0 ; i < errors.size() ; i ++) { + Long start = errors.get(i).getStartTime().getTime(); + Long end = errors.get(i).getEndTime().getTime(); + if (startMdc <= start ) { + errors.get(i).setStartTime( errors.get(i).getStartTime()); + } else { + errors.get(i).setStartTime(mdcDate.getStartTime()); + } + if (endMdc >= end) { + errors.get(i).setEndTime( errors.get(i).getEndTime()); + } else { + errors.get(i).setEndTime(mdcDate.getEndTime()); + } + Long sen = DateUtils.differentSecond( errors.get(i).getStartTime(), + errors.get(i).getEndTime()); + if (sen <= 0) { + errors.remove(i); + i--; + } else { + errors.get(i).setDuration(sen); + errors.get(i).setStartLong( errors.get(i).getStartTime().getTime()); + errors.get(i).setEndLong( errors.get(i).getEndTime().getTime()); + } + } + + //鎶婅繍琛屼腑瀛樺湪鐨勬姤璀﹀墧闄ゆ帀 + for (MdcEquipmentRunningSection se : sRun) { + long runStart = se.getStartTime().getTime(); + long runEnd = se.getEndTime().getTime(); + if (se.getStatus() == 3) { + if (errors != null && !errors.isEmpty() ) { + //澶勭悊鎶ヨ鏁版嵁 + for (int i = 0 ; i < errors.size(); i ++ ) { + long errStart = errors.get(i).getStartTime().getTime(); + long errEnd = errors.get(i).getEndTime().getTime(); + // 鎶ヨ寮�濮� 灏忎簬 杩愯寮�濮� 鎶ヨ缁撴潫 灏忎簬杩愯缁撴潫 鎶ヨ缁撴潫 澶т簬 杩愯寮�濮� + if ( errStart < runStart && errEnd <= runEnd && errEnd > runStart ) { + errors.get(i).setEndTime(se.getStartTime()); + Long sen = DateUtils.differentSecond(errors.get(i).getStartTime(), + errors.get(i).getEndTime()); + errors.get(i).setDuration(sen); + errors.get(i).setStartLong(errors.get(i).getStartTime().getTime()); + errors.get(i).setEndLong(errors.get(i).getEndTime().getTime()); + } + // 鎶ヨ寮�濮� 澶т簬 杩愯寮�濮� 锛� 鎶ヨ寮�濮� 灏忎簬 杩愯缁撴潫 锛屾姤璀︾粨鏉� 澶т簬 杩愯缁撴潫 + else if (errStart >= runStart && errStart < runEnd && errEnd > runEnd ) { + errors.get(i).setStartTime(se.getEndTime()); + Long sen = DateUtils.differentSecond(errors.get(i).getStartTime(), + errors.get(i).getEndTime()); + errors.get(i).setDuration(sen); + errors.get(i).setStartLong(errors.get(i).getStartTime().getTime()); + errors.get(i).setEndLong(errors.get(i).getEndTime().getTime()); + } + // 鎶ヨ寮�濮� 澶т簬 杩愯寮�濮� 锛� 鎶ヨ寮�濮� 灏忎簬 杩愯缁撴潫 锛屾姤璀︾粨鏉� 澶т簬 杩愯寮�濮嬶紝鎶ヨ缁撴潫 灏忎簬 杩愯缁撴潫 + else if (errStart >= runStart && errStart < runEnd && + errEnd > runStart && errEnd <= runEnd ){ + errors.remove(i); + i--; + } + //濡傛灉瓒呭嚭鑼冨洿 + else if (errStart <= runStart && errStart < runEnd && + errEnd > runStart && errEnd >= runEnd ) { + MdcEquipmentRunningSection errOne = new MdcEquipmentRunningSection(); + errOne.setEndTime(errors.get(i).getEndTime()); + + errors.get(i).setStartTime(errors.get(i).getStartTime()); + errors.get(i).setEndTime(se.getStartTime()); + Long sen = DateUtils.differentSecond(errors.get(i).getStartTime(), + errors.get(i).getEndTime()); + // + + //TODO + errOne.setStatus(22); + errOne.setEquipmentId(errors.get(i).getEquipmentId()); + errOne.setStartTime(se.getEndTime()); + errors.get(i).setDuration(sen); + errors.get(i).setStartLong(errors.get(i).getStartTime().getTime()); + errors.get(i).setEndLong(errors.get(i).getEndTime().getTime()); + + Long one = DateUtils.differentSecond(errOne.getStartTime(), errOne.getEndTime()); + errOne.setDuration(one); + errOne.setStartLong(errOne.getStartTime().getTime()); + errOne.setEndLong(errOne.getEndTime().getTime()); + if (sen <= 0) { + errors.remove(i); + errors.add(i,errOne); + } else { + errors.add(i+1,errOne); + i++; + } + } else { + continue; + } + } + } + } + } + } + //澶勭悊鎶ヨ鏁版嵁 + List<MdcEquipmentRunningSection> sectionList = new ArrayList<>(); + if (sRun != null && !sRun.isEmpty()) { + for (MdcEquipmentRunningSection se : sRun) { + sectionList.add(se); + } + } + //鎶ヨ鍓旈櫎杩愯鎶ヨ + if (errors != null && !errors.isEmpty()) { + sectionList.addAll(errors); + } + //鍏虫満澶勭悊涓烘晠闅滄姤璀� + if (faultRun != null && !faultRun.isEmpty()) { + sectionList.addAll(faultRun); + } + return sectionList; + } + + private List<MdcEquipmentRepair> findSubRepairs(List<MdcEquipmentRepair> repairs, MdcShiftDateVo dates) { + if (repairs == null || repairs.isEmpty() || dates == null) { + return null; + } + for (MdcEquipmentRepair repair : repairs) { + //璋冩暣 + Date start = null; + Date end = null; + long dStart = dates.getStartDate().getTime(); + long dEnd = dates.getEndDate().getTime(); + long rStart = repair.getStartTime().getTime(); + long rEnd = repair.getEndTime().getTime(); + + if (rStart <= dStart && rEnd >= dStart && rEnd <= dEnd) { + start = dates.getStartDate(); + end = repair.getEndTime(); + } else if (rStart >= dStart && rEnd <= dEnd) { + start = repair.getStartTime(); + end = repair.getEndTime(); + } else if (rStart >= dStart && rStart <= dEnd && rEnd >= dEnd) { + start = repair.getStartTime(); + end = dates.getEndDate(); + } else if (rStart <= dStart && rEnd >= dEnd) { + start = dates.getStartDate(); + end = dates.getEndDate(); + } + repair.setStartTime(start); + repair.setEndTime(end); + //澶勭悊寮傚父鏁版嵁 + if (start == null || end == null) { + repair.setSecondLong(0); + } else { + try { + repair.setSecondLong(DateUtils.getSeconds(start, end)); + } catch (Exception e) { + repair.setSecondLong(0); + } + + } + + } + for (int i = 0; i < repairs.size(); i++) { + if (repairs.get(i).getStartTime() == null || repairs.get(i).getEndTime() == null || repairs.get(i).getSecondLong() == 0) { + repairs.remove(i); + i--; + } + } + return repairs; + } + + /** + * 鏃堕棿闂澶勭悊 濡傛灉褰撳ぉ鏈�鏈熬鏃堕棿澶т簬褰撳墠鏃堕棿 杩斿洖0 + * + * @param temp + * @return + */ + private List<MdcShiftDateVo> getDatesListByMdcDeviceCalendarVo(MdcDeviceCalendarVo temp) { + List<MdcShiftDateVo> result = new ArrayList<>(); + String startDateStr = temp.getStartDate(); + String endDateStr = temp.getEndDate(); + String sleepStartDateStr = temp.getSleepStartDate(); + String sleepEndDateStr = temp.getSleepEndDate(); + String effectiveDateStr = temp.getEffectiveDate(); + String eff = DateUtils.format(DateUtils.toDate(effectiveDateStr, DateUtils.STRDATE), DateUtils.STR_DATE); + try { + Date effectiveDate = new SimpleDateFormat("yyyyMMdd").parse(effectiveDateStr); + long startDate = getLongDate(effectiveDate, startDateStr, "false"); + long endDate = getLongDate(effectiveDate, endDateStr, temp.getIsDaySpan()); + //澶勭悊鏈�鍚庣殑鏃堕棿闂 鏄惁瓒呰繃褰撳墠鏃堕棿 濡傛灉瓒呰繃涓嶅垪鍏ヨ绠� BUG + Date endTime = null; + if ("true".equals(temp.getIsDaySpan())) { + Date day = DateUtils.toDate(effectiveDateStr, DateUtils.STRDATE); + day = DateUtils.plusTime(day, 1); + String dayTime = DateUtils.format(day, DateUtils.STR_DATE); + endTime = DateUtils.toDate(dayTime + " " + temp.getEndDate(), DateUtils.STR_DATE_TIME_SMALL); + } else { + Date day = DateUtils.toDate(effectiveDateStr, DateUtils.STRDATE); + String dayTime = DateUtils.format(day, DateUtils.STR_DATE); + endTime = DateUtils.toDate(dayTime + " " + temp.getEndDate(), DateUtils.STR_DATE_TIME_SMALL); + } + if (endTime.getTime() > DateUtils.getNow().getTime()) { + return null; + } + if (StringUtils.isNotEmpty(sleepStartDateStr)) { + long sleepStartDate = getLongDate(effectiveDate, sleepStartDateStr, "false"); + long sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, "false"); + Date start1 = DateUtils.getFormatDate(eff + " " + startDateStr, DateUtils.STR_DATE_TIME_SMALL); + Date end1 = DateUtils.getFormatDate(eff + " " + sleepStartDateStr, DateUtils.STR_DATE_TIME_SMALL); + Date start2 = DateUtils.getFormatDate(eff + " " + sleepEndDateStr, DateUtils.STR_DATE_TIME_SMALL); + Date end2 = DateUtils.getFormatDate(eff + " " + endDateStr, DateUtils.STR_DATE_TIME_SMALL); + if ("true".equals(temp.getIsDaySpan())) { + //璺ㄥぉ 鍒ゆ柇鐝寮�濮嬫椂闂村拰缁撴潫鏃堕棿鏄惁璺ㄥぉ + if (startDateStr.compareTo(endDateStr) < 0) { + //鐝寮�濮嬫椂闂村拰缁撴潫鏃堕棿閮借法澶� + startDate = getLongDate(effectiveDate, startDateStr, temp.getIsDaySpan()); + start1 = DateUtils.addDays(start1, 1); + end2 = DateUtils.addDays(end2, 1); + //鐝寮�濮嬫椂闂村拰缁撴潫鏃堕棿閮借法澶� 浼戞伅寮�濮嬫椂闂村拰缁撴潫鏃堕棿涔熶竴瀹氳法澶� + sleepStartDate = getLongDate(effectiveDate, sleepStartDateStr, temp.getIsDaySpan()); + end1 = DateUtils.addDays(end1, 1); + sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, temp.getIsDaySpan()); + start2 = DateUtils.addDays(start2, 1); + } else { + //鐝寮�濮嬫椂闂翠笉璺ㄥぉ锛� 缁撴潫鏃堕棿璺ㄥぉ + end2 = DateUtils.addDays(end2, 1); + //鍒ゆ柇浼戞伅寮�濮嬫椂闂存槸鍚﹁法澶� + if (startDateStr.compareTo(sleepStartDateStr) > 0) { + //寮�濮嬩紤鎭椂闂磋法澶╋紝 缁撴潫浼戞伅鏃堕棿涔熶竴瀹氳法澶� + sleepStartDate = getLongDate(effectiveDate, sleepStartDateStr, temp.getIsDaySpan()); + end1 = DateUtils.addDays(end1, 1); + sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, temp.getIsDaySpan()); + start2 = DateUtils.addDays(start2, 1); + } else { + //浼戞伅寮�濮嬫椂闂翠笉璺ㄥぉ, 鍒ゆ柇浼戞伅缁撴潫鏃堕棿鏄惁璺ㄥぉ + if (sleepStartDateStr.compareTo(sleepEndDateStr) > 0) { + //浼戞伅缁撴潫鏃堕棿璺ㄥぉ + sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, temp.getIsDaySpan()); + start2 = DateUtils.addDays(start2, 1); + } + } + } + + } + MdcShiftDateVo dates1 = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), startDate, sleepStartDate, effectiveDateStr, endTime, start1, end1); + result.add(dates1); + MdcShiftDateVo dates2 = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), sleepEndDate, endDate, effectiveDateStr, endTime, start2, end2); + result.add(dates2); + } else { + /*鑾峰彇鐝鐨勫紑濮嬫椂闂寸粨鏉熸椂闂�*/ + Date start = DateUtils.getFormatDate(eff + " " + startDateStr, DateUtils.STR_DATE_TIME_SMALL); + Date end = DateUtils.getFormatDate(eff + " " + endDateStr, DateUtils.STR_DATE_TIME_SMALL); + if ("true".equals(temp.getIsDaySpan())) { + if (startDateStr.compareTo(endDateStr) < 0) { + startDate = getLongDate(effectiveDate, startDateStr, temp.getIsDaySpan()); + start = DateUtils.addDays(start, 1); + } + end = DateUtils.addDays(end, 1); + } + MdcShiftDateVo dates = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), startDate, endDate, effectiveDateStr, endTime, start, end); + result.add(dates); + } + } catch (ParseException e) { + e.printStackTrace(); + } + return result; + } + + /** + * 璁惧鐝杞崲 + * + * @param equipmentid + * @param stringDates + * @return + */ + private Map<String, List<MdcDeviceCalendarVo>> mdcDeviceCalendarMap(String equipmentid, List<String> stringDates) { + List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = mdcDeviceCalendarService.listByEquipmentAndDate(equipmentid, stringDates); + if (mdcDeviceCalendarVos.isEmpty()) { + return null; + } + Map<String, List<MdcDeviceCalendarVo>> map = new HashMap<>(); + for (MdcDeviceCalendarVo mdcDeviceCalendarVo : mdcDeviceCalendarVos) { + List<MdcDeviceCalendarVo> mdcDeviceCalendarVos1; + if (map.containsKey(mdcDeviceCalendarVo.getEffectiveDate())) { + mdcDeviceCalendarVos1 = map.get(mdcDeviceCalendarVo.getEffectiveDate()); + } else { + mdcDeviceCalendarVos1 = new ArrayList<>(); + } + mdcDeviceCalendarVos1.add(mdcDeviceCalendarVo); + map.put(mdcDeviceCalendarVo.getEffectiveDate(), mdcDeviceCalendarVos1); + } + return map; + } + + private long getLongDate(Date effectiveDate, String startDateStr, String isDaySpan) { + String[] startDateArray = startDateStr.split(":"); + Calendar cal = Calendar.getInstance(); + cal.setTime(effectiveDate); + cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(startDateArray[0])); + cal.set(Calendar.MINUTE, Integer.parseInt(startDateArray[1])); + cal.set(Calendar.SECOND, Integer.parseInt(startDateArray[2])); + if ("true".equals(isDaySpan)) { + cal.add(Calendar.DAY_OF_YEAR, 1); + } + return cal.getTime().getTime(); + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java index 699683d..6ca849d 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java @@ -312,7 +312,7 @@ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("闈炶鍒掑仠鏈虹淮鎶ゅ垪琛ㄦ暟鎹�", "瀵煎嚭浜�:"+user.getRealname(), "瀵煎嚭淇℃伅")); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("闈炶鍒掑仠鏈虹淮鎶ゅ垪琛ㄦ暟鎹�", "瀵煎嚭浜�:"+user.getRealname(), "闈炶鍒掑仠鏈虹淮鎶�")); //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ mv.addObject(NormalExcelConstants.DATA_LIST, mdcNoplanCloses); return mv; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPassRateServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPassRateServiceImpl.java index da8164a..e5916d1 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPassRateServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPassRateServiceImpl.java @@ -188,7 +188,7 @@ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鍚堟牸鐜囧垪琛ㄦ暟鎹�", "瀵煎嚭浜�:" + user.getRealname(), "瀵煎嚭淇℃伅")); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鍚堟牸鐜囧垪琛ㄦ暟鎹�", "瀵煎嚭浜�:" + user.getRealname(), "鍚堟牸鐜�")); //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ mv.addObject(NormalExcelConstants.DATA_LIST, mdcPassRates); return mv; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java index 37d65a6..1082564 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java @@ -128,7 +128,7 @@ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鍔犲伐鏁伴噺鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "瀵煎嚭淇℃伅")); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鍔犲伐鏁伴噺鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "鍔犲伐鏁伴噺")); //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ mv.addObject(NormalExcelConstants.DATA_LIST, processQuantityDtos); return mv; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftServiceImpl.java index a0ee2f6..b2a49d6 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftServiceImpl.java @@ -12,7 +12,9 @@ import org.jeecg.modules.mdc.mapper.MdcShiftMapper; import org.jeecg.modules.mdc.service.IMdcShiftService; import org.jeecg.modules.mdc.service.IMdcShiftSubService; +import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -32,14 +34,11 @@ @Resource private IMdcShiftSubService mdcShiftSubService; - @Resource - private MdcShiftMapper mdcShiftMapper; - @Override public IPage<MdcShift> queryPageList(Page page, MdcShift mdcShift) { LambdaQueryWrapper<MdcShift> lambdaQueryWrapper = new LambdaQueryWrapper<>(); //鍒ゆ柇鍓嶇杩斿洖鐨勫�间腑shiftName鏄惁涓嶄负绌�,涓嶄负绌哄垯灏唖hiftName娣诲姞鍒版ā绯婃煡璇腑 - if(StringUtils.isNotBlank(mdcShift.getShiftName())){ + if (StringUtils.isNotBlank(mdcShift.getShiftName())) { lambdaQueryWrapper.like(MdcShift::getShiftName, mdcShift.getShiftName()); } return this.page(page, lambdaQueryWrapper); @@ -48,12 +47,13 @@ @Override public Boolean addShift(MdcShift mdcShift) { //鐘舵�侀粯璁や负鍚敤 - if (StringUtils.isEmpty(mdcShift.getShiftStatus())){ + if (StringUtils.isEmpty(mdcShift.getShiftStatus())) { mdcShift.setShiftStatus("1"); } + mdcShift.setDefaultShift("false"); List<MdcShift> mdcShifts = listMdcName(mdcShift); //鏌ヨ鏈夐噸澶嶆暟鎹繑鍥瀎alse - if (null != mdcShifts && !mdcShifts.isEmpty()){ + if (null != mdcShifts && !mdcShifts.isEmpty()) { return false; } return this.save(mdcShift); @@ -82,8 +82,8 @@ public Result<MdcShift> deleteShift(String id) { //杩斿洖true鏈煡鍒版暟鎹� Boolean flag = mdcShiftSubService.selectMdcShiftSub(id); - if (flag){ - if (removeById(id)){ + if (flag) { + if (removeById(id)) { return Result.OK("鍒犻櫎鎴愬姛"); } return Result.error("鏁版嵁搴撴棤璇ユ暟鎹�,鏃犳硶鍒犻櫎"); @@ -103,4 +103,22 @@ } return result; } + + /** + * 璁剧疆榛樿鐝埗 + * + * @param id + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean changeDefaultShift(String id) { + MdcShift mdcShift = this.baseMapper.selectOne(new LambdaQueryWrapper<MdcShift>().eq(MdcShift::getDefaultShift, "true")); + mdcShift.setDefaultShift("false"); + this.baseMapper.updateById(mdcShift); + MdcShift defaultShift = this.baseMapper.selectById(id); + defaultShift.setDefaultShift("true"); + this.baseMapper.updateById(defaultShift); + return true; + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftSubServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftSubServiceImpl.java index ba7f3a4..c03dac6 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftSubServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftSubServiceImpl.java @@ -14,6 +14,7 @@ import org.jeecg.modules.mdc.entity.MdcShiftSub; import org.jeecg.modules.mdc.mapper.MdcShiftSubMapper; import org.jeecg.modules.mdc.service.IMdcShiftSubService; +import org.jeecg.modules.mdc.util.DateUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -21,8 +22,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.Date; -import java.util.List; +import java.util.*; /** * @Description: 鐝琛�(娆¤〃) @@ -51,21 +51,7 @@ } @Override - public MdcShiftSub addMdcShiftSub(JSONObject jsonbject) { - MdcShiftSub mdcShiftSub = jsonbject.toJavaObject(MdcShiftSub.class); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss"); - String startDate = simpleDateFormat.format(jsonbject.getDate("startDate")); - mdcShiftSub.setStartDate(startDate); - String endDate = simpleDateFormat.format(jsonbject.getDate("endDate")); - mdcShiftSub.setEndDate(endDate); - if (jsonbject.getDate("sleepStartDate") != null) { - String sleepStartDate = simpleDateFormat.format(jsonbject.getDate("sleepStartDate")); - mdcShiftSub.setSleepStartDate(sleepStartDate); - } - if (jsonbject.getDate("sleepEndDate") != null) { - String sleepEndDate = simpleDateFormat.format(jsonbject.getDate("sleepEndDate")); - mdcShiftSub.setSleepEndDate(sleepEndDate); - } + public MdcShiftSub addMdcShiftSub(MdcShiftSub mdcShiftSub) { this.save(mdcShiftSub); return mdcShiftSub; } @@ -95,5 +81,18 @@ return Result.error("褰撳墠鏃ユ湡宸茶璁惧鏃ュ巻寮曠敤鏃犳硶鍒犻櫎"); } + @Override + public List<Map<String, String>> initShiftSubList(String shiftId) { + List<MdcShiftSub> mdcShiftSubs = this.baseMapper.selectList(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getShiftSubStatus, "1").eq(MdcShiftSub::getShiftId, shiftId)); + List<Map<String, String>> result = new ArrayList<>(); + for (MdcShiftSub mdcShiftSub : mdcShiftSubs) { + Map<String, String> map = new HashMap<>(); + map.put("label", mdcShiftSub.getShiftSubName()); + map.put("value", mdcShiftSub.getId()); + result.add(map); + } + return result; + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcStandardProcessDurationServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcStandardProcessDurationServiceImpl.java index 10e4607..7e950c2 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcStandardProcessDurationServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcStandardProcessDurationServiceImpl.java @@ -148,7 +148,7 @@ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鏍囧噯鍔犲伐鏃堕棿鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "瀵煎嚭淇℃伅")); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鏍囧噯鍔犲伐鏃堕棿鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "鏍囧噯鍔犲伐鏃堕棿")); //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ mv.addObject(NormalExcelConstants.DATA_LIST, mdcStandardProcessDurations); return mv; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java index 5c752ac..7c2348a 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java @@ -170,7 +170,7 @@ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鎵煩閰嶇疆鍒楄〃鏁版嵁", "瀵煎嚭浜�:"+user.getRealname(), "瀵煎嚭淇℃伅")); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鎵煩閰嶇疆鍒楄〃鏁版嵁", "瀵煎嚭浜�:"+user.getRealname(), "鎵煩閰嶇疆")); //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ mv.addObject(NormalExcelConstants.DATA_LIST, mdcTorqueConfigs); return mv; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcUtilizationRateServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcUtilizationRateServiceImpl.java index 8c00020..3695d73 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcUtilizationRateServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcUtilizationRateServiceImpl.java @@ -85,7 +85,15 @@ for (MdcUtilizationRate mdcUtilizationRate : list) { MdcUtilizationRateDto mdcUtilizationRateDto = new MdcUtilizationRateDto(); mdcUtilizationRateDto.setColor(mdcUtilizationRate.getRateParameterColor()); - mdcUtilizationRateDto.setTitle(mdcUtilizationRate.getMinimumRange() + "% <= " + mdcUtilizationRate.getRateParameterCategory() + " < " + mdcUtilizationRate.getMaximumRange() + "%"); + String title; + if (mdcUtilizationRate.getMinimumRange() == 0) { + title = mdcUtilizationRate.getRateParameterCategory() + " < " + mdcUtilizationRate.getMaximumRange() + "%"; + } else if (mdcUtilizationRate.getMaximumRange() == 100){ + title = mdcUtilizationRate.getRateParameterCategory() + ">= " + mdcUtilizationRate.getMinimumRange() + "%"; + } else { + title = mdcUtilizationRate.getMinimumRange() + "% <= " + mdcUtilizationRate.getRateParameterCategory() + " < " + mdcUtilizationRate.getMaximumRange() + "%"; + } + mdcUtilizationRateDto.setTitle(title); result.add(mdcUtilizationRateDto); } return result; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcVacationManagementServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcVacationManagementServiceImpl.java index 32aa32b..33fb1af 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcVacationManagementServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcVacationManagementServiceImpl.java @@ -6,15 +6,22 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import net.sf.saxon.expr.Component; import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.entity.MdcEquipment; +import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; import org.jeecg.modules.mdc.entity.MdcVacationManagement; import org.jeecg.modules.mdc.mapper.MdcVacationManagementMappper; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.service.IMdcVacationManagementService; import org.jeecg.modules.mdc.util.DateUtils; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.text.ParseException; @@ -145,4 +152,60 @@ } } + + @Override + public ModelAndView exportXls(String userId, MdcVacationManagement mdcVacationManagement) { + LambdaQueryWrapper<MdcVacationManagement> queryWrapper = new LambdaQueryWrapper<>(); + //鏌ヨ鐢ㄦ埛鎵�鎷ユ湁鐨勮澶囦俊鎭� + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(mdcVacationManagement.getParentId()) && StringUtils.isEmpty(mdcVacationManagement.getEquipmentId())) { + if ("2".equals(mdcVacationManagement.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = equipmentService.getEquipmentIdsByDepart(userId, mdcVacationManagement.getParentId()); + } else { + //浜х嚎灞傜骇 + equipmentIds = equipmentService.getEquipmentIdsProduction(userId, mdcVacationManagement.getParentId()); + } + } else if (StringUtils.isNotEmpty(mdcVacationManagement.getEquipmentId())) { + //鍗曞彴璁惧淇℃伅 + mdcVacationManagement.setMdcSectionIds(Collections.singletonList(mdcVacationManagement.getEquipmentId())); + } else { + //鏌ヨ鐢ㄦ埛鎵�鎷ユ湁鐨勮澶囦俊鎭� + if ("2".equals(mdcVacationManagement.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = equipmentService.getEquipmentIdsByDepart(userId, null); + } else { + equipmentIds = equipmentService.getEquipmentIdsProduction(userId, null); + } + } + if (mdcVacationManagement.getMdcSectionIds() == null || mdcVacationManagement.getMdcSectionIds().isEmpty()) { + mdcVacationManagement.setMdcSectionIds(equipmentIds); + } + if (mdcVacationManagement.getMdcSectionIds() == null || mdcVacationManagement.getMdcSectionIds().isEmpty()) { + return null; + } else { + queryWrapper.in(MdcVacationManagement::getEquipmentId, mdcVacationManagement.getMdcSectionIds()); + } + if (StringUtils.isNotEmpty(mdcVacationManagement.getEquipmentId())) { + queryWrapper.like(MdcVacationManagement::getEquipmentId, mdcVacationManagement.getEquipmentId()); + } + if (StringUtils.isNotEmpty(mdcVacationManagement.getEquipmentName())) { + queryWrapper.like(MdcVacationManagement::getEquipmentName, mdcVacationManagement.getEquipmentName()); + } + if (StringUtils.isNotEmpty(mdcVacationManagement.getStartTime()) && StringUtils.isNotEmpty(mdcVacationManagement.getEndTime())) { + queryWrapper.between(MdcVacationManagement::getVacationDate, mdcVacationManagement.getStartTime(), mdcVacationManagement.getEndTime()); + } + queryWrapper.orderByAsc(MdcVacationManagement::getVacationDate); + // Step.2 AutoPoi 瀵煎嚭Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List<MdcVacationManagement> mdcStandardProcessDurations = this.baseMapper.selectList(queryWrapper); + // 瀵煎嚭鏂囦欢鍚嶇О + mv.addObject(NormalExcelConstants.FILE_NAME, "鍋囨湡绠$悊鍒楄〃"); + mv.addObject(NormalExcelConstants.CLASS, MdcVacationManagement.class); + //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鍋囨湡绠$悊鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "鍋囨湡绠$悊")); + mv.addObject(NormalExcelConstants.DATA_LIST, mdcStandardProcessDurations); + return mv; + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java index 5aa4da8..75c7f8e 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java @@ -1,6 +1,8 @@ package org.jeecg.modules.mdc.util; +import io.swagger.models.auth.In; + import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.ParseException; @@ -73,10 +75,11 @@ } /** - * @return 鑾峰彇涓や釜date鐨勬椂闂村樊锛岀粨鏋滀负绉� + * @return 鑾峰彇涓や釜date鐨勬椂闂村樊锛岀粨鏋滀负绉� 闄� */ public static long differentSecond(Date startDate, Date endDate) { - return (endDate.getTime() - startDate.getTime()) / 1000; + return new BigDecimal(endDate.getTime() - startDate.getTime()).divide(new BigDecimal("1000"), 0, BigDecimal.ROUND_HALF_UP).longValue(); +// return (endDate.getTime() - startDate.getTime()) / 1000; } /** @@ -162,6 +165,7 @@ public static final String STR_DATE_TIME_FULL = "yyyyMMddHHmmssSSS"; public static final String STR_HHMMSS = "HH:mm:ss"; public static final String STR_HHMM = "HH:mm"; + public static final String STR_MMDD = "MM-dd"; /** * <p> @@ -670,6 +674,26 @@ return list; } + /** + * 鑾峰彇start/end鐨勬墍鏈夋棩鏈熷瓧绗︿覆 鏍煎紡MM-dd + * + * @param start + * @param end + * @return + */ + public static List<String> getDatesStringLists(Date start, Date end) { + List<String> list = new ArrayList<>(); + int i = getDays(start, end); + for (int j = 0; j <= i; j++) { + if (j == 0) { + list.add(format(start, STR_MMDD)); + } else { + list.add(format(plusTime(start, j), STR_MMDD)); + } + } + return list; + } + public static List<String> getMonthBetween(Date start, Date end) { List<String> list = new ArrayList<>(); Calendar min = Calendar.getInstance(); @@ -1011,4 +1035,48 @@ dateList.forEach(localDate -> result.add(Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()))); return result; } + + /** + * @param smallDate + * @param bigDate + * @desc 鑾峰彇涓や釜鏃ユ湡涔嬮棿鐨勫ぉ鏁� + */ + public static Integer getDaysBetween(String smallDate, String bigDate) throws ParseException { + // 鏃ユ湡鏍煎紡 + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + // 鑾峰彇涓や釜鏃ユ湡鐨勬椂闂存埑 + Calendar cal = Calendar.getInstance(); + cal.setTime(sdf.parse(smallDate)); + long smallTime = cal.getTimeInMillis(); + cal.setTime(sdf.parse(bigDate)); + long bigTime = cal.getTimeInMillis(); + // 鐩稿樊鐨勬棩鏈� + long days = (bigTime - smallTime) / (1000 * 3600 * 24); + // long杞琲nt 瀛樺湪婧㈠嚭鎯呭喌 鏍规嵁涓氬姟鎯呭喌缂栬緫catch涓繑鍥炲�� + try { + return Integer.parseInt(String.valueOf(days)); + } catch (NumberFormatException e) { + e.printStackTrace(); + return 0; + } + } + + /** + * 鏃ユ湡杞崲锛屽皢鎺ュ彛杩斿洖鐨�20180524杞负2018-05-24 + * + * @param str + * @return + */ + public static String dateConvertion(String str) { + Date parse = null; + String dateString = ""; + try { + parse = new SimpleDateFormat("yyyyMMdd").parse(str); + dateString = new SimpleDateFormat("yyyy-MM-dd").format(parse); + } catch (ParseException e) { + dateString = null; + } + + return dateString; + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/ThrowableUtil.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/ThrowableUtil.java new file mode 100644 index 0000000..a6a9908 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/ThrowableUtil.java @@ -0,0 +1,25 @@ +package org.jeecg.modules.mdc.util; + +import java.io.PrintWriter; +import java.io.StringWriter; + +/** + * 寮傚父宸ュ叿 + * + * @author: LiuS + * @create: 2023-08-07 16:42 + */ +public class ThrowableUtil { + + /** + * 鑾峰彇鍫嗘爤淇℃伅 + */ + public static String getStackTrace(Throwable throwable) { + StringWriter sw = new StringWriter(); + try (PrintWriter pw = new PrintWriter(sw)) { + throwable.printStackTrace(pw); + return sw.toString(); + } + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/ComparativeAnalysisQueryVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/ComparativeAnalysisQueryVo.java new file mode 100644 index 0000000..09cbd35 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/ComparativeAnalysisQueryVo.java @@ -0,0 +1,44 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-07-31 09:51 + */ +@Data +public class ComparativeAnalysisQueryVo { + + /** + * 璁惧绫诲瀷 + */ + private String driveType; + + /** + * 寮�濮嬫椂闂� -> 20220101 + */ + private String startTime; + /** + * 缁撴潫鏃堕棿 -> 20220101 + */ + private String endTime; + /** + * 鏍戠被鍨� -> 1:杞﹂棿灞傜骇 2:閮ㄩ棬灞傜骇 + */ + private String typeTree; + /** + * 灞傜骇ID + */ + private String parentId; + /** + * 璁惧Id + */ + private String equipmentId; + + /** + * 璁惧ids + */ + private List<String> equipmentIdList; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayRateDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayRateDto.java new file mode 100644 index 0000000..8fe2b46 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayRateDto.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author: LiuS + * @create: 2023-08-01 15:28 + */ +@Data +public class DayRateDto { + + private String dateTime; + private BigDecimal utilizationRate; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayUtilizationRateContrastQueryVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayUtilizationRateContrastQueryVo.java new file mode 100644 index 0000000..a84b779 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayUtilizationRateContrastQueryVo.java @@ -0,0 +1,48 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-08-02 13:50 + */ +@Data +public class DayUtilizationRateContrastQueryVo { + + /** + * 鏃ユ湡 -> 20220101 + */ + private String startDate; + /** + * 鏃ユ湡 -> 20220101 + */ + private String endDate; + + /** + * 璁惧Id + */ + private String equipmentId; + /** + * 鏍戠被鍨� -> 1:杞﹂棿灞傜骇 2:閮ㄩ棬灞傜骇 + */ + private String typeTree; + /** + * 鏃堕棿娈� + */ + private String startTime; + /** + * 鏃堕棿娈� + */ + private String endTime; + /** + * 灞傜骇ID + */ + private String parentId; + /** + * 璁惧ids + */ + private List<String> equipmentIdList; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayUtilizationRateQueryVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayUtilizationRateQueryVo.java new file mode 100644 index 0000000..1994ea2 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/DayUtilizationRateQueryVo.java @@ -0,0 +1,35 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; + +/** + * @author: LiuS + * @create: 2023-08-01 14:33 + */ +@Data +public class DayUtilizationRateQueryVo { + + /** + * 鏃ユ湡 -> 20220101 + */ + private String dateTime; + + /** + * 璁惧Id + */ + private String equipmentId; + /** + * 璁惧鍚嶇О + */ + private String equipmentName; + /** + * 鏍戠被鍨� -> 1:杞﹂棿灞傜骇 2:閮ㄩ棬灞傜骇 + */ + private String typeTree; + /** + * 鏃堕棿闂撮殧 + */ + private Integer timeType; + + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentCalendarVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentCalendarVo.java index cd9e110..1a4fef1 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentCalendarVo.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/EquipmentCalendarVo.java @@ -4,6 +4,7 @@ import lombok.Data; import java.time.LocalDate; +import java.util.List; /** * @author: LiuS @@ -13,28 +14,9 @@ public class EquipmentCalendarVo { private String equipmentId; - /** - * 寮�濮嬫椂闂� - */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - private LocalDate takeEffectDate; - /** - * 缁撴潫鏃堕棿 - */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - private LocalDate invalidDate; - private String monShiftId; + private List<String> dateList; - private String tueShiftId; + private String shiftId; - private String wedShiftId; - - private String thuShiftId; - - private String friShiftId; - - private String satShiftId; - - private String sunShiftId; } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcAlarmAnalyzeQueryVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcAlarmAnalyzeQueryVo.java new file mode 100644 index 0000000..f6bc979 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcAlarmAnalyzeQueryVo.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-09-07 11:17 + */ +@Data +public class MdcAlarmAnalyzeQueryVo { + + /** + * 鏃ユ湡 -> 20220101 + */ + private String startDate; + /** + * 鏃ユ湡 -> 20220101 + */ + private String endDate; + /** + * 璁惧Id + */ + private String equipmentId; + /** + * 鏍戠被鍨� -> 1:杞﹂棿灞傜骇 2:閮ㄩ棬灞傜骇 + */ + private String typeTree; + /** + * 灞傜骇ID + */ + private String parentId; + /** + * 璁惧ids + */ + private List<String> equipmentIdList; + /** + * 鎶ヨ鍙� + */ + private String alarmCode; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDateVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDateVo.java new file mode 100644 index 0000000..77fc75d --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDateVo.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; + +import java.util.Date; + +/** + * @author: LiuS + * @create: 2023-07-27 09:58 + */ +@Data +public class MdcDateVo { + private Date startTime; + private Date endTime; + private Long start; + private Long end; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDeviceCalendarVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDeviceCalendarVo.java index e52b641..e6f60d0 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDeviceCalendarVo.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcDeviceCalendarVo.java @@ -17,5 +17,5 @@ private String sleepEndDate; private String isDaySpan; private String equipmentName; - private String equipmentId; +// private String equipmentId; } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcShiftDateVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcShiftDateVo.java new file mode 100644 index 0000000..a9b4f6a --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcShiftDateVo.java @@ -0,0 +1,106 @@ +package org.jeecg.modules.mdc.vo; + + +import java.util.Date; + +/** + * @author: LiuS + * @create: 2023-07-25 10:32 + */ +public class MdcShiftDateVo { + + private String shiftId; + + private String shiftSubId; + + private long start; + + private long end; + + private String day; + + private Date endTime; + /** + * 寮�濮嬫椂闂� + */ + private Date startDate; + /** + * 缁撴潫鏃堕棿 + */ + private Date endDate; + + public String getShiftId() { + return shiftId; + } + + public void setShiftId(String shiftId) { + this.shiftId = shiftId; + } + + public String getShiftSubId() { + return shiftSubId; + } + + public void setShiftSubId(String shiftSubId) { + this.shiftSubId = shiftSubId; + } + + public long getStart() { + return start; + } + + public void setStart(long start) { + this.start = start; + } + + public long getEnd() { + return end; + } + + public void setEnd(long end) { + this.end = end; + } + + public String getDay() { + return day; + } + + public void setDay(String day) { + this.day = day; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public MdcShiftDateVo(String shiftId, String shiftSubId, long start, long end, String day, Date endTime, Date startDate, Date endDate) { + this.shiftId = shiftId; + this.shiftSubId = shiftSubId; + this.start = start; + this.end = end; + this.day = day; + this.endTime = endTime; + this.startDate = startDate; + this.endDate = endDate; + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationRateDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationRateDto.java new file mode 100644 index 0000000..2a97da1 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationRateDto.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-08-04 11:36 + */ +@Data +public class MdcUtilizationRateDto { + + /** + * 鍒╃敤鐜囨暟鎹� + */ + private List<MdcUtilizationRateListDto> mdcEfficiencyList; + + private List<String> dates; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationRateListDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationRateListDto.java new file mode 100644 index 0000000..1da1068 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationRateListDto.java @@ -0,0 +1,30 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-08-04 11:37 + */ +@Data +public class MdcUtilizationRateListDto { + + /** + * 璁惧缂栫爜 + */ + private String equipmentId; + /** + * 璁惧鍚嶇О + */ + private String equipmentName; + /** + * 璁惧绫诲瀷 + */ + private String equipmentType; + /** + * 鍒╃敤鐜囨暟鎹� + */ + private List<MdcUtilizationResultDto> dataList; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationResultDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationResultDto.java new file mode 100644 index 0000000..4f63d46 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcUtilizationResultDto.java @@ -0,0 +1,37 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author: LiuS + * @create: 2023-08-04 13:47 + */ +@Data +public class MdcUtilizationResultDto { + /** + * 璁惧缂栫爜 + */ + private String equipmentId; + /** + * 璁惧鍚嶇О + */ + private String equipmentName; + /** + * 璁惧绫诲瀷 + */ + private String equipmentType; + /** + * 鏈夋晥鏃ユ湡 + */ + private String theDate; + /** + * 鍒╃敤鐜� + */ + private BigDecimal utilizationRate; + /** + * 棰滆壊 + */ + private String color; +} diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/controller/SysQuartzLogController.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/controller/SysQuartzLogController.java new file mode 100644 index 0000000..533f6ea --- /dev/null +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/controller/SysQuartzLogController.java @@ -0,0 +1,61 @@ +package org.jeecg.modules.quartz.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.shiro.SecurityUtils; +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.vo.LoginUser; +import org.jeecg.modules.quartz.dto.SysQuartzLogDto; +import org.jeecg.modules.quartz.entity.SysQuartzLog; +import org.jeecg.modules.quartz.service.ISysQuartzLogService; +import org.jeecg.modules.quartz.vo.SysQuartzLogVo; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +/** + * @Description: 瀹氭椂浠诲姟鏃ュ織 + * @author: LiuS + * @create: 2023-08-05 14:01 + */ +@Slf4j +@Api(tags = "瀹氭椂浠诲姟鏃ュ織鎺ュ彛") +@RestController +@RequestMapping("/sys/quartzLog") +public class SysQuartzLogController extends JeecgController<SysQuartzLog, ISysQuartzLogService> { + + @Resource + private ISysQuartzLogService sysQuartzLogService; + + @AutoLog(value = "瀹氭椂浠诲姟鏃ュ織鎺ュ彛-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "瀹氭椂浠诲姟鏃ュ織鎺ュ彛-鍒嗛〉鍒楄〃鏌ヨ", notes = "瀹氭椂浠诲姟鏃ュ織鎺ュ彛-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<IPage<SysQuartzLogDto>> queryList(SysQuartzLogVo sysQuartzLogVo, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + if (StringUtils.isBlank(sysQuartzLogVo.getJobId())) { + return Result.error("浠诲姟ID涓嶈兘涓虹┖锛�"); + } + IPage<SysQuartzLogDto> result = sysQuartzLogService.pageList(pageNo, pageSize, sysQuartzLogVo); + return Result.OK(result); + } + + @AutoLog(value = "瀹氭椂浠诲姟鏃ュ織鎺ュ彛-瀵煎嚭") + @ApiOperation(value = "瀹氭椂浠诲姟鏃ュ織鎺ュ彛-瀵煎嚭", notes = "瀹氭椂浠诲姟鏃ュ織鎺ュ彛-瀵煎嚭") + @RequestMapping("/exportXls") + public ModelAndView exportXls(HttpServletRequest request, SysQuartzLogVo sysQuartzLogVo) { + return this.sysQuartzLogService.exportXls(sysQuartzLogVo); + } + + +} diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/dto/SysQuartzLogDto.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/dto/SysQuartzLogDto.java new file mode 100644 index 0000000..df21fa9 --- /dev/null +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/dto/SysQuartzLogDto.java @@ -0,0 +1,37 @@ +package org.jeecg.modules.quartz.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @author: LiuS + * @create: 2023-08-05 14:05 + */ +@Data +public class SysQuartzLogDto { + + @Excel(name = "浠诲姟鍚嶇О", width = 40) + private String jobName; + @Excel(name = "浠诲姟绫诲悕", width = 40) + private String jobClassName; + @Excel(name = "cron琛ㄨ揪寮�", width = 30) + private String cronExpression; + @Excel(name = "鍙傛暟", width = 15) + private String parameter; + @Excel(name = "鎻忚堪", width = 40) + private String description; + @Excel(name = "鎶ラ敊淇℃伅", width = 50) + private String exceptionDetail; + @Excel(name = "鎴愬姛鏍囧織 0鎴愬姛 -1澶辫触", width = 15) + private Integer isSuccess; + @Excel(name = "鎵ц鏃堕棿", width = 15) + private Integer executionTime; + @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") + private Date createTime; +} diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/entity/QuartzJob.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/entity/QuartzJob.java index 9fd7e02..6631ed2 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/entity/QuartzJob.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/entity/QuartzJob.java @@ -42,6 +42,9 @@ @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private java.util.Date updateTime; + /**浠诲姟鍚嶇О*/ + @Excel(name="浠诲姟鍚嶇О",width=15) + private String jobName; /**浠诲姟绫诲悕*/ @Excel(name="浠诲姟绫诲悕",width=40) private java.lang.String jobClassName; diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/entity/SysQuartzLog.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/entity/SysQuartzLog.java new file mode 100644 index 0000000..dbe3a6d --- /dev/null +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/entity/SysQuartzLog.java @@ -0,0 +1,77 @@ +package org.jeecg.modules.quartz.entity; + +import java.io.Serializable; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +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 com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; + +/** + * @Description: 瀹氭椂浠诲姟鏃ュ織 + * @Author: Lius + * @Date: 2023-08-05 + * @Version: V1.0 + */ +@Data +@TableName("sys_quartz_log") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "sys_quartz_log瀵硅薄", description = "瀹氭椂浠诲姟鏃ュ織") +public class SysQuartzLog implements Serializable { + + private static final long serialVersionUID = 1804183004277004124L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private String id; + /** + * 浠诲姟id + */ + @Excel(name = "浠诲姟id", width = 15) + @ApiModelProperty(value = "浠诲姟id") + private String jobId; + /** + * 鎶ラ敊淇℃伅 + */ + @Excel(name = "鎶ラ敊淇℃伅", width = 15) + @ApiModelProperty(value = "鎶ラ敊淇℃伅") + private String exceptionDetail; + /** + * 鎴愬姛鏍囧織 0鎴愬姛 -1澶辫触 + */ + @Excel(name = "鎴愬姛鏍囧織 0鎴愬姛 -1澶辫触", width = 15) + @ApiModelProperty(value = "鎴愬姛鏍囧織 0鎴愬姛 -1澶辫触") + private Integer isSuccess; + /** + * 鍙傛暟 + */ + @Excel(name = "鍙傛暟", width = 15) + @ApiModelProperty(value = "鍙傛暟") + private String params; + /** + * 鎵ц鏃堕棿 + */ + @Excel(name = "鎵ц鏃堕棿", width = 15) + @ApiModelProperty(value = "鎵ц鏃堕棿") + private Integer executionTime; + /** + * 鍒涘缓鏃堕棿 + */ + @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 createTime; +} diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/mapper/SysQuartzLogMapper.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/mapper/SysQuartzLogMapper.java new file mode 100644 index 0000000..ca8a06d --- /dev/null +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/mapper/SysQuartzLogMapper.java @@ -0,0 +1,23 @@ +package org.jeecg.modules.quartz.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.quartz.dto.SysQuartzLogDto; +import org.jeecg.modules.quartz.entity.SysQuartzLog; +import org.jeecg.modules.quartz.vo.SysQuartzLogVo; + +import java.util.List; + +/** + * @Description: 瀹氭椂浠诲姟鏃ュ織 + * @Author: Lius + * @Date: 2023-08-05 + * @Version: V1.0 + */ +public interface SysQuartzLogMapper extends BaseMapper<SysQuartzLog> { + + IPage<SysQuartzLogDto> pageList(IPage<SysQuartzLogDto> page, @Param("sysQuartzLogVo") SysQuartzLogVo sysQuartzLogVo); + + List<SysQuartzLogDto> list(@Param("sysQuartzLogVo") SysQuartzLogVo sysQuartzLogVo); +} diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/mapper/xml/SysQuartzLogMapper.xml b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/mapper/xml/SysQuartzLogMapper.xml new file mode 100644 index 0000000..bac0744 --- /dev/null +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/mapper/xml/SysQuartzLogMapper.xml @@ -0,0 +1,70 @@ +<?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.quartz.mapper.SysQuartzLogMapper"> + + <!--鍒嗛〉鍒楄〃鏌ヨ--> + <select id="pageList" resultType="org.jeecg.modules.quartz.dto.SysQuartzLogDto"> + SELECT + t2.job_name jobName, + t2.job_class_name jobClassName, + t2.cron_expression cronExpression, + t1.params params, + t2.description description, + t1.exception_detail exceptionDetail, + t1.is_success isSuccess, + t1.execution_time executionTime, + t1.create_time createTime + FROM + sys_quartz_log t1 + LEFT JOIN sys_quartz_job t2 ON t1.job_id = t2.id + <where> + AND t2.id = #{ sysQuartzLogVo.jobId } + <if test="sysQuartzLogVo.isSuccess != null"> + AND t1.is_success = #{ sysQuartzLogVo.isSuccess } + </if> + <if test="sysQuartzLogVo.startTime != null and sysQuartzLogVo.startTime != '' and sysQuartzLogVo.endTime != null and sysQuartzLogVo.endTime != ''"> + AND t1.create_time BETWEEN #{ sysQuartzLogVo.startTime } AND #{ sysQuartzLogVo.endTime } + </if> + <if test="sysQuartzLogVo.jobName != null and sysQuartzLogVo.jobName != ''"> + AND t2.job_name LIKE CONCAT(CONCAT('%',#{ sysQuartzLogVo.jobName }),'%') + </if> + <if test="sysQuartzLogVo.description != null and sysQuartzLogVo.description != ''"> + AND t2.description LIKE CONCAT(CONCAT('%',#{ sysQuartzLogVo.description }),'%') + </if> + </where> + ORDER BY t1.create_time DESC + </select> + + + <select id="list" resultType="org.jeecg.modules.quartz.dto.SysQuartzLogDto"> + SELECT + t2.job_name jobName, + t2.job_class_name jobClassName, + t2.cron_expression cronExpression, + t1.params params, + t2.description description, + t1.exception_detail exceptionDetail, + t1.is_success isSuccess, + t1.execution_time executionTime, + t1.create_time createTime + FROM + sys_quartz_log t1 + LEFT JOIN sys_quartz_job t2 ON t1.job_id = t2.id + <where> + AND t2.id = #{ sysQuartzLogVo.jobId } + <if test="sysQuartzLogVo.isSuccess != null"> + AND t1.is_success = #{ sysQuartzLogVo.isSuccess } + </if> + <if test="sysQuartzLogVo.startTime != null and sysQuartzLogVo.startTime != '' and sysQuartzLogVo.endTime != null and sysQuartzLogVo.endTime != ''"> + AND t1.create_time BETWEEN #{ sysQuartzLogVo.startTime } AND #{ sysQuartzLogVo.endTime } + </if> + <if test="sysQuartzLogVo.jobName != null and sysQuartzLogVo.jobName != ''"> + AND t2.job_name LIKE CONCAT(CONCAT('%',#{ sysQuartzLogVo.jobName }),'%') + </if> + <if test="sysQuartzLogVo.description != null and sysQuartzLogVo.description != ''"> + AND t2.description LIKE CONCAT(CONCAT('%',#{ sysQuartzLogVo.description }),'%') + </if> + </where> + ORDER BY t1.create_time DESC + </select> +</mapper> \ No newline at end of file diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/service/ISysQuartzLogService.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/service/ISysQuartzLogService.java new file mode 100644 index 0000000..8fee224 --- /dev/null +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/service/ISysQuartzLogService.java @@ -0,0 +1,36 @@ +package org.jeecg.modules.quartz.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.quartz.dto.SysQuartzLogDto; +import org.jeecg.modules.quartz.entity.SysQuartzLog; +import org.jeecg.modules.quartz.vo.SysQuartzLogVo; +import org.springframework.web.servlet.ModelAndView; + +/** + * @Description: 瀹氭椂浠诲姟鏃ュ織 + * @Author: Lius + * @Date: 2023-08-05 + * @Version: V1.0 + */ +public interface ISysQuartzLogService extends IService<SysQuartzLog> { + + /** + * 鍒嗛〉鍒楄〃 + * + * @param pageNo + * @param pageSize + * @param sysQuartzLogVo + * @return + */ + IPage<SysQuartzLogDto> pageList(Integer pageNo, Integer pageSize, SysQuartzLogVo sysQuartzLogVo); + + /** + * 瀵煎嚭 + * + * @param sysQuartzLogVo + * @return + */ + ModelAndView exportXls(SysQuartzLogVo sysQuartzLogVo); + +} diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/service/impl/SysQuartzLogServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/service/impl/SysQuartzLogServiceImpl.java new file mode 100644 index 0000000..83a28c8 --- /dev/null +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/service/impl/SysQuartzLogServiceImpl.java @@ -0,0 +1,50 @@ +package org.jeecg.modules.quartz.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.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.quartz.dto.SysQuartzLogDto; +import org.jeecg.modules.quartz.entity.SysQuartzLog; +import org.jeecg.modules.quartz.mapper.SysQuartzLogMapper; +import org.jeecg.modules.quartz.service.ISysQuartzLogService; +import org.jeecg.modules.quartz.vo.SysQuartzLogVo; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; + +import java.util.List; + +/** + * @Description: 瀹氭椂浠诲姟鏃ュ織 + * @Author: Lius + * @Date: 2023-08-05 + * @Version: V1.0 + */ +@Service +public class SysQuartzLogServiceImpl extends ServiceImpl<SysQuartzLogMapper, SysQuartzLog> implements ISysQuartzLogService { + + @Override + public IPage<SysQuartzLogDto> pageList(Integer pageNo, Integer pageSize, SysQuartzLogVo sysQuartzLogVo) { + IPage<SysQuartzLogDto> page = new Page<>(pageNo, pageSize); + return this.baseMapper.pageList(page, sysQuartzLogVo); + } + + @Override + public ModelAndView exportXls(SysQuartzLogVo sysQuartzLogVo) { + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List<SysQuartzLogDto> list = this.baseMapper.list(sysQuartzLogVo); + // 瀵煎嚭鏂囦欢鍚嶇О + mv.addObject(NormalExcelConstants.FILE_NAME, "瀹氭椂浠诲姟鏃ュ織鍒楄〃"); + mv.addObject(NormalExcelConstants.CLASS, SysQuartzLogDto.class); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("瀹氭椂浠诲姟鏃ュ織鍒楄〃鏁版嵁", "瀵煎嚭浜�:"+user.getRealname(), "瀵煎嚭淇℃伅")); + //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ + mv.addObject(NormalExcelConstants.DATA_LIST, list); + return mv; + } +} diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/vo/SysQuartzLogVo.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/vo/SysQuartzLogVo.java new file mode 100644 index 0000000..f2f518a --- /dev/null +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/quartz/vo/SysQuartzLogVo.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.quartz.vo; + +import lombok.Data; + +/** + * @author: LiuS + * @create: 2023-08-05 14:07 + */ +@Data +public class SysQuartzLogVo { + + private String jobId; + + private Integer isSuccess; + + private String startTime; + + private String endTime; + + private String jobName; + + private String description; + +} diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysAnnouncementService.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysAnnouncementService.java index bf0ea45..a9314bb 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysAnnouncementService.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysAnnouncementService.java @@ -61,5 +61,10 @@ */ void updateReaded(List<String> annoceIdList); + /** + * 瀹氭椂浠诲姟澶辫触鍙戦�佺郴缁熸秷鎭� + */ + void jobSendMessage(String jobDescription, String exceptionDetail); + } diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysAnnouncementServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysAnnouncementServiceImpl.java index 0934d2e..783aa0c 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysAnnouncementServiceImpl.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysAnnouncementServiceImpl.java @@ -1,18 +1,25 @@ package org.jeecg.modules.system.service.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.SecurityUtils; import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.constant.CommonSendStatus; +import org.jeecg.common.constant.WebsocketConst; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.message.websocket.WebSocket; import org.jeecg.modules.system.entity.SysAnnouncement; import org.jeecg.modules.system.entity.SysAnnouncementSend; import org.jeecg.modules.system.mapper.SysAnnouncementMapper; import org.jeecg.modules.system.mapper.SysAnnouncementSendMapper; import org.jeecg.modules.system.service.ISysAnnouncementService; +import org.jeecg.modules.system.service.ISysDictService; +import org.jeecg.modules.system.service.ISysUserService; +import org.jeecg.modules.system.util.XssUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -37,6 +44,15 @@ @Resource private SysAnnouncementSendMapper sysAnnouncementSendMapper; + + @Resource + private ISysDictService sysDictService; + + @Resource + private ISysUserService sysUserService; + + @Resource + private WebSocket webSocket; @Transactional(rollbackFor = Exception.class) @Override @@ -185,4 +201,54 @@ sysAnnouncementSendMapper.updateReaded(sysUser.getId(), annoceIdList); } + @Override + public void jobSendMessage(String jobDescription, String exceptionDetail) { + SysAnnouncement sysAnnouncement = new SysAnnouncement(); + String title = XssUtils.scriptXss(jobDescription + "澶辫触锛�"); + // 鏍囬 + sysAnnouncement.setTitile(title); + // 娑堟伅绫诲瀷 + sysAnnouncement.setMsgCategory(CommonConstant.MSG_CATEGORY_2); + // 浼樺厛绾� + sysAnnouncement.setPriority(CommonConstant.PRIORITY_H); + // 閫氬憡瀵硅薄绫诲瀷 + sysAnnouncement.setMsgType(CommonConstant.MSG_TYPE_UESR); + // 鍒犻櫎鐘舵�� + sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); + // 鍙戝竷鐘舵�� + sysAnnouncement.setSendStatus(CommonSendStatus.PUBLISHED_STATUS_1); + // 鍙戝竷鏃堕棿 + sysAnnouncement.setSendTime(new Date()); + // 鍙戝竷浜� + sysAnnouncement.setSender("admin"); + // 娑堟伅鍐呭 + sysAnnouncement.setMsgContent(exceptionDetail); + // 鑾峰彇鐢ㄦ埛 + // step1. 浠庡瓧鍏告暟鎹腑鏌ヨ闇�瑕佸彂閫佺殑瑙掕壊缂栫爜 + String roleCode = sysDictService.queryDictTextByKey(CommonConstant.JOB_SEND_MSG, CommonConstant.STATUS_NORMAL.toString()); + // step2. 鏍规嵁瑙掕壊缂栫爜鏌ヨ鐢ㄦ埛id闆嗗悎 + List<String> userIds = sysUserService.getUserByRoleCode(roleCode); + if (userIds != null && !userIds.isEmpty()) { + sysAnnouncement.setUserIds(String.join(",", userIds)); + sysAnnouncementMapper.insert(sysAnnouncement); + String anntId = sysAnnouncement.getId(); + Date refDate = new Date(); + for (String userId : userIds) { + SysAnnouncementSend announcementSend = new SysAnnouncementSend(); + announcementSend.setAnntId(anntId); + announcementSend.setUserId(userId); + announcementSend.setReadFlag(CommonConstant.NO_READ_FLAG); + announcementSend.setReadTime(refDate); + sysAnnouncementSendMapper.insert(announcementSend); + } + // 鍙戦�佹秷鎭� + JSONObject obj = new JSONObject(); + obj.put(WebsocketConst.MSG_CMD, WebsocketConst.CMD_USER); + obj.put(WebsocketConst.MSG_ID, sysAnnouncement.getId()); + obj.put(WebsocketConst.MSG_TXT, sysAnnouncement.getTitile()); + webSocket.sendMessage(sysAnnouncement.getUserIds().split(","), obj.toJSONString()); + } + + } + } diff --git a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml index de4eb0f..98fee06 100644 --- a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml +++ b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml @@ -1,5 +1,5 @@ server: - port: 8080 + port: 9999 tomcat: max-swallow-size: -1 error: @@ -132,11 +132,10 @@ connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 datasource: master: -# url: jdbc:sqlserver://192.168.0.29:1433;databasename=LXZN_TEST_430 - url: jdbc:sqlserver://30036q420j.yicp.fun:11047;databasename=LXZN_TEST_430 + url: jdbc:sqlserver://192.168.0.118:1433;databasename=LXZN_TEST_430 username: sa -# password: LXZN@1688 password: 123 + #password: 123 driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver #url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai #username: root @@ -153,7 +152,7 @@ database: 0 host: 127.0.0.1 port: 6379 - password: + password: 123456 #mybatis plus 璁剧疆 mybatis-plus: mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml diff --git a/lxzn-module-system/lxzn-system-start/src/main/resources/application-prod.yml b/lxzn-module-system/lxzn-system-start/src/main/resources/application-prod.yml index bf9bf19..2a44c8b 100644 --- a/lxzn-module-system/lxzn-system-start/src/main/resources/application-prod.yml +++ b/lxzn-module-system/lxzn-system-start/src/main/resources/application-prod.yml @@ -1,5 +1,5 @@ server: - port: 8080 + port: 9999 tomcat: max-swallow-size: -1 error: @@ -132,11 +132,21 @@ connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 datasource: master: - url: jdbc:sqlserver://192.168.0.29:1433;databasename=LXZN_TEST_430 + url: jdbc:sqlserver://166.0.1.10:1433;databasename=LXZN_TEST_430 username: sa - password: LXZN@1688 + password: 123 #password: 123 driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver + #url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai + #username: root + #password: root + #driver-class-name: com.mysql.cj.jdbc.Driver + # 澶氭暟鎹簮閰嶇疆 + #multi-datasource1: + # url: jdbc:sqlserver://192.168.0.118:1433;databasename=lxzn_test + # username: sa + # password: 123 + # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver #redis 閰嶇疆 redis: database: 0 @@ -169,7 +179,7 @@ signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a # 绛惧悕鎷︽埅鎺ュ彛 signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys - #local\minio\alioss + #local銆乵inio銆乤lioss uploadType: local # 鍓嶇璁块棶鍦板潃 domainUrl: @@ -177,9 +187,9 @@ app: http://localhost:8051 path: #鏂囦欢涓婁紶鏍圭洰褰� 璁剧疆 - upload: /opt/jeecg-boot/upload + upload: /opt/upFiles #webapp鏂囦欢璺緞 - webapp: /opt/jeecg-boot/webapp + webapp: /opt/webapp shiro: excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo #闃块噷浜憃ss瀛樺偍鍜屽ぇ楸肩煭淇$閽ラ厤缃� -- Gitblit v1.9.3