From 9f8be6f9527ca0491c1a9a65d8785e4ac8135038 Mon Sep 17 00:00:00 2001 From: zhouhy Date: Sat, 30 Mar 2024 18:00:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=EF=BC=9A?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=95=B0=E6=8D=AE=E5=BA=93=E4=B8=AD=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/aucma/api/task/SAPTask.java | 38 +++++++++++++++++++ .../com/aucma/base/mapper/PublicMapper.java | 17 +++++++++ .../base/mapper/RecordDnbInstantMapper.java | 18 +++++---- .../service/IRecordDnbInstantService.java | 18 +++++---- .../impl/RecordDnbInstantServiceImpl.java | 21 ++++++---- .../resources/mapper/base/PublicMapper.xml | 11 ++++++ .../mapper/base/RecordDnbInstantMapper.xml | 5 ++- .../mapper/DeviceAlarmRecordMapper.java | 18 +++++---- .../service/IDeviceAlarmRecordService.java | 21 ++++++---- .../impl/DeviceAlarmRecordServiceImpl.java | 21 ++++++---- .../mapper/report/DeviceAlarmRecordMapper.xml | 7 +++- 11 files changed, 145 insertions(+), 50 deletions(-) create mode 100644 aucma-base/src/main/java/com/aucma/base/mapper/PublicMapper.java create mode 100644 aucma-base/src/main/resources/mapper/base/PublicMapper.xml diff --git a/aucma-api/src/main/java/com/aucma/api/task/SAPTask.java b/aucma-api/src/main/java/com/aucma/api/task/SAPTask.java index dbabb94..9c69d0c 100644 --- a/aucma-api/src/main/java/com/aucma/api/task/SAPTask.java +++ b/aucma-api/src/main/java/com/aucma/api/task/SAPTask.java @@ -5,11 +5,14 @@ import com.aucma.api.domain.dto.SAPPortDto; import com.aucma.api.domain.dto.WERKSDto; import com.aucma.api.service.ISAPPortService; import com.aucma.base.domain.BaseOrderInfo; +import com.aucma.base.mapper.PublicMapper; import com.aucma.base.service.IBaseOrderInfoService; +import com.aucma.base.service.IRecordDnbInstantService; import com.aucma.common.utils.DateUtils; import com.aucma.production.domain.BaseBomInfo; import com.aucma.production.service.IBaseBomInfoService; import com.aucma.production.service.IProductPlanInfoService; +import com.aucma.report.service.IDeviceAlarmRecordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -36,6 +39,15 @@ public class SAPTask { @Autowired private IBaseOrderInfoService orderInfoService; + @Autowired + private IDeviceAlarmRecordService deviceAlarmRecordService; + + @Autowired + private IRecordDnbInstantService recordDnbInstantService; + + @Autowired + private PublicMapper publicMapper; + /** * SAP物料主数据定时任务 * @param factoryCode @@ -148,4 +160,30 @@ public class SAPTask { return sapPortDto; } + /*** + * 定时任务:定期删除设备报警记录信息 + */ + + public void DeleteDeviceAlarmRecordTable(Long dates){ + deviceAlarmRecordService.deleteDeviceAlarmRecordByDates(dates); + System.out.println("删除设备报警记录数据库中数据"); + } + + /** + * 定时任务:定期删除电实时数据信息 + * */ + public void DeleteRecordDnbInstant(Long dates){ + recordDnbInstantService.deleteRecordDnbInstantByDates(dates); + System.out.println("删除电实时数据"); + } + /** + * + * 定时任务:定期删除门体发泡设备数据 + * */ + public void DeleteDOORFOAMREMACHINE(Long dates){ + publicMapper.DeleteDOORFOAMREMACHINE(dates); + System.out.println("删除门体发泡数据"); + } + + } diff --git a/aucma-base/src/main/java/com/aucma/base/mapper/PublicMapper.java b/aucma-base/src/main/java/com/aucma/base/mapper/PublicMapper.java new file mode 100644 index 0000000..e993541 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/mapper/PublicMapper.java @@ -0,0 +1,17 @@ +package com.aucma.base.mapper; + +import com.aucma.common.annotation.DataSource; +import com.aucma.common.enums.DataSourceType; +import org.springframework.stereotype.Repository; + +/** + * @ClassName : PublicMapper + * @Description : + * @Author : + * @Date: 2024-03-30 17:29 + */ +@Repository +public interface PublicMapper { + @DataSource(value = DataSourceType.SLAVE) + int DeleteDOORFOAMREMACHINE(Long dates); +} diff --git a/aucma-base/src/main/java/com/aucma/base/mapper/RecordDnbInstantMapper.java b/aucma-base/src/main/java/com/aucma/base/mapper/RecordDnbInstantMapper.java index efd7dfd..36aa314 100644 --- a/aucma-base/src/main/java/com/aucma/base/mapper/RecordDnbInstantMapper.java +++ b/aucma-base/src/main/java/com/aucma/base/mapper/RecordDnbInstantMapper.java @@ -5,15 +5,15 @@ import com.aucma.base.domain.RecordDnbInstant; /** * 电实时数据Mapper接口 - * + * * @author Yinq * @date 2023-09-26 */ -public interface RecordDnbInstantMapper +public interface RecordDnbInstantMapper { /** * 查询电实时数据 - * + * * @param objId 电实时数据主键 * @return 电实时数据 */ @@ -21,7 +21,7 @@ public interface RecordDnbInstantMapper /** * 查询电实时数据列表 - * + * * @param recordDnbInstant 电实时数据 * @return 电实时数据集合 */ @@ -29,7 +29,7 @@ public interface RecordDnbInstantMapper /** * 新增电实时数据 - * + * * @param recordDnbInstant 电实时数据 * @return 结果 */ @@ -37,7 +37,7 @@ public interface RecordDnbInstantMapper /** * 修改电实时数据 - * + * * @param recordDnbInstant 电实时数据 * @return 结果 */ @@ -45,7 +45,7 @@ public interface RecordDnbInstantMapper /** * 删除电实时数据 - * + * * @param objId 电实时数据主键 * @return 结果 */ @@ -53,9 +53,11 @@ public interface RecordDnbInstantMapper /** * 批量删除电实时数据 - * + * * @param objIds 需要删除的数据主键集合 * @return 结果 */ public int deleteRecordDnbInstantByObjIds(Long[] objIds); + + int deleteRecordDnbInstantByDates(Long dates); } diff --git a/aucma-base/src/main/java/com/aucma/base/service/IRecordDnbInstantService.java b/aucma-base/src/main/java/com/aucma/base/service/IRecordDnbInstantService.java index 2a1d204..6687737 100644 --- a/aucma-base/src/main/java/com/aucma/base/service/IRecordDnbInstantService.java +++ b/aucma-base/src/main/java/com/aucma/base/service/IRecordDnbInstantService.java @@ -5,15 +5,15 @@ import com.aucma.base.domain.RecordDnbInstant; /** * 电实时数据Service接口 - * + * * @author Yinq * @date 2023-09-26 */ -public interface IRecordDnbInstantService +public interface IRecordDnbInstantService { /** * 查询电实时数据 - * + * * @param objId 电实时数据主键 * @return 电实时数据 */ @@ -21,7 +21,7 @@ public interface IRecordDnbInstantService /** * 查询电实时数据列表 - * + * * @param recordDnbInstant 电实时数据 * @return 电实时数据集合 */ @@ -29,7 +29,7 @@ public interface IRecordDnbInstantService /** * 新增电实时数据 - * + * * @param recordDnbInstant 电实时数据 * @return 结果 */ @@ -37,7 +37,7 @@ public interface IRecordDnbInstantService /** * 修改电实时数据 - * + * * @param recordDnbInstant 电实时数据 * @return 结果 */ @@ -45,7 +45,7 @@ public interface IRecordDnbInstantService /** * 批量删除电实时数据 - * + * * @param objIds 需要删除的电实时数据主键集合 * @return 结果 */ @@ -53,9 +53,11 @@ public interface IRecordDnbInstantService /** * 删除电实时数据信息 - * + * * @param objId 电实时数据主键 * @return 结果 */ public int deleteRecordDnbInstantByObjId(Long objId); + + int deleteRecordDnbInstantByDates(long dates); } diff --git a/aucma-base/src/main/java/com/aucma/base/service/impl/RecordDnbInstantServiceImpl.java b/aucma-base/src/main/java/com/aucma/base/service/impl/RecordDnbInstantServiceImpl.java index 835ef9f..5dcf5eb 100644 --- a/aucma-base/src/main/java/com/aucma/base/service/impl/RecordDnbInstantServiceImpl.java +++ b/aucma-base/src/main/java/com/aucma/base/service/impl/RecordDnbInstantServiceImpl.java @@ -9,19 +9,19 @@ import com.aucma.base.service.IRecordDnbInstantService; /** * 电实时数据Service业务层处理 - * + * * @author Yinq * @date 2023-09-26 */ @Service -public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService +public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService { @Autowired private RecordDnbInstantMapper recordDnbInstantMapper; /** * 查询电实时数据 - * + * * @param objId 电实时数据主键 * @return 电实时数据 */ @@ -33,7 +33,7 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService /** * 查询电实时数据列表 - * + * * @param recordDnbInstant 电实时数据 * @return 电实时数据 */ @@ -45,7 +45,7 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService /** * 新增电实时数据 - * + * * @param recordDnbInstant 电实时数据 * @return 结果 */ @@ -57,7 +57,7 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService /** * 修改电实时数据 - * + * * @param recordDnbInstant 电实时数据 * @return 结果 */ @@ -69,7 +69,7 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService /** * 批量删除电实时数据 - * + * * @param objIds 需要删除的电实时数据主键 * @return 结果 */ @@ -81,7 +81,7 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService /** * 删除电实时数据信息 - * + * * @param objId 电实时数据主键 * @return 结果 */ @@ -90,4 +90,9 @@ public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService { return recordDnbInstantMapper.deleteRecordDnbInstantByObjId(objId); } + + @Override + public int deleteRecordDnbInstantByDates(long dates) { + return recordDnbInstantMapper.deleteRecordDnbInstantByDates(dates); + } } diff --git a/aucma-base/src/main/resources/mapper/base/PublicMapper.xml b/aucma-base/src/main/resources/mapper/base/PublicMapper.xml new file mode 100644 index 0000000..e761f2d --- /dev/null +++ b/aucma-base/src/main/resources/mapper/base/PublicMapper.xml @@ -0,0 +1,11 @@ + + + + + delete + from DOOR_FOAMREMACHINE + where (sysdate-#{dates})>CREATED_TIME + + diff --git a/aucma-base/src/main/resources/mapper/base/RecordDnbInstantMapper.xml b/aucma-base/src/main/resources/mapper/base/RecordDnbInstantMapper.xml index ebf1256..b0169a3 100644 --- a/aucma-base/src/main/resources/mapper/base/RecordDnbInstantMapper.xml +++ b/aucma-base/src/main/resources/mapper/base/RecordDnbInstantMapper.xml @@ -178,4 +178,7 @@ #{objId} - \ No newline at end of file + + delete from record_dnb_instant where (sysdate-#{dates})>COLLECT_TIME + + diff --git a/aucma-report/src/main/java/com/aucma/report/mapper/DeviceAlarmRecordMapper.java b/aucma-report/src/main/java/com/aucma/report/mapper/DeviceAlarmRecordMapper.java index 3c229be..f931c99 100644 --- a/aucma-report/src/main/java/com/aucma/report/mapper/DeviceAlarmRecordMapper.java +++ b/aucma-report/src/main/java/com/aucma/report/mapper/DeviceAlarmRecordMapper.java @@ -5,15 +5,15 @@ import com.aucma.report.domain.DeviceAlarmRecord; /** * 设备报警记录Mapper接口 - * + * * @author Yinq * @date 2024-03-26 */ -public interface DeviceAlarmRecordMapper +public interface DeviceAlarmRecordMapper { /** * 查询设备报警记录 - * + * * @param objId 设备报警记录主键 * @return 设备报警记录 */ @@ -21,7 +21,7 @@ public interface DeviceAlarmRecordMapper /** * 查询设备报警记录列表 - * + * * @param deviceAlarmRecord 设备报警记录 * @return 设备报警记录集合 */ @@ -29,7 +29,7 @@ public interface DeviceAlarmRecordMapper /** * 新增设备报警记录 - * + * * @param deviceAlarmRecord 设备报警记录 * @return 结果 */ @@ -37,7 +37,7 @@ public interface DeviceAlarmRecordMapper /** * 修改设备报警记录 - * + * * @param deviceAlarmRecord 设备报警记录 * @return 结果 */ @@ -45,7 +45,7 @@ public interface DeviceAlarmRecordMapper /** * 删除设备报警记录 - * + * * @param objId 设备报警记录主键 * @return 结果 */ @@ -53,9 +53,11 @@ public interface DeviceAlarmRecordMapper /** * 批量删除设备报警记录 - * + * * @param objIds 需要删除的数据主键集合 * @return 结果 */ public int deleteDeviceAlarmRecordByObjIds(Long[] objIds); + + int deleteDeviceAlarmRecordByDates(Long dates); } diff --git a/aucma-report/src/main/java/com/aucma/report/service/IDeviceAlarmRecordService.java b/aucma-report/src/main/java/com/aucma/report/service/IDeviceAlarmRecordService.java index 2c55658..f0df14e 100644 --- a/aucma-report/src/main/java/com/aucma/report/service/IDeviceAlarmRecordService.java +++ b/aucma-report/src/main/java/com/aucma/report/service/IDeviceAlarmRecordService.java @@ -5,15 +5,15 @@ import com.aucma.report.domain.DeviceAlarmRecord; /** * 设备报警记录Service接口 - * + * * @author Yinq * @date 2024-03-26 */ -public interface IDeviceAlarmRecordService +public interface IDeviceAlarmRecordService { /** * 查询设备报警记录 - * + * * @param objId 设备报警记录主键 * @return 设备报警记录 */ @@ -21,7 +21,7 @@ public interface IDeviceAlarmRecordService /** * 查询设备报警记录列表 - * + * * @param deviceAlarmRecord 设备报警记录 * @return 设备报警记录集合 */ @@ -29,7 +29,7 @@ public interface IDeviceAlarmRecordService /** * 新增设备报警记录 - * + * * @param deviceAlarmRecord 设备报警记录 * @return 结果 */ @@ -37,7 +37,7 @@ public interface IDeviceAlarmRecordService /** * 修改设备报警记录 - * + * * @param deviceAlarmRecord 设备报警记录 * @return 结果 */ @@ -45,7 +45,7 @@ public interface IDeviceAlarmRecordService /** * 批量删除设备报警记录 - * + * * @param objIds 需要删除的设备报警记录主键集合 * @return 结果 */ @@ -53,9 +53,14 @@ public interface IDeviceAlarmRecordService /** * 删除设备报警记录信息 - * + * * @param objId 设备报警记录主键 * @return 结果 */ public int deleteDeviceAlarmRecordByObjId(Long objId); + + /** + * 根据传入天数删除设备报警记录信息 + * */ + public int deleteDeviceAlarmRecordByDates(Long dates); } diff --git a/aucma-report/src/main/java/com/aucma/report/service/impl/DeviceAlarmRecordServiceImpl.java b/aucma-report/src/main/java/com/aucma/report/service/impl/DeviceAlarmRecordServiceImpl.java index df09da9..ee3f91a 100644 --- a/aucma-report/src/main/java/com/aucma/report/service/impl/DeviceAlarmRecordServiceImpl.java +++ b/aucma-report/src/main/java/com/aucma/report/service/impl/DeviceAlarmRecordServiceImpl.java @@ -9,19 +9,19 @@ import com.aucma.report.service.IDeviceAlarmRecordService; /** * 设备报警记录Service业务层处理 - * + * * @author Yinq * @date 2024-03-26 */ @Service -public class DeviceAlarmRecordServiceImpl implements IDeviceAlarmRecordService +public class DeviceAlarmRecordServiceImpl implements IDeviceAlarmRecordService { @Autowired private DeviceAlarmRecordMapper deviceAlarmRecordMapper; /** * 查询设备报警记录 - * + * * @param objId 设备报警记录主键 * @return 设备报警记录 */ @@ -33,7 +33,7 @@ public class DeviceAlarmRecordServiceImpl implements IDeviceAlarmRecordService /** * 查询设备报警记录列表 - * + * * @param deviceAlarmRecord 设备报警记录 * @return 设备报警记录 */ @@ -45,7 +45,7 @@ public class DeviceAlarmRecordServiceImpl implements IDeviceAlarmRecordService /** * 新增设备报警记录 - * + * * @param deviceAlarmRecord 设备报警记录 * @return 结果 */ @@ -57,7 +57,7 @@ public class DeviceAlarmRecordServiceImpl implements IDeviceAlarmRecordService /** * 修改设备报警记录 - * + * * @param deviceAlarmRecord 设备报警记录 * @return 结果 */ @@ -69,7 +69,7 @@ public class DeviceAlarmRecordServiceImpl implements IDeviceAlarmRecordService /** * 批量删除设备报警记录 - * + * * @param objIds 需要删除的设备报警记录主键 * @return 结果 */ @@ -81,7 +81,7 @@ public class DeviceAlarmRecordServiceImpl implements IDeviceAlarmRecordService /** * 删除设备报警记录信息 - * + * * @param objId 设备报警记录主键 * @return 结果 */ @@ -90,4 +90,9 @@ public class DeviceAlarmRecordServiceImpl implements IDeviceAlarmRecordService { return deviceAlarmRecordMapper.deleteDeviceAlarmRecordByObjId(objId); } + + @Override + public int deleteDeviceAlarmRecordByDates(Long dates) { + return deviceAlarmRecordMapper.deleteDeviceAlarmRecordByDates(dates); + } } diff --git a/aucma-report/src/main/resources/mapper/report/DeviceAlarmRecordMapper.xml b/aucma-report/src/main/resources/mapper/report/DeviceAlarmRecordMapper.xml index b937efb..ef9ce9f 100644 --- a/aucma-report/src/main/resources/mapper/report/DeviceAlarmRecordMapper.xml +++ b/aucma-report/src/main/resources/mapper/report/DeviceAlarmRecordMapper.xml @@ -133,4 +133,9 @@ #{objId} - \ No newline at end of file + + delete + from RECORD_ALARM_DEVICE + where (sysdate-#{dates})>ALARM_TIME + +