From 430ada5d23fca5c1869271f1a907957daf022c87 Mon Sep 17 00:00:00 2001 From: nieziyan Date: Fri, 3 Nov 2023 19:14:22 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat=EF=BC=9A=E6=B8=85=E7=90=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=92=8C=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/common/util/FTPUtil.java | 31 ++++ .../org/jeecg/modules/base/dto/OwnerDto.java | 11 ++ .../service/impl/SysDatabaseServiceImpl.java | 7 +- .../controller/GardsSampleDataController.java | 10 +- .../system/mapper/GardsSampleDataMapper.java | 13 ++ .../mapper/xml/GardsSampleDataMapper.xml | 31 ++++ .../service/IGardsSampleDataService.java | 4 +- .../impl/GardsSampleDataServiceImpl.java | 150 ++++++++++++++++-- 8 files changed, 239 insertions(+), 18 deletions(-) create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/OwnerDto.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java index 382ddc2c..6520c1ec 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/FTPUtil.java @@ -1,6 +1,8 @@ package org.jeecg.common.util; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; @@ -20,6 +22,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -292,6 +295,34 @@ public class FTPUtil { } } + /* + * 批量删除FTP文件 返回删除失败的文件路径 + * */ + public List removeFiles(List paths){ + List failList = new ArrayList<>(); + if (CollUtil.isEmpty(paths)) + return failList; + // 连接FTP服务 + final FTPClient ftpClient = this.LoginFTP(); + for (String path : paths) { + try { + if (StrUtil.isBlank(path)) continue; + boolean success = ftpClient.deleteFile(path); + if (!success) failList.add(path); + } catch (IOException e) { + failList.add(path); + e.printStackTrace(); + } + } + // 关闭FTP连接 + try { + if (ObjectUtil.isNotNull(ftpClient)) ftpClient.disconnect(); + } catch (IOException e) { + e.printStackTrace(); + } + return failList; + } + public static boolean createDirs(FTPClient ftp , String path) throws IOException { /* 该部分为逐级创建 */ String[] split = path.split(SymbolConstant.SINGLE_SLASH); diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/OwnerDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/OwnerDto.java new file mode 100644 index 00000000..855a0243 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/OwnerDto.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.base.dto; + +import lombok.Data; + +@Data +public class OwnerDto { + + private String owner; + + private String tableName; +} diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java index 685e1708..c47dcefd 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java @@ -257,6 +257,11 @@ public class SysDatabaseServiceImpl extends ServiceImpl dbInfoMY(String dataBase){ - return baseMapper.dbInfoMY(dataBase); + // 切换数据源 + + List dbInfos = baseMapper.dbInfoMY(dataBase); + // 清除数据源 + + return dbInfos; } } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSampleDataController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSampleDataController.java index b5aae5ad..ea98467d 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSampleDataController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/GardsSampleDataController.java @@ -9,10 +9,7 @@ import org.jeecg.common.util.RedisUtil; import org.jeecg.modules.system.entity.GardsSampleDataSystem; import org.jeecg.modules.system.service.IGardsSampleDataService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.Map; @@ -49,8 +46,9 @@ public class GardsSampleDataController { @DeleteMapping("deleteById") @ApiOperation(value = "删除DATA_BASE数据", notes = "删除DATA_BASE数据") - public Result deleteById(Integer sampleId){ - return gardsSampleDataService.deleteById(sampleId); + public Result deleteById(@RequestParam Integer sampleId, boolean sampleData, + boolean rnAuto, boolean rnMan){ + return gardsSampleDataService.deleteById(sampleId, sampleData, rnAuto, rnMan); } } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java index 741273dd..329628fa 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/GardsSampleDataMapper.java @@ -1,7 +1,20 @@ package org.jeecg.modules.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.base.dto.OwnerDto; +import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.system.entity.GardsSampleDataSystem; +import java.util.List; + public interface GardsSampleDataMapper extends BaseMapper { + + List containSampleId(String filed); + + void delTables(@Param("tableNames") List tableNames, + @Param("sampleId") Integer sampleId); + + GardsAnalyses getAnalysis(@Param("sampleId") Integer sampleId, + @Param("owner") String owner); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml new file mode 100644 index 00000000..7c0751c9 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml @@ -0,0 +1,31 @@ + + + + + + DELETE FROM ${tableName} WHERE SAMPLE_ID = #{sampleId} + + + + + + \ No newline at end of file diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsSampleDataService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsSampleDataService.java index 58aa94ed..bc445d48 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsSampleDataService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/IGardsSampleDataService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.system.entity.GardsSampleDataSystem; public interface IGardsSampleDataService extends IService { @@ -21,6 +22,7 @@ public interface IGardsSampleDataService extends IService * @param sampleId * @return */ - Result deleteById(Integer sampleId); + Result deleteById(Integer sampleId, boolean sampleData, boolean rnAuto, boolean rnMan); + GardsSampleDataSystem getOne(Integer sampleId); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java index 64da4204..99c9ccb8 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java @@ -1,5 +1,10 @@ package org.jeecg.modules.system.service.impl; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -9,23 +14,44 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; +import org.jeecg.common.constant.enums.FileTypeEnum; +import org.jeecg.common.properties.SpectrumPathProperties; +import org.jeecg.common.util.FTPUtil; import org.jeecg.common.util.RedisUtil; +import org.jeecg.modules.base.dto.OwnerDto; +import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.system.entity.GardsSampleDataSystem; import org.jeecg.modules.system.mapper.GardsSampleDataMapper; import org.jeecg.modules.system.service.IGardsSampleDataService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; +import org.springframework.transaction.support.DefaultTransactionDefinition; -import java.util.HashMap; -import java.util.Objects; +import java.util.*; +import java.util.stream.Collectors; @Service("gardsSampleDataService") @DS("ora") public class GardsSampleDataServiceImpl extends ServiceImpl implements IGardsSampleDataService { + @Autowired private RedisUtil redisUtil; + @Autowired + private FTPUtil ftpUtil; + + @Autowired + private SpectrumPathProperties pathProperties; + + @Autowired + private PlatformTransactionManager transactionManager; + @Override public Result> findPage(QueryRequest queryRequest, GardsSampleDataSystem gardsSampleData) { //查询全部台站信息 @@ -62,14 +88,118 @@ public class GardsSampleDataServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(GardsSampleDataSystem::getSampleId, sampleId); - this.baseMapper.delete(queryWrapper); - result.success("Successfully deleted"); - return result; + public Result deleteById(Integer sampleId, boolean sampleData, + boolean rnAuto, boolean rnMan) { + String ftpRootPath = ftpUtil.getFtpRootPath(); + String savePath = ftpRootPath + pathProperties.getSaveFilePath(); + String logPath = ftpRootPath + pathProperties.getLogPath(); + /* 删除数据库数据 */ + // 过滤掉多余的表 + String ORIGINAL = "ORIGINAL";String RNAUTO = "RNAUTO";String RNMAN = "RNMAN"; + List suitable = ListUtil.toList(ORIGINAL, RNAUTO, RNMAN); + List ownerDtos = baseMapper.containSampleId("SAMPLE_ID").stream() + .filter(owner -> CollUtil.contains(suitable, owner.getOwner())) + .collect(Collectors.toList()); + String DOT = StrUtil.DOT; + // 手动控制事务 + TransactionDefinition txDef = new DefaultTransactionDefinition(); + TransactionStatus txStatus = transactionManager.getTransaction(txDef); + try { + List needDel = new ArrayList<>(); + if (sampleData){ + // 收集所有表名 + List allTables = ownerDtos.stream() + .map(owner -> owner.getOwner() + DOT + owner.getTableName()) + .collect(Collectors.toList()); + // 删除表数据 + if (CollUtil.isNotEmpty(allTables)) + baseMapper.delTables(allTables, sampleId); + // 收集待删除文件路径 + needDel.add(samplePath(savePath, sampleId)); // 原始谱文件 + needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNMAN)); // 人工交互文件 + needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNAUTO)); // 自动处理文件 + } + else { + if (rnAuto){ + // 收集自动处理库所有表名 + List autoTables = ownerDtos.stream() + .filter(owner -> StrUtil.equals(owner.getOwner(), RNAUTO)) + .map(owner -> owner.getOwner() + DOT + owner.getTableName()) + .collect(Collectors.toList()); + // 删除表数据 + if (CollUtil.isNotEmpty(autoTables)) + baseMapper.delTables(autoTables, sampleId); + // 收集待删除文件路径 + needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNAUTO)); // 自动处理文件 + } + if (rnMan){ + // 收集人工交互库所有表名 + List manTables = ownerDtos.stream() + .filter(owner -> StrUtil.equals(owner.getOwner(), RNMAN)) + .map(owner -> owner.getOwner() + DOT + owner.getTableName()) + .collect(Collectors.toList()); + // 删除表数据 + if (CollUtil.isNotEmpty(manTables)) + baseMapper.delTables(manTables, sampleId); + // 收集待删除文件路径 + needDel.addAll(manOrAutoPath(savePath, logPath, sampleId, RNMAN)); // 人工交互文件 + } + } + transactionManager.commit(txStatus); + needDel = needDel.stream().filter(StrUtil::isNotBlank).collect(Collectors.toList()); + if (CollUtil.isEmpty(needDel)) + return Result.OK("Data cleaning is complete. No files need to be cleaned!"); + // 删除FTP文件 + List failList = ftpUtil.removeFiles(needDel); + if (CollUtil.isNotEmpty(failList)) + return Result.error("Data clearing is complete, but file clearing fails!", failList); + return Result.OK("Data and file cleanup complete!"); + }catch (Exception e){ + transactionManager.rollback(txStatus); + e.printStackTrace(); + return Result.error("Data deletion is abnormal, The file deletion operation has not been performed!"); + } } + @Override + public GardsSampleDataSystem getOne(Integer sampleId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsSampleDataSystem::getSampleId, sampleId); + return Optional.ofNullable(getOne(wrapper)) + .orElse(new GardsSampleDataSystem()); + } + + private String samplePath(String savePath, + Integer sampleId){ + GardsSampleDataSystem sampleData = getOne(sampleId); + String inputFileName = sampleData.getInputFileName(); + if (StrUtil.isBlank(inputFileName)) + return null; + return savePath + inputFileName; + } + + private List manOrAutoPath(String savePath, + String logPath, + Integer sampleId, + String owner){ + List fileList = new ArrayList<>(); + GardsAnalyses analysisMan = baseMapper.getAnalysis(sampleId, owner); + if (ObjectUtil.isNull(analysisMan)) + return fileList; + String baselinePath = analysisMan.getBaselinePath(); + if (StrUtil.isNotBlank(baselinePath)) + fileList.add(savePath + baselinePath); + String lcPath = analysisMan.getLcPath(); + if (StrUtil.isNotBlank(lcPath)) + fileList.add(savePath + lcPath); + String scacPath = analysisMan.getScacPath(); + if (StrUtil.isNotBlank(scacPath)) + fileList.add(savePath + scacPath); + if (StrUtil.isNotBlank(analysisMan.getLogPath())) + fileList.add(logPath + analysisMan.getLogPath()); + String reportPath = analysisMan.getReportPath(); + if (StrUtil.isNotBlank(reportPath)) + fileList.add(savePath + reportPath + FileTypeEnum.txt.getType()); + return fileList; + } } From dfb536fbbbb574299a78afaf5c0d02851269bd1c Mon Sep 17 00:00:00 2001 From: nieziyan Date: Fri, 3 Nov 2023 19:34:56 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix=EF=BC=9A1.=E8=A1=A5=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=88=86=E9=9A=94=E7=AC=A6=202.SQL=E8=AF=AD=E5=8F=A5=E5=88=86?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/mapper/xml/GardsSampleDataMapper.xml | 4 ++-- .../service/impl/GardsSampleDataServiceImpl.java | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml index 7c0751c9..b35248fd 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/GardsSampleDataMapper.xml @@ -2,8 +2,8 @@ - - DELETE FROM ${tableName} WHERE SAMPLE_ID = #{sampleId} + + DELETE FROM ${tableName} WHERE SAMPLE_ID = #{sampleId}; diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java index 99c9ccb8..bca30914 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/GardsSampleDataServiceImpl.java @@ -91,8 +91,8 @@ public class GardsSampleDataServiceImpl extends ServiceImpl deleteById(Integer sampleId, boolean sampleData, boolean rnAuto, boolean rnMan) { String ftpRootPath = ftpUtil.getFtpRootPath(); - String savePath = ftpRootPath + pathProperties.getSaveFilePath(); - String logPath = ftpRootPath + pathProperties.getLogPath(); + String savePath = ftpRootPath + pathProperties.getSaveFilePath() + StrUtil.SLASH; + String logPath = ftpRootPath + pathProperties.getLogPath() + StrUtil.SLASH; /* 删除数据库数据 */ // 过滤掉多余的表 String ORIGINAL = "ORIGINAL";String RNAUTO = "RNAUTO";String RNMAN = "RNMAN"; @@ -169,8 +169,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl manOrAutoPath(String savePath, - String logPath, - Integer sampleId, - String owner){ + private List manOrAutoPath(String savePath, String logPath, + Integer sampleId, String owner){ List fileList = new ArrayList<>(); GardsAnalyses analysisMan = baseMapper.getAnalysis(sampleId, owner); if (ObjectUtil.isNull(analysisMan)) From b741d18fc5b29e64b1126786c4d89884202f7c8f Mon Sep 17 00:00:00 2001 From: xiongzheng Date: Mon, 6 Nov 2023 08:58:38 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeecg-module-web-statistics/pom.xml | 10 ++++++++- .../modules/entity/bo/StatDataNumber.java | 21 +++++++++++++++++++ .../entity/data/OriginalDataNumber.java | 13 ++++++++++++ .../service/IGardsAlertDataService.java | 4 ++++ .../modules/service/IGardsMetDataService.java | 3 +++ .../service/IGardsSampleDataWebService.java | 2 ++ .../modules/service/IGardsSohDataService.java | 4 ++++ .../impl/GardsAlertDataServiceImpl.java | 7 +++++++ .../service/impl/GardsMetDataServiceImpl.java | 7 +++++++ .../impl/GardsSampleDataWebServiceImpl.java | 8 +++++++ .../service/impl/GardsSohDataServiceImpl.java | 8 +++++++ 11 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/bo/StatDataNumber.java create mode 100644 jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/OriginalDataNumber.java diff --git a/jeecg-module-web-statistics/pom.xml b/jeecg-module-web-statistics/pom.xml index 3ce55b2e..c0ea9bb1 100644 --- a/jeecg-module-web-statistics/pom.xml +++ b/jeecg-module-web-statistics/pom.xml @@ -22,6 +22,14 @@ org.jeecgframework.boot jeecg-boot-starter-cloud + + + + com.google.guava + guava + 32.1.2-jre + + - \ No newline at end of file + diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/bo/StatDataNumber.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/bo/StatDataNumber.java new file mode 100644 index 00000000..f19eeb42 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/bo/StatDataNumber.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.entity.bo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class StatDataNumber implements Serializable { + + private int originalDataNumber = 0; + private int anlyseDataNumber = 0; + + public void addOriginalDataNumber(int incr) { + originalDataNumber += incr; + } + + public void addAnlyseDataNumber(int incr) { + anlyseDataNumber += incr; + } + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/OriginalDataNumber.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/OriginalDataNumber.java new file mode 100644 index 00000000..5ced4908 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/entity/data/OriginalDataNumber.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.entity.data; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class OriginalDataNumber implements Serializable { + + private String siteCode; + private String dataType; + private Integer count; +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsAlertDataService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsAlertDataService.java index b7ce9d90..18339bb1 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsAlertDataService.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsAlertDataService.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.entity.GardsAlertDataWeb; import javax.servlet.http.HttpServletResponse; +import java.util.Date; +import java.util.List; public interface IGardsAlertDataService extends IService { @@ -11,4 +13,6 @@ public interface IGardsAlertDataService extends IService { String startTime, String endTime, HttpServletResponse response); + + List queryByTime(Date startTime, Date endTime); } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsMetDataService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsMetDataService.java index 986adc22..619ef012 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsMetDataService.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsMetDataService.java @@ -7,6 +7,7 @@ import org.jeecg.modules.entity.GardsMetDataWeb; import javax.servlet.http.HttpServletResponse; import java.util.Date; +import java.util.List; public interface IGardsMetDataService extends IService { @@ -24,4 +25,6 @@ public interface IGardsMetDataService extends IService { String startTime, String endTime, HttpServletResponse response); + + List queryByModDate(Date startTime, Date endTime); } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java index 24344b55..bfe900d6 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java @@ -48,4 +48,6 @@ public interface IGardsSampleDataWebService extends IService String startTime, String endTime, List sampleIds); + + List queryByModDate(Date startTime, Date endTime); } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSohDataService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSohDataService.java index 11ab0ee1..03392863 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSohDataService.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSohDataService.java @@ -7,6 +7,7 @@ import org.jeecg.modules.entity.GardsSohDataWeb; import javax.servlet.http.HttpServletResponse; import java.util.Date; +import java.util.List; public interface IGardsSohDataService extends IService { @@ -41,4 +42,7 @@ public interface IGardsSohDataService extends IService { String startTime, String endTime, HttpServletResponse response); + + + List queryByModDate(Date startTime, Date endTime); } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsAlertDataServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsAlertDataServiceImpl.java index 8f31e2a7..cc1aa8f8 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsAlertDataServiceImpl.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsAlertDataServiceImpl.java @@ -73,4 +73,11 @@ public class GardsAlertDataServiceImpl extends ServiceImpl queryByTime(Date startTime, Date endTime) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.between(GardsAlertDataWeb::getTime, startTime, endTime); + return list(queryWrapper); + } } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java index 3bed3945..e6f90467 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsMetDataServiceImpl.java @@ -112,4 +112,11 @@ public class GardsMetDataServiceImpl extends ServiceImpl queryByModDate(Date startTime, Date endTime) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.between(GardsMetDataWeb::getModdate, startTime ,endTime); + return list(queryWrapper); + } + } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java index 04e49b1d..b70f9c96 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java @@ -709,4 +709,12 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl queryByModDate(Date startTime, Date endTime) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.between(GardsSampleDataWeb::getModdate, startTime, endTime); + queryWrapper.orderByAsc(GardsSampleDataWeb::getSiteDetCode); + return list(queryWrapper); + } } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java index 3202a0d3..fa823cf0 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSohDataServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.dynamic.datasource.annotation.DS; 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 org.apache.commons.codec.language.bm.Lang; import org.apache.poi.ss.usermodel.Workbook; import org.jeecg.common.api.QueryRequest; import org.jeecg.common.api.vo.Result; @@ -192,4 +193,11 @@ public class GardsSohDataServiceImpl extends ServiceImpl queryByModDate(Date startTime, Date endTime) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.between(GardsSohDataWeb::getModdate, startTime, endTime); + return list(queryWrapper); + } } From 9913770471778a7deac070b93a7c23aa484e9b8d Mon Sep 17 00:00:00 2001 From: xiongzheng Date: Mon, 6 Nov 2023 09:08:50 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/mapper/StatReportMapper.java | 71 +++++++++ .../modules/mapper/SysEmailLogStatMapper.java | 11 ++ .../modules/mapper/xml/StatReportMapper.xml | 13 ++ .../modules/service/IStatReportService.java | 19 +++ .../service/ISysEmailLogStatService.java | 10 ++ .../service/impl/StatReportServiceImpl.java | 139 ++++++++++++++++++ .../impl/SysEmailLogStatServiceImpl.java | 21 +++ 7 files changed, 284 insertions(+) create mode 100644 jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/StatReportMapper.java create mode 100644 jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysEmailLogStatMapper.java create mode 100644 jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/StatReportMapper.xml create mode 100644 jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IStatReportService.java create mode 100644 jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysEmailLogStatService.java create mode 100644 jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/StatReportServiceImpl.java create mode 100644 jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/SysEmailLogStatServiceImpl.java diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/StatReportMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/StatReportMapper.java new file mode 100644 index 00000000..b84f2e97 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/StatReportMapper.java @@ -0,0 +1,71 @@ +package org.jeecg.modules.mapper; + +import org.apache.ibatis.annotations.Select; +import org.jeecg.modules.entity.data.OriginalDataNumber; + +import java.util.List; + +public interface StatReportMapper { + + List queryOriginalDataNumberFromGardsSampleData(String startTime, String endTime); + + @Select("select count(sample_id) from original.GARDS_SAMPLE_DESCRIPTION where sample_id = #{sampleId}") + Integer countGardsSampleDescriptionBySampleId(Integer sampleId); + + @Select("select count(sample_id) from original.GARDS_SAMPLE_RATIOS where sample_id = #{sampleId}") + Integer countGardsSampleRatiosBySampleId(Integer sampleId); + + @Select("select count(sample_id) from original.GARDS_SPECTRUM where sample_id = #{sampleId}") + Integer countGardsSpectrumBySampleId(Integer sampleId); + + @Select("select count(sample_id) from original.GARDS_TOTAL_EFFICIENCY_PAIRS where sample_id = #{sampleId}") + Integer countGardsTotalEfficiencyPairsBySampleId(Integer sampleId); + + @Select("select count(sample_id) from original.GARDS_HISTOGRAM where sample_id = #{sampleId}") + Integer countGardsHistogramBySampleId(Integer sampleId); + + @Select("select count(sample_id) from original.GARDS_CALIBRATION_PAIRS_ORIG where sample_id = #{sampleId}") + Integer countGardsCalibrationPairsOrig(Integer sampleId); + + @Select("select count(sample_id) from original.GARDS_BG_EFFICIENCY_PAIRS where sample_id = #{sampleId}") + Integer countGardsBGEfficinecyPairsBySampleId(Integer sampleId); + + @Select("select count(sample_id) from original.GARDS_ROI_LIMITS where sample_id = #{sampleId}") + Integer countGardsROILimitsBySampleId(Integer sampleId); + + @Select("select count(sample_id) from original.GARDS_SAMPLE_AUX where sample_id = #{sampleId}") + Integer countGardsSampleAUXBySampleId(Integer sampleId); + + @Select("select count(sample_id) from original.GARDS_SAMPLE_CERT where sample_id = #{sampleId}") + Integer countGardsSampleCertBySampleId(Integer sampleId); + + @Select("select count(sample_id) from original.GARDS_SAMPLE_CERT_LINE where sample_id = #{sampleId}") + Integer countGardsSampleCertLineBySampleId(Integer sampleId); + + @Select("select count(sample_id) from rnauto.GARDS_ANALYSES where sample_id = #{sampleId}") + Integer countGardsAnalysesBySampleId(Integer sampleId); + + @Select("select count(sample_id) from rnauto.GARDS_CALIBRATION where sample_id = #{sampleId}") + Integer countGardsCalibrationBySampleId(Integer sampleId); + + @Select("select count(sample_id) from rnauto.GARDS_CALIBRATION_PAIRS where sample_id = #{sampleId}") + Integer countGardsCalibrationPairsBySampleId(Integer sampleId); + + @Select("select count(sample_id) from rnauto.GARDS_NUCL_LINES_IDED where sample_id = #{sampleId}") + Integer countGardsNuclLinesIdedBySampleId(Integer sampleId); + + @Select("select count(sample_id) from rnauto.GARDS_ROI_CHANNELS where sample_id = #{sampleId}") + Integer countGardsRoiChannelsBySampleId(Integer sampleId); + + @Select("select count(sample_id) from rnauto.GARDS_ROI_RESULTS where sample_id = #{sampleId}") + Integer countGardsRoiResultsBySampleId(Integer sampleId); + + @Select("select count(sample_id) from rnauto.GARDS_XE_RESULTS where sample_id = #{sampleId}") + Integer countGardsXeResultsBySampleId(Integer sampleId); + + @Select("select count(sample_id) from rnauto.GARDS_PEAKS where sample_id = #{sampleId}") + Integer countGardsPeaksBySampleId(Integer sampleId); + + @Select("select count(sample_id) from rnauto.GARDS_QC_CHECK where sample_id = #{sampleId}") + Integer countGardsQcCheckBySampleId(Integer sampleId); +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysEmailLogStatMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysEmailLogStatMapper.java new file mode 100644 index 00000000..10af6b84 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysEmailLogStatMapper.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.postgre.SysEmailLog; +import org.jeecg.modules.entity.GardsAlertDataWeb; + +import java.util.Date; + +public interface SysEmailLogStatMapper extends BaseMapper { + +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/StatReportMapper.xml b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/StatReportMapper.xml new file mode 100644 index 00000000..d3d82aa9 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/StatReportMapper.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IStatReportService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IStatReportService.java new file mode 100644 index 00000000..af7e578b --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IStatReportService.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.service; + +import com.google.common.collect.HashBasedTable; +import org.jeecg.modules.entity.bo.StatDataNumber; + +import java.util.Date; + +public interface IStatReportService { + + /** + * 统计LoadIntoDB + * + * @param startTime + * @param endTime + */ + HashBasedTable statLoadIntoDB(Date startTime, Date endTime); + + void doStat(Date startTime, Date endTime); +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysEmailLogStatService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysEmailLogStatService.java new file mode 100644 index 00000000..736ece6d --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/ISysEmailLogStatService.java @@ -0,0 +1,10 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.postgre.SysEmailLog; +import java.util.Date; + +public interface ISysEmailLogStatService extends IService { + + long queryEmailCount(Date startTime, Date endTime); +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/StatReportServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/StatReportServiceImpl.java new file mode 100644 index 00000000..bd96c356 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/StatReportServiceImpl.java @@ -0,0 +1,139 @@ +package org.jeecg.modules.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.google.common.collect.HashBasedTable; +import org.jeecg.modules.entity.GardsAlertDataWeb; +import org.jeecg.modules.entity.GardsMetDataWeb; +import org.jeecg.modules.entity.GardsSampleDataWeb; +import org.jeecg.modules.entity.GardsSohDataWeb; +import org.jeecg.modules.entity.bo.StatDataNumber; +import org.jeecg.modules.mapper.StatReportMapper; +import org.jeecg.modules.service.*; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Optional; + +@Service +@DS("ora") +public class StatReportServiceImpl implements IStatReportService { + @Resource + private IGardsSampleDataWebService gardsSampleDataWebService; + @Resource + private StatReportMapper statReportMapper; + @Resource + private IGardsMetDataService gardsMetDataService; + @Resource + private IGardsSohDataService gardsSohDataService; + @Resource + private IGardsAlertDataService gardsAlertDataService; + @Resource + private ISysEmailLogStatService sysEmailLogStatService; + + @Override + public HashBasedTable statLoadIntoDB(Date startTime, Date endTime) { + HashBasedTable statTable = HashBasedTable.create(); + + List gardsSampleDataWebs = gardsSampleDataWebService.queryByModDate(startTime, endTime); + for (GardsSampleDataWeb gardsSampleDataWeb : gardsSampleDataWebs) { + Integer sampleId = gardsSampleDataWeb.getSampleId(); + String site = gardsSampleDataWeb.getSiteDetCode().split("_")[0]; + String dataType = gardsSampleDataWeb.getDataType(); + increase(statTable, site, dataType, 1, 0); + + Integer sampleDescription = statReportMapper.countGardsSampleDescriptionBySampleId(sampleId); + Integer sampleCertLine = statReportMapper.countGardsSampleCertLineBySampleId(sampleId); + Integer bgEfficinecyPairs = statReportMapper.countGardsBGEfficinecyPairsBySampleId(sampleId); + Integer calibrationPairsOrig = statReportMapper.countGardsCalibrationPairsOrig(sampleId); + Integer gardsHistogram = statReportMapper.countGardsHistogramBySampleId(sampleId); + Integer roiLimits = statReportMapper.countGardsROILimitsBySampleId(sampleId); + Integer sampleAUX = statReportMapper.countGardsSampleAUXBySampleId(sampleId); + Integer totalEfficiencyPairs = statReportMapper.countGardsTotalEfficiencyPairsBySampleId(sampleId); + Integer spectrum = statReportMapper.countGardsSpectrumBySampleId(sampleId); + Integer sampleCert = statReportMapper.countGardsSampleCertBySampleId(sampleId); + Integer sampleRatios = statReportMapper.countGardsSampleRatiosBySampleId(sampleId); + int originalNumberTotal = sampleDescription + sampleCertLine + bgEfficinecyPairs + calibrationPairsOrig + + gardsHistogram + roiLimits + sampleAUX + totalEfficiencyPairs + spectrum + sampleCert + sampleRatios; + increase(statTable, site, dataType, originalNumberTotal, 0); + + if (gardsSampleDataWeb.getDataType().equals("S")) { // 只有SAMPLEPHD才有分析数据 + Integer i = statReportMapper.countGardsCalibrationPairsBySampleId(sampleId); + Integer i1 = statReportMapper.countGardsNuclLinesIdedBySampleId(sampleId); + Integer i2 = statReportMapper.countGardsRoiChannelsBySampleId(sampleId); + Integer i3 = statReportMapper.countGardsRoiResultsBySampleId(sampleId); + Integer i4 = statReportMapper.countGardsXeResultsBySampleId(sampleId); + Integer i5 = statReportMapper.countGardsPeaksBySampleId(sampleId); + Integer i6 = statReportMapper.countGardsQcCheckBySampleId(sampleId); + Integer i7 = statReportMapper.countGardsAnalysesBySampleId(sampleId); + Integer i8 = statReportMapper.countGardsCalibrationBySampleId(sampleId); + int total = i + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8; + increase(statTable, site, dataType, 0, total); + } + } + + List metDataList = gardsMetDataService.queryByModDate(startTime, endTime); + for (GardsMetDataWeb gardsMetDataWeb : metDataList) { + increase(statTable, gardsMetDataWeb.getStationCode(), "MET", 1, 0); + } + List sohDataList = gardsSohDataService.queryByModDate(startTime, endTime); + for (GardsSohDataWeb gardsSohDataWeb : sohDataList) { + increase(statTable, gardsSohDataWeb.getStationCode(), "SOH", 1, 0); + } + List alertDataList = gardsAlertDataService.queryByTime(startTime, endTime); + for (GardsAlertDataWeb gardsAlertDataWeb : alertDataList) { + increase(statTable, gardsAlertDataWeb.getStationCode(), "ALERT", 1, 0); + } + return statTable; + } + + @Override + public void doStat(Date startTime, Date endTime) { + long emailCount = sysEmailLogStatService.queryEmailCount(startTime, endTime); + HashBasedTable loadToDBTable = statLoadIntoDB(startTime, endTime); + Collection values = loadToDBTable.values(); + Optional originalDataLoadTotal = values.stream().map(StatDataNumber::getOriginalDataNumber).reduce(Integer::sum); + } + + + private String genReport(Date startTime, Date endTime, long emailNumber, int originalDataLoadToDB, int fileFormatErr, int fileRepeatErr, HashBasedTable statTable) { + String content = + " GENERATED STATISTICS REPORT \n" + + " Creation Date %s \n" + + "\n" + + "#STATISTICS INFO \n" + + " Statistics BeginTime: %s \n" + + " Statistics EndTime: %s \n" + + " Email Number: %d \n" + + " Original Data Load to DB Number: %d \n" + + "\n" + + "#STATISTICS ERROR FILE \n" + + " File Format Error: %d \n" + + " File Repeat Error: %d \n" + + "\n" + + "#LOAD INTO DB INFO \n" + + " Station Name DataType Original Data Number Anlyse Data Number "; + String dateFormat = "yyyy/MM/dd-HH:mm:ss"; + String nowDateStr = DateUtil.format(new Date(), dateFormat); + String startTimeStr = DateUtil.format(startTime, dateFormat); + String endTimeStr = DateUtil.format(endTime, dateFormat); + String format = String.format(content, nowDateStr, startTimeStr, endTimeStr, emailNumber, originalDataLoadToDB, fileFormatErr, fileRepeatErr); + // ARP01 SAMPLEPHD 19 19 + return format; + } + + private void increase(HashBasedTable statTable, String key1, String key2, int originalDataNumberIncr, int anlyseDataNumberIncr) { + StatDataNumber statDataNumber; + if (!statTable.contains(key1, key2)) { + statDataNumber = new StatDataNumber(); + } else { + statDataNumber = statTable.get(key1, key2); + } + statDataNumber.addOriginalDataNumber(originalDataNumberIncr); + statDataNumber.addAnlyseDataNumber(anlyseDataNumberIncr); + statTable.put(key1, key2, statDataNumber); + } +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/SysEmailLogStatServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/SysEmailLogStatServiceImpl.java new file mode 100644 index 00000000..bd4395bd --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/SysEmailLogStatServiceImpl.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.postgre.SysEmailLog; +import org.jeecg.modules.mapper.SysEmailLogStatMapper; +import org.jeecg.modules.service.ISysEmailLogStatService; +import org.springframework.stereotype.Service; + +import java.util.Date; + +@Service +public class SysEmailLogStatServiceImpl extends ServiceImpl implements ISysEmailLogStatService { + + @Override + public long queryEmailCount(Date startTime, Date endTime) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.between(SysEmailLog::getCreateTime, startTime, endTime); + return count(queryWrapper); + } +}