5df0433f 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 5dca25a6 7438018c
package com.skua.common.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 水质水量报表
* @auther kangwei
* @create 2024-11-27-9:10
*/
@Data
public class DataViewVO {
@ApiModelProperty(value = "时间")
private String time;
@ApiModelProperty(value = "水厂")
private String departId;
@ApiModelProperty(value = "负荷率")
private String fhl;
@ApiModelProperty(value = "进水量")
private BigDecimal JSL;
@ApiModelProperty(value = "出水量")
private BigDecimal CSL;
@ApiModelProperty(value = "处理水量")
private BigDecimal CLSL;
@ApiModelProperty(value = "进水总磷")
private String JSZL;
@ApiModelProperty(value = "进水总磷")
private String CSZL;
@ApiModelProperty(value = "进水COD")
private String JSCOD;
@ApiModelProperty(value = "进水COD")
private String CSCOD;
@ApiModelProperty(value = "进水氨氮")
private String JSAD;
@ApiModelProperty(value = "出水氨氮")
private String CSAD;
@ApiModelProperty(value = "进水总氮")
private String JSZD;
@ApiModelProperty(value = "出水总氮")
private String CSTN;
@ApiModelProperty(value = "进水PH")
private String JSPH;
@ApiModelProperty(value = "出水PH")
private String CSPH;
@ApiModelProperty(value = "进水SS")
private String JSSS;
@ApiModelProperty(value = "出水SS")
private String CSSS;
public DataViewVO(){
}
public void initData(){
this.JSL = BigDecimal.ZERO;
this.CSL= BigDecimal.ZERO;
this.JSZL = "0.0";
this.JSAD = "0.0";
this.CSSS="0.0";
this.JSSS="0.0";
this.CSPH="0.0";
this.JSPH = "0.0";
this.JSZL="0.0";
this.CSZL="0.0";
this.JSCOD="0.0";
this.CSCOD="0.0";
this.JSAD="0.0";
this.CSAD="0.0";
this.JSZD="0.0";
this.CSTN="0.0";
}
//计算一组数据的标准差
public void calculateStandardDeviation(){
}
}
package com.skua.common.report.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;
import java.util.ArrayList;
import java.util.List;
/**
* @auther kangwei
* @create 2024-11-26-15:21
*/
@Data
@ApiModel(value="折线图对象", description="折线图对象")
public class DrugChartsVO {
@ApiModelProperty(value = "时间参数")
private List<String> timeList;
@ApiModelProperty(value = "value:数值数组")
private List<String> valueList;
@ApiModelProperty(value = "同比:数值数组")
private List<String> valueTBList;
@ApiModelProperty(value = "总电耗数值数组")
private List<String> dhDataList;
@ApiModelProperty(value = "吨水电耗数值数组")
private List<String> dsdhDataList;
@ApiModelProperty(value = "(负荷率)数值数组")
private List<String> fhlDataList;
@ApiModelProperty(value = "(COD)数值数组")
private List<String> codDataList;
@ApiModelProperty(value = "(氨氮)数值数组")
private List<String> adDataList;
@ApiModelProperty(value = "(总磷)数值数组")
private List<String> zlDataList;
public DrugChartsVO(){
}
public void setDsdhData(String time ,String dsdh){
this.getTimeList().add(time);
this.getDsdhDataList().add(ConvertUtils.getString(dsdh,"0.0"));
}
public void setDsdhData(String time ,String dsdh,String fhl){
this.getTimeList().add(time);
this.getDsdhDataList().add(ConvertUtils.getString(dsdh,"0.0"));
this.getFhlDataList().add(ConvertUtils.getString(fhl,"0.0") );
}
public void setFhlData(String time ,String fhl){
this.getTimeList().add(time);
this.getFhlDataList().add(ConvertUtils.getString(fhl,"0.0") );
}
//设置污染物
public void setCodAdZlData(String time ,String cod,String ad,String zl){
this.getTimeList().add(time);
this.getCodDataList().add(ConvertUtils.getString(cod,"0.0") );
this.getAdDataList().add(ConvertUtils.getString(ad,"0.0"));
this.getZlDataList().add(ConvertUtils.getString(zl,"0.0") );
}
//设置污染物去除率
public void setCodAdZlRateData(DataViewVO dataViewVO2119){
this.getTimeList().add(dataViewVO2119.getTime());
String expressionCod ="(" +dataViewVO2119.getJSCOD() +"-"+ dataViewVO2119.getCSAD() +") *100/ "+dataViewVO2119.getJSCOD();
this.getCodDataList().add(JSUtils.executeExpression( expressionCod ,"0.0"));
String expressionAD ="(" +dataViewVO2119.getJSAD() +"-"+ dataViewVO2119.getCSAD() +") *100/ "+dataViewVO2119.getJSAD();
this.getAdDataList().add(JSUtils.executeExpression( expressionAD ,"0.0"));
String expressionZL ="(" +dataViewVO2119.getJSZL() +"-"+ dataViewVO2119.getCSZL() +") *100/ "+dataViewVO2119.getJSZL();
this.getZlDataList().add(JSUtils.executeExpression( expressionZL ,"0.0"));
}
//设置进水浓度
public void setJSCodAdZlData(DataViewVO dataViewVO2119){
this.getTimeList().add(dataViewVO2119.getTime());
this.getCodDataList().add( dataViewVO2119.getJSCOD() );
this.getAdDataList().add(dataViewVO2119.getJSAD());
this.getZlDataList().add( dataViewVO2119.getJSZL());
}
//设置出水浓度
public void setCSCodAdZlData(DataViewVO dataViewVO2119){
this.getTimeList().add(dataViewVO2119.getTime());
this.getCodDataList().add( dataViewVO2119.getCSCOD() );
this.getAdDataList().add(dataViewVO2119.getCSCOD());
this.getZlDataList().add( dataViewVO2119.getCSZL());
}
public List<String> getValueList() {
if(valueList == null ) valueList = new ArrayList<>();
return valueList;
}
public List<String> getValueTBList() {
if(valueTBList == null ) valueTBList = new ArrayList<>();
return valueTBList;
}
public List<String> getTimeList() {
if(timeList == null ) timeList = new ArrayList<>();
return timeList;
}
public List<String> getDsdhDataList() {
if(dsdhDataList == null ) dsdhDataList = new ArrayList<>();
return dsdhDataList;
}
public List<String> getFhlDataList() {
if(fhlDataList == null ) fhlDataList = new ArrayList<>();
return fhlDataList;
}
public List<String> getCodDataList() {
if(codDataList == null ) codDataList = new ArrayList<>();
return codDataList;
}
public List<String> getAdDataList() {
if(adDataList == null ) adDataList = new ArrayList<>();
return adDataList;
}
public List<String> getZlDataList() {
if(zlDataList == null ) zlDataList = new ArrayList<>();
return zlDataList;
}
}
......@@ -7,10 +7,9 @@ import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Stack;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -377,6 +376,28 @@ public class JSUtils {
return str;
}
/***
* 计算时间的前几个月的月份
* @param month
* @param time
* @return
*/
public static String getMonthBytime(int month,String time) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(format.parse(time));
} catch (ParseException e) {
e.printStackTrace();
}
calendar.add(Calendar.MONTH, month);
return format.format(calendar.getTime());
}
public static void main(String[] args) {
System.out.println(getMonthBytime(-12,"2024-12"));
}
/* ScriptEngine se = new ScriptEngineManager().getEngineByName("JavaScript");
Object eval = null;
try {
......
......@@ -154,6 +154,8 @@ public class MaterialInfoController {
Page<MaterialInfo> page = new Page<MaterialInfo>(pageNo, pageSize);
QueryWrapper<MaterialInfo> queryWrapper = getMaterialInfoQueryWrapper(materialInfo);
//queryWrapper.in("status","'1','2'");
queryWrapper.eq("user_id",BaseContextHandler.getUserId());
IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
......@@ -164,14 +166,16 @@ public class MaterialInfoController {
private QueryWrapper<MaterialInfo> getMaterialInfoQueryWrapper(MaterialInfo materialInfo){
QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper();
String departIds = null;
if (StringUtils.isBlank(materialInfo.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) {
departIds = departService.getChildDepartId(BaseContextHandler.getDeparts());
}else{
if (StringUtils.isNotEmpty(materialInfo.getDepartId())) {
//departIds = departService.getChildDepartId(BaseContextHandler.getDeparts());
departIds = departService.getChildDepartId(materialInfo.getDepartId());
}else{
departIds = BaseContextHandler.getDeparts();
}
// Page<MaterialInfo> page = new Page<ErpSettlement>(pageNo, pageSize);
queryWrapper.eq("del_flag","0");
queryWrapper.in("depart_id", JSUtils.quoteEach(departIds,","));
// queryWrapper.eq("depart_id",materialInfo.getDepartId());
//queryWrapper.in("depart_id", JSUtils.quoteEach(departIds,","));
if(StringUtils.isNotEmpty(materialInfo.getFacInformationtype())){
queryWrapper.eq("fac_informationtype",materialInfo.getFacInformationtype());
}
......@@ -188,6 +192,7 @@ public class MaterialInfoController {
if(StringUtils.isNotEmpty(materialInfo.getStandardsType())){
queryWrapper.eq("standards_type",materialInfo.getStandardsType());
}
queryWrapper.orderByDesc("create_time");
return queryWrapper;
}
......@@ -206,9 +211,10 @@ public class MaterialInfoController {
Result<MaterialInfo> result = new Result<MaterialInfo>();
try {
if (StringUtils.isBlank(materialInfo.getDepartId())) {
String userCode = BaseContextHandler.getUserId();
//String userCode = BaseContextHandler.getUserId();
//根据用户id查询所属厂区 只要第一个
materialInfo.setDepartId(materialInfoService.queryFacByUserId(userCode));
//materialInfo.setDepartId(materialInfoService.queryFacByUserId(userCode));
materialInfo.setDepartId(BaseContextHandler.getRealDepartId());
}
materialInfoService.save(materialInfo);
result.success("添加成功!");
......
......@@ -41,6 +41,9 @@ public class MaterialInfo {
/**删除状态(0,正常,1已删除)*/
@ApiModelProperty(value = "删除状态(0,正常,1已删除)")
private String delFlag;
@ApiModelProperty(value = "用户编号")
private String userId;
/**创建人*/
@Excel(name = "创建人", width = 15,dictTable = "sys_user",dicCode = "username",dicText = "realname" ,orderNum = "6")
@ApiModelProperty(value = "创建人" )
......@@ -56,7 +59,6 @@ public class MaterialInfo {
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
......
......@@ -199,11 +199,11 @@
v8.dlhj,v8.yjhl,v8.wnl,
v2.zclsl,v2.rjclsl,
t.target_power as dsdhnmb,
round(v8.dlhj/(v2.zclsl*10000),2) as dsdhzsj,
'' as dsdhdb,
round(IFNULL(v8.dlhj,0)/(v2.zclsl),2) as dsdhzsj,
round((IFNULL(v8.dlhj,0)/(v2.zclsl) - t.target_power)*100/t.target_power,2) as dsdhdb,
t.target_drug as yjnmb,
round(v8.yjhl/(v2.zclsl*10000),2) as yjzsj,
'' as yjdb,
round(IFNULL(v8.yjhl,0)/(v2.zclsl),2) as yjzsj,
round((IFNULL(v8.yjhl,0)/(v2.zclsl) - t.target_drug)*100/t.target_drug ,2) as yjdb,
f.pro_scale as sjgm
FROM
sys_depart d
......
......@@ -195,6 +195,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
valueMap.put("startdate", startDate);
valueMap.put("enddate", endDate);
}
//
return valueMap;
}
......
......@@ -375,8 +375,8 @@
</select>
<select id="querySixMonthPowerConsumption" resultType="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),2) AS totalBYYDL,
ROUND(IFNULL(v3.DLHJ,0)/SUM(v2.CSL),2) AS dsdh,
LEFT(v2.time,7) AS time
from ${dataViewName2119} v2
......
......@@ -59,6 +59,8 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ", departIds, start, end);
String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, start, end);
List<Map> SixMonthPowerConsumption = powerAnalysisNewMapper.querySixMonthPowerConsumption(dataViewName3a24, dataViewName2119, start, end, departIds);
resultMap.put("totalResult", result);
resultMap.put("dataList", SixMonthPowerConsumption);
......
......@@ -10,4 +10,13 @@ public class TonOfWaterAndLoadRateDto {
private String dsdh;
private String fhl;
public TonOfWaterAndLoadRateDto(){
}
public TonOfWaterAndLoadRateDto(String time, String dsdh, String fhl) {
this.time = time;
this.dsdh = dsdh;
this.fhl = fhl;
}
}
......
......@@ -7,4 +7,12 @@ public class TonOfWaterTrendDto {
private String time;
private String v;
public TonOfWaterTrendDto(){
}
public TonOfWaterTrendDto(String time, String v) {
this.time = time;
this.v = v;
}
}
......
......@@ -73,28 +73,6 @@ public interface ComprehensiveSupervisionMapper {
String selectMetricNameById(String id);
/**
* 月度电耗水耗统计
*
* @return
*/
ConsumptionDto selectMonthlyPowerConsumption(@Param("dataStr") String dataStr, @Param("departIds") List<String> departIds);
/**
* 月度药耗统计
*
* @return
*/
DrugConsumptionDto selectMonthlyDrugConsumptionStatistics(@Param("dataStr") String dataStr, @Param("departIds") List<String> departIds);
/**
* 天出水量统计
*
* @return
*/
Integer selectShByDay(@Param("date") String date, @Param("departIds") List<String> departIds);
/**
......
......@@ -230,144 +230,8 @@
select metric_name from sys_monitor_metric_info
where id=#{id}
</select>
<select id="selectMonthlyPowerConsumption" resultType="com.skua.modules.equipment.dto.ConsumptionDto">
SELECT
dateStr AS TIME,
sum( dh ) AS dh,
FORMAT(
sum( dh )/ sum( csl ),2) AS dsdh
FROM
(
SELECT
v.item_value AS dh,
DATE_FORMAT( v.data_time, '%Y-%m' ) AS dateStr,
0 AS csl
FROM
f_report_item i
LEFT JOIN f_report_itemv v ON i.id = v.reit_id
WHERE
i.report_id = '07079703413c58fd96d79298f23af854'
AND i.item_code = 'dhkwh64bc'
and v.depart_id in
<foreach collection="departIds" item="departId" open="(" separator="," close=")">
#{departId}
</foreach>
AND DATE_FORMAT( v.data_time, '%Y-%m' ) = #{dataStr} UNION ALL
SELECT
0 AS dh,
DATE_FORMAT( v.data_time, '%Y-%m' ) AS dateStr,
v.item_value AS csl
FROM
f_report_item i
LEFT JOIN f_report_itemv v ON i.id = v.reit_id
WHERE
i.report_id = '2044b09220b8413eeda84ce4c861305b'
AND i.item_code = 'csl50c'
and v.depart_id in
<foreach collection="departIds" item="departId" open="(" separator="," close=")">
#{departId}
</foreach>
AND DATE_FORMAT( v.data_time, '%Y-%m' ) = #{dataStr}
) AS d
GROUP BY
dateStr
</select>
<select id="selectMonthlyDrugConsumptionStatistics"
resultType="com.skua.modules.equipment.dto.DrugConsumptionDto">
SELECT dateStr AS TIME,
sum(yh) AS yh,
FORMAT(
sum(yh) / sum(csl),2) AS dsyh
FROM (SELECT DATE_FORMAT(v.data_time, '%Y-%m') as dateStr,
v.item_value AS yh,
0 AS csl
FROM f_report_item i
LEFT JOIN f_report_itemv v ON i.id = v.reit_id
WHERE i.report_id = '07079703413c58fd96d79298f23af854'
AND i.item_code IN (
'lsytgtxhldc44',
'lsytytxhlda760',
'sysytxhld95e',
'pamylzgtxhldb77',
'pamylzgtxhldb0f',
'fmhxtgtxhldc0',
'klhxtgtxhldfc1d',
'jhlytxhld4f41',
'jhlgtxhld17d',
'lygtxhldf2d5',
'fhtyytxhld55ce',
'fhtygtxhld046f',
'pttgtxhlda01c',
'pttytxhldea55',
'clsnnacloytxhld09ea',
'qljgtxhldf9e1',
'yyytxhld84d',
'gyygtxhlde2ca',
'nmsytxhld245a',
'zgjytxhld49a5',
'qyhnnaohgtxhld2fde',
'qyhnnaohytxhld8bae',
'tsnna2cogtxhld6e21',
'jhlstytxhld29d8',
'nlsytxhld6dff',
'xpjgtxhldc22',
'cfjytxhlda2a1',
'hyjnahsogtxhlde7e',
'fyhsjjytxhld959',
'chjcyyxhldbcd6',
'jzytxhldea44',
'mzyqxjytxhld52f',
'lsqengtxhlde976',
'edta4nagtxhld06e2',
'qthxyj1xhldf66f',
'qthxyj2xhld2f0a',
'qthxyjxhldb97b',
'qthxyj4xhld2645',
'qthxyj5xhldaf94',
'qthxyj6xhld2152'
)
AND v.depart_id in
<foreach collection="departIds" item="departId" open="(" separator="," close=")">
#{departId}
</foreach>
AND DATE_FORMAT(v.data_time, '%Y-%m') = #{dataStr}
UNION ALL
SELECT DATE_FORMAT(v.data_time, '%Y-%m') as dateStr,
0 AS yh,
v.item_value AS csl
FROM f_report_item i
LEFT JOIN f_report_itemv v ON i.id = v.reit_id
WHERE i.report_id = '2044b09220b8413eeda84ce4c861305b'
AND i.item_code = 'csl50c'
AND v.depart_id in
<foreach collection="departIds" item="departId" open="(" separator="," close=")">
#{departId}
</foreach>
AND DATE_FORMAT(v.data_time, '%Y-%m') = #{dataStr}) d
GROUP BY dateStr
</select>
<select id="selectShByDay" resultType="java.lang.Integer">
SELECT sum(b.item_value)
FROM (SELECT v.item_value,
DATE_FORMAT(v.data_time, '%Y-%m-%d') AS dateStr
FROM f_report_item i
LEFT JOIN f_report_itemv v ON i.id = v.reit_id
WHERE-- 今日出水
i.report_id = '2044b09220b8413eeda84ce4c861305b'
AND i.item_code = 'csl50c'
AND v.depart_id in
<foreach collection="departIds" item="departId" open="(" separator="," close=")">
#{departId}
</foreach>
AND DATE_FORMAT(v.data_time, '%Y-%m-%d') = #{date}) AS b
GROUP BY dateStr
</select>
<select id="selectCountAlarmByYearForDay" resultType="com.skua.modules.equipment.dto.AlarmCountDto">
select count(1),
DATE_FORMAT(create_time, '%Y-%m-%d') as dateStr
......@@ -416,9 +280,9 @@
</select>
<select id="selectClslByMonths" resultType="java.util.HashMap">
select sum(item_value) as v,DATE_FORMAT(data_time, '%Y-%m') as time from f_report_itemv a
select round(sum(item_value),2) as v,DATE_FORMAT(data_time, '%Y-%m') as time from f_report_itemv a
left join f_report_item b on b.id=a.reit_id
where b.item_code='csl503c'
where b.item_code='CSL'
and a.depart_id = #{factoryId}
<if test="list!=null and list.size>0">
and DATE_FORMAT(data_time, '%Y-%m') in
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!