From 2a25593d8c504d8510afd331acd934aefb66c832 Mon Sep 17 00:00:00 2001 From: xuxin <2727830447@qq.com> Date: Sun, 13 Aug 2023 01:43:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=9F=E6=B0=94=E5=BA=9F=E6=B0=B4=E8=B6=85?= =?UTF-8?q?=E9=87=8F=E6=9C=AA=E8=90=BD=E5=AE=9E=E6=8E=92=E6=B1=A1=E8=AE=B8?= =?UTF-8?q?=E5=8F=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../excess/AirExcessMonthProcessService.java | 120 +++++++++++++++++ .../AirExcessQuarterProcessService.java | 123 ++++++++++++++++++ .../excess/AirExcessYearProcessService.java | 123 ++++++++++++++++++ .../WaterExcessMonthProcessService.java | 123 ++++++++++++++++++ .../WaterExcessQuarterProcessService.java | 121 +++++++++++++++++ .../excess/WaterExcessYearProcessService.java | 121 +++++++++++++++++ .../talroad/task/ReportExcessController.java | 96 ++++++++++++++ 7 files changed, 827 insertions(+) create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessMonthProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessQuarterProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessYearProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessMonthProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessQuarterProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessYearProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/task/ReportExcessController.java diff --git a/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessMonthProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessMonthProcessService.java new file mode 100644 index 0000000..8736e58 --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessMonthProcessService.java @@ -0,0 +1,120 @@ +package cn.cecep.talroad.data.analyse.task.execute.report.excess; + +import cn.cecep.talroad.data.analyse.task.execute.report.PollutionDischargeProcessService; +import cn.cecep.talroad.domain.AmProblemFi; +import cn.cecep.talroad.domain.BMainActionReports; +import cn.cecep.talroad.domain.BStatTableZxbgPflAir; +import cn.cecep.talroad.domain.PcFactory; +import cn.cecep.talroad.mapper.*; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Service +@Slf4j +public class AirExcessMonthProcessService implements PollutionDischargeProcessService { + @Autowired + private BStatTableZxbgPflAirMapper statTableZxbgPflAirMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + /** + * 0:月报,1:季报,2:年报 + */ + public static final String zxbgType = "0"; + + /** + * 1:年报,2:季报,3:月报 + */ + + public static final String reportsType = "3"; + + /** + * 污染物来源 1废气、2废水 3 视频 可为空 + */ + public static final String pollutantSource = "1"; + + @Override + public void process() { + + // todo :缺少查询报告周期条件 + List report = getReport(); + + for (BMainActionReports bMainActionReports : report) { + + LambdaQueryWrapper bStatTableZxbgPflWaterLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgPflAir::getZxbgType, zxbgType) + .eq(BStatTableZxbgPflAir::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgPflAir::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = statTableZxbgPflAirMapper.selectList(bStatTableZxbgPflWaterLambdaQueryWrapper); + + for (BStatTableZxbgPflAir bStatTableZxbgPflAir : bStatTableZxbgPflWaters) { + BigDecimal zxbgYear = new BigDecimal(bStatTableZxbgPflAir.getZxbgDischargeYear()); + BigDecimal zxbgActual = new BigDecimal(bStatTableZxbgPflAir.getZxbgDischargeActual()); + if (zxbgActual.doubleValue()>zxbgYear.doubleValue()){ + addAmProblemFi(bStatTableZxbgPflAir); + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgPflAir bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + String problemString = getProblemString(pcFactory.getFactoryName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getZxbgPollutant()); + + AmProblemFi amProblemFi = new AmProblemFi(); + amProblemFi.setFactoryId(pcFactory.getId()); + amProblemFi.setAnalyseTime(new Date()); + amProblemFi.setType(1); + amProblemFi.setPollutantSourceAi(pollutantSource); + amProblemFi.setDetails(problemString); + amProblemFiMapper.insert(amProblemFi); + + } + + /** + * 执行报告年报中,实际排放情况及达标判定分析-实际排放量信息-废水模块年度每个污染物排放量合计大于许可排放量要求就算超总量 + * 报警说明:“企业名称”“执行报告周期(2013年执行报告年报/2013年执行报告第一季度季报。。。)”中“污染物名称”实际排放量大于许可排放量,出现超总量情况。 + */ + public String getProblemString(String factoryName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(pollutantName).append("实际排放量大于许可排放量,出现超总量情况。") + .toString(); + } + + /** + * 查询报告周期 + * todo :缺少查询报告周期条件 + * @return + */ + public List getReport(){ + LambdaQueryWrapper bMainActionReportsLambdaQueryWrapper = new QueryWrapper().lambda().eq(BMainActionReports::getReportsType, reportsType); + List bMainActionReports = mainActionReportsMapper.selectList(bMainActionReportsLambdaQueryWrapper); + return bMainActionReports; + } + +} diff --git a/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessQuarterProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessQuarterProcessService.java new file mode 100644 index 0000000..170d03c --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessQuarterProcessService.java @@ -0,0 +1,123 @@ +package cn.cecep.talroad.data.analyse.task.execute.report.excess; + +import cn.cecep.talroad.data.analyse.task.execute.report.PollutionDischargeProcessService; +import cn.cecep.talroad.domain.AmProblemFi; +import cn.cecep.talroad.domain.BMainActionReports; +import cn.cecep.talroad.domain.BStatTableZxbgPflAir; +import cn.cecep.talroad.domain.PcFactory; +import cn.cecep.talroad.mapper.AmProblemFiMapper; +import cn.cecep.talroad.mapper.BMainActionReportsMapper; +import cn.cecep.talroad.mapper.BStatTableZxbgPflAirMapper; +import cn.cecep.talroad.mapper.PcFactoryMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Service +@Slf4j +public class AirExcessQuarterProcessService implements PollutionDischargeProcessService { + @Autowired + private BStatTableZxbgPflAirMapper statTableZxbgPflAirMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + /** + * 0:月报,1:季报,2:年报 + */ + public static final String zxbgType = "1"; + + /** + * 1:年报,2:季报,3:月报 + */ + + public static final String reportsType = "2"; + + /** + * 污染物来源 1废气、2废水 3 视频 可为空 + */ + public static final String pollutantSource = "1"; + + @Override + public void process() { + + // todo :缺少查询报告周期条件 + List report = getReport(); + + for (BMainActionReports bMainActionReports : report) { + + LambdaQueryWrapper bStatTableZxbgPflWaterLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgPflAir::getZxbgType, zxbgType) + .eq(BStatTableZxbgPflAir::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgPflAir::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = statTableZxbgPflAirMapper.selectList(bStatTableZxbgPflWaterLambdaQueryWrapper); + + for (BStatTableZxbgPflAir bStatTableZxbgPflAir : bStatTableZxbgPflWaters) { + BigDecimal zxbgYear = new BigDecimal(bStatTableZxbgPflAir.getZxbgDischargeYear()); + BigDecimal zxbgActual = new BigDecimal(bStatTableZxbgPflAir.getZxbgDischargeActual()); + if (zxbgActual.doubleValue()>zxbgYear.doubleValue()){ + addAmProblemFi(bStatTableZxbgPflAir); + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgPflAir bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + String problemString = getProblemString(pcFactory.getFactoryName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getZxbgPollutant()); + + AmProblemFi amProblemFi = new AmProblemFi(); + amProblemFi.setFactoryId(pcFactory.getId()); + amProblemFi.setAnalyseTime(new Date()); + amProblemFi.setType(1); + amProblemFi.setPollutantSourceAi(pollutantSource); + amProblemFi.setDetails(problemString); + amProblemFiMapper.insert(amProblemFi); + + } + + /** + * 执行报告年报中,实际排放情况及达标判定分析-实际排放量信息-废水模块年度每个污染物排放量合计大于许可排放量要求就算超总量 + * 报警说明:“企业名称”“执行报告周期(2013年执行报告年报/2013年执行报告第一季度季报。。。)”中“污染物名称”实际排放量大于许可排放量,出现超总量情况。 + */ + public String getProblemString(String factoryName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(pollutantName).append("实际排放量大于许可排放量,出现超总量情况。") + .toString(); + } + + /** + * 查询报告周期 + * todo :缺少查询报告周期条件 + * @return + */ + public List getReport(){ + LambdaQueryWrapper bMainActionReportsLambdaQueryWrapper = new QueryWrapper().lambda().eq(BMainActionReports::getReportsType, reportsType); + List bMainActionReports = mainActionReportsMapper.selectList(bMainActionReportsLambdaQueryWrapper); + return bMainActionReports; + } + +} diff --git a/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessYearProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessYearProcessService.java new file mode 100644 index 0000000..e5fe6ef --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessYearProcessService.java @@ -0,0 +1,123 @@ +package cn.cecep.talroad.data.analyse.task.execute.report.excess; + +import cn.cecep.talroad.data.analyse.task.execute.report.PollutionDischargeProcessService; +import cn.cecep.talroad.domain.AmProblemFi; +import cn.cecep.talroad.domain.BMainActionReports; +import cn.cecep.talroad.domain.BStatTableZxbgPflAir; +import cn.cecep.talroad.domain.PcFactory; +import cn.cecep.talroad.mapper.AmProblemFiMapper; +import cn.cecep.talroad.mapper.BMainActionReportsMapper; +import cn.cecep.talroad.mapper.BStatTableZxbgPflAirMapper; +import cn.cecep.talroad.mapper.PcFactoryMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Service +@Slf4j +public class AirExcessYearProcessService implements PollutionDischargeProcessService { + @Autowired + private BStatTableZxbgPflAirMapper statTableZxbgPflAirMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + /** + * 0:月报,1:季报,2:年报 + */ + public static final String zxbgType = "2"; + + /** + * 1:年报,2:季报,3:月报 + */ + + public static final String reportsType = "1"; + + /** + * 污染物来源 1废气、2废水 3 视频 可为空 + */ + public static final String pollutantSource = "1"; + + @Override + public void process() { + + // todo :缺少查询报告周期条件 + List report = getReport(); + + for (BMainActionReports bMainActionReports : report) { + + LambdaQueryWrapper bStatTableZxbgPflWaterLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgPflAir::getZxbgType, zxbgType) + .eq(BStatTableZxbgPflAir::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgPflAir::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = statTableZxbgPflAirMapper.selectList(bStatTableZxbgPflWaterLambdaQueryWrapper); + + for (BStatTableZxbgPflAir bStatTableZxbgPflAir : bStatTableZxbgPflWaters) { + BigDecimal zxbgYear = new BigDecimal(bStatTableZxbgPflAir.getZxbgDischargeYear()); + BigDecimal zxbgActual = new BigDecimal(bStatTableZxbgPflAir.getZxbgDischargeActual()); + if (zxbgActual.doubleValue()>zxbgYear.doubleValue()){ + addAmProblemFi(bStatTableZxbgPflAir); + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgPflAir bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + String problemString = getProblemString(pcFactory.getFactoryName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getZxbgPollutant()); + + AmProblemFi amProblemFi = new AmProblemFi(); + amProblemFi.setFactoryId(pcFactory.getId()); + amProblemFi.setAnalyseTime(new Date()); + amProblemFi.setType(1); + amProblemFi.setPollutantSourceAi(pollutantSource); + amProblemFi.setDetails(problemString); + amProblemFiMapper.insert(amProblemFi); + + } + + /** + * 执行报告年报中,实际排放情况及达标判定分析-实际排放量信息-废水模块年度每个污染物排放量合计大于许可排放量要求就算超总量 + * 报警说明:“企业名称”“执行报告周期(2013年执行报告年报/2013年执行报告第一季度季报。。。)”中“污染物名称”实际排放量大于许可排放量,出现超总量情况。 + */ + public String getProblemString(String factoryName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(pollutantName).append("实际排放量大于许可排放量,出现超总量情况。") + .toString(); + } + + /** + * 查询报告周期 + * todo :缺少查询报告周期条件 + * @return + */ + public List getReport(){ + LambdaQueryWrapper bMainActionReportsLambdaQueryWrapper = new QueryWrapper().lambda().eq(BMainActionReports::getReportsType, reportsType); + List bMainActionReports = mainActionReportsMapper.selectList(bMainActionReportsLambdaQueryWrapper); + return bMainActionReports; + } + +} diff --git a/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessMonthProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessMonthProcessService.java new file mode 100644 index 0000000..5c85cd2 --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessMonthProcessService.java @@ -0,0 +1,123 @@ +package cn.cecep.talroad.data.analyse.task.execute.report.excess; + +import cn.cecep.talroad.data.analyse.task.execute.report.PollutionDischargeProcessService; +import cn.cecep.talroad.domain.*; +import cn.cecep.talroad.mapper.AmProblemFiMapper; +import cn.cecep.talroad.mapper.BMainActionReportsMapper; +import cn.cecep.talroad.mapper.BStatTableZxbgPflWaterMapper; +import cn.cecep.talroad.mapper.PcFactoryMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class WaterExcessMonthProcessService implements PollutionDischargeProcessService { + + @Autowired + private BStatTableZxbgPflWaterMapper statTableZxbgPflWaterMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + /** + * 0:月报,1:季报,2:年报 + */ + public static final String zxbgType = "0"; + + /** + * 1:年报,2:季报,3:月报 + */ + + public static final String reportsType = "3"; + + /** + * 污染物来源 1废气、2废水 3 视频 可为空 + */ + public static final String pollutantSource = "2"; + + @Override + public void process() { + + // todo :缺少查询报告周期条件 + List report = getReport(); + + for (BMainActionReports bMainActionReports : report) { + + LambdaQueryWrapper bStatTableZxbgPflWaterLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgPflWater::getZxbgType, zxbgType) + .eq(BStatTableZxbgPflWater::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgPflWater::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = statTableZxbgPflWaterMapper.selectList(bStatTableZxbgPflWaterLambdaQueryWrapper); + + for (BStatTableZxbgPflWater bStatTableZxbgPflWater : bStatTableZxbgPflWaters) { + BigDecimal zxbgYear = new BigDecimal(bStatTableZxbgPflWater.getZxbgDischargeYear()); + BigDecimal zxbgActual = new BigDecimal(bStatTableZxbgPflWater.getZxbgDischargeActual()); + if (zxbgActual.doubleValue()>zxbgYear.doubleValue()){ + //todo 添加报警信息 + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgPflAir bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + String problemString = getProblemString(pcFactory.getFactoryName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getZxbgPollutant()); + + AmProblemFi amProblemFi = new AmProblemFi(); + amProblemFi.setFactoryId(pcFactory.getId()); + amProblemFi.setAnalyseTime(new Date()); + amProblemFi.setType(1); + amProblemFi.setPollutantSourceAi(pollutantSource); + amProblemFi.setDetails(problemString); + amProblemFiMapper.insert(amProblemFi); + + } + + /** + * 执行报告年报中,实际排放情况及达标判定分析-实际排放量信息-废水模块年度每个污染物排放量合计大于许可排放量要求就算超总量 + * 报警说明:“企业名称”“执行报告周期(2013年执行报告年报/2013年执行报告第一季度季报。。。)”中“污染物名称”实际排放量大于许可排放量,出现超总量情况。 + */ + public String getProblemString(String factoryName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(pollutantName).append("实际排放量大于许可排放量,出现超总量情况。") + .toString(); + } + + + /** + * 查询报告周期 + * todo :缺少查询报告周期条件 + * @return + */ + public List getReport(){ + LambdaQueryWrapper bMainActionReportsLambdaQueryWrapper = new QueryWrapper().lambda().eq(BMainActionReports::getReportsType, reportsType); + List bMainActionReports = mainActionReportsMapper.selectList(bMainActionReportsLambdaQueryWrapper); + return bMainActionReports; + } +} diff --git a/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessQuarterProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessQuarterProcessService.java new file mode 100644 index 0000000..d364a55 --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessQuarterProcessService.java @@ -0,0 +1,121 @@ +package cn.cecep.talroad.data.analyse.task.execute.report.excess; + +import cn.cecep.talroad.data.analyse.task.execute.report.PollutionDischargeProcessService; +import cn.cecep.talroad.domain.*; +import cn.cecep.talroad.mapper.AmProblemFiMapper; +import cn.cecep.talroad.mapper.BMainActionReportsMapper; +import cn.cecep.talroad.mapper.BStatTableZxbgPflWaterMapper; +import cn.cecep.talroad.mapper.PcFactoryMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Service +@Slf4j +public class WaterExcessQuarterProcessService implements PollutionDischargeProcessService { + + @Autowired + private BStatTableZxbgPflWaterMapper statTableZxbgPflWaterMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + /** + * 0:月报,1:季报,2:年报 + */ + public static final String zxbgType = "1"; + + /** + * 1:年报,2:季报,3:月报 + */ + + public static final String reportsType = "2"; + + /** + * 污染物来源 1废气、2废水 3 视频 可为空 + */ + public static final String pollutantSource = "2"; + + @Override + public void process() { + + // todo :缺少查询报告周期条件 + List report = getReport(); + + for (BMainActionReports bMainActionReports : report) { + + LambdaQueryWrapper bStatTableZxbgPflWaterLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgPflWater::getZxbgType, zxbgType) + .eq(BStatTableZxbgPflWater::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgPflWater::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = statTableZxbgPflWaterMapper.selectList(bStatTableZxbgPflWaterLambdaQueryWrapper); + + for (BStatTableZxbgPflWater bStatTableZxbgPflWater : bStatTableZxbgPflWaters) { + BigDecimal zxbgYear = new BigDecimal(bStatTableZxbgPflWater.getZxbgDischargeYear()); + BigDecimal zxbgActual = new BigDecimal(bStatTableZxbgPflWater.getZxbgDischargeActual()); + if (zxbgActual.doubleValue()>zxbgYear.doubleValue()){ + //todo 添加报警信息 + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgPflAir bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + String problemString = getProblemString(pcFactory.getFactoryName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getZxbgPollutant()); + + AmProblemFi amProblemFi = new AmProblemFi(); + amProblemFi.setFactoryId(pcFactory.getId()); + amProblemFi.setAnalyseTime(new Date()); + amProblemFi.setType(1); + amProblemFi.setPollutantSourceAi(pollutantSource); + amProblemFi.setDetails(problemString); + amProblemFiMapper.insert(amProblemFi); + + } + + /** + * 执行报告年报中,实际排放情况及达标判定分析-实际排放量信息-废水模块年度每个污染物排放量合计大于许可排放量要求就算超总量 + * 报警说明:“企业名称”“执行报告周期(2013年执行报告年报/2013年执行报告第一季度季报。。。)”中“污染物名称”实际排放量大于许可排放量,出现超总量情况。 + */ + public String getProblemString(String factoryName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(pollutantName).append("实际排放量大于许可排放量,出现超总量情况。") + .toString(); + } + + + /** + * 查询报告周期 + * todo :缺少查询报告周期条件 + * @return + */ + public List getReport(){ + LambdaQueryWrapper bMainActionReportsLambdaQueryWrapper = new QueryWrapper().lambda().eq(BMainActionReports::getReportsType, reportsType); + List bMainActionReports = mainActionReportsMapper.selectList(bMainActionReportsLambdaQueryWrapper); + return bMainActionReports; + } +} diff --git a/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessYearProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessYearProcessService.java new file mode 100644 index 0000000..c140d9a --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessYearProcessService.java @@ -0,0 +1,121 @@ +package cn.cecep.talroad.data.analyse.task.execute.report.excess; + +import cn.cecep.talroad.data.analyse.task.execute.report.PollutionDischargeProcessService; +import cn.cecep.talroad.domain.*; +import cn.cecep.talroad.mapper.AmProblemFiMapper; +import cn.cecep.talroad.mapper.BMainActionReportsMapper; +import cn.cecep.talroad.mapper.BStatTableZxbgPflWaterMapper; +import cn.cecep.talroad.mapper.PcFactoryMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Service +@Slf4j +public class WaterExcessYearProcessService implements PollutionDischargeProcessService { + + @Autowired + private BStatTableZxbgPflWaterMapper statTableZxbgPflWaterMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + /** + * 0:月报,1:季报,2:年报 + */ + public static final String zxbgType = "2"; + + /** + * 1:年报,2:季报,3:月报 + */ + + public static final String reportsType = "1"; + + /** + * 污染物来源 1废气、2废水 3 视频 可为空 + */ + public static final String pollutantSource = "2"; + + @Override + public void process() { + + // todo :缺少查询报告周期条件 + List report = getReport(); + + for (BMainActionReports bMainActionReports : report) { + + LambdaQueryWrapper bStatTableZxbgPflWaterLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgPflWater::getZxbgType, zxbgType) + .eq(BStatTableZxbgPflWater::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgPflWater::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = statTableZxbgPflWaterMapper.selectList(bStatTableZxbgPflWaterLambdaQueryWrapper); + + for (BStatTableZxbgPflWater bStatTableZxbgPflWater : bStatTableZxbgPflWaters) { + BigDecimal zxbgYear = new BigDecimal(bStatTableZxbgPflWater.getZxbgDischargeYear()); + BigDecimal zxbgActual = new BigDecimal(bStatTableZxbgPflWater.getZxbgDischargeActual()); + if (zxbgActual.doubleValue()>zxbgYear.doubleValue()){ + //todo 添加报警信息 + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgPflAir bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + String problemString = getProblemString(pcFactory.getFactoryName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getZxbgPollutant()); + + AmProblemFi amProblemFi = new AmProblemFi(); + amProblemFi.setFactoryId(pcFactory.getId()); + amProblemFi.setAnalyseTime(new Date()); + amProblemFi.setType(1); + amProblemFi.setPollutantSourceAi(pollutantSource); + amProblemFi.setDetails(problemString); + amProblemFiMapper.insert(amProblemFi); + + } + + /** + * 执行报告年报中,实际排放情况及达标判定分析-实际排放量信息-废水模块年度每个污染物排放量合计大于许可排放量要求就算超总量 + * 报警说明:“企业名称”“执行报告周期(2013年执行报告年报/2013年执行报告第一季度季报。。。)”中“污染物名称”实际排放量大于许可排放量,出现超总量情况。 + */ + public String getProblemString(String factoryName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(pollutantName).append("实际排放量大于许可排放量,出现超总量情况。") + .toString(); + } + + + /** + * 查询报告周期 + * todo :缺少查询报告周期条件 + * @return + */ + public List getReport(){ + LambdaQueryWrapper bMainActionReportsLambdaQueryWrapper = new QueryWrapper().lambda().eq(BMainActionReports::getReportsType, reportsType); + List bMainActionReports = mainActionReportsMapper.selectList(bMainActionReportsLambdaQueryWrapper); + return bMainActionReports; + } +} diff --git a/szhpt-fixed-task/src/main/java/cn/cecep/talroad/task/ReportExcessController.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/task/ReportExcessController.java new file mode 100644 index 0000000..7d1e31b --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/task/ReportExcessController.java @@ -0,0 +1,96 @@ +package cn.cecep.talroad.task; + +import cn.cecep.talroad.data.analyse.task.execute.report.excess.*; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "执行报告中出现废水废气超总量排污行为,未有效落实排污许可制度") +@RestController +@RequestMapping("/report/excess") +@Slf4j +public class ReportExcessController { + + @Autowired + private AirExcessMonthProcessService airExcessMonthProcessService; + + @Autowired + private AirExcessQuarterProcessService airExcessQuarterProcessService; + + @Autowired + private AirExcessYearProcessService airExcessYearProcessService; + + @Autowired + private WaterExcessMonthProcessService waterExcessMonthProcessService; + + @Autowired + private WaterExcessQuarterProcessService waterExcessQuarterProcessService; + + @Autowired + private WaterExcessYearProcessService waterExcessYearProcessService; + + + @GetMapping("/airExcessMonth") + public void airExcessMonth() { + try { + airExcessMonthProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废气超量未落实排污许可 , 按月 . 原因:" + e.getMessage()); + } + } + + @GetMapping("/airExcessQuarter") + public void airExcessQuarter() { + try { + airExcessQuarterProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废气超量未落实排污许可 , 按季度 . 原因:" + e.getMessage()); + } + } + + @GetMapping("/airExcessYear") + public void airExcessYear() { + try { + airExcessYearProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废气超量未落实排污许可 , 按年 . 原因:" + e.getMessage()); + } + } + + @GetMapping("/waterExcessMonth") + public void waterExcessMonth() { + try { + waterExcessMonthProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废水超量未落实排污许可 , 按月 . 原因:" + e.getMessage()); + } + } + + @GetMapping("/waterExcessQuarter") + public void waterExcessQuarter() { + try { + waterExcessQuarterProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废水超量未落实排污许可 , 按季度 . 原因:" + e.getMessage()); + } + } + + @GetMapping("/waterExcessYear") + public void waterExcessYear() { + try { + waterExcessYearProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废水超量未落实排污许可 , 按年 . 原因:" + e.getMessage()); + } + } + +}