95a8b818 康伟

kangwei: 解决bug:运营季报公式

1 个父辈 3cd805b1
正在显示 18 个修改的文件 包含 113 行增加91 行删除
......@@ -38,6 +38,8 @@
WHERE
d.depart_type = 1
AND r.report_date LIKE CONCAT(#{year},'%')
order by r.report_date desc
</select>
<select id="getMapData" resultType="com.skua.modules.emergency.vo.MapDatabaseResult">
......
......@@ -152,7 +152,7 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
@Override
public List<RiskDatabaseResult> getRiskList(String year) {
if(year==null){
if(StringUtils.isEmpty(year)){
year = String.valueOf(DateUtils.getYear());
}
List<RiskDatabaseResult> list = emergencyRiskEventMapper.getRiskList(year);
......@@ -161,7 +161,7 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
@Override
public List<DangerDatabaseResult> getDangerList(String year) {
if(year==null){
if(StringUtils.isEmpty(year)){
year = String.valueOf(DateUtils.getYear());
}
List<DangerDatabaseResult> list = emergencyRiskEventMapper.getDangerList(year);
......@@ -170,7 +170,7 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
@Override
public List<MapDatabaseResult> getMapData(String year) {
if(year==null){
if(StringUtils.isEmpty(year)){
year = String.valueOf(DateUtils.getYear());
}
List<DangerDatabaseResult> dangerList = emergencyRiskEventMapper.getDangerList(year);
......
......@@ -2,6 +2,7 @@ package com.skua.modules.dataAnalysis.controller;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.util.DateUtils;
import com.skua.modules.dataAnalysis.service.IPowerAnalysisNewService;
import com.skua.modules.dataAnalysis.vo.OperationMonthVO;
......@@ -148,7 +149,8 @@ public class PowerAnalysisNewController {
@GetMapping(value = "/powerCutDownAllList")
public Result powerCutDownAllList(String time) {
Result result = new Result();
Map<String, Object> resultMap = operationMonthService.powerCutDownAllList(time);
String departIds = BaseContextHandler.getDeparts();
Map<String, Object> resultMap = operationMonthService.powerCutDownAllList(departIds,time);
result.setSuccess(true);
result.setResult(resultMap);
return result;
......
......@@ -376,7 +376,7 @@
<select id="querySixMonthPowerConsumption" resultType="map">
SELECT
ROUND(SUM(IFNULL(v2.CSL,0))/10000,2) AS totalBYCLSL,
ROUND(IFNULL(v3.DLHJ,0),2) AS totalBYYDL,
ROUND(IFNULL(v3.DLHJ,0)/10000,2) AS totalBYYDL,
ROUND(IFNULL(v3.DLHJ,0)/SUM(v2.CSL),2) AS dsdh,
LEFT(v2.time,7) AS time
from ${dataViewName2119} v2
......@@ -795,8 +795,8 @@
</select>
<select id="queryHDLAndSLByFac" resultType="java.util.Map">
SELECT
ROUND(SUM(v2.CSL),2) AS totalBYCLSL,
IFNULL(v3.DLHJ,0) AS totalBYYDL,
ROUND(SUM(IFNULL(v2.CSL,0))/10000,2) AS totalBYCLSL,
ROUND(IFNULL(v3.DLHJ,0)/10000,2) AS totalBYYDL,
ROUND(IFNULL(v3.DLHJ,0)/SUM(v2.CSL),2) AS dsdh,
LEFT(v2.time,7) AS time
from ${dataViewName2119} v2
......
......@@ -6,9 +6,9 @@ import java.util.List;
import java.util.Map;
public interface IFactoryOperateCenterService {
//厂区统计数据
Map<String, Object> getData(String departId,String month);
//厂区报表统计数据
Map<String, Object> getReportData(String departId, String month);
List<EquipAlarmVO> getEquipAlarm(String departId, String month);
......
......@@ -24,7 +24,6 @@ public interface IPowerAnalysisNewService {
Map<String, Object> powerDSDHCurve(String id, String type, String time);
/**
*
* @Description 电耗分析单位污染物削减电耗
* @Date 2021-06-03 16:37
* @Param [time]
......@@ -35,7 +34,6 @@ public interface IPowerAnalysisNewService {
Map<String, Object> powerConsumptionDistributionList(String type, String time);
/**
*
* @Description 根据厂站获取单位污染物削减电耗历史趋势
* @Date 2021-06-04 15:05
* @Param [startTime, endTime, factoryId]
......@@ -44,13 +42,12 @@ public interface IPowerAnalysisNewService {
Map<String, Object> powerCutDownByFac(String startTime, String endTime, String departId);
/**
*
* @Description 电耗分析获取所有单位污染物削减电耗列表
* @Date 2021-06-04 18:33
* @Param [time]
* @return java.util.Map<java.lang.String, java.lang.Object>
**/
Map<String, Object> powerCutDownAllList(String time);
Map<String, Object> powerCutDownAllList(String departIds,String time);
/**
*
......
......@@ -33,7 +33,7 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
private FactoryOperateCenterMapper factoryOperateCenterMapper;
@Resource
private ReportTargetConfigMapper reportTargetMapper;
//厂区统计数据
@Override
public Map<String, Object> getData(String departId, String month) {
DecimalFormat df = new DecimalFormat("#.##");
......@@ -156,6 +156,7 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
map.put("nclsl",new HashMap<>());
Map<String, Object> nclslMap = new HashMap<>();
nclslMap.put("nsjsl", yearClsl);
nclslMap.put("nsjsl", yearClslMb);
nclslMap.put("wcbfb", df.format(100*yearClsl/yearClslMb));
nclslMap.put("nmb", yearClslMb);
nclslMap.put("nmbTb", df.format((yearClslMb-yearTbClslMb)/yearClslMb));
......@@ -170,7 +171,7 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
map.put("yclsl",new HashMap<>());
Map<String, Object> yclslMap = new HashMap<>();
yclslMap.put("ysjsl", monthClsl);
yclslMap.put("wcbfb", df.format(100*monthClsl/(yearClslMb/12)));
yclslMap.put("wcbfb", df.format(100*monthClsl/(yearClslMb/12)));//较上月
yclslMap.put("ymb", df.format(yearClslMb/12));
yclslMap.put("ymbTb", "0");
yclslMap.put("ywcd", df.format(100*monthClsl/(yearClslMb/12)));
......@@ -320,7 +321,7 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
return monthDataVOList;
}
//厂区报表统计数据
@Override
public Map<String, Object> getReportData(String departId, String month) {
int dayCount = DateUtils.getDayCountByMonth(month);
......
package com.skua.modules.dataAnalysis.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @auther kangwei
* @create 2024-12-19-10:19
*/
@Data
@ApiModel(value="能耗分析:单位污染物削减耗电量对象", description="能耗分析:单位污染物削减耗电量对象")
public class PowerCutDownVO {
@ApiModelProperty(value = "部门编号")
public String departId ;
@ApiModelProperty(value = "名称")
public String clsl ;
@ApiModelProperty(value = "名称")
public String codValue;
@ApiModelProperty(value = "名称")
public String hdl;
@ApiModelProperty(value = "名称")
public String nh3nValue;
@ApiModelProperty(value = "名称")
public String num;
@ApiModelProperty(value = "名称")
public String tnValue;
@ApiModelProperty(value = "名称")
public String tpValue;
}
......@@ -7,8 +7,6 @@ import com.skua.modules.report.vo.ProductDataVO;
* @create 2024-10-14-9:11
*/
public interface IOperationReportService {
/***
* 处理月季度数据
* @param year
......
......@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* 月度电费报表
*/
public interface IReportElectricCostService extends IService<ReportElectricCost> {
//月度电费报表-分页列表查询
IPage<ReportElectricCost> getPage(Page<ReportElectricCost> page, ReportElectricCost reportElectricCost);
}
......
......@@ -6,6 +6,7 @@ import com.skua.core.context.BaseContextHandler;
import com.skua.modules.report.entity.ReportElectricCost;
import com.skua.modules.report.mapper.ReportElectricCostMapper;
import com.skua.modules.report.service.IReportElectricCostService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -23,10 +24,10 @@ public class ReportElectricCostServiceImpl extends ServiceImpl<ReportElectricCos
@Resource
private ReportElectricCostMapper reportElectricCostMapper;
//月度电费报表-分页列表查询
@Override
public IPage<ReportElectricCost> getPage(Page<ReportElectricCost> page, ReportElectricCost reportElectricCost) {
if(reportElectricCost.getDepartId()==null){
if(StringUtils.isEmpty(reportElectricCost.getDepartId())){
reportElectricCost.setDepartId(BaseContextHandler.getDeparts());
}
// if(reportElectricCost.getMonth()!=null){
......
......@@ -11,7 +11,7 @@ import java.math.BigDecimal;
public class FReportPowerMonthDataVO {
@ApiModelProperty(value = "所属厂站名称")
private String deptartName;
private String departName;
@ApiModelProperty(value = "目标消耗")
private String targetConsume;
......@@ -26,8 +26,8 @@ public class FReportPowerMonthDataVO {
}
public FReportPowerMonthDataVO(String deptartName, String targetConsume, String realConsume , String causeAnalysis) {
this.deptartName = deptartName;
public FReportPowerMonthDataVO(String departName, String targetConsume, String realConsume , String causeAnalysis) {
this.departName = departName;
this.targetConsume = targetConsume;
this.realConsume = realConsume;
this.causeAnalysis = causeAnalysis;
......
......@@ -11,7 +11,7 @@ import java.math.BigDecimal;
public class FReportWaterMonthDataVO {
@ApiModelProperty(value = "所属厂站名称")
private String deptartName;
private String departName;
@ApiModelProperty(value = "比例")
private String ratio;
......@@ -23,8 +23,8 @@ public class FReportWaterMonthDataVO {
}
public FReportWaterMonthDataVO(String deptartName, String ratio, String causeAnalysis) {
this.deptartName = deptartName;
public FReportWaterMonthDataVO(String departName, String ratio, String causeAnalysis) {
this.departName = departName;
this.ratio = ratio;
this.causeAnalysis = causeAnalysis;
}
......
......@@ -26,15 +26,12 @@ public class ProductDataVO {
@ApiModelProperty(value = "水务厂站数量")
private String deptartCount;
@ApiModelProperty(value = "相差天数")
private Long dayNum;
@ApiModelProperty(value = "收费水量")
private String chargeWaterVolume;//收费水量9854.012552万吨
@ApiModelProperty(value = "收费水量-日均值")
private String avgDayWaterVolume;//平均108.29万吨/天
@ApiModelProperty(value = "收费水量-同比增长")
private Double chargeWaterRatio;
private String chargeWaterRatio;
@ApiModelProperty(value = "收费水量-完成率")
private String completeRatio;
@ApiModelProperty(value = "序时进度")
......@@ -47,7 +44,7 @@ public class ProductDataVO {
@ApiModelProperty(value = "实际处理水量-日均值")
private String avgYsjslWaterVolume;//平均99.76万吨/天
@ApiModelProperty(value = "实际处理水量--同比增长")
private Double ysjslWaterRatio;
private String ysjslWaterRatio;
@ApiModelProperty(value = "药量目标")
......@@ -65,12 +62,13 @@ public class ProductDataVO {
@ApiModelProperty(value = "水电耗高于控制目标--水务公司列表")
private List<FReportPowerMonthDataVO> powerDeptartList = new ArrayList<>();
@ApiModelProperty(value = "水电耗高于控制目标--水务公司列表")
@ApiModelProperty(value = "水电耗高于控制目标--水务公司名称")
private String powerDeptartName;
@ApiModelProperty(value = "药剂成本高于控制目标--水务公司列表")
private List<FReportPowerMonthDataVO> drugDeptartList = new ArrayList<>();
@ApiModelProperty(value = "药剂成本高于控制目标--水务公司列表")
@ApiModelProperty(value = "药剂成本高于控制目标--水务公司名称")
private String drugDeptartName;
@ApiModelProperty(value = "季度最后一天")
......@@ -82,17 +80,6 @@ public class ProductDataVO {
@ApiModelProperty(value = "隐患部门名称")
private String dangerDeptNames;
//收费水量-日均值
public String getAvgDayWaterVolume() {
avgDayWaterVolume = JSUtils.divide(chargeWaterVolume , dayNum ) ;
return avgDayWaterVolume;
}
//实际处理水量-日均值
public String getAvgYsjslWaterVolume() {
// avgYsjslWaterVolume = ConvertUtils.getDouble(ysjslWaterVolume,0) / dayNum;
avgYsjslWaterVolume = JSUtils.divide(ysjslWaterVolume , dayNum ) ;
return avgYsjslWaterVolume;
}
public String getWaterDeptartName() {
return getDeptName(waterDeptartList);
......@@ -111,8 +98,8 @@ public class ProductDataVO {
if( deptartList != null && !deptartList.isEmpty() ){
for(FReportWaterMonthDataVO dataVO : deptartList){
if(deptName.length() > 0 ) deptName+="、";
if(StringUtils.isNotEmpty(dataVO.getDeptartName())){
deptName += dataVO.getDeptartName();
if(StringUtils.isNotEmpty(dataVO.getDepartName())){
deptName += dataVO.getDepartName();
}
}
......@@ -124,8 +111,8 @@ public class ProductDataVO {
if( deptartList != null && !deptartList.isEmpty() ){
for(FReportPowerMonthDataVO dataVO : deptartList){
if(deptName.length() > 0 ) deptName+="、";
if(StringUtils.isNotEmpty(dataVO.getDeptartName())){
deptName += dataVO.getDeptartName();
if(StringUtils.isNotEmpty(dataVO.getDepartName())){
deptName += dataVO.getDepartName();
}
}
}
......
......@@ -2,6 +2,7 @@ package com.skua.modules.equipment.service.impl;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.common.report.vo.ReportItemVO;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.common.vo.DateVO;
......@@ -38,20 +39,18 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
//数据展示
public DrugConsumptionDisplayVO dataDisplay(String time, String departId){
DrugConsumptionDisplayVO displayVO = null;
DateVO dateVO = new DateVO(time);//转换后的时间参数
//出水量
Double CSL = getCSL(departId, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());//出水量
//同比-上月出水量
Double tbsyCsl = getCSL(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());//出水量
//环比--去年出水量
Double tbqnCsl = getCSL(departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());//出水量
String startTime = time+"-01";
String endTime = time +"-31";
// DateVO dateVO = new DateVO(time);//转换后的时间参数
//出水量:+同比+环比
ReportItemVO csl_reportVO = ReportViewUtil.getSumValueByTBHB(ReportConstant.view2119,ReportConstant.field_CSL, departId, startTime, endTime);
//总药耗:value ; 同比 环比
ReportItemVO zyhReportVO = ReportViewUtil.getSumValueByTBHB( ReportConstant.view3a24,ReportConstant.fieldYj, departId, startTime,endTime);
//计算药耗
Double zyh = countDSYH(departId ,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());//总药耗
Double tbqnzyh = countDSYH(departId ,dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime() );//去年同比总药耗
Double hbsyzyh = countDSYH(departId ,dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime() );//环比上月总药耗
displayVO = new DrugConsumptionDisplayVO(ConvertUtils.getDouble(csl_reportVO.getValue(),0d) , ConvertUtils.getDouble(csl_reportVO.getValueHb(),0d), ConvertUtils.getDouble(csl_reportVO.getValueTb(),0d),
ConvertUtils.getDouble(zyhReportVO.getValue(),0d), ConvertUtils.getDouble(zyhReportVO.getValueHb(),0d), ConvertUtils.getDouble(zyhReportVO.getValueTb(),0d));
displayVO = new DrugConsumptionDisplayVO( CSL, tbqnCsl, tbsyCsl, zyh, hbsyzyh, tbqnzyh);
//历史最低吨水药耗???
String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.fieldClsl, departId, null,null);
......
package com.skua.modules.equipment.vo;
import com.skua.core.util.ConvertUtils;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -84,39 +86,32 @@ public class DrugConsumptionDisplayVO {
this.CSL = CSL;
this.tbqnCsl = tbqnCsl;
this.hbsyCsl = hbsyCsl;
this.zyh = zyh;
this.zyh = ConvertUtils.getDouble(zyh,0d);
this.hbsyzyh = hbsyzyh;
this.tbqnzyh = tbqnzyh;
// 计算吨水药耗: 药耗量[kg] / 处理水量[吨]
this.dsyh = Double.parseDouble(JSUtils.divide(zyh, CSL));
//同比总药耗
this.tbqnzyhsl = Double.parseDouble(JSUtils.subtract( zyh, tbqnzyh));
String expression = "100*( "+zyh+" - "+tbqnzyh+") / "+tbqnzyh;
this.tbqnzyhbl = Double.parseDouble(JSUtils.executeExpression(expression,"0") );
//同比吨水药耗
this.tbqndsyh = Double.parseDouble( JSUtils.divide(tbqnzyh ,tbqnCsl));
this.tbqndsyhsl = this.getValue(this.dsyh - this.tbqndsyh);
expression = "100*( "+this.dsyh+" - "+this.tbqndsyh+") / "+this.tbqnzyh;
this.tbqndsyhbl = Double.parseDouble( JSUtils.executeExpression( expression, "0"));
//环比 总药耗
this.hbsyzyhsl = Double.parseDouble(JSUtils.subtract( this.zyh ,this.hbsyzyh));
expression = "100*( "+this.zyh+" - "+this.hbsyzyh+") / "+this.hbsyzyh;
this.hbsyzyhbl = Double.parseDouble(JSUtils.executeExpression(expression,"0") );
//环比 吨水药耗
this.hbsydsyh = Double.parseDouble( JSUtils.divide(this.hbsyzyh ,this.hbsyCsl));
this.hbsydsyhsl = this.getValue(this.dsyh - this.hbsydsyh);
expression = "100*( "+this.dsyh+" - "+this.hbsydsyh+") / "+this.hbsydsyh;
this.hbsydsyhbl = Double.parseDouble( JSUtils.executeExpression( expression, "0"));
if(this.zyh != null ){
//计算吨水药耗
//药耗量[kg] / 处理水量[吨]
if(this.CSL != null && Double.compare(this.CSL, 0.0) != 0) {
this.dsyh = this.getValue(this.zyh /this.CSL );
}
//同比总药耗
if(this.tbqnzyh != null){
this.tbqnzyhsl = this.getValue(this.zyh - this.tbqnzyh);
this.tbqnzyhbl = this.getValue(((this.zyh - this.tbqnzyh)/this.tbqnzyh)*100) ;
//计算吨水药耗 //同比吨水药耗
if(this.tbqnCsl != null && Double.compare(this.tbqnCsl, 0.0) != 0) this.tbqndsyh = this.getValue(this.tbqnzyh /this.tbqnCsl );
if(this.tbqndsyh != null && this.dsyh != null ){
this.tbqndsyhsl = this.getValue(dsyh-tbqndsyh);
this.tbqndsyhbl = this.getValue((dsyh-tbqndsyh)/tbqndsyh*100);
}
}
//环比总药耗
if(this.hbsyzyh != null ){
this.hbsyzyhsl = this.getValue(this.zyh - this.hbsyzyh);
this.hbsyzyhbl = this.getValue(((this.zyh - this.hbsyzyh)/this.hbsyzyh)*100) ;
//环比-吨水药耗
if(this.hbsyCsl != null && Double.compare(this.hbsyCsl, 0.0) != 0) this.hbsydsyh = this.getValue(this.hbsyzyh /this.hbsyCsl );
if(this.hbsydsyh != null && this.dsyh != null){
this.hbsydsyhsl = this.getValue(this.dsyh - this.hbsydsyh);
this.hbsydsyhbl = this.getValue((this.dsyh - this.hbsydsyh) / this.hbsydsyh*100);
}
}
}
}
private Double getValue(Double d) {
try{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!