44aa0bf6 张雷

报表问题修改

1 个父辈 7f614fea
......@@ -60,8 +60,8 @@ public class VideoController {
public Result<Object> videoMessage(){
Result<Object> result = new Result<Object>();
//获取摄像头所有的列表
String factoryids = BaseContextHandler.getDeparts();
List<Map<String,Object>> videoList = tVideoService.queryVideoList(factoryids);
String departIds = BaseContextHandler.getDeparts();
List<Map<String,Object>> videoList = tVideoService.queryVideoList(departIds);
//将业务数据转换为构造树所需的数据结构
List<TransTreeModel> transTreeModels = videoList.stream().map(bo -> convertToTreeModel(bo)).collect(Collectors.toList());
//此处工具类构建树通过拼接root构造根节点
......
......@@ -23,7 +23,7 @@ public interface TVideoMapper extends BaseMapper<TVideo> {
/**
* APP查询摄像头列表
* @param orgCode
* @param departIds
* @return
*/
List<Map<String, Object>> queryVideoList(@Param("departIds") String departIds);
......
......@@ -73,11 +73,11 @@
FROM
sys_depart f
WHERE
<!-- id in-->
<!-- <foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- and -->
id in
<foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
and
depart_type ='1'
UNION ALL
SELECT
......@@ -89,10 +89,10 @@
2222222 AS depart_order
FROM
t_video
<!-- where depart_id in-->
<!-- <foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
where depart_id in
<foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
) ss
ORDER BY
ss.depart_order,ss.video_name
......@@ -139,7 +139,7 @@
</if>
order by IFNULL(a.video_sort,99),d.depart_name,a.video_camerauuid
</select>
<select id="queryCustomVideoPageList" resultType="com.skua.modules.video.entity.TVideo">
SELECT
c.video_root_name AS area_name,
......
......@@ -24,7 +24,7 @@ public interface ITVideoService extends IService<TVideo> {
* @param orgCode
* @return
*/
List<Map<String, Object>> queryVideoList(String orgCode);
List<Map<String, Object>> queryVideoList(String departIds);
/**
* <pre>
* App摄像头模糊搜索
......
......@@ -41,8 +41,8 @@ public class TVideoServiceImpl extends ServiceImpl<TVideoMapper, TVideo> impleme
}
@Override
public List<Map<String, Object>> queryVideoList(String orgCode) {
return tVideoMapper.queryVideoList(orgCode);
public List<Map<String, Object>> queryVideoList(String departIds) {
return tVideoMapper.queryVideoList(departIds);
}
@Override
......
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("yynbReportHandle")
public class YynbReportHandle 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) {
List<String> timeList = DateUtils.getMonthsBetween(startTime, endTime);
Map<String, Object> levelMap = factoryCenterService.getMonitorThreshold(departId);
String departIds = commonSqlService.getChildDepartId(departId);
Map<String,List<Map<String,ValueEntity>>> resMap = new HashMap<String,List<Map<String,ValueEntity>>>();
Map<String,List<Map<String,ValueEntity>>> dataMap = new HashMap<String,List<Map<String,ValueEntity>>>();
//获取数据集
//获取填报数据及报表数据项信息,组装报表所需数据机构
List<Map<String,ValueEntity>> list = new ArrayList<Map<String,ValueEntity>>();
//获取填报数据
String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"", departIds, startTime, endTime);
//根据数据集id获取数据项及填报数据
List<FCustomReportDatasetVO> dataFieldList1 = fCustomReportDatasetService.getDataField(ReportConstant.view3a24);
Map<String,String> dataFieldDict = new HashMap<String,String>();
for(FCustomReportDatasetVO dataField : dataFieldList1) {
dataFieldDict.put(dataField.getDatasetId(), dataField.getDatasetName());
}
List<FCustomReportDatasetVO> dataFieldList2 = fCustomReportDatasetService.getDataField(ReportConstant.view2119);
for(FCustomReportDatasetVO dataField : dataFieldList2) {
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.querySzYynbReport(dataViewName2119, startTime, endTime, departIds);
list = changeDataList(szMapList,list,startTime,dataFieldDict);
dataMap.put("水质水量报表", list);
List<Map<String, Object>> nhMapList = fCustomReportDatasetService.queryNhYynbReport(dataViewName3a24, startTime, endTime, departIds);
list = changeDataList(nhMapList,list,startTime,dataFieldDict);
dataMap.put("能耗报表", list);
List<Map<String,ValueEntity>> dList = new ArrayList<>();
for (String time: timeList) {
Map<String,ValueEntity> newDataMap = new HashMap<>();
ValueEntity valueEntity = new ValueEntity();
valueEntity.setValue(time);
newDataMap.put("时间", valueEntity);
for (Map.Entry<String, List<Map<String,ValueEntity>>> entry : dataMap.entrySet()) {
List<Map<String,ValueEntity>> dataList = entry.getValue();
for (Map<String,ValueEntity> dMap: dataList) {
if(time.equals(dMap.get("时间").getValue())){
if(levelMap!=null){
dMap = changeDataColor(dMap,levelMap);
}
newDataMap.putAll(dMap);
}
}
}
dList.add(newDataMap);
}
resMap.put("综合数据源", dList);
return resMap;
}
/**
* 构造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;
}
@Override
public String buildWaterQualityAlarmValue(String reportId, String departId, String json) {
return json;
}
/**
* 指标变色
* @param map
* @param levelMap
* @return
*/
public Map<String,ValueEntity> changeDataColor(Map<String,ValueEntity> map,Map<String, Object> levelMap){
for (Map.Entry<String, ValueEntity> entry : map.entrySet()) {
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");
}
}
}
}
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");
}
}
}
}
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");
}
}
}
}
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");
}
}
}
}
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");
}
}
}
}
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");
}
}
}
}
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");
}
}
}
}
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");
}
}
}
}
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);
}
}
}
}
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);
}
}
}
}
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");
}
}
}
}
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");
}
}
}
}
}
return map;
}
}
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.context.SpringContextUtils;
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;
......@@ -32,53 +34,46 @@ public class YyybReportHandle implements ICustomHandle{
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) {
List<String> timeList = DateUtils.getDatesBetween(startTime, endTime);
Map<String, Object> levelMap = factoryCenterService.getMonitorThreshold(departId);
String departIds = commonSqlService.getChildDepartId(departId);
Map<String,List<Map<String,ValueEntity>>> resMap = new HashMap<String,List<Map<String,ValueEntity>>>();
Map<String,List<Map<String,ValueEntity>>> dataMap = new HashMap<String,List<Map<String,ValueEntity>>>();
//获取数据集
List<FCustomReportDatasetVO> dataSetList = fCustomReportDatasetService.getDataset(reportId);
for(FCustomReportDatasetVO fv : dataSetList) {
String dataSetId = fv.getDatasetId();
//获取填报数据及报表数据项信息,组装报表所需数据机构
List<Map<String,ValueEntity>> list = new ArrayList<Map<String,ValueEntity>>();
//根据数据集id获取数据项及填报数据
List<FCustomReportDatasetVO> dataFieldList = fCustomReportDatasetService.getDataField(dataSetId);
Map<String,String> dataFieldDict = new HashMap<String,String>();
for(FCustomReportDatasetVO dataField : dataFieldList) {
dataFieldDict.put(dataField.getDatasetId(), dataField.getDatasetName());
}
//添加厂站、时间字段
dataFieldDict.put("depart_name", "厂站名称");
dataFieldDict.put("time", "时间");
dataFieldDict.put("paramTime", "参数时间");
//获取填报数据
String dataViewName = ReportViewUtil.buildView(dataSetId,"", departId, startTime,endTime);
//结果集
List<Map<String, Object>> valueMapList = fCustomReportDatasetService.queryReportValue(dataViewName,startTime,endTime,departId);
for(Map<String,Object> valueMap : valueMapList) {
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);
}
dataMap.put(fv.getDatasetName(), list);
//获取填报数据及报表数据项信息,组装报表所需数据机构
List<Map<String,ValueEntity>> list = new ArrayList<Map<String,ValueEntity>>();
//获取填报数据
String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"", departIds, startTime, endTime);
//根据数据集id获取数据项及填报数据
List<FCustomReportDatasetVO> dataFieldList1 = fCustomReportDatasetService.getDataField(ReportConstant.view3a24);
Map<String,String> dataFieldDict = new HashMap<String,String>();
for(FCustomReportDatasetVO dataField : dataFieldList1) {
dataFieldDict.put(dataField.getDatasetId(), dataField.getDatasetName());
}
List<FCustomReportDatasetVO> dataFieldList2 = fCustomReportDatasetService.getDataField(ReportConstant.view2119);
for(FCustomReportDatasetVO dataField : dataFieldList2) {
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);
dataMap.put("水质水量报表", list);
List<Map<String, Object>> nhMapList = fCustomReportDatasetService.queryNhYyybReport(dataViewName3a24, startTime, endTime, departIds);
list = changeDataList(nhMapList,list,startTime,dataFieldDict);
dataMap.put("能耗报表", list);
List<Map<String,ValueEntity>> dList = new ArrayList<>();
for (String time: timeList) {
Map<String,ValueEntity> newDataMap = new HashMap<>();
......@@ -86,8 +81,8 @@ public class YyybReportHandle implements ICustomHandle{
valueEntity.setValue(time);
newDataMap.put("时间", valueEntity);
for (Map.Entry<String, List<Map<String,ValueEntity>>> entry : dataMap.entrySet()) {
List<Map<String,ValueEntity>> list = entry.getValue();
for (Map<String,ValueEntity> dMap: list) {
List<Map<String,ValueEntity>> dataList = entry.getValue();
for (Map<String,ValueEntity> dMap: dataList) {
if(time.equals(dMap.get("时间").getValue())){
if(levelMap!=null){
dMap = changeDataColor(dMap,levelMap);
......@@ -107,6 +102,35 @@ public class YyybReportHandle implements ICustomHandle{
}
/**
* 构造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
......@@ -117,7 +141,7 @@ public class YyybReportHandle implements ICustomHandle{
String key = entry.getKey();
ValueEntity value = entry.getValue();
if("进水COD".equals(key)){
if(levelMap.get("JSCOD")!=null){
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());
......@@ -129,7 +153,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("出水COD".equals(key)){
if(levelMap.get("CSCOD")!=null){
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());
......@@ -141,7 +165,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("进水氨氮".equals(key)){
if(levelMap.get("JSNH3N")!=null){
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());
......@@ -153,7 +177,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("出水氨氮".equals(key)){
if(levelMap.get("CSNH3N")!=null){
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());
......@@ -165,7 +189,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("进水总氮".equals(key)){
if(levelMap.get("JSTN")!=null){
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());
......@@ -177,7 +201,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("出水总氮".equals(key)){
if(levelMap.get("CSTN")!=null){
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());
......@@ -189,7 +213,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("进水总磷".equals(key)){
if(levelMap.get("JSTP")!=null){
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());
......@@ -201,7 +225,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("出水总磷".equals(key)){
if(levelMap.get("CSTP")!=null){
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());
......@@ -213,7 +237,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("进水pH".equals(key)){
if(levelMap.get("JSPH")!=null){
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());
......@@ -225,7 +249,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("出水pH".equals(key)){
if(levelMap.get("CSPH")!=null){
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());
......@@ -237,7 +261,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("进水SS".equals(key)){
if(levelMap.get("JSSS")!=null){
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());
......@@ -249,7 +273,7 @@ public class YyybReportHandle implements ICustomHandle{
}
}
if("出水SS".equals(key)){
if(levelMap.get("CSSS")!=null){
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());
......
......@@ -120,4 +120,20 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData
List<JnhbReportDetailsHj> getHjList(@Param(value="dataViewName2") String dataViewName2, @Param(value="dataViewName3") String dataViewName3,
@Param(value="departId") String departId, @Param(value="year") String year);
List<Map<String, Object>> querySzYynbReport(@Param(value="dataViewName2119") String dataViewName2119,
@Param(value="startTime")String startTime, @Param(value="endTime")String endTime,
@Param(value="departId") String departId);
List<Map<String, Object>> queryNhYynbReport(@Param(value="dataViewName3a24") String dataViewName3a24,
@Param(value="startTime") String startTime, @Param(value="endTime") String endTime,
@Param(value="departId") String departId);
List<Map<String, Object>> querySzYyybReport(@Param(value="dataViewName2119") String dataViewName2119,
@Param(value="startTime")String startTime, @Param(value="endTime")String endTime,
@Param(value="departId") String departId);
List<Map<String, Object>> queryNhYyybReport(@Param(value="dataViewName3a24") String dataViewName3a24,
@Param(value="startTime") String startTime, @Param(value="endTime") String endTime,
@Param(value="departId") String departId);
}
......
......@@ -512,4 +512,169 @@
GROUP BY
LEFT ( v.time, 7 )
</select>
<select id="querySzYynbReport" resultType="java.util.HashMap">
SELECT
ROUND( SUM( v.JSL ), 2 ) AS `JSL`,
ROUND( SUM( v.CSL ), 2 ) AS `CSL`,
ROUND( AVG( v.JSPH ), 2 ) AS `JSPH`,
ROUND( AVG( v.CSPH ), 2 ) AS `CSPH`,
ROUND( AVG( v.JSCOD ), 2 ) AS `JSCOD`,
ROUND( AVG( v.CSCOD ), 2 ) AS `CSCOD`,
ROUND( AVG( v.CSTN ), 2 ) AS `CSTN`,
ROUND( AVG( v.JSZD ), 2 ) AS `JSZD`,
ROUND( AVG( v.JSZL ), 2 ) AS `JSZL`,
ROUND( AVG( v.CSZL ), 2 ) AS `CSZL`,
ROUND( AVG( v.JSAD ), 2 ) AS `JSAD`,
ROUND( AVG( v.CSAD ), 2 ) AS `CSAD`,
ROUND( AVG( v.JSSS ), 2 ) AS `JSSS`,
ROUND( AVG( v.CSSS ), 2 ) AS `CSSS`,
v.BZ,
v.depart_id,
LEFT ( v.time, 7 ) AS time
FROM
${dataViewName2119} v
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
LEFT ( v.time, 7 )
</select>
<select id="queryNhYynbReport" resultType="java.util.HashMap">
SELECT
SUM(v3.PFS) AS PFS,
SUM(v3.FHTY) AS FHTY,
SUM(v3.RYXNJ) AS RYXNJ,
SUM(v3.YWL) AS YWL,
SUM(v3.GXCLJ) AS GXCLJ,
SUM(v3.CH3COONA) AS CH3COONA,
SUM(v3.HXT) AS HXT,
SUM(v3.FECL3) AS FECL3,
SUM(v3.SH) AS SH,
SUM(v3.CH3COOH) AS CH3COOH,
SUM(v3.FESO4G) AS FESO4G,
SUM(v3.FESO4Y) AS FESO4Y,
SUM(v3.H2O2) AS H2O2,
SUM(v3.GFFDL) AS GFFDL,
SUM(v3.QY) AS QY,
SUM(v3.GFCZL) AS GFCZL,
SUM(v3.WNHSL) AS WNHSL,
SUM(v3.WFCSL) AS WFCSL,
SUM(v3.WFCZL) AS WFCZL,
SUM(v3.DLJZ) AS DLJZ,
SUM(v3.GFSYL) AS GFSYL,
SUM(v3.WNL) AS WNL,
SUM(v3.DLFZ) AS DLFZ,
SUM(v3.DLPZ) AS DLPZ,
SUM(v3.DLGZ) AS DLGZ,
SUM(v3.DLHJ) AS DLHJ,
SUM(v3.YSL) AS YSL,
SUM(v3.PAMZ) AS PAMZ,
SUM(v3.PAMF) AS PAMF,
SUM(v3.PAMRJ) AS PAMRJ,
SUM(v3.SCLPAMZ) AS SCLPAMZ,
SUM(v3.SCLPAMF) AS SCLPAMF,
SUM(v3.NACLO) AS NACLO,
SUM(v3.PACGT) AS PACGT,
SUM(v3.PACYT) AS PACYT,
v3.BZ AS BZ,
v3.depart_id AS depart_id,
LEFT(v3.time,7) AS time
FROM ${dataViewName3a24} v3
WHERE
v3.depart_id IN
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
AND v3.time &gt;= #{startTime}
AND v3.time &lt;= #{endTime}
GROUP BY LEFT(v3.time,7)
</select>
<select id="querySzYyybReport" resultType="java.util.HashMap">
SELECT
ROUND( SUM( v.JSL ), 2 ) AS `JSL`,
ROUND( SUM( v.CSL ), 2 ) AS `CSL`,
ROUND( AVG( v.JSPH ), 2 ) AS `JSPH`,
ROUND( AVG( v.CSPH ), 2 ) AS `CSPH`,
ROUND( AVG( v.JSCOD ), 2 ) AS `JSCOD`,
ROUND( AVG( v.CSCOD ), 2 ) AS `CSCOD`,
ROUND( AVG( v.CSTN ), 2 ) AS `CSTN`,
ROUND( AVG( v.JSZD ), 2 ) AS `JSZD`,
ROUND( AVG( v.JSZL ), 2 ) AS `JSZL`,
ROUND( AVG( v.CSZL ), 2 ) AS `CSZL`,
ROUND( AVG( v.JSAD ), 2 ) AS `JSAD`,
ROUND( AVG( v.CSAD ), 2 ) AS `CSAD`,
ROUND( AVG( v.JSSS ), 2 ) AS `JSSS`,
ROUND( AVG( v.CSSS ), 2 ) AS `CSSS`,
v.BZ,
v.depart_id,
v.time
FROM
${dataViewName2119} v
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.time
</select>
<select id="queryNhYyybReport" resultType="java.util.HashMap">
SELECT
SUM(v3.PFS) AS PFS,
SUM(v3.FHTY) AS FHTY,
SUM(v3.RYXNJ) AS RYXNJ,
SUM(v3.YWL) AS YWL,
SUM(v3.GXCLJ) AS GXCLJ,
SUM(v3.CH3COONA) AS CH3COONA,
SUM(v3.HXT) AS HXT,
SUM(v3.FECL3) AS FECL3,
SUM(v3.SH) AS SH,
SUM(v3.CH3COOH) AS CH3COOH,
SUM(v3.FESO4G) AS FESO4G,
SUM(v3.FESO4Y) AS FESO4Y,
SUM(v3.H2O2) AS H2O2,
SUM(v3.GFFDL) AS GFFDL,
SUM(v3.QY) AS QY,
SUM(v3.GFCZL) AS GFCZL,
SUM(v3.WNHSL) AS WNHSL,
SUM(v3.WFCSL) AS WFCSL,
SUM(v3.WFCZL) AS WFCZL,
SUM(v3.DLJZ) AS DLJZ,
SUM(v3.GFSYL) AS GFSYL,
SUM(v3.WNL) AS WNL,
SUM(v3.DLFZ) AS DLFZ,
SUM(v3.DLPZ) AS DLPZ,
SUM(v3.DLGZ) AS DLGZ,
SUM(v3.DLHJ) AS DLHJ,
SUM(v3.YSL) AS YSL,
SUM(v3.PAMZ) AS PAMZ,
SUM(v3.PAMF) AS PAMF,
SUM(v3.PAMRJ) AS PAMRJ,
SUM(v3.SCLPAMZ) AS SCLPAMZ,
SUM(v3.SCLPAMF) AS SCLPAMF,
SUM(v3.NACLO) AS NACLO,
SUM(v3.PACGT) AS PACGT,
SUM(v3.PACYT) AS PACYT,
v3.BZ AS BZ,
v3.depart_id AS depart_id,
v3.time
FROM ${dataViewName3a24} v3
WHERE
v3.depart_id IN
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
AND v3.time &gt;= #{startTime}
AND v3.time &lt;= #{endTime}
GROUP BY v3.time
</select>
</mapper>
......
......@@ -129,4 +129,11 @@ public interface IFCustomReportDatasetService extends IService<FCustomReportData
*/
List<ResultNumberVO> jnhbLargeScreenShowResultNumber(String departIds, String time);
List<Map<String, Object>> querySzYynbReport(String dataViewName2119, String startTime, String endTime, String departId);
List<Map<String, Object>> queryNhYynbReport(String dataViewName3a24, String startTime, String endTime, String departId);
List<Map<String, Object>> querySzYyybReport(String dataViewName2119, String startTime, String endTime, String departId);
List<Map<String, Object>> queryNhYyybReport(String dataViewName3a24, String startTime, String endTime, String departId);
}
......
......@@ -430,6 +430,30 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
return reduceStatisticsList;
}
@Override
public List<Map<String, Object>> querySzYynbReport(String dataViewName2119, String startTime, String endTime, String departId) {
List<Map<String, Object>> list = mapper.querySzYynbReport(dataViewName2119, startTime, endTime, departId);
return list;
}
@Override
public List<Map<String, Object>> queryNhYynbReport(String dataViewName3a24, String startTime, String endTime, String departId) {
List<Map<String, Object>> list = mapper.queryNhYynbReport(dataViewName3a24, startTime, endTime, departId);
return list;
}
@Override
public List<Map<String, Object>> querySzYyybReport(String dataViewName2119, String startTime, String endTime, String departId) {
List<Map<String, Object>> list = mapper.querySzYyybReport(dataViewName2119, startTime, endTime, departId);
return list;
}
@Override
public List<Map<String, Object>> queryNhYyybReport(String dataViewName3a24, String startTime, String endTime, String departId) {
List<Map<String, Object>> list = mapper.queryNhYyybReport(dataViewName3a24, startTime, endTime, departId);
return list;
}
/**转换为Map<部门编号,JnhbReportData> */
private Map<String,JnhbReportData> convertJnhbReportDataMap(List<JnhbReportData> dataList){// Map<部门编号,JnhbReportData>
Map<String,JnhbReportData> dataMap = new HashMap<>();
......
......@@ -51,8 +51,8 @@ public class FCustomReportInfoServiceImpl extends ServiceImpl<FCustomReportInfoM
//获取自定义报表对象
FCustomReportInfo reportInfo = this.getById(reportId);
if("3".equals(reportInfo.getReportTimeQueryType())){//年
startTime = startTime + "-01-01";
endTime = endTime + "-12-31";
startTime = startTime + "-01";
endTime = endTime + "-31";
}else if("2".equals(reportInfo.getReportTimeQueryType())){//月
startTime = startTime + "-01";
endTime = endTime + "-31";
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!