f674f251 张雷

化验日报和生产日报修改

1 个父辈 549362dd
package com.skua.modules.custom.handle.impl;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.common.report.entity.ValueEntity;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.common.service.ICommonSqlService;
import com.skua.modules.custom.handle.ICustomHandle;
import com.skua.modules.custom.service.IFCustomReportDatasetService;
import com.skua.modules.custom.vo.FCustomReportDatasetVO;
import com.skua.modules.dataAnalysis.service.IFactoryCenterService;
import com.skua.modules.dataAnalysis.vo.WaterQualityMonitoringDetailVO;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.*;
/**
* <pre>
* 生产日报自定义逻辑
* </pre>
* @author zhanglei
* @version V0.1, 2024年11月17日 上午9:40:17
*/
@Component("hyrbReportHandle")
public class HyrbReportHandle implements ICustomHandle{
@Autowired
private IFCustomReportDatasetService fCustomReportDatasetService;
@Resource
private IFactoryCenterService factoryCenterService;
@Autowired
private ICommonSqlService commonSqlService;
@Override
public Map<String, List<Map<String, ValueEntity>>> buildDataMap(String reportId, String startTime, String endTime,
String departId,String indexCode) {
Map<String, Object> levelMap = factoryCenterService.getMonitorThreshold(departId);
Map<String,List<Map<String,ValueEntity>>> dataMap = new HashMap<String,List<Map<String,ValueEntity>>>();
//获取数据集
//获取填报数据及报表数据项信息,组装报表所需数据机构
List<Map<String,ValueEntity>> list = new ArrayList<Map<String,ValueEntity>>();
//根据数据集id获取数据项及填报数据
Map<String,String> dataFieldDict = new HashMap<String,String>();
List<FCustomReportDatasetVO> dataFieldList = fCustomReportDatasetService.getDataField(ReportConstant.view9bff);
for(FCustomReportDatasetVO dataField : dataFieldList) {
dataFieldDict.put(dataField.getDatasetId(), dataField.getDatasetName());
}
//添加厂站、时间字段
dataFieldDict.put("depart_name", "厂站名称");
dataFieldDict.put("time", "时间");
dataFieldDict.put("paramTime", "参数时间");
String dataViewName9bff = ReportViewUtil.buildView(ReportConstant.view9bff,"", departId, startTime, endTime);
//结果集
List<Map<String, Object>> szMapList = fCustomReportDatasetService.queryHyReport(dataViewName9bff, startTime, endTime, departId);
list = changeDataList(szMapList,list,startTime,dataFieldDict);
List<Map<String,ValueEntity>> dList = new ArrayList<>();
Map<String,ValueEntity> newDataMap = new HashMap<>();
List<WaterQualityMonitoringDetailVO> realDataList = factoryCenterService.queryMonitoringData(departId,null);
for (WaterQualityMonitoringDetailVO waterQualityMonitoring : realDataList) {
if("in".equals(waterQualityMonitoring.getParmType())){
ValueEntity inCodEntity = new ValueEntity();
inCodEntity.setValue(waterQualityMonitoring.getCodVal());
newDataMap.put("在线进水COD", inCodEntity);
ValueEntity inNh3nEntity = new ValueEntity();
inNh3nEntity.setValue(waterQualityMonitoring.getNh3Val());
newDataMap.put("在线进水氨氮", inNh3nEntity);
ValueEntity inTnEntity = new ValueEntity();
inTnEntity.setValue(waterQualityMonitoring.getTnVal());
newDataMap.put("在线进水总氮", inTnEntity);
ValueEntity inTpEntity = new ValueEntity();
inTpEntity.setValue(waterQualityMonitoring.getTpVal());
newDataMap.put("在线进水总磷", inTpEntity);
ValueEntity inPhEntity = new ValueEntity();
inPhEntity.setValue(waterQualityMonitoring.getPhVal());
newDataMap.put("在线进水PH", inPhEntity);
ValueEntity inSsEntity = new ValueEntity();
inSsEntity.setValue(waterQualityMonitoring.getZdVal());
newDataMap.put("在线进水SS", inSsEntity);
ValueEntity inBodEntity = new ValueEntity();
inBodEntity.setValue(waterQualityMonitoring.getCodVal());
newDataMap.put("在线进水BOD", inBodEntity);
}
if("out".equals(waterQualityMonitoring.getParmType())){
ValueEntity outCodEntity = new ValueEntity();
outCodEntity.setValue(waterQualityMonitoring.getCodVal());
newDataMap.put("在线出水COD", outCodEntity);
ValueEntity outNh3nEntity = new ValueEntity();
outNh3nEntity.setValue(waterQualityMonitoring.getNh3Val());
newDataMap.put("在线出水氨氮", outNh3nEntity);
ValueEntity outTnEntity = new ValueEntity();
outTnEntity.setValue(waterQualityMonitoring.getTnVal());
newDataMap.put("在线出水总氮", outTnEntity);
ValueEntity outTpEntity = new ValueEntity();
outTpEntity.setValue(waterQualityMonitoring.getTpVal());
newDataMap.put("在线出水总磷", outTpEntity);
ValueEntity outPhEntity = new ValueEntity();
outPhEntity.setValue(waterQualityMonitoring.getPhVal());
newDataMap.put("在线出水PH", outPhEntity);
ValueEntity outSsEntity = new ValueEntity();
outSsEntity.setValue(waterQualityMonitoring.getZdVal());
newDataMap.put("在线出水SS", outSsEntity);
ValueEntity outBodEntity = new ValueEntity();
outBodEntity.setValue(waterQualityMonitoring.getCodVal());
newDataMap.put("在线出水BOD", outBodEntity);
}
}
ValueEntity valueEntity = new ValueEntity();
valueEntity.setValue(startTime);
newDataMap.put("时间", valueEntity);
Map<String,ValueEntity> dMap = new HashMap<>();
if(list.size() > 0){
dMap = list.get(0);
if(levelMap!=null){
dMap = changeDataColor(dMap,levelMap);
}
newDataMap.putAll(dMap);
}else{
for (Map.Entry<String, String> data : dataFieldDict.entrySet()) {
ValueEntity dataEntity = new ValueEntity();
dataEntity.setValue(null);
newDataMap.put(data.getValue(), dataEntity);
}
for (Map.Entry<String, Object> level : levelMap.entrySet()) {
ValueEntity levelEntity = new ValueEntity();
levelEntity.setValue(level.getValue().toString());
if("JSBOD".equals(level.getKey())){
newDataMap.put("化验进水BOD标准", levelEntity);
continue;
}
if("CSBOD".equals(level.getKey())){
newDataMap.put("化验出水BOD标准", levelEntity);
continue;
}
if("JSCOD".equals(level.getKey())){
newDataMap.put("化验进水COD标准", levelEntity);
continue;
}
if("CSCOD".equals(level.getKey())){
newDataMap.put("化验出水COD标准", levelEntity);
continue;
}
if("JSNH3N".equals(level.getKey())){
newDataMap.put("化验进水氨氮标准", levelEntity);
continue;
}
if("CSNH3N".equals(level.getKey())){
newDataMap.put("化验出水氨氮标准", levelEntity);
}
if("JSTN".equals(level.getKey())){
newDataMap.put("化验进水总氮标准", levelEntity);
continue;
}
if("CSTN".equals(level.getKey())){
newDataMap.put("化验出水总氮标准", levelEntity);
continue;
}
if("JSTP".equals(level.getKey())){
newDataMap.put("化验进水总磷标准", levelEntity);
continue;
}
if("CSTP".equals(level.getKey())){
newDataMap.put("化验出水总磷标准", levelEntity);
continue;
}
if("JSPH".equals(level.getKey())){
newDataMap.put("化验进水PH标准", levelEntity);
continue;
}
if("CSPH".equals(level.getKey())){
newDataMap.put("化验出水PH标准", levelEntity);
continue;
}
if("JSSS".equals(level.getKey())){
newDataMap.put("化验进水SS标准", levelEntity);
continue;
}
if("CSSS".equals(level.getKey())){
newDataMap.put("化验出水SS标准", levelEntity);
continue;
}
}
}
dList.add(newDataMap);
dataMap.put("化验数据日报表", dList);
return dataMap;
}
@Override
public String buildWaterQualityAlarmValue(String reportId, String departId, String json) {
return json;
}
/**
* 构造LIST
* @param szMapList
* @param list
* @param startTime
* @param dataFieldDict
* @return
*/
private List<Map<String, ValueEntity>> changeDataList(List<Map<String, Object>> szMapList, List<Map<String, ValueEntity>> list,
String startTime, Map<String, String> dataFieldDict) {
for(Map<String,Object> valueMap : szMapList) {
Map<String,ValueEntity> handleMap = new HashMap<String,ValueEntity>();
//添加时间参数
ValueEntity startTimeValueEntity = new ValueEntity();
startTimeValueEntity.setValue(startTime);
handleMap.put("参数时间", startTimeValueEntity);
Set<String> keySet = valueMap.keySet();
for(String key : keySet) {
if(!StringUtils.isEmpty(dataFieldDict.get(key))) {
ValueEntity valueEntity = new ValueEntity();
valueEntity.setValue(ConvertUtils.getString(valueMap.get(key)));
handleMap.put(dataFieldDict.get(key),valueEntity);
}
}
list.add(handleMap);
}
return list;
}
/**
* 指标变色
* @param map
* @param levelMap
* @return
*/
public Map<String,ValueEntity> changeDataColor(Map<String,ValueEntity> map,Map<String, Object> levelMap){
Map<String,ValueEntity> result = new HashMap<>();
for (Map.Entry<String, ValueEntity> entry : map.entrySet()) {
ValueEntity levelEntity = new ValueEntity();
String key = entry.getKey();
ValueEntity value = entry.getValue();
if("化验进水COD".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSCOD"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSCOD").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSCOD").toString());
}
}
}
if("化验出水COD".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSCOD"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSCOD").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSCOD").toString());
}
}
}
if("化验进水BOD".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSBOD"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSBOD").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSBOD").toString());
}
}
}
if("化验出水BOD".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSBOD"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSBOD").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSBOD").toString());
}
}
}
if("化验进水氨氮".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSNH3N"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSNH3N").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSNH3N").toString());
}
}
}
if("化验出水氨氮".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSNH3N"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSNH3N").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSNH3N").toString());
}
}
}
if("化验进水总氮".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSTN"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSTN").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSTN").toString());
}
}
}
if("化验出水总氮".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSTN"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSTN").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSTN").toString());
}
}
}
if("化验进水总磷".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSTP"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSTP").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSTP").toString());
}
}
}
if("化验出水总磷".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSTP"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSTP").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSTP").toString());
}
}
}
if("化验进水PH".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSPH"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSPH").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l);
}
levelEntity.setValue(levelMap.get("JSPH").toString());
}
}
}
if("化验出水PH".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSPH"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSPH").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l);
}
levelEntity.setValue(levelMap.get("CSPH").toString());
}
}
}
if("化验进水SS".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSSS"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSSS").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSSS").toString());
}
}
}
if("化验出水SS".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSSS"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSSS").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSSS").toString());
}
}
}
result.put(key,value);
result.put(key+"标准", levelEntity);
}
return result;
}
}
package com.skua.modules.custom.handle.impl;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.common.report.entity.ValueEntity;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.common.service.ICommonSqlService;
import com.skua.modules.custom.handle.ICustomHandle;
import com.skua.modules.custom.service.IFCustomReportDatasetService;
import com.skua.modules.custom.vo.FCustomReportDatasetVO;
import com.skua.modules.dataAnalysis.service.IFactoryCenterService;
import com.skua.tool.util.DateUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.*;
/**
* <pre>
* 生产日报自定义逻辑
* </pre>
* @author zhanglei
* @version V0.1, 2024年11月17日 上午9:40:17
*/
@Component("scrbReportHandle")
public class ScrbReportHandle implements ICustomHandle{
@Autowired
private IFCustomReportDatasetService fCustomReportDatasetService;
@Resource
private IFactoryCenterService factoryCenterService;
@Autowired
private ICommonSqlService commonSqlService;
@Override
public Map<String, List<Map<String, ValueEntity>>> buildDataMap(String reportId, String startTime, String endTime,
String departId,String indexCode) {
Map<String, Object> levelMap = factoryCenterService.getMonitorThreshold(departId);
String departIds = commonSqlService.getChildDepartId(departId);
Map<String,List<Map<String,ValueEntity>>> dataMap = new HashMap<String,List<Map<String,ValueEntity>>>();
//获取数据集
//获取填报数据及报表数据项信息,组装报表所需数据机构
List<Map<String,ValueEntity>> list = new ArrayList<Map<String,ValueEntity>>();
//根据数据集id获取数据项及填报数据
Map<String,String> dataFieldDict = new HashMap<String,String>();
List<FCustomReportDatasetVO> dataFieldList = fCustomReportDatasetService.getDataField(ReportConstant.view2119);
for(FCustomReportDatasetVO dataField : dataFieldList) {
dataFieldDict.put(dataField.getDatasetId(), dataField.getDatasetName());
}
//添加厂站、时间字段
dataFieldDict.put("depart_name", "厂站名称");
dataFieldDict.put("time", "时间");
dataFieldDict.put("paramTime", "参数时间");
String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"", departIds, startTime, endTime);
//结果集
List<Map<String, Object>> szMapList = fCustomReportDatasetService.querySzYyybReport(dataViewName2119, startTime, endTime, departIds);
list = changeDataList(szMapList,list,startTime,dataFieldDict);
List<Map<String,ValueEntity>> dList = new ArrayList<>();
Map<String,ValueEntity> newDataMap = new HashMap<>();
ValueEntity valueEntity = new ValueEntity();
valueEntity.setValue(startTime);
newDataMap.put("时间", valueEntity);
Map<String,ValueEntity> dMap = new HashMap<>();
if(list.size() > 0){
dMap = list.get(0);
if(levelMap!=null){
dMap = changeDataColor(dMap,levelMap);
}
newDataMap.putAll(dMap);
}else{
for (Map.Entry<String, String> data : dataFieldDict.entrySet()) {
ValueEntity dataEntity = new ValueEntity();
dataEntity.setValue(null);
newDataMap.put(data.getValue(), dataEntity);
}
for (Map.Entry<String, Object> level : levelMap.entrySet()) {
ValueEntity levelEntity = new ValueEntity();
levelEntity.setValue(level.getValue().toString());
if("JSCOD".equals(level.getKey())){
newDataMap.put("进水COD标准", levelEntity);
continue;
}
if("CSCOD".equals(level.getKey())){
newDataMap.put("出水COD标准", levelEntity);
continue;
}
if("JSNH3N".equals(level.getKey())){
newDataMap.put("进水氨氮标准", levelEntity);
continue;
}
if("CSNH3N".equals(level.getKey())){
newDataMap.put("出水氨氮标准", levelEntity);
}
if("JSTN".equals(level.getKey())){
newDataMap.put("进水总氮标准", levelEntity);
continue;
}
if("CSTN".equals(level.getKey())){
newDataMap.put("出水总氮标准", levelEntity);
continue;
}
if("JSTP".equals(level.getKey())){
newDataMap.put("进水总磷标准", levelEntity);
continue;
}
if("CSTP".equals(level.getKey())){
newDataMap.put("出水总磷标准", levelEntity);
continue;
}
if("JSPH".equals(level.getKey())){
newDataMap.put("进水pH标准", levelEntity);
continue;
}
if("CSPH".equals(level.getKey())){
newDataMap.put("出水pH标准", levelEntity);
continue;
}
if("JSSS".equals(level.getKey())){
newDataMap.put("进水SS标准", levelEntity);
continue;
}
if("CSSS".equals(level.getKey())){
newDataMap.put("出水SS标准", levelEntity);
continue;
}
}
}
dList.add(newDataMap);
dataMap.put("水质水量日报表", dList);
return dataMap;
}
@Override
public String buildWaterQualityAlarmValue(String reportId, String departId, String json) {
return json;
}
/**
* 构造LIST
* @param szMapList
* @param list
* @param startTime
* @param dataFieldDict
* @return
*/
private List<Map<String, ValueEntity>> changeDataList(List<Map<String, Object>> szMapList, List<Map<String, ValueEntity>> list,
String startTime, Map<String, String> dataFieldDict) {
for(Map<String,Object> valueMap : szMapList) {
Map<String,ValueEntity> handleMap = new HashMap<String,ValueEntity>();
//添加时间参数
ValueEntity startTimeValueEntity = new ValueEntity();
startTimeValueEntity.setValue(startTime);
handleMap.put("参数时间", startTimeValueEntity);
Set<String> keySet = valueMap.keySet();
for(String key : keySet) {
if(!StringUtils.isEmpty(dataFieldDict.get(key))) {
ValueEntity valueEntity = new ValueEntity();
valueEntity.setValue(ConvertUtils.getString(valueMap.get(key)));
handleMap.put(dataFieldDict.get(key),valueEntity);
}
}
list.add(handleMap);
}
return list;
}
/**
* 指标变色
* @param map
* @param levelMap
* @return
*/
public Map<String,ValueEntity> changeDataColor(Map<String,ValueEntity> map,Map<String, Object> levelMap){
Map<String,ValueEntity> result = new HashMap<>();
for (Map.Entry<String, ValueEntity> entry : map.entrySet()) {
ValueEntity levelEntity = new ValueEntity();
String key = entry.getKey();
ValueEntity value = entry.getValue();
if("进水COD".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSCOD"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSCOD").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSCOD").toString());
}
}
}
if("出水COD".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSCOD"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSCOD").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSCOD").toString());
}
}
}
if("进水氨氮".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSNH3N"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSNH3N").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSNH3N").toString());
}
}
}
if("出水氨氮".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSNH3N"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSNH3N").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSNH3N").toString());
}
}
}
if("进水总氮".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSTN"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSTN").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSTN").toString());
}
}
}
if("出水总氮".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSTN"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSTN").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSTN").toString());
}
}
}
if("进水总磷".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSTP"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSTP").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSTP").toString());
}
}
}
if("出水总磷".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSTP"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSTP").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSTP").toString());
}
}
}
if("进水pH".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSPH"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSPH").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l);
}
levelEntity.setValue(levelMap.get("JSPH").toString());
}
}
}
if("出水pH".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSPH"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSPH").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l);
}
levelEntity.setValue(levelMap.get("CSPH").toString());
}
}
}
if("进水SS".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("JSSS"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("JSSS").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("JSSS").toString());
}
}
}
if("出水SS".equals(key)){
if(ConvertUtils.isNotEmpty(levelMap.get("CSSS"))){
if(ConvertUtils.isNotEmpty(value.getValue())){
double v = Double.parseDouble(value.getValue());
double l = Double.parseDouble(levelMap.get("CSSS").toString());
if(v > l){
value.setDataSourceColor("red");
value.setTitle("超过上限"+l+"mg/L");
}
levelEntity.setValue(levelMap.get("CSSS").toString());
}
}
}
result.put(key,value);
result.put(key+"标准", levelEntity);
}
return result;
}
}
......@@ -144,4 +144,8 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData
List<Map<String, Object>> queryNhYyrbReport(@Param(value="dataViewName3a24") String dataViewName3a24,
@Param(value="startTime") String startTime, @Param(value="endTime") String endTime,
@Param(value="departId") String departId);
List<Map<String, Object>> queryHyReport(@Param(value="dataViewName9bff") String dataViewName9bff,
@Param(value="startTime") String startTime, @Param(value="endTime") String endTime,
@Param(value="departId") String departId);
}
......
......@@ -763,4 +763,49 @@
AND v3.time &lt;= #{endTime}
GROUP BY v3.depart_id
</select>
<select id="queryHyReport" resultType="java.util.HashMap">
SELECT
ROUND( AVG( v.SW ), 2 ) AS `SW`,
ROUND( AVG( v.FYHGMLSS ), 2 ) AS `FYHGMLSS`,
ROUND( AVG( v.EYHGMLSS ), 2 ) AS `EYHGMLSS`,
ROUND( AVG( v.DYHGMLSS ), 2 ) AS `DYHGMLSS`,
ROUND( AVG( v.BYHGMLSS ), 2 ) AS `BYHGMLSS`,
ROUND( AVG( v.CYHGMLSS ), 2 ) AS `CYHGMLSS`,
ROUND( AVG( v.AYHGMLSS ), 2 ) AS `AYHGMLSS`,
ROUND( AVG( v.FYHGCJB ), 2 ) AS `FYHGCJB`,
ROUND( AVG( v.EYHGCJB ), 2 ) AS `EYHGCJB`,
ROUND( AVG( v.DYHGCJB ), 2 ) AS `DYHGCJB`,
ROUND( AVG( v.BYHGCJB ), 2 ) AS `BYHGCJB`,
ROUND( AVG( v.CYHGCJB ), 2 ) AS `CYHGCJB`,
ROUND( AVG( v.AYHGCJB ), 2 ) AS `AYHGCJB`,
ROUND( AVG( v.JSCODHY ), 2 ) AS `JSCODHY`,
ROUND( AVG( v.CSCODHY ), 2 ) AS `CSCODHY`,
ROUND( AVG( v.JSADHY ), 2 ) AS `JSADHY`,
ROUND( AVG( v.CSADHY ), 2 ) AS `CSADHY`,
ROUND( AVG( v.CSTNHY ), 2 ) AS `CSTNHY`,
ROUND( AVG( v.JSZDHY ), 2 ) AS `JSZDHY`,
ROUND( AVG( v.JSZLHY ), 2 ) AS `JSZLHY`,
ROUND( AVG( v.CSZLHY ), 2 ) AS `CSZLHY`,
ROUND( AVG( v.JSSSHY ), 2 ) AS `JSSSHY`,
ROUND( AVG( v.CSSSHY ), 2 ) AS `CSSSHY`,
ROUND( AVG( v.JSPHHY ), 2 ) AS `JSPHHY`,
ROUND( AVG( v.CSPHHY ), 2 ) AS `CSPHHY`,
ROUND( AVG( v.CSBODHY ), 2 ) AS `CSBODHY`,
ROUND( AVG( v.JSBODHY ), 2 ) AS `JSBODHY`,
v.depart_id,
d.depart_name as depart_name,
v.time
FROM
${dataViewName9bff} v
LEFT JOIN sys_depart d ON v.depart_id = d.id
WHERE
v.depart_id IN
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
AND v.time &gt;= #{startTime}
AND v.time &lt;= #{endTime}
GROUP BY v.depart_id
</select>
</mapper>
......
......@@ -140,4 +140,6 @@ public interface IFCustomReportDatasetService extends IService<FCustomReportData
List<Map<String, Object>> querySzYyrbReport(String dataViewName2119, String startTime, String endTime, String departId);
List<Map<String, Object>> queryNhYyrbReport(String dataViewName3a24, String startTime, String endTime, String departId);
List<Map<String, Object>> queryHyReport(String dataViewName9bff, String startTime, String endTime, String departIds);
}
......
......@@ -466,6 +466,12 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
return list;
}
@Override
public List<Map<String, Object>> queryHyReport(String dataViewName9bff, String startTime, String endTime, String departId) {
List<Map<String, Object>> list = mapper.queryHyReport(dataViewName9bff, startTime, endTime, departId);
return list;
}
/**转换为Map<部门编号,JnhbReportData> */
private Map<String,JnhbReportData> convertJnhbReportDataMap(List<JnhbReportData> dataList){// Map<部门编号,JnhbReportData>
Map<String,JnhbReportData> dataMap = new HashMap<>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!