efe583e9 kangwei

kangwei:运营月报统计数据修改,修改

1 个父辈 9d850624
......@@ -30,9 +30,6 @@ public class MaterialINVO extends MaterialIN {
@ApiModelProperty(value = "权限厂站编号集合")
private String departIds;
@ApiModelProperty(value = "药剂入库编号")
private String materialInId;
@ApiModelProperty(value = "物料编码")
private String sparepartCode;
......
package com.skua.modules.statistics.vo;
import cn.jiguang.common.utils.StringUtils;
import com.skua.core.aspect.annotation.Dict;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import liquibase.util.StringUtils;
import lombok.Data;
import java.util.List;
......
......@@ -107,11 +107,25 @@ public class OperationReportServiceImpl implements IOperationReportService {
//目标水量
sql = "select sum(ifnull(target_water,0)) target_water from report_target_config where 1=1 ";
if(StringUtils.isNotEmpty(departId)){
sql += " and depart_id in ("+JSUtils.quoteEach(departId,",")+")";
//根据开始时间、结束时间判断;如果是同一个月,那么就获取月度目标,不在一个月那就获取年度目标
String target_water = null;
if(startMonth.equals(endMonth )){//获取月度目标
sql = "select sum(ifnull(target_value,0)) target_water from report_target_config_sub where target_type='sl' and target_time = '"+endMonth+"' ";
if(StringUtils.isNotEmpty(departId)){
sql += " and depart_id in ("+JSUtils.quoteEach(departId,",")+")";
}
target_water = getJdbcTemplate().queryForObject(sql,String.class);
}else{//获取年度目标
sql = "select sum(ifnull(target_water,0)) target_water from report_target_config where 1=1 and target_year = '"+year+"' ";
if(StringUtils.isNotEmpty(departId)){
sql += " and depart_id in ("+JSUtils.quoteEach(departId,",")+")";
}
target_water = getJdbcTemplate().queryForObject(sql,String.class);
}
String target_water = getJdbcTemplate().queryForObject(sql,String.class);
productDataVO.setAvgDayWaterVolume( JSUtils.divide(ysfsl, dayNum) );
String completeRatio = JSUtils.multiply( JSUtils.divide(ysfsl,target_water),100);
productDataVO.setCompleteRatio( completeRatio);//完成率
......@@ -144,11 +158,11 @@ public class OperationReportServiceImpl implements IOperationReportService {
List<FReportWaterMonthDataVO> waterMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportWaterMonthDataVO>(FReportWaterMonthDataVO.class));
productDataVO.setWaterDeptartList(waterMonthDataList);
//水电耗高于控制目标--水务公司列表 YYYY-MM
//水电耗高于控制目标--水务公司列表 YYYY-MM 月电耗
dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ydh,dhcmbzyy", departId, startMonth,endMonth);
sql = "select * from ( ";
sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.ydh),2) realConsume , IFNULL(tc.target_power,2) 'targetConsume' ,GROUP_CONCAT(aaa.dhcmbzyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";;
sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')";
sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='"+year+"')";
sql += " left join sys_depart d on d.id = aaa.depart_id ";
sql += " group by aaa.depart_id )bbb where bbb.realConsume > bbb.targetConsume ";
List<FReportPowerMonthDataVO> dhMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportPowerMonthDataVO>(FReportPowerMonthDataVO.class));
......@@ -159,7 +173,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"yyh,yhcyqyy", departId, startMonth,endMonth);
sql = "select * from ( ";
sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.yyh),2) realConsume , IFNULL(tc.target_drug,2) 'targetConsume' ,GROUP_CONCAT(aaa.yhcyqyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";;
sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')";
sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='"+year+"')";
sql += " left join sys_depart d on d.id = aaa.depart_id ";
sql += " group by aaa.depart_id )bbb where bbb.realConsume > bbb.targetConsume ";
List<FReportPowerMonthDataVO> yyhMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportPowerMonthDataVO>(FReportPowerMonthDataVO.class));
......
......@@ -98,21 +98,23 @@ public class ProductDataVO {
public String getWaterDeptartName() {
return getDeptName(waterDeptartList);
}
public String getPowerDeptartName() {
return getDeptName2(powerDeptartList);
}
String deptName = "";
if( waterDeptartList != null && !waterDeptartList.isEmpty() ){
for(FReportWaterMonthDataVO dataVO : waterDeptartList){
if(deptName.length() > 0 ) deptName+="、";
if(StringUtils.isNotEmpty(dataVO.getDepartName())){
deptName += dataVO.getDepartName();
}
public String getDrugDeptartName() {
return getDeptName2(drugDeptartList);
}
}
return deptName;
}
private String getDeptName(List<FReportWaterMonthDataVO> deptartList){
public String getPowerDeptartName() {
String deptName = "";
if( deptartList != null && !deptartList.isEmpty() ){
for(FReportWaterMonthDataVO dataVO : deptartList){
if( powerDeptartList != null && !powerDeptartList.isEmpty() ){
for(FReportPowerMonthDataVO dataVO : powerDeptartList){
if(deptName.length() > 0 ) deptName+="、";
if(StringUtils.isNotEmpty(dataVO.getDepartName())){
deptName += dataVO.getDepartName();
......@@ -122,19 +124,20 @@ public class ProductDataVO {
}
return deptName;
}
private String getDeptName2(List<FReportPowerMonthDataVO> deptartList){
public String getDrugDeptartName() {
String deptName = "";
if( deptartList != null && !deptartList.isEmpty() ){
for(FReportPowerMonthDataVO dataVO : deptartList){
if( drugDeptartList != null && !drugDeptartList.isEmpty() ){
for(FReportPowerMonthDataVO dataVO : drugDeptartList){
if(deptName.length() > 0 ) deptName+="、";
if(StringUtils.isNotEmpty(dataVO.getDepartName())){
deptName += dataVO.getDepartName();
}
}
}
return deptName;
}
public ProductDataVO() {
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!