From a85cb25fa037f0158fbad5224ba181027ff2c9c8 Mon Sep 17 00:00:00 2001 From: xuxin <2727830447@qq.com> Date: Sun, 13 Aug 2023 02:15:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=9F=E6=B0=94=E5=BA=9F=E6=B0=B4=E5=9D=87?= =?UTF-8?q?=E5=80=BC=E7=9B=91=E6=B5=8B=E8=B6=85=E9=87=8F=E6=9C=AA=E8=90=BD?= =?UTF-8?q?=E5=AE=9E=E6=8E=92=E6=B1=A1=E8=AE=B8=E5=8F=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AirExcessMonthAvgProcessService.java | 124 ++++++++++++++++++ .../AirExcessQuarterAvgProcessService.java | 124 ++++++++++++++++++ .../AirExcessYearAvgProcessService.java | 124 ++++++++++++++++++ .../WaterExcessMonthAvgProcessService.java | 124 ++++++++++++++++++ .../WaterExcessQuarterAvgProcessService.java | 124 ++++++++++++++++++ .../WaterExcessYearAvgProcessService.java | 124 ++++++++++++++++++ .../talroad/task/ReportExcessController.java | 79 +++++++++++ 7 files changed, 823 insertions(+) create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessMonthAvgProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessQuarterAvgProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessYearAvgProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessMonthAvgProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessQuarterAvgProcessService.java create mode 100644 szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessYearAvgProcessService.java diff --git a/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessMonthAvgProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessMonthAvgProcessService.java new file mode 100644 index 0000000..ab4e1be --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessMonthAvgProcessService.java @@ -0,0 +1,124 @@ +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.*; +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 AirExcessMonthAvgProcessService implements PollutionDischargeProcessService { + + @Autowired + //b_stat_table_zxbg_gas_emission + private BStatTableZxbgGasEmissionMapper bStatTableZxbgGasEmissionMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + @Autowired + private PcOutletMapper pcOutletMapper; + + /** + * 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 bStatTableZxbgGasEmissionLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgGasEmission::getZxbgType, zxbgType) + .eq(BStatTableZxbgGasEmission::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgGasEmission::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = bStatTableZxbgGasEmissionMapper.selectList(bStatTableZxbgGasEmissionLambdaQueryWrapper); + + for (BStatTableZxbgGasEmission bStatTableZxbgGasEmission : bStatTableZxbgPflWaters) { + BigDecimal folds = new BigDecimal(bStatTableZxbgGasEmission.getFoldsAvgHour()); + BigDecimal emiss = new BigDecimal(bStatTableZxbgGasEmission.getEmissionConcentration()); + if (emiss.doubleValue()>folds.doubleValue()){ + addAmProblemFi(bStatTableZxbgGasEmission); + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgGasEmission bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + LambdaQueryWrapper eq = new QueryWrapper().lambda().eq(PcOutlet::getOutletCode, bStatTableZxbgPflAir.getOutletCode()); + PcOutlet pcOutlet = pcOutletMapper.selectOne(eq); + + String problemString = getProblemString(pcFactory.getFactoryName() , pcOutlet.getOutletCode() , pcOutlet.getOutletName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getPollutantName()); + + 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 outletCode , String outletName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append("企业名称").append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(outletCode).append(outletName).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/AirExcessQuarterAvgProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessQuarterAvgProcessService.java new file mode 100644 index 0000000..464db12 --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessQuarterAvgProcessService.java @@ -0,0 +1,124 @@ +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.*; +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 AirExcessQuarterAvgProcessService implements PollutionDischargeProcessService { + + @Autowired + //b_stat_table_zxbg_gas_emission + private BStatTableZxbgGasEmissionMapper bStatTableZxbgGasEmissionMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + @Autowired + private PcOutletMapper pcOutletMapper; + + /** + * 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 bStatTableZxbgGasEmissionLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgGasEmission::getZxbgType, zxbgType) + .eq(BStatTableZxbgGasEmission::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgGasEmission::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = bStatTableZxbgGasEmissionMapper.selectList(bStatTableZxbgGasEmissionLambdaQueryWrapper); + + for (BStatTableZxbgGasEmission bStatTableZxbgGasEmission : bStatTableZxbgPflWaters) { + BigDecimal folds = new BigDecimal(bStatTableZxbgGasEmission.getFoldsAvgHour()); + BigDecimal emiss = new BigDecimal(bStatTableZxbgGasEmission.getEmissionConcentration()); + if (emiss.doubleValue()>folds.doubleValue()){ + addAmProblemFi(bStatTableZxbgGasEmission); + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgGasEmission bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + LambdaQueryWrapper eq = new QueryWrapper().lambda().eq(PcOutlet::getOutletCode, bStatTableZxbgPflAir.getOutletCode()); + PcOutlet pcOutlet = pcOutletMapper.selectOne(eq); + + String problemString = getProblemString(pcFactory.getFactoryName() , pcOutlet.getOutletCode() , pcOutlet.getOutletName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getPollutantName()); + + 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 outletCode , String outletName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append("企业名称").append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(outletCode).append(outletName).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/AirExcessYearAvgProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessYearAvgProcessService.java new file mode 100644 index 0000000..bad27a0 --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/AirExcessYearAvgProcessService.java @@ -0,0 +1,124 @@ +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.*; +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 AirExcessYearAvgProcessService implements PollutionDischargeProcessService { + + @Autowired + //b_stat_table_zxbg_gas_emission + private BStatTableZxbgGasEmissionMapper bStatTableZxbgGasEmissionMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + @Autowired + private PcOutletMapper pcOutletMapper; + + /** + * 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 bStatTableZxbgGasEmissionLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgGasEmission::getZxbgType, zxbgType) + .eq(BStatTableZxbgGasEmission::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgGasEmission::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = bStatTableZxbgGasEmissionMapper.selectList(bStatTableZxbgGasEmissionLambdaQueryWrapper); + + for (BStatTableZxbgGasEmission bStatTableZxbgGasEmission : bStatTableZxbgPflWaters) { + BigDecimal folds = new BigDecimal(bStatTableZxbgGasEmission.getFoldsAvgHour()); + BigDecimal emiss = new BigDecimal(bStatTableZxbgGasEmission.getEmissionConcentration()); + if (emiss.doubleValue()>folds.doubleValue()){ + addAmProblemFi(bStatTableZxbgGasEmission); + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgGasEmission bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + LambdaQueryWrapper eq = new QueryWrapper().lambda().eq(PcOutlet::getOutletCode, bStatTableZxbgPflAir.getOutletCode()); + PcOutlet pcOutlet = pcOutletMapper.selectOne(eq); + + String problemString = getProblemString(pcFactory.getFactoryName() , pcOutlet.getOutletCode() , pcOutlet.getOutletName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getPollutantName()); + + 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 outletCode , String outletName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append("企业名称").append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(outletCode).append(outletName).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/WaterExcessMonthAvgProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessMonthAvgProcessService.java new file mode 100644 index 0000000..743979e --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessMonthAvgProcessService.java @@ -0,0 +1,124 @@ +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.*; +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 WaterExcessMonthAvgProcessService implements PollutionDischargeProcessService { + + @Autowired + //b_stat_table_zxbg_water_emission + private BStatTableZxbgWaterEmissionMapper bStatTableZxbgWaterEmissionMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + @Autowired + private PcOutletMapper pcOutletMapper; + + /** + * 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 bStatTableZxbgGasEmissionLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgWaterEmission::getZxbgType, zxbgType) + .eq(BStatTableZxbgWaterEmission::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgWaterEmission::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = bStatTableZxbgWaterEmissionMapper.selectList(bStatTableZxbgGasEmissionLambdaQueryWrapper); + + for (BStatTableZxbgWaterEmission bStatTableZxbgGasEmission : bStatTableZxbgPflWaters) { + BigDecimal folds = new BigDecimal(bStatTableZxbgGasEmission.getDetectionAvgDay()); + BigDecimal emiss = new BigDecimal(bStatTableZxbgGasEmission.getEmissionConcentration()); + if (emiss.doubleValue()>folds.doubleValue()){ + addAmProblemFi(bStatTableZxbgGasEmission); + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgWaterEmission bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + LambdaQueryWrapper eq = new QueryWrapper().lambda().eq(PcOutlet::getOutletCode, bStatTableZxbgPflAir.getOutletCode()); + PcOutlet pcOutlet = pcOutletMapper.selectOne(eq); + + String problemString = getProblemString(pcFactory.getFactoryName() , pcOutlet.getOutletCode() , pcOutlet.getOutletName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getPollutantName()); + + 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 outletCode , String outletName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append("企业名称").append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(outletCode).append(outletName).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/WaterExcessQuarterAvgProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessQuarterAvgProcessService.java new file mode 100644 index 0000000..3ac76cf --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessQuarterAvgProcessService.java @@ -0,0 +1,124 @@ +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.*; +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 WaterExcessQuarterAvgProcessService implements PollutionDischargeProcessService { + + @Autowired + //b_stat_table_zxbg_water_emission + private BStatTableZxbgWaterEmissionMapper bStatTableZxbgWaterEmissionMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + @Autowired + private PcOutletMapper pcOutletMapper; + + /** + * 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 bStatTableZxbgGasEmissionLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgWaterEmission::getZxbgType, zxbgType) + .eq(BStatTableZxbgWaterEmission::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgWaterEmission::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = bStatTableZxbgWaterEmissionMapper.selectList(bStatTableZxbgGasEmissionLambdaQueryWrapper); + + for (BStatTableZxbgWaterEmission bStatTableZxbgGasEmission : bStatTableZxbgPflWaters) { + BigDecimal folds = new BigDecimal(bStatTableZxbgGasEmission.getDetectionAvgDay()); + BigDecimal emiss = new BigDecimal(bStatTableZxbgGasEmission.getEmissionConcentration()); + if (emiss.doubleValue()>folds.doubleValue()){ + addAmProblemFi(bStatTableZxbgGasEmission); + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgWaterEmission bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + LambdaQueryWrapper eq = new QueryWrapper().lambda().eq(PcOutlet::getOutletCode, bStatTableZxbgPflAir.getOutletCode()); + PcOutlet pcOutlet = pcOutletMapper.selectOne(eq); + + String problemString = getProblemString(pcFactory.getFactoryName() , pcOutlet.getOutletCode() , pcOutlet.getOutletName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getPollutantName()); + + 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 outletCode , String outletName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append("企业名称").append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(outletCode).append(outletName).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/WaterExcessYearAvgProcessService.java b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessYearAvgProcessService.java new file mode 100644 index 0000000..18d3576 --- /dev/null +++ b/szhpt-fixed-task/src/main/java/cn/cecep/talroad/data/analyse/task/execute/report/excess/WaterExcessYearAvgProcessService.java @@ -0,0 +1,124 @@ +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.*; +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 WaterExcessYearAvgProcessService implements PollutionDischargeProcessService { + + @Autowired + //b_stat_table_zxbg_water_emission + private BStatTableZxbgWaterEmissionMapper bStatTableZxbgWaterEmissionMapper; + + @Autowired + private BMainActionReportsMapper mainActionReportsMapper; + + @Autowired + private AmProblemFiMapper amProblemFiMapper; + + @Autowired + private PcFactoryMapper factoryMapper; + + @Autowired + private PcOutletMapper pcOutletMapper; + + /** + * 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 bStatTableZxbgGasEmissionLambdaQueryWrapper = new QueryWrapper().lambda() + .eq(BStatTableZxbgWaterEmission::getZxbgType, zxbgType) + .eq(BStatTableZxbgWaterEmission::getZxbgPeriod, bMainActionReports.getReportsTime()) + .eq(BStatTableZxbgWaterEmission::getFactoryId, bMainActionReports.getFactoryId()); + List bStatTableZxbgPflWaters = bStatTableZxbgWaterEmissionMapper.selectList(bStatTableZxbgGasEmissionLambdaQueryWrapper); + + for (BStatTableZxbgWaterEmission bStatTableZxbgGasEmission : bStatTableZxbgPflWaters) { + BigDecimal folds = new BigDecimal(bStatTableZxbgGasEmission.getDetectionAvgDay()); + BigDecimal emiss = new BigDecimal(bStatTableZxbgGasEmission.getEmissionConcentration()); + if (emiss.doubleValue()>folds.doubleValue()){ + addAmProblemFi(bStatTableZxbgGasEmission); + } + + } + + } + + + } + + public void addAmProblemFi(BStatTableZxbgWaterEmission bStatTableZxbgPflAir){ + + PcFactory pcFactory = factoryMapper.selectById(bStatTableZxbgPflAir.getFactoryId()); + + if (pcFactory==null){ + log.warn("企业id不存在 , 企业ID : {}",bStatTableZxbgPflAir.getFactoryId()); + } + + LambdaQueryWrapper eq = new QueryWrapper().lambda().eq(PcOutlet::getOutletCode, bStatTableZxbgPflAir.getOutletCode()); + PcOutlet pcOutlet = pcOutletMapper.selectOne(eq); + + String problemString = getProblemString(pcFactory.getFactoryName() , pcOutlet.getOutletCode() , pcOutlet.getOutletName(), bStatTableZxbgPflAir.getZxbgPeriod(), bStatTableZxbgPflAir.getPollutantName()); + + 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 outletCode , String outletName , String zxbgPeriod , String pollutantName){ + return new StringBuilder() + .append("企业名称").append(factoryName).append("(").append(zxbgPeriod).append(")") + .append("中").append(outletCode).append(outletName).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 index 7d1e31b..0ee8a24 100644 --- 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 @@ -32,6 +32,24 @@ public class ReportExcessController { @Autowired private WaterExcessYearProcessService waterExcessYearProcessService; + @Autowired + private AirExcessMonthAvgProcessService airExcessMonthAvgProcessService; + + @Autowired + private AirExcessQuarterAvgProcessService airExcessQuarterAvgProcessService; + + @Autowired + private AirExcessYearAvgProcessService airExcessYearAvgProcessService; + + @Autowired + private WaterExcessMonthAvgProcessService waterExcessMonthAvgProcessService; + + @Autowired + private WaterExcessQuarterAvgProcessService waterExcessQuarterAvgProcessService; + + @Autowired + private WaterExcessYearAvgProcessService waterExcessYearAvgProcessService; + @GetMapping("/airExcessMonth") public void airExcessMonth() { @@ -93,4 +111,65 @@ public class ReportExcessController { } } + ///// + @GetMapping("/airAvgExcessMonth") + public void airAvgExcessMonth() { + try { + airExcessMonthAvgProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废气均值监测超量未落实排污许可 , 按月 . 原因:" + e.getMessage()); + } + } + + @GetMapping("/airAvgExcessQuarter") + public void airAvgExcessQuarter() { + try { + airExcessQuarterAvgProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废气均值监测超量未落实排污许可 , 按季度 . 原因:" + e.getMessage()); + } + } + + @GetMapping("/airAvgExcessYear") + public void airAvgExcessYear() { + try { + airExcessYearAvgProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废气均值监测超量未落实排污许可 , 按年 . 原因:" + e.getMessage()); + } + } + + @GetMapping("/waterAvgExcessMonth") + public void waterAvgExcessMonth() { + try { + waterExcessMonthAvgProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废水均值监测超量未落实排污许可 , 按月 . 原因:" + e.getMessage()); + } + } + + @GetMapping("/waterAvgExcessQuarter") + public void waterAvgExcessQuarter() { + try { + waterExcessQuarterAvgProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废水均值监测超量未落实排污许可 , 按季度 . 原因:" + e.getMessage()); + } + } + + @GetMapping("/waterAvgExcessYear") + public void waterAvgExcessYear() { + try { + waterExcessYearAvgProcessService.process(); + } catch (Exception e) { + e.printStackTrace(); + log.info("废水均值监测超量未落实排污许可 , 按年 . 原因:" + e.getMessage()); + } + } + }