8eff13c1 康伟

kangwei: 修改吨水电耗公式

1 个父辈 e6ec9091
......@@ -43,6 +43,10 @@ public class ReportItemVO {
@ApiModelProperty(value = "吨水消耗")
private String dsValue;
@ApiModelProperty(value = "吨水产泥量")
private String dscnl;
/* @ApiModelProperty(value = "环比差值")
private String valueHbDifference;
@ApiModelProperty(value = "单位")
......
......@@ -2,10 +2,10 @@ package com.skua.modules.algorithm.service.impl;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.common.report.vo.ReportItemVO;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.algorithm.vo.DepartLoadRateResultVO;
import com.skua.modules.algorithm.vo.ReportItemVO;
import com.skua.modules.algorithm.vo.WaterTreatmentVO;
import com.skua.modules.common.vo.DateVO;
import com.skua.modules.quartz.util.BaseUtil;
......@@ -83,27 +83,30 @@ public class ReportItemvService {
public List<FRportlCommandCenterVO> statisticsByElectricity(String departId, String startTime, String endTime) {
List<FRportlCommandCenterVO> fRportlCommandCenterVOList = new ArrayList<>();
DateVO dateVO = new DateVO(startTime);
String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departId, startTime,endTime);
String sql = "select ROUND( SUM( IFNULL(aaa.DLHJ,0) ), 2 ) AS DLHJ from " + dataViewName3a24+ "aaa";
// String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departId, startTime,endTime);
// String sql = "select ROUND( SUM( IFNULL(aaa.DLHJ,0) ), 2 ) AS DLHJ from " + dataViewName3a24+ "aaa";
String nowMonthValue = getSumDLHJ(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
String lastMonthValue = getSumDLHJ(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
String lastYearValue = getSumDLHJ(departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
ReportItemVO dlhjData = ReportViewUtil.getSumValueByTBHB(ReportConstant.view3a24, "DLHJ", departId, startTime, endTime);
String nowMonthCSL = getSumCSL(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
String lastMonthCSL = getSumCSL(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
String lastYearCSL = getSumCSL(departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
long nowDifferDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
long lastMonthDifferDay = DateUtils.differenceDay(dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
String dlhj_avg_value = getAvgDLHJ(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
String dlhj_avg_valueHB = getAvgDLHJ(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
String dlhj_avg_valueTB = getAvgDLHJ(departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
String csl_avg_value = getSumCSL(departId,dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
String csl_avg_valueHB = getSumCSL(departId, dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
String csl_avg_valueTB = getSumCSL(departId, dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
// long nowDifferDay = DateUtils.differenceDay(dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
// long lastMonthDifferDay = DateUtils.differenceDay(dateVO.getLastMonthStartTime(),dateVO.getLastMonthEndTime());
// long lastYearDifferDay = DateUtils.differenceDay(dateVO.getLastYearMonthStartTime(),dateVO.getLastYearMonthEndTime());
//当月数据/环比、同比
FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗(", JSUtils.divide(nowMonthValue,10000), JSUtils.divide(lastMonthValue,10000), JSUtils.divide(lastYearValue,10000));
FRportlCommandCenterVO nowMonthVO = new FRportlCommandCenterVO("月总电耗(", JSUtils.divide(dlhjData.getValue(),10000), JSUtils.divide(dlhjData.getValueHb(),10000), JSUtils.divide(dlhjData.getValueTb(),10000));
//日均数据:/环比/同比
FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均电耗",JSUtils.divide( nowMonthValue ,nowDifferDay*10000 ) ,JSUtils.divide( lastMonthValue ,lastMonthDifferDay*10000 ),JSUtils.divide( lastYearValue ,lastYearDifferDay*10000 ) );
FRportlCommandCenterVO lastMonthVO = new FRportlCommandCenterVO("日均电耗",dlhj_avg_value ,dlhj_avg_valueHB,dlhj_avg_valueTB );
//吨水消耗
FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗",JSUtils.divide( nowMonthValue ,nowMonthCSL ) ,JSUtils.divide( lastMonthValue ,lastMonthCSL ),JSUtils.divide( lastYearValue ,lastYearCSL ));
FRportlCommandCenterVO lastYearVo = new FRportlCommandCenterVO("吨水电耗",JSUtils.divide( dlhj_avg_value ,csl_avg_value ) ,JSUtils.divide( dlhj_avg_valueHB ,csl_avg_valueHB ),JSUtils.divide( dlhj_avg_valueTB ,csl_avg_valueTB ));
fRportlCommandCenterVOList.add( nowMonthVO) ;
fRportlCommandCenterVOList.add( lastMonthVO) ;
fRportlCommandCenterVOList.add( lastYearVo) ;
......@@ -275,13 +278,28 @@ public class ReportItemvService {
String csl = getJdbcTemplate().queryForObject(sql,String.class);
return ConvertUtils.getString(csl,"0.00");
}
public String getAvgCSL(String departId ,String startTime ,String endTime){
String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, startTime,endTime);
String sql = "select ROUND( avg( IFNULL( aaa.CSL,0) ),2) from " + dataViewName2119+ " aaa where ifnull(aaa.CSL,0)> 0";
String csl = getJdbcTemplate().queryForObject(sql,String.class);
return ConvertUtils.getString(csl,"0.00");
}
public String getSumDLHJ(String departId ,String startTime ,String endTime){
String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departId, startTime,endTime);
String sql = "select ROUND( sum( IFNULL( aaa.DLHJ,0) ),2) from " + dataViewName3a24+ "aaa";
String dlhj = getJdbcTemplate().queryForObject(sql,String.class);
return ConvertUtils.getString(dlhj,"0.00");
}
public String getAvgDLHJ(String departId ,String startTime ,String endTime){
String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departId, startTime,endTime);
String sql = "select ROUND( avg( IFNULL( aaa.DLHJ,0) ),2) from " + dataViewName3a24+ " aaa where ifnull(aaa.DLHJ,0)> 0 ";
String dlhj = getJdbcTemplate().queryForObject(sql,String.class);
return ConvertUtils.getString(dlhj,"0.00");
}
public String getSumValue(String viewName,String fileds,String departId ,String startTime ,String endTime){
String dataViewName3a24 = ReportViewUtil.buildViewLike(viewName,fileds, departId, startTime,endTime);
String sql = "select ROUND(sum( IFNULL( aaa."+fileds+",0)),2) from " + dataViewName3a24+ "aaa";
......
package com.skua.modules.dataAnalysis.controller;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.vo.ReportItemVO;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
......@@ -9,7 +8,6 @@ import com.skua.core.util.ConvertUtils;
import com.skua.modules.dataAnalysis.service.ICommandCentreService;
import com.skua.modules.algorithm.service.impl.ReportItemvService;
import com.skua.modules.algorithm.vo.DepartLoadRateResultVO;
import com.skua.modules.algorithm.vo.ReportItemVO;
import com.skua.modules.algorithm.vo.StackedAreaChartDataVO;
import com.skua.modules.algorithm.vo.WaterTreatmentVO;
import com.skua.modules.common.vo.DateVO;
......
......@@ -137,6 +137,7 @@ public class UserPaperController {
try {
userPaperVO.setEndTime(DateUtils.now());
userPaperVO.setUserId(BaseContextHandler.getUserId());//考试人编号
userPaperVO.setDepartId(BaseContextHandler.getRealDepartId());
paperScore = paperService.submitPaper(userPaperVO);
userPaperVO.setScore( paperScore );
......
......@@ -25,7 +25,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@Accessors(chain = true)
@ApiModel(value="edu_user_paper对象", description="在线考试")
public class UserPaper {
/**主键*/
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "主键")
......@@ -75,4 +75,12 @@ public class UserPaper {
this.endTime = endTime;
this.signature = signature;
}
public UserPaper(String paperId, String departId,String userId, String startTime, String endTime,String signature) {
this.paperId = paperId;
this.departId = departId;
this.userId = userId;
this.startTime = startTime;
this.endTime = endTime;
this.signature = signature;
}
}
......
......@@ -202,7 +202,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
Paper paper = paperMapper.selectById( paperVO.getPaperId() ) ;
//创建用户答题记录
// public UserPaper(String paperId, String departId, String userId, String startTime, String endTime) {
UserPaper userPaper = new UserPaper(paperVO.getPaperId(), paperVO.getUserId(),paperVO.getStartTime(),paperVO.getEndTime(), paperVO.getSignature());
UserPaper userPaper = new UserPaper(paperVO.getPaperId(), paperVO.getDepartId(),paperVO.getUserId(),paperVO.getStartTime(),paperVO.getEndTime(), paperVO.getSignature());
userPaperMapper.insert( userPaper );
//答题卡详情
String score = "0";
......
......@@ -19,6 +19,8 @@ public class UserPaperVO {
private String paperId;
@ApiModelProperty(value = "参加考试人员")
private String userId;
@ApiModelProperty(value = "所属厂站")
private String departId;
@ApiModelProperty(value = "考试开始时间")
private String startTime;
......
......@@ -121,10 +121,10 @@ public class EquipmentController {
if(equipmentInfo.getDepartId()==null){
equipmentInfo.setDepartId(BaseContextHandler.getDeparts());
}
/* if(model==1){
queryWrapper.isNotNull("is_model");
queryWrapper.last(" and is_model != ''");
}*/
if(model==1){
queryWrapper.isNotNull("digital_twins_struct_code");
queryWrapper.last(" and digital_twins_struct_code != ''");
}
queryWrapper.orderByDesc("create_time");
List<EquipmentInfo> dataList = equipmentInfoService.list(queryWrapper);
result.setSuccess(true);
......
......@@ -290,4 +290,7 @@ public class EquipmentInfo {
@ApiModelProperty(value = "企业负责人")
private String enterpriseManager;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!