9910378a 张雷

数据接口修改

1 个父辈 e59cc5b1
......@@ -289,7 +289,7 @@ public class SysCommandCentreController {
List<String> yaXisList = new ArrayList<String>();
yaXisList.addAll(fyList) ;//费用
yaXisList.addAll( waterList) ;//水
yaXisList.addAll(waterList) ;//水
stackedAreaChartDataVO.setYAxis( yaXisList );
Result<StackedAreaChartDataVO> result = new Result<>();
......
......@@ -110,7 +110,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
" round(ifnull(v5.dlhj/tb.clsl_tb,0)/10000,2) qntqdh, " +
" round(100*(v4.dlhj-ifnull(v5.dlhj,0))/ifnull(v5.dlhj,v4.dlhj),2) as dhdbbhl, " +
" v6.dhgyqntqyy, " +
" round(v4.yjhl/sum(v1.CSL),2) as yyh, " +
" round(v6.yyf/sum(v1.CSL),2) as yyh, " +
" v6.yyf," +
" round(ifnull(v5.yjhl/tb.clsl_tb/10000,0),2) qntqyh, " +
" round(100*(v4.yjhl-ifnull(v5.yjhl,0))/ifnull(v5.yjhl,v4.yjhl),2) as yhdbbhl, " +
......
......@@ -6,6 +6,7 @@ import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.core.util.DateUtils;
import com.skua.modules.custom.service.IFCustomReportDatasetService;
import com.skua.modules.dataAnalysis.mapper.PowerAnalysisNewMapper;
......@@ -30,10 +31,10 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
private PowerAnalysisNewMapper powerAnalysisNewMapper;
@Autowired
private WaterCountAnalysisNewMapper waterCountAnalysisNewMapper;
@Autowired
private IFCustomReportDatasetService fCustomReportDatasetService;
//时间格式
public static final SimpleDateFormat yyyyMM = new SimpleDateFormat("yyyy-MM");
//格式化小数
private static DecimalFormat df = new DecimalFormat("#.##");
/**
* 功能描述: <br>电耗分析统计
......@@ -53,6 +54,12 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
//本月总的电耗,处理水量,吨水电耗
Map result = powerAnalysisNewMapper.totalPowerConsumptionAnalysis(thisDataViewName3a24, thisDataViewName2119,
lastDataViewName3a24, lastDataViewName2119, thisMonth, lastMonth, departIds);
List<Map<String, Object>> thisList = powerAnalysisNewMapper.powerConsumptionDistribution(thisDataViewName3a24,thisDataViewName2119, thisMonth, departIds);
List<Map<String, Object>> lastList = powerAnalysisNewMapper.powerConsumptionDistribution(lastDataViewName3a24,lastDataViewName2119, lastMonth, departIds);
result = updateDSDH(result,thisList,lastList);
//向前6个月的电耗,处理水量分布
String precedingTime = getSixMonth(thisMonth);
String start = precedingTime+"-01";
......@@ -60,14 +67,47 @@ 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);
return resultMap;
}
//更新吨水电耗计算逻辑
private Map updateDSDH(Map result, List<Map<String, Object>> thisList, List<Map<String, Object>> lastList) {
int thisnNum = 0;int lastNum = 0;//平均值计数
double thisDsdh = 0.00;double lastDsdh = 0.00;//吨水电耗
String bydsdh = "0.00";String sydsdh = "0.00";
for (Map<String, Object> map : thisList) {
if(ConvertUtils.isNotEmpty(map.get("ydl"))&&ConvertUtils.isNotEmpty(map.get("clsl"))){
if(!"0.0".equals(String.valueOf(map.get("ydl")))&&!"0.0".equals(String.valueOf(map.get("clsl")))){
thisDsdh = thisDsdh + Double.parseDouble(map.get("dsdh").toString());
thisnNum = thisnNum + 1;
}
}
}
if(thisnNum > 0){
bydsdh = df.format(thisDsdh/thisnNum);
result.put("BYDSHDL",bydsdh);
}
for (Map<String, Object> map : lastList) {
if(ConvertUtils.isNotEmpty(map.get("ydl"))&&ConvertUtils.isNotEmpty(map.get("clsl"))){
if(!"0.0".equals(String.valueOf(map.get("ydl")))&&!"0.0".equals(String.valueOf(map.get("clsl")))){
lastDsdh = lastDsdh + Double.parseDouble(map.get("dsdh").toString());
lastNum = lastNum + 1;
}
}
}
if(lastNum > 0){
sydsdh = df.format(lastDsdh/lastNum);
result.put("SYDSHDL",sydsdh);
}
bydsdh = result.get("BYDSHDL").toString();
sydsdh = result.get("SYDSHDL").toString();
result.put("DSHDLCZ",df.format(Double.parseDouble(bydsdh)-Double.parseDouble(sydsdh)));
return result;
}
public static String getSixMonth(String month) {
try {
Date currdate = yyyyMM.parse(month);
......@@ -87,7 +127,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departIds, time);
String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departIds, time);
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> distributionMap = powerAnalysisNewMapper.powerConsumptionDistribution(dataViewName3a24,dataViewName2119,time,departIds);
List<Map<String, Object>> distributionList = powerAnalysisNewMapper.powerConsumptionDistribution(dataViewName3a24,dataViewName2119,time,departIds);
List<Map<String, Object>> keys = Lists.newArrayList();
Integer count1 = 0, count2 = 0, count3 = 0, count4 = 0;
Map<String, Object> tmp1 = Maps.newTreeMap();
......@@ -107,7 +147,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
tmp4.put("name", "高电耗");
tmp4.put("id", "4");
for (Map<String, Object> v : distributionMap) {
for (Map<String, Object> v : distributionList) {
Double dsdh = (Double) v.get("dsdh");
if (dsdh > 0.7) {
count4++;
......@@ -128,7 +168,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService {
keys.add(tmp3);
keys.add(tmp4);
result.put("distributionMap", keys);
result.put("factoryDistributionList", distributionMap);
result.put("factoryDistributionList", distributionList);
return result;
}
......
......@@ -54,7 +54,7 @@
<select id="getFyData" resultType="com.skua.modules.report.vo.ReportDateTrendVO">
SELECT
t.month AS time,
ROUND( SUM( IFNULL(t.cost,0) ), 2 ) AS value
ROUND( SUM( IFNULL(t.cost,0) )/10000, 2 ) AS value
FROM
report_electric_cost t
WHERE
......
......@@ -76,6 +76,24 @@ public class SysDepartController {
return result;
}
/**
* 查询数据 查出所有厂区
* @return
*/
@RequestMapping(value = "/getDepartList", method = RequestMethod.GET)
public Result<List<SysDepart>> getDepartList() {
Result<List<SysDepart>> result = new Result<>();
try {
String departIds = BaseContextHandler.getDeparts();
List<SysDepart> list = sysDepartService.getDepartList(departIds);
result.setResult(list);
result.setSuccess(true);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return result;
}
@ApiOperation(value="无token获取全部机构", notes="无token获取全部机构")
@RequestMapping(value = "/getTreeList", method = RequestMethod.GET)
public Result<List<SysDepartTreeModel>> getTreeList() {
......
......@@ -183,4 +183,6 @@ public interface ISysDepartService extends IService<SysDepart>{
List<SysDepart> queryUserDepartList(String userId);
List<SysDepartTreeModel> getTreeList();
List<SysDepart> getDepartList(String departIds);
}
......
......@@ -24,6 +24,7 @@ import com.skua.modules.system.util.FindsDepartsChildrenUtil;
import com.skua.modules.system.vo.DepartTree;
import com.skua.modules.system.vo.SysDeptUserVO;
import com.skua.tool.dfs.MapDFS;
import com.skua.tool.util.JSUtils;
import io.netty.util.internal.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -590,4 +591,15 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
return listResult;
}
@Override
public List<SysDepart> getDepartList(String departIds) {
List<SysDepart> list = new ArrayList<>();
QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", departIds.split(","));
queryWrapper.eq("depart_type","1");
queryWrapper.orderByAsc("depart_order");
list = sysDepartMapper.selectList(queryWrapper);
return list;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!