0d8961ee 张雷

运营问题修改

1 个父辈 d1431d0a
......@@ -26,4 +26,7 @@ public interface FactoryOperateCenterMapper {
List<Map<String, String>> getReportCount(@Param("departId") String departId, @Param("month") String month,
@Param("reportName") String reportName);
Map<String, Object> getSdyData(@Param("view2119") String view2119, @Param("view3a24") String view3a24,
@Param("departId") String departId, @Param("dateTime") String dateTime);
}
......
......@@ -128,4 +128,21 @@
depart_id = #{departId}
AND time LIKE CONCAT(#{month},'%')
</select>
<select id="getSdyData" resultType="java.util.HashMap">
select
ROUND(SUM(v.CSL)/10000,2) AS CLSL,
v3.DLHJ,
v3.YJHJ
from ${view2119} v
LEFT JOIN (select ROUND(SUM(v.DLHJ),2) AS DLHJ,ROUND(SUM(IFNULL(v.PAMRJ,0)+
IFNULL(v.SCLPAMZ,0)+IFNULL(v.SCLPAMF,0)+IFNULL(v.NACLO,0)+IFNULL(v.PACGT,0)+
IFNULL(v.PACYT,0)+IFNULL(v.PFS,0)+IFNULL(v.FHTY,0)+IFNULL(v.RYXNJ,0)+IFNULL(v.YWL,0)+
IFNULL(v.GXCLJ,0)+IFNULL(v.CH3COONA,0)+IFNULL(v.HXT,0)+IFNULL(v.FECL3,0)+IFNULL(v.SH,0)+
IFNULL(v.CH3COOH,0)+IFNULL(v.FESO4G,0)+IFNULL(v.FESO4Y,0)+IFNULL(v.H2O2,0)),2) AS YJHJ,
v.depart_id,v.time
from ${view3a24} v where v.depart_id = #{departId} and v.time like CONCAT(#{dateTime},'%')) v3
ON v.depart_id = v3.depart_id
where v.depart_id = #{departId} and v.time like CONCAT(#{dateTime},'%')
</select>
</mapper>
......
package com.skua.modules.dataAnalysis.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.core.util.DoubleOperaUtils;
......@@ -9,9 +10,13 @@ import com.skua.modules.dataAnalysis.vo.ArchivesWarnVO;
import com.skua.modules.dataAnalysis.vo.EquipAlarmVO;
import com.skua.modules.dataAnalysis.vo.EquipRunTimeVO;
import com.skua.modules.dataAnalysis.vo.EquipWarnVO;
import com.skua.modules.report.entity.ReportTargetConfig;
import com.skua.modules.report.mapper.ReportTargetConfigMapper;
import com.skua.tool.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -22,19 +27,60 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
@Resource
private FactoryOperateCenterMapper factoryOperateCenterMapper;
@Resource
private ReportTargetConfigMapper reportTargetMapper;
@Override
public Map<String, Object> getData(String departId, String month) {
DecimalFormat df = new DecimalFormat("#.##");
String tbMonth = DateUtils.getTbMonth(month);
String hbMonth = DateUtils.getHbMonth(month);
String year = month.substring(0,4);
String tbYear = String.valueOf(Integer.parseInt(year) - 1);
//目标
double yearClslMb = 0.00;double yearDlhjMb = 0.00;double yearYjhjMb = 0.00;
double yearTbClslMb = 0.00;double yearTbDlhjMb = 0.00;double yearTbYjhjMb = 0.00;
//实际
double yearClsl = 0.00;double yearDlhj = 0.00;double yearYjhj = 0.00;
double yearTbClsl = 0.00;double yearTbDlhj = 0.00;double yearTbYjhj = 0.00;
double monthClsl = 0.00;double monthDlhj = 0.00;double monthYjhj = 0.00;
double monthTbClsl = 0.00;double monthTbDlhj = 0.00;double monthTbYjhj = 0.00;
double monthHbClsl = 0.00;double monthHbDlhj = 0.00;double monthHbYjhj = 0.00;
LambdaQueryWrapper<ReportTargetConfig> queryWrapper = new LambdaQueryWrapper<ReportTargetConfig>();
queryWrapper.eq(ReportTargetConfig::getDepartId,departId);
queryWrapper.eq(ReportTargetConfig::getTargetYear,year);
List<ReportTargetConfig> yearTargetList = reportTargetMapper.selectList(queryWrapper);
if(yearTargetList.size() > 0){
ReportTargetConfig target = yearTargetList.get(0);
if(target.getTargetWater()!=null){
yearClslMb = Double.parseDouble(target.getTargetWater());
}
if(target.getTargetPower()!=null){
yearDlhjMb = Double.parseDouble(target.getTargetPower());
}
if(target.getTargetDrug()!=null){
yearYjhjMb = Double.parseDouble(target.getTargetDrug());
}
}
queryWrapper.eq(ReportTargetConfig::getTargetYear,tbYear);
List<ReportTargetConfig> yearTbTargetList = reportTargetMapper.selectList(queryWrapper);
if(yearTbTargetList.size() > 0){
ReportTargetConfig target = yearTbTargetList.get(0);
if(target.getTargetWater()!=null){
yearTbClslMb = Double.parseDouble(target.getTargetWater());
}
if(target.getTargetPower()!=null){
yearTbDlhjMb = Double.parseDouble(target.getTargetPower());
}
if(target.getTargetDrug()!=null){
yearTbYjhjMb = Double.parseDouble(target.getTargetDrug());
}
}
String dataViewName2119Year = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, year);
String dataViewName2119YearTb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, tbYear);
String dataViewName2119Month = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, month);
String dataViewName2119MonthTb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, tbMonth);
String dataViewName2119MonthHb = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, hbMonth);
String field3a24 = "DLHJ,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
"YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2";
String dataViewName3a24Year = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, year);
......@@ -42,41 +88,101 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
String dataViewName3a24Month = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, month);
String dataViewName3a24MonthTb = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, tbMonth);
String dataViewName3a24MonthHb = ReportViewUtil.buildViewLike(ReportConstant.view3a24,field3a24, departId, hbMonth);
//CLSL,DLHJ,YJHJ
Map<String,Object> yearMap = factoryOperateCenterMapper.getSdyData(dataViewName2119Year, dataViewName3a24Year, departId, year);
if(yearMap != null){
if(yearMap.get("CLSL") != null){
yearClsl = Double.parseDouble(yearMap.get("CLSL").toString());
}
if(yearMap.get("DLHJ") != null){
yearDlhj = Double.parseDouble(yearMap.get("DLHJ").toString());
}
if(yearMap.get("YJHJ") != null){
yearYjhj = Double.parseDouble(yearMap.get("YJHJ").toString());
}
}
Map<String,Object> yearTbMap = factoryOperateCenterMapper.getSdyData(dataViewName2119YearTb, dataViewName3a24YearTb, departId, tbYear);
if(yearTbMap != null){
if(yearTbMap.get("CLSL") != null){
yearTbClsl = Double.parseDouble(yearTbMap.get("CLSL").toString());
}
if(yearMap.get("DLHJ") != null){
yearTbDlhj = Double.parseDouble(yearTbMap.get("DLHJ").toString());
}
if(yearMap.get("YJHJ") != null){
yearTbYjhj = Double.parseDouble(yearTbMap.get("YJHJ").toString());
}
}
Map<String,Object> monthMap = factoryOperateCenterMapper.getSdyData(dataViewName2119Month, dataViewName3a24Month, departId, month);
if(monthMap != null){
if(yearMap.get("CLSL") != null){
monthClsl = Double.parseDouble(monthMap.get("CLSL").toString());
}
if(monthMap.get("DLHJ") != null){
monthDlhj = Double.parseDouble(monthMap.get("DLHJ").toString());
}
if(monthMap.get("YJHJ") != null){
monthYjhj = Double.parseDouble(monthMap.get("YJHJ").toString());
}
}
Map<String,Object> monthTbMap = factoryOperateCenterMapper.getSdyData(dataViewName2119MonthTb, dataViewName3a24MonthTb, departId, tbMonth);
if(monthTbMap != null){
if(monthTbMap.get("CLSL") != null){
monthTbClsl = Double.parseDouble(monthTbMap.get("CLSL").toString());
}
if(monthTbMap.get("DLHJ") != null){
monthTbDlhj = Double.parseDouble(monthTbMap.get("DLHJ").toString());
}
if(monthTbMap.get("YJHJ") != null){
monthTbYjhj = Double.parseDouble(monthTbMap.get("YJHJ").toString());
}
}
Map<String,Object> monthHbMap = factoryOperateCenterMapper.getSdyData(dataViewName2119MonthHb, dataViewName3a24MonthHb, departId, hbMonth);
if(monthHbMap != null){
if(monthHbMap.get("CLSL") != null){
monthHbClsl = Double.parseDouble(monthHbMap.get("CLSL").toString());
}
if(monthHbMap.get("DLHJ") != null){
monthHbDlhj = Double.parseDouble(monthHbMap.get("DLHJ").toString());
}
if(monthHbMap.get("YJHJ") != null){
monthHbYjhj = Double.parseDouble(monthHbMap.get("YJHJ").toString());
}
}
Map<String, Object> map = new HashMap<>();
map.put("nclsl",new HashMap<>());
Map<String, Object> nclslMap = new HashMap<>();
nclslMap.put("nsjsl","1267");
nclslMap.put("wcbfb","80");
nclslMap.put("nmb","1678");
nclslMap.put("nmbTb","1");
nclslMap.put("nwcd","1234");
nclslMap.put("nwcdTb","3");
nclslMap.put("nsjsl", yearClsl);
nclslMap.put("wcbfb", df.format(100*yearClsl/yearClslMb));
nclslMap.put("nmb", yearClslMb);
nclslMap.put("nmbTb", df.format((yearClslMb-yearTbClslMb)/yearClslMb));
nclslMap.put("nwcd", df.format(100*yearClsl/yearClslMb));
nclslMap.put("nwcdTb", "1");
map.put("yclsl",new HashMap<>());
Map<String, Object> yclslMap = new HashMap<>();
yclslMap.put("ysjsl","185");
yclslMap.put("wcbfb","80");
yclslMap.put("ymb","161");
yclslMap.put("ymbTb","5");
yclslMap.put("ywcd","161");
yclslMap.put("ywcdTb","2");
yclslMap.put("ysjsl", monthClsl);
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)));
yclslMap.put("ywcdTb", "0");
map.put("ndsdh",new HashMap<>());
Map<String, Object> ndsdhMap = new HashMap<>();
ndsdhMap.put("ndsdh","0.5");
ndsdhMap.put("nmb","0.45");
ndsdhMap.put("nmbTb","1");
ndsdhMap.put("ydsdh","0.32");
ndsdhMap.put("ydsdhTb","0");
ndsdhMap.put("ndsdh", df.format(yearDlhj/(10000*yearClsl)));
ndsdhMap.put("nmb", yearDlhjMb);
ndsdhMap.put("nmbTb", yearTbDlhjMb);
ndsdhMap.put("ydsdh", "0.32");
ndsdhMap.put("ydsdhTb", "0");
map.put("ndsyf",new HashMap<>());
Map<String, Object> ndsyfMap = new HashMap<>();
ndsyfMap.put("ndsyf","0.8");
ndsyfMap.put("nmb","0.65");
ndsyfMap.put("nmbTb","2");
ndsyfMap.put("ndsyf", df.format(yearYjhj/(10000*yearClsl)));
ndsyfMap.put("nmb", yearYjhjMb);
ndsyfMap.put("nmbTb", yearTbYjhjMb);
ndsyfMap.put("ydsyf","0.68");
ndsyfMap.put("ydsyfTb","1");
ndsyfMap.put("ydsyfTb","0");
map.put("zhpf",new HashMap<>());
Map<String, Object> zhpfMap = new HashMap<>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!