72eb82e2 张雷

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

2 个父辈 7290d1b5 79358c7d
......@@ -86,7 +86,7 @@ public final class ChineseInital {
}
public static void main(String[] args) {
System.out.println("获取拼音首字母:"+getAllFirstLetter("1大中国南昌中大china"));
System.out.println("获取拼音首字母:"+getAllFirstLetter("1-1#进水提升泵"));
}
}
......
......@@ -28,6 +28,8 @@ public class JTDisplayScreenController {
public Result<List<SysFactoryInfoVO>> factoryList() {
Result<List<SysFactoryInfoVO>> result = new Result<>();
List<SysFactoryInfoVO> list = displayScreenService.getFactoryList();
result.setResult(list);
return result;
}
......
......@@ -55,7 +55,7 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService {
List<Map<String, Object>> dataList = masterDB.queryForList(factorySql);
for(Map<String, Object> dataMap : dataList) {
// resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
factoryInfoVO = new SysFactoryInfoVO(dataMap.get("id")+"",dataMap.get("depart_id").toString(),dataMap.get("depart_name").toString(),dataMap.get("pro_longitude").toString(),dataMap.get("pro_latitude").toString());
factoryInfoVO = new SysFactoryInfoVO(dataMap.get("id")+"",dataMap.get("depart_id").toString(),dataMap.get("depart_name").toString(),dataMap.get("pro_longitude").toString(),dataMap.get("pro_latitude").toString(),1);
factoryInfoMap.put(factoryInfoVO.getDepartId(),factoryInfoVO);
}
//查询部门集合
......@@ -89,9 +89,19 @@ public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService {
}
// resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
}
factoryInfoVOList = new ArrayList(factoryInfoMap.values());
// 添加:中冶数据
factorySql = "select fi.id,fi.depart_id,d.depart_name, fi.pro_longitude,fi.pro_latitude ,d.depart_type from sys_factory_info fi ,sys_depart d where fi.depart_id = d.id and d.depart_type =-1";
List<SysFactoryInfoVO> factroyList = masterDB.query(factorySql, new BeanPropertyRowMapper<SysFactoryInfoVO>(SysFactoryInfoVO.class));
if(factroyList != null ){
factoryInfoVOList.addAll(factroyList);
}
return factoryInfoVOList;
}
/**
* 项目运营情况
* @param departId
......
......@@ -17,6 +17,9 @@ public class SysFactoryInfoVO {
@ApiModelProperty(value = "水厂名称")
private String departId;
@ApiModelProperty(value = "厂站类型")
private Integer departType = 1;
@ApiModelProperty(value = "水厂名称")
private String departName;
......@@ -42,11 +45,12 @@ public class SysFactoryInfoVO {
public SysFactoryInfoVO() {
}
public SysFactoryInfoVO(String id, String departId, String departName, String proLongitude, String proLatitude) {
public SysFactoryInfoVO(String id, String departId, String departName, String proLongitude, String proLatitude,Integer departType) {
this.id = id;
this.departId = departId;
this.departName = departName;
this.proLongitude = proLongitude;
this.proLatitude = proLatitude;
this.departType = departType;
}
}
......
......@@ -11,16 +11,6 @@ import java.util.List;
*/
public interface OperationReportMapper {
/***
* 查询月度生产数据报表
* @param startTime
* @param endTime
* @param lastStartTime
* @param lastEndTime
* @return
*/
List<FReportMonthDataVO> queryReportMonthData(@Param("startTime") String startTime,@Param("endTime") String endTime, @Param("lastStartTime")String lastStartTime,@Param("lastEndTime") String lastEndTime) ;
/***
* 查询隐含排查部门名称
* @return
*/
......
......@@ -2,60 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.report.mapper.OperationReportMapper">
<!-- -->
<select id="queryReportMonthData" resultType="com.skua.modules.report.vo.FReportMonthDataVO">
SELECT
a.depart_id,tc.target_water,tc. target_power,tc.target_drug,
(select t.depart_name from sys_depart t where t.id = a.depart_id ) 'depart_name',
(
select sum(fiv.item_value)/10000 from f_report_itemv fiv ,f_report_item fi
where fi.report_id = '2119ecbf53a1d2d0708258ff67cfd9e1' and item_code= 'CSL' and fiv.reit_id =fi.id and a.depart_id = fiv.depart_id and fiv.data_time like '2024%'
) 'ysjsl',
(
select sum(fiv.item_value)/10000 from f_report_itemv fiv ,f_report_item fi
where fi.report_id = '2119ecbf53a1d2d0708258ff67cfd9e1' and item_code= 'CSL' and fiv.reit_id =fi.id and a.depart_id = fiv.depart_id and fiv.data_time like '2023%'
) 'tqysjsl',
(select sum(fiv.item_value)/10000 from f_report_itemv fiv ,f_report_item fi
where fi.report_id = '3a243d5715b9e1a3753c180872ca0df9' and item_code= 'DLHJ' and fiv.reit_id =fi.id and a.depart_id = fiv.depart_id and fiv.data_time like '2024%' ) 'ydh',
sum( IF ( ( `d`.`item_code` = 'yslwcbl' ), `a`.`item_value`, NULL ) ) AS `yslwcbl`, -- 月水量完成比例
sum( IF ( ( `d`.`item_code` = 'ysjsldyqntqyy' ), `a`.`item_value`, NULL ) ) AS `ysjsldyqntqyy`, -- 月实际水量低于去年同期原因
sum( IF ( ( `d`.`item_code` = 'qntqsfsl' ), `a`.`item_value`, NULL ) ) AS `qntqsfsl`, -- 去年同期收费水量
sum( IF ( ( `d`.`item_code` = 'ysfsl' ), `a`.`item_value`, NULL ) ) AS `ysfsl`, -- 月收费水量
sum( IF ( ( `d`.`item_code` = 'bnsjdh' ), `a`.`item_value`, NULL ) ) AS `bnsjdh`,-- 本年实际电耗
sum( IF ( ( `d`.`item_code` = 'sldyyqyy' ), `a`.`item_value`, NULL ) ) AS `sldyyqyy`,-- 收费水量对比变化率
sum( IF ( ( `d`.`item_code` = 'dhgyqntqyy' ), `a`.`item_value`, NULL ) ) AS `dhgyqntqyy`, -- 电耗高于去年同期原因
sum( IF ( ( `d`.`item_code` = 'yyf' ), `a`.`item_value`, NULL ) ) AS `yyf`, -- 月药费
sum( IF ( ( `d`.`item_code` = 'yhgyqntqyy' ), `a`.`item_value`, NULL ) ) AS `yhgyqntqyy`, -- 药耗高于去年同期原因
sum( IF ( ( `d`.`item_code` = 'dhcmbzyy' ), `a`.`item_value`, NULL ) ) AS `dhcmbzyy`, -- 电耗超目标值原因
sum( IF ( ( `d`.`item_code` = 'yhcyqyy' ), `a`.`item_value`, NULL ) ) AS `yhcyqyy` -- 药耗超预期原因
FROM
( (SELECT reit_id,item_value,depart_id
FROM f_report_itemv
WHERE
data_time LIKE '2024%'
AND reit_id IN (
'1818936216687595521',
'1818936217375461377',
'1818936218109464577',
'1818936218910576642',
'1818936219120291842',
'1818936219854295042',
'1818936220017872897',
'1818936220353417218',
'1818936220571521025',
'1818936220739293185',
'1818936220890288130' )
) `a`
LEFT JOIN `f_report_item` `d` ON ( ( `a`.`reit_id` = `d`.`id` ) )
LEFT JOIN `report_target_config` tc ON ( ( `tc`.`depart_id` = `a`.`depart_id` ) )
)
WHERE
1 = 1
GROUP BY
`a`.`depart_id`
</select>
<select id="queryDepatNameList" resultType="java.lang.String">
select d.depart_name from ajh_rectification_info t
left join sys_depart d on t.depart_id = d.id
......
......@@ -8,12 +8,6 @@ import com.skua.modules.report.vo.ProductDataVO;
*/
public interface IOperationReportService {
/***
* 执行查询sql语句返回一个结果
* @param sql
* @return
*/
String queryForString(String sql );
/***
* 处理月季度数据
......
package com.skua.modules.report.service.impl;
import com.skua.common.report.ReportViewUtil;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.report.mapper.OperationReportMapper;
import com.skua.modules.report.service.IOperationReportService;
import com.skua.modules.report.vo.*;
import com.skua.tool.util.DateUtils;
import com.skua.tool.util.DigitalUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
......@@ -16,6 +20,7 @@ import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
/***
* 运营周报
......@@ -25,6 +30,15 @@ public class OperationReportServiceImpl implements IOperationReportService {
@Resource
private OperationReportMapper operationReportMapper;
String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";// 水 COD TP TN NH3H
String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";//能耗报表
String view4411 = "4411ed3d78634bcdcd700f6e33724025";
private JdbcTemplate getJdbcTemplate(){
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
return masterDB;
}
/***
* 处理月季度数据
* @param year
......@@ -37,23 +51,106 @@ public class OperationReportServiceImpl implements IOperationReportService {
productDataVO.setLastYear(lastYear);
SeasonTimeVO seasonTimeVO = new SeasonTimeVO(year ,season );
SeasonTimeVO lastSeasonTimeVO = new SeasonTimeVO(lastYear ,season );
productDataVO.setStartTime(seasonTimeVO.getStartTime());
productDataVO.setEndTime( seasonTimeVO.getEndTime());
productDataVO.setSeansonEndDay(seasonTimeVO.getEndTime());//季度最后一天
productDataVO.setStartTime(seasonTimeVO.getStartTime());//季度开始时间
productDataVO.setEndTime( seasonTimeVO.getEndTime());//季度结束时间
//水务公司总数
String sql = "select count(1) from sys_depart where depart_type = 1";
String deptartCount = queryForString(sql);
String deptartCount = getJdbcTemplate().queryForObject(sql,String.class);
productDataVO.setDeptartCount( deptartCount );
List<FReportMonthDataVO> reportMonthDataVOList = operationReportMapper.queryReportMonthData(seasonTimeVO.getStartTime() ,seasonTimeVO.getEndTime() , lastSeasonTimeVO.getStartTime(),lastSeasonTimeVO.getEndTime());
//处理月报生成数据
handeReportMonthData(productDataVO,reportMonthDataVOList,seasonTimeVO.getDisparityDay());
productDataVO.setSeansonEndDay(seasonTimeVO.getEndTime());//季度最后一天
//生产指标完成情况--收费水量
//DLHJ 电量合计 ,ydh 用电量 ,yslwcbl 月水量完成比例,ysjsldyqntqyy 月实际水量低于去年同期原因,qntqsfsl 去年同期收费水量, ysfsl`,月收费水量 `bnsjdh`, 本年实际电耗 sldyyqyy`, 收费水量对比变化率 ,`dhgyqntqyy`, 电耗高于去年同期原因;`yyf`, 月药费 `yhgyqntqyy`, 药耗高于去年同期原因 `dhcmbzyy`, 电耗超目标值原因 `yhcyqyy` 药耗超预期原因
// 电量合计 , 用电量 , 月水量完成比例, 月实际水量低于去年同期原因, 去年同期收费水量, `,月收费水量 ``, 本年实际电耗 `, 收费水量对比变化率 ,``, 电耗高于去年同期原因;``, 月药费 ``, 药耗高于去年同期原因 ``, 电耗超目标值原因 `` 药耗超预期原因
//String fields = "DLHJ,ydh,yslwcbl,ysjsldyqntqyy,qntqsfsl,ysfsl,bnsjdh,sldyyqyy,dhgyqntqyy,yyf,yhgyqntqyy,dhcmbzyy,yhcyqyy";
// fields = "DLHJ,YDH,YSLWCBL,YSJSLDYQNTQYY,QNTQSFSL,YSFSL,BNSJDH,SLDYYQYY,DHGYQNTQYY,YYF,YHGYQNTQYY,DHCMBZYY,YHCYQYY";
// fields = fields.toUpperCase();
String departId = null;
// ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量
String dataViewName4411 = ReportViewUtil.buildViewLike(view4411,"ysfsl,ysjsl,yyf", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime());
sql = "select sum( aaa.ysfsl ) 'ysfsl' , sum( aaa.ysjsl ) 'ysjsl' , sum(tc.target_water ) 'target_water', sum(tc.target_drug ) 'target_drug' ,round((sum( aaa.ysfsl ) *100 / sum(tc.target_water )),2) as 'completeRatio' from "+dataViewName4411+" aaa";
sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year = '"+year+"')";
List<Map<String, Object>> mapList = getJdbcTemplate().queryForList(sql);
productDataVO.setDayNum( DateUtils.differenceDay(seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime()) );//相差天数
Double target_drug = null;//药吨水药耗
Double drugCost = 0d;//药剂实际费用
Double ysjsl = null;//实际处理水量
if(mapList != null ){
for(Map<String,Object> map : mapList){
productDataVO.setChargeWaterVolume( ConvertUtils.getString( map.get("ysfsl")) ); //收费水量
productDataVO.setYsjslWaterVolume(ConvertUtils.getString( map.get("ysjsl")) );//实际处理水量
productDataVO.setCompleteRatio( ConvertUtils.getDouble( map.get("completeRatio"),0d) );//收费水量-完成率
target_drug = ConvertUtils.getDouble( map.get("target_drug"),0d);
ysjsl = ConvertUtils.getDouble( map.get("ysjsl"),0d);
if(ysjsl.doubleValue() != 0 ){
drugCost = ConvertUtils.getDouble( map.get("yyf"),0d) / ysjsl;
}
}
}
productDataVO.setDrugCost( drugCost );
productDataVO.setTargetDrug( target_drug );
productDataVO.setSequentialProgress("基本满足时序进度");
if(productDataVO.getCompleteRatio().doubleValue() > 25){
productDataVO.setSequentialProgress("超额完成时序进度");
}
// 去年水数据:月收费水量、月实际水量
// ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量
dataViewName4411 = ReportViewUtil.buildViewLike(view4411,"ysfsl,ysjsl", departId, lastSeasonTimeVO.getStartTime(),lastSeasonTimeVO.getEndTime());
sql = "select sum( aaa.ysfsl ) 'ysfsl' , sum( aaa.ysjsl ) 'ysjsl' from "+dataViewName4411+" aaa";
if(mapList != null ){
for(Map<String,Object> map : mapList){
Double qn_ysfsl = ConvertUtils.getDouble( map.get("ysfsl"),0d);// 去年:收费水量
Double qn_ysjsl = ConvertUtils.getDouble( map.get("ysjsl"),0d);// 去年:月实际水量
if(qn_ysfsl.doubleValue() != 0){//去年:收费水量
productDataVO.setChargeWaterRatio( (ConvertUtils.getDouble( productDataVO.getChargeWaterVolume() ,0d) - qn_ysfsl) / qn_ysfsl );
}
if(qn_ysjsl.doubleValue() != 0){//去年:月实际水量
productDataVO.setYsjslWaterRatio( ( ConvertUtils.getDouble( productDataVO.getYsjslWaterVolume() ,0d) - qn_ysjsl ) / qn_ysjsl );
}
}
}
//实际水量同比下降水务公司原因分析一览表
//ysjsldyqntqyy 月实际水量低于去年同期原因
//tqysjsl 同期月实际水量
//ysjsl 月实际水量
// fields = "ysjsl,tqysjsl,ysjsldyqntqyy";
dataViewName4411 = ReportViewUtil.buildView(view4411,"ysjsl,tqysjsl,ysjsldyqntqyy", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime());
// sql = "select sum( aaa.ysfsl ) 'ysfsl' , sum( aaa.ysjsl ) 'ysjsl' , sum(tc.target_water ) 'target_water' , sum(tc.target_power) 'target_power' ,round((sum( aaa.ysfsl ) *100 / sum(tc.target_water )),2) as 'completeRatio' from "+dataViewName4411+" aaa";
sql = "select round( (aaa.tqysjsl - aaa.ysjsl ) / aaa.tqysjsl ,2 ) 'ratio' , aaa.tqysjsl , aaa.ysjsl , aaa.ysjsldyqntqyy 'causeAnalysis' , d.depart_name from "+dataViewName4411 +" aaa";
sql += " left join sys_depart d on d.id = aaa.depart_id where aaa.tqysjsl > aaa.ysjsl";
List<FReportWaterMonthDataVO> waterMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportWaterMonthDataVO>(FReportWaterMonthDataVO.class));
productDataVO.setWaterDeptartList(waterMonthDataList);
//水电耗高于控制目标--水务公司列表
dataViewName4411 = ReportViewUtil.buildViewLike(view4411,"ydh,qntqdh,dhgyqntqyy", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime(),"max");
sql = "select aaa.dhgyqntqyy 'causeAnalysis' , aaa.qntqdh ,aaa.ydh 'realConsume' ,d.depart_name 'deptartName' , tc.target_power 'targetConsume' from " + dataViewName4411 + " aaa ";
sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year ="+year+")";
sql += " left join sys_depart d on d.id = aaa.depart_id ";
sql += " where aaa.ydh > IFNULL(tc.target_power,0)";
List<FReportPowerMonthDataVO> powerMonthDataVOList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportPowerMonthDataVO>(FReportPowerMonthDataVO.class));
productDataVO.setPowerDeptartList(powerMonthDataVOList);
/**
* ysjsl:月实际水量 ; 月药耗 yyh; 去年同期药耗 qntqyh; 月药费 yyf;药耗高于去年同期原因 yhgyqntqyy;药耗超预期原因 yhcyqyy; 本年实际药耗 bnsjyh; 本年药耗目标 bnyhmb*/
//药剂成本高于控制目标--水务公司列表
dataViewName4411 = ReportViewUtil.buildViewLike(view4411,"ysjsl,yyh,qntqyh,qntqyh,yhgyqntqyy,bnsjyh,bnyhmb", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime(),"max");
// sql = "select (aaa.yyh/aaa.ysjsl) 'realConsume',aaa.ysjsl,aaa.qntqyh,aaa.qntqyh,aaa.yhgyqntqyy '',aaa.bnsjyh,aaa.bnyhmb,aaa.depart_id ,d.depart_name ,tc.target_drug 'targetConsume' from " + dataViewName4411 + " aaa ";
sql = "select (aaa.yyh/aaa.ysjsl) 'realConsume',aaa.yhgyqntqyy 'causeAnalysis',d.depart_name 'deptartName' ,tc.target_drug 'targetConsume' from " + dataViewName4411 + " aaa ";
sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year ="+year+")";
sql+= " left join sys_depart d on d.id = aaa.depart_id ";
sql += " where (aaa.ysjsl/aaa.ysjsl) > IFNULL(tc.target_drug,0)";
List<FReportPowerMonthDataVO> drugDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportPowerMonthDataVO>(FReportPowerMonthDataVO.class));
productDataVO.setDrugDeptartList(drugDataList);
//隐患排查完成情况
List<String> deptNameList = operationReportMapper.queryDepatNameList();
sql = "select d.depart_name from ajh_rectification_info t ";
sql+=" left join sys_depart d on t.depart_id = d.id ";
sql += " group by t.depart_id ";
List<String> deptNameList = operationReportMapper.queryDepatNameList();
productDataVO.setDangerDeptCount( 0 );
if(deptNameList != null && !deptNameList.isEmpty()){
productDataVO.setDangerDeptCount( deptNameList.size());
......@@ -62,219 +159,4 @@ public class OperationReportServiceImpl implements IOperationReportService {
return productDataVO;
}
private void handeReportMonthData(ProductDataVO productDataVO,List<FReportMonthDataVO> reportMonthDataVOList,String disparityDay){
// 遍历月数据报表获取
String chargeWaterVolume = "0";//收费水量 总量
String lastYearChargeWaterVolume = "0";//去年收费水量 总量
String ysjslWaterVolume = "0";//月实际水量 总量
String tqysjslWaterVolume = "0";//同期月实际水量 总量
String targetWater = "0";//水目标
FReportWaterMonthDataVO reportMonthItemDataVO = null;
//同期月实际水量
if(reportMonthDataVOList != null && !reportMonthDataVOList.isEmpty()){
for(FReportMonthDataVO monthDataVO : reportMonthDataVOList){
/**********************收费水量********************************/
if(StringUtils.isNotEmpty(monthDataVO.getYsfsl())){//ysfsl 月收费水量
chargeWaterVolume = DigitalUtils.add( chargeWaterVolume , monthDataVO.getYsfsl());
}
if(StringUtils.isNotEmpty(monthDataVO.getQntqsfsl())){//qntqsfsl 去年同期收费水量
lastYearChargeWaterVolume = DigitalUtils.add( lastYearChargeWaterVolume , monthDataVO.getQntqsfsl());
}
if(StringUtils.isNotEmpty(monthDataVO.getTargetWater())){//ysfsl 收费水量目标
targetWater = DigitalUtils.add( targetWater , monthDataVO.getTargetWater());
}
/********************实际水量**********************************/
if(StringUtils.isNotEmpty(monthDataVO.getYsjsl())){//ysjsl 月实际水量
ysjslWaterVolume = DigitalUtils.add( ysjslWaterVolume , monthDataVO.getYsjsl());
}
if(StringUtils.isNotEmpty(monthDataVO.getQntqsfsl())){//qntqsfsl 去年同期收费水量
tqysjslWaterVolume = DigitalUtils.add( tqysjslWaterVolume , monthDataVO.getQntqsfsl());
}
//同比下降的部门
Integer comparisonResult_water = DigitalUtils.compareTo(ysjslWaterVolume , tqysjslWaterVolume) ;
if(comparisonResult_water != null && comparisonResult_water < 0 ){//同比下降
// 部门名称,下降比例,下降原因
String ratio = DigitalUtils.division( ysjslWaterVolume ,tqysjslWaterVolume ) ;
ratio = DigitalUtils.multiply( ratio , "100");
reportMonthItemDataVO = new FReportWaterMonthDataVO(monthDataVO.getDeptartName(),ratio,monthDataVO.getYsjsldyqntqyy()) ;
productDataVO.getWaterDeptartList().add( reportMonthItemDataVO );
}
/********************电**********************************/
String consume = checkPowerConsume(monthDataVO.getYdh(),monthDataVO.getYsjsl() ,monthDataVO.getTargetPower());//部门电耗
if(consume != null){
productDataVO.getPowerDeptartList().add( new FReportPowerMonthDataVO( monthDataVO.getDeptartName(), monthDataVO.getTargetDrug(),consume,monthDataVO.getDhcmbzyy() ) );
}
/********************药剂**********************************/
productDataVO.setTargetDrug(monthDataVO.getTargetDrug() );//目标药剂
if(StringUtils.isNotEmpty(monthDataVO.getYyf()) && StringUtils.isNotEmpty(monthDataVO.getYsjsl()) ){
String drugCost = DigitalUtils.division( monthDataVO.getYyf() , monthDataVO.getYsjsl() );
Integer comparison_drug = DigitalUtils.compareTo( drugCost , monthDataVO.getTargetDrug() ) ;
if(comparison_drug != null && comparison_drug > 0){
productDataVO.getDrugDeptartList().add( new FReportPowerMonthDataVO( monthDataVO.getDeptartName(), monthDataVO.getTargetDrug(),drugCost.toString(),monthDataVO.getYhcyqyy() ) );
}
}
}
}
/****************实际水量、统计数量、百分比、平均值***********/
setChargeWater(productDataVO, chargeWaterVolume , lastYearChargeWaterVolume ,targetWater,disparityDay);
/****************实际水量、统计数量、百分比、平均值***********/
setYsjslWater(productDataVO, ysjslWaterVolume , tqysjslWaterVolume ,disparityDay);
}
/***
* 比较两个数字
* @param ydl 用电量
* @param ysjsl 用水量
* @param targetPower 目标电耗
* @return
*/
public String checkPowerConsume(String ydl ,String ysjsl, String targetPower){
Double consume = null;
if(StringUtils.isNotEmpty(ydl) && StringUtils.isNotEmpty(ysjsl) && StringUtils.isNotEmpty(targetPower)){
Double ysjslD = Double.parseDouble(ysjsl);
//公式 = 用电量/用水量 - 目标电耗 = 用电量 - 用水量 * 目标电耗
if( ysjslD.doubleValue() > 0 && ( Double.parseDouble(ydl) - Double.parseDouble(ysjsl) * Double.parseDouble(targetPower) ) > 0){
consume = Double.parseDouble(ydl)/Double.parseDouble(ysjsl) - Double.parseDouble(targetPower);
return consume.toString();
}
}
return null;
}
/***
* ***************设置实际收费水量***************
* @param targetChargeWater
* @param tqysjslWaterVolume
* @param disparityDay
*/
public void setChargeWater(ProductDataVO productDataVO,String chargeWaterVolume, String tqysjslWaterVolume,String targetChargeWater, String disparityDay) {
productDataVO.setChargeWaterVolume(chargeWaterVolume);//收费水量 总量
// 除法运算,保留两位小数
String avgDayWaterVolume = DigitalUtils.division(chargeWaterVolume ,disparityDay );
productDataVO.setAvgDayWaterVolume( avgDayWaterVolume );//收费水量 日均值
//完成年度目标
if(targetChargeWater != null ){
String completeRatio = DigitalUtils.division(chargeWaterVolume ,targetChargeWater );
productDataVO.setCompleteRatio( completeRatio );//完成年度目标
int comparisonResult = DigitalUtils.compareTo(completeRatio ,"25" );
if(comparisonResult > 0 ){
productDataVO.setSequentialProgress("超额完成时序进度");
} else {
productDataVO.setSequentialProgress("基本满足时序进度");
}
}
String chargeWaterRatio = DigitalUtils.division(chargeWaterVolume , tqysjslWaterVolume ) ; //增长率
productDataVO.setChargeWaterRatio( chargeWaterRatio );
}
/***
* ***************实际水量、统计数量、百分比、平均值**********
* @param ysjslWaterVolume
* @param tqysjslWaterVolume
* @param disparityDay
*/
public void setYsjslWater(ProductDataVO productDataVO,String ysjslWaterVolume, String tqysjslWaterVolume, String disparityDay) {
productDataVO.setYsjslWaterVolume( ysjslWaterVolume );//实际水量
// 除法运算,保留两位小数
String avgDayWaterVolume = DigitalUtils.division(ysjslWaterVolume ,disparityDay );
productDataVO.setAvgDayWaterVolume( avgDayWaterVolume );//实际水量 日均值
//增长率
if(tqysjslWaterVolume != null ){
String chargeWaterRatio = DigitalUtils.division(ysjslWaterVolume ,tqysjslWaterVolume );
productDataVO.setYsjslWaterRatio( chargeWaterRatio );//完成年度目标
}
}
/***
* 执行查询sql语句返回一个结果
* @param sql
* @return
*/
public String queryForString(String sql ){
//主库数据源
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
String result = masterDB.queryForObject(sql, String.class);
return result;
}
/***
* 根据记录获取:季度开始时间
* @param year
* @param season
* @return
*/
public String getStartTimeBySeason(int year,int season){
int startMonth = 0;
int endMonth = 0;
switch (season) {
case 1:
startMonth = 1;
endMonth = 3;
break;
case 2:
startMonth = 4;
endMonth = 6;
break;
case 3:
startMonth = 7;
endMonth = 9;
break;
case 4:
startMonth = 10;
endMonth = 12;
break;
default:
System.out.println("季度输入无效,请输入1-4之间的数字。");
return "";
}
LocalDate startDate = LocalDate.of(year, startMonth, 1);
LocalDate endDate = LocalDate.of(year, endMonth, startDate.lengthOfMonth());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
return startDate.format(formatter);
}
/***
* 根据记录获取:季度结束时间
* @param year
* @param season
* @return
*/
public String getEndTimeBySeason(int year,int season){
int startMonth = 0;
int endMonth = 0;
switch (season) {
case 1:
startMonth = 1;
endMonth = 3;
break;
case 2:
startMonth = 4;
endMonth = 6;
break;
case 3:
startMonth = 7;
endMonth = 9;
break;
case 4:
startMonth = 10;
endMonth = 12;
break;
default:
System.out.println("季度输入无效,请输入1-4之间的数字。");
return "";
}
LocalDate startDate = LocalDate.of(year, startMonth, 1);
LocalDate endDate = LocalDate.of(year, endMonth, startDate.lengthOfMonth());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
return endDate.format(formatter);
}
}
......
......@@ -22,6 +22,10 @@ public class FReportPowerMonthDataVO {
@ApiModelProperty(value = "原因分析")
private String causeAnalysis;
public FReportPowerMonthDataVO(){
}
public FReportPowerMonthDataVO(String deptartName, String targetConsume, String realConsume , String causeAnalysis) {
this.deptartName = deptartName;
this.targetConsume = targetConsume;
......
......@@ -19,6 +19,10 @@ public class FReportWaterMonthDataVO {
@ApiModelProperty(value = "原因分析")
private String causeAnalysis;
public FReportWaterMonthDataVO(){
}
public FReportWaterMonthDataVO(String deptartName, String ratio, String causeAnalysis) {
this.deptartName = deptartName;
this.ratio = ratio;
......
package com.skua.modules.report.vo;
import com.skua.core.util.ConvertUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -18,19 +19,22 @@ public class ProductDataVO {
@ApiModelProperty(value = "季度开始时间")
private String startTime;
@ApiModelProperty(value = "季度结束时间")
private String endTime;
@ApiModelProperty(value = "水务厂站数量")
private String deptartCount;
@ApiModelProperty(value = "相差天数")
private Long dayNum;
@ApiModelProperty(value = "收费水量")
private String chargeWaterVolume;//收费水量9854.012552万吨
@ApiModelProperty(value = "收费水量-日均值")
private String avgDayWaterVolume;//平均108.29万吨/天
private Double avgDayWaterVolume;//平均108.29万吨/天
@ApiModelProperty(value = "收费水量-同比增长")
private String chargeWaterRatio;
private Double chargeWaterRatio;
@ApiModelProperty(value = "收费水量-完成率")
private String completeRatio;
private Double completeRatio;
@ApiModelProperty(value = "序时进度")
private String sequentialProgress;
......@@ -39,17 +43,17 @@ public class ProductDataVO {
@ApiModelProperty(value = "实际处理水量")
private String ysjslWaterVolume;
@ApiModelProperty(value = "实际处理水量-日均值")
private String avgYsjslWaterVolume;//平均99.76万吨/天
private Double avgYsjslWaterVolume;//平均99.76万吨/天
@ApiModelProperty(value = "实际处理水量--同比增长")
private String ysjslWaterRatio;
private Double ysjslWaterRatio;
@ApiModelProperty(value = "药量目标")
private String targetDrug;
private Double targetDrug;
@ApiModelProperty(value = "药剂实际费用")
private String drugCost;//实际发生为0.219元/吨水
private Double drugCost;//实际发生为0.219元/吨水
@ApiModelProperty(value = "实际水量同比下降--水务公司列表")
......@@ -76,6 +80,16 @@ public class ProductDataVO {
@ApiModelProperty(value = "隐患部门名称")
private String dangerDeptNames;
//收费水量-日均值
public Double getAvgDayWaterVolume() {
avgDayWaterVolume = ConvertUtils.getDouble(chargeWaterVolume,0) / dayNum ;
return avgDayWaterVolume;
}
//实际处理水量-日均值
public Double getAvgYsjslWaterVolume() {
avgYsjslWaterVolume = ConvertUtils.getDouble(ysjslWaterVolume,0) / dayNum;
return avgYsjslWaterVolume;
}
public String getWaterDeptartName() {
return getDeptName(waterDeptartList);
......@@ -110,3 +124,4 @@ public class ProductDataVO {
return deptName;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!