数据接口修改
正在显示
7 个修改的文件
包含
83 行增加
和
11 行删除
sk-module-biz/src/main/java/com/skua/modules/dataAnalysis/controller/SysCommandCentreController.java
... | @@ -289,7 +289,7 @@ public class SysCommandCentreController { | ... | @@ -289,7 +289,7 @@ public class SysCommandCentreController { |
289 | 289 | ||
290 | List<String> yaXisList = new ArrayList<String>(); | 290 | List<String> yaXisList = new ArrayList<String>(); |
291 | yaXisList.addAll(fyList) ;//费用 | 291 | yaXisList.addAll(fyList) ;//费用 |
292 | yaXisList.addAll( waterList) ;//水 | 292 | yaXisList.addAll(waterList) ;//水 |
293 | stackedAreaChartDataVO.setYAxis( yaXisList ); | 293 | stackedAreaChartDataVO.setYAxis( yaXisList ); |
294 | 294 | ||
295 | Result<StackedAreaChartDataVO> result = new Result<>(); | 295 | Result<StackedAreaChartDataVO> result = new Result<>(); | ... | ... |
... | @@ -110,7 +110,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -110,7 +110,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
110 | " round(ifnull(v5.dlhj/tb.clsl_tb,0)/10000,2) qntqdh, " + | 110 | " round(ifnull(v5.dlhj/tb.clsl_tb,0)/10000,2) qntqdh, " + |
111 | " round(100*(v4.dlhj-ifnull(v5.dlhj,0))/ifnull(v5.dlhj,v4.dlhj),2) as dhdbbhl, " + | 111 | " round(100*(v4.dlhj-ifnull(v5.dlhj,0))/ifnull(v5.dlhj,v4.dlhj),2) as dhdbbhl, " + |
112 | " v6.dhgyqntqyy, " + | 112 | " v6.dhgyqntqyy, " + |
113 | " round(v4.yjhl/sum(v1.CSL),2) as yyh, " + | 113 | " round(v6.yyf/sum(v1.CSL),2) as yyh, " + |
114 | " v6.yyf," + | 114 | " v6.yyf," + |
115 | " round(ifnull(v5.yjhl/tb.clsl_tb/10000,0),2) qntqyh, " + | 115 | " round(ifnull(v5.yjhl/tb.clsl_tb/10000,0),2) qntqyh, " + |
116 | " round(100*(v4.yjhl-ifnull(v5.yjhl,0))/ifnull(v5.yjhl,v4.yjhl),2) as yhdbbhl, " + | 116 | " 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; | ... | @@ -6,6 +6,7 @@ import com.skua.common.constant.ReportConstant; |
6 | import com.skua.common.report.ReportViewUtil; | 6 | import com.skua.common.report.ReportViewUtil; |
7 | import com.skua.core.context.BaseContextHandler; | 7 | import com.skua.core.context.BaseContextHandler; |
8 | import com.skua.core.context.SpringContextUtils; | 8 | import com.skua.core.context.SpringContextUtils; |
9 | import com.skua.core.util.ConvertUtils; | ||
9 | import com.skua.core.util.DateUtils; | 10 | import com.skua.core.util.DateUtils; |
10 | import com.skua.modules.custom.service.IFCustomReportDatasetService; | 11 | import com.skua.modules.custom.service.IFCustomReportDatasetService; |
11 | import com.skua.modules.dataAnalysis.mapper.PowerAnalysisNewMapper; | 12 | import com.skua.modules.dataAnalysis.mapper.PowerAnalysisNewMapper; |
... | @@ -30,10 +31,10 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { | ... | @@ -30,10 +31,10 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { |
30 | private PowerAnalysisNewMapper powerAnalysisNewMapper; | 31 | private PowerAnalysisNewMapper powerAnalysisNewMapper; |
31 | @Autowired | 32 | @Autowired |
32 | private WaterCountAnalysisNewMapper waterCountAnalysisNewMapper; | 33 | private WaterCountAnalysisNewMapper waterCountAnalysisNewMapper; |
33 | @Autowired | 34 | //时间格式 |
34 | private IFCustomReportDatasetService fCustomReportDatasetService; | ||
35 | |||
36 | public static final SimpleDateFormat yyyyMM = new SimpleDateFormat("yyyy-MM"); | 35 | public static final SimpleDateFormat yyyyMM = new SimpleDateFormat("yyyy-MM"); |
36 | //格式化小数 | ||
37 | private static DecimalFormat df = new DecimalFormat("#.##"); | ||
37 | 38 | ||
38 | /** | 39 | /** |
39 | * 功能描述: <br>电耗分析统计 | 40 | * 功能描述: <br>电耗分析统计 |
... | @@ -53,6 +54,12 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { | ... | @@ -53,6 +54,12 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { |
53 | //本月总的电耗,处理水量,吨水电耗 | 54 | //本月总的电耗,处理水量,吨水电耗 |
54 | Map result = powerAnalysisNewMapper.totalPowerConsumptionAnalysis(thisDataViewName3a24, thisDataViewName2119, | 55 | Map result = powerAnalysisNewMapper.totalPowerConsumptionAnalysis(thisDataViewName3a24, thisDataViewName2119, |
55 | lastDataViewName3a24, lastDataViewName2119, thisMonth, lastMonth, departIds); | 56 | lastDataViewName3a24, lastDataViewName2119, thisMonth, lastMonth, departIds); |
57 | |||
58 | List<Map<String, Object>> thisList = powerAnalysisNewMapper.powerConsumptionDistribution(thisDataViewName3a24,thisDataViewName2119, thisMonth, departIds); | ||
59 | List<Map<String, Object>> lastList = powerAnalysisNewMapper.powerConsumptionDistribution(lastDataViewName3a24,lastDataViewName2119, lastMonth, departIds); | ||
60 | |||
61 | result = updateDSDH(result,thisList,lastList); | ||
62 | |||
56 | //向前6个月的电耗,处理水量分布 | 63 | //向前6个月的电耗,处理水量分布 |
57 | String precedingTime = getSixMonth(thisMonth); | 64 | String precedingTime = getSixMonth(thisMonth); |
58 | String start = precedingTime+"-01"; | 65 | String start = precedingTime+"-01"; |
... | @@ -60,14 +67,47 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { | ... | @@ -60,14 +67,47 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { |
60 | String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ", departIds, start, end); | 67 | String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"DLHJ", departIds, start, end); |
61 | String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, start, end); | 68 | String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, start, end); |
62 | List<Map> SixMonthPowerConsumption = powerAnalysisNewMapper.querySixMonthPowerConsumption(dataViewName3a24, dataViewName2119, start, end, departIds); | 69 | List<Map> SixMonthPowerConsumption = powerAnalysisNewMapper.querySixMonthPowerConsumption(dataViewName3a24, dataViewName2119, start, end, departIds); |
63 | |||
64 | |||
65 | resultMap.put("totalResult", result); | 70 | resultMap.put("totalResult", result); |
66 | resultMap.put("dataList", SixMonthPowerConsumption); | 71 | resultMap.put("dataList", SixMonthPowerConsumption); |
67 | 72 | ||
68 | return resultMap; | 73 | return resultMap; |
69 | } | 74 | } |
70 | 75 | ||
76 | //更新吨水电耗计算逻辑 | ||
77 | private Map updateDSDH(Map result, List<Map<String, Object>> thisList, List<Map<String, Object>> lastList) { | ||
78 | int thisnNum = 0;int lastNum = 0;//平均值计数 | ||
79 | double thisDsdh = 0.00;double lastDsdh = 0.00;//吨水电耗 | ||
80 | String bydsdh = "0.00";String sydsdh = "0.00"; | ||
81 | for (Map<String, Object> map : thisList) { | ||
82 | if(ConvertUtils.isNotEmpty(map.get("ydl"))&&ConvertUtils.isNotEmpty(map.get("clsl"))){ | ||
83 | if(!"0.0".equals(String.valueOf(map.get("ydl")))&&!"0.0".equals(String.valueOf(map.get("clsl")))){ | ||
84 | thisDsdh = thisDsdh + Double.parseDouble(map.get("dsdh").toString()); | ||
85 | thisnNum = thisnNum + 1; | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | if(thisnNum > 0){ | ||
90 | bydsdh = df.format(thisDsdh/thisnNum); | ||
91 | result.put("BYDSHDL",bydsdh); | ||
92 | } | ||
93 | for (Map<String, Object> map : lastList) { | ||
94 | if(ConvertUtils.isNotEmpty(map.get("ydl"))&&ConvertUtils.isNotEmpty(map.get("clsl"))){ | ||
95 | if(!"0.0".equals(String.valueOf(map.get("ydl")))&&!"0.0".equals(String.valueOf(map.get("clsl")))){ | ||
96 | lastDsdh = lastDsdh + Double.parseDouble(map.get("dsdh").toString()); | ||
97 | lastNum = lastNum + 1; | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | if(lastNum > 0){ | ||
102 | sydsdh = df.format(lastDsdh/lastNum); | ||
103 | result.put("SYDSHDL",sydsdh); | ||
104 | } | ||
105 | bydsdh = result.get("BYDSHDL").toString(); | ||
106 | sydsdh = result.get("SYDSHDL").toString(); | ||
107 | result.put("DSHDLCZ",df.format(Double.parseDouble(bydsdh)-Double.parseDouble(sydsdh))); | ||
108 | return result; | ||
109 | } | ||
110 | |||
71 | public static String getSixMonth(String month) { | 111 | public static String getSixMonth(String month) { |
72 | try { | 112 | try { |
73 | Date currdate = yyyyMM.parse(month); | 113 | Date currdate = yyyyMM.parse(month); |
... | @@ -87,7 +127,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { | ... | @@ -87,7 +127,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { |
87 | String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departIds, time); | 127 | String dataViewName3a24 = ReportViewUtil.buildViewLike(ReportConstant.view3a24,"DLHJ", departIds, time); |
88 | String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departIds, time); | 128 | String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departIds, time); |
89 | Map<String, Object> result = new HashMap<>(); | 129 | Map<String, Object> result = new HashMap<>(); |
90 | List<Map<String, Object>> distributionMap = powerAnalysisNewMapper.powerConsumptionDistribution(dataViewName3a24,dataViewName2119,time,departIds); | 130 | List<Map<String, Object>> distributionList = powerAnalysisNewMapper.powerConsumptionDistribution(dataViewName3a24,dataViewName2119,time,departIds); |
91 | List<Map<String, Object>> keys = Lists.newArrayList(); | 131 | List<Map<String, Object>> keys = Lists.newArrayList(); |
92 | Integer count1 = 0, count2 = 0, count3 = 0, count4 = 0; | 132 | Integer count1 = 0, count2 = 0, count3 = 0, count4 = 0; |
93 | Map<String, Object> tmp1 = Maps.newTreeMap(); | 133 | Map<String, Object> tmp1 = Maps.newTreeMap(); |
... | @@ -107,7 +147,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { | ... | @@ -107,7 +147,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { |
107 | tmp4.put("name", "高电耗"); | 147 | tmp4.put("name", "高电耗"); |
108 | tmp4.put("id", "4"); | 148 | tmp4.put("id", "4"); |
109 | 149 | ||
110 | for (Map<String, Object> v : distributionMap) { | 150 | for (Map<String, Object> v : distributionList) { |
111 | Double dsdh = (Double) v.get("dsdh"); | 151 | Double dsdh = (Double) v.get("dsdh"); |
112 | if (dsdh > 0.7) { | 152 | if (dsdh > 0.7) { |
113 | count4++; | 153 | count4++; |
... | @@ -128,7 +168,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { | ... | @@ -128,7 +168,7 @@ public class PowerAnalysisNewServiceImpl implements IPowerAnalysisNewService { |
128 | keys.add(tmp3); | 168 | keys.add(tmp3); |
129 | keys.add(tmp4); | 169 | keys.add(tmp4); |
130 | result.put("distributionMap", keys); | 170 | result.put("distributionMap", keys); |
131 | result.put("factoryDistributionList", distributionMap); | 171 | result.put("factoryDistributionList", distributionList); |
132 | return result; | 172 | return result; |
133 | } | 173 | } |
134 | 174 | ... | ... |
... | @@ -54,7 +54,7 @@ | ... | @@ -54,7 +54,7 @@ |
54 | <select id="getFyData" resultType="com.skua.modules.report.vo.ReportDateTrendVO"> | 54 | <select id="getFyData" resultType="com.skua.modules.report.vo.ReportDateTrendVO"> |
55 | SELECT | 55 | SELECT |
56 | t.month AS time, | 56 | t.month AS time, |
57 | ROUND( SUM( IFNULL(t.cost,0) ), 2 ) AS value | 57 | ROUND( SUM( IFNULL(t.cost,0) )/10000, 2 ) AS value |
58 | FROM | 58 | FROM |
59 | report_electric_cost t | 59 | report_electric_cost t |
60 | WHERE | 60 | WHERE | ... | ... |
... | @@ -76,6 +76,24 @@ public class SysDepartController { | ... | @@ -76,6 +76,24 @@ public class SysDepartController { |
76 | return result; | 76 | return result; |
77 | } | 77 | } |
78 | 78 | ||
79 | /** | ||
80 | * 查询数据 查出所有厂区 | ||
81 | * @return | ||
82 | */ | ||
83 | @RequestMapping(value = "/getDepartList", method = RequestMethod.GET) | ||
84 | public Result<List<SysDepart>> getDepartList() { | ||
85 | Result<List<SysDepart>> result = new Result<>(); | ||
86 | try { | ||
87 | String departIds = BaseContextHandler.getDeparts(); | ||
88 | List<SysDepart> list = sysDepartService.getDepartList(departIds); | ||
89 | result.setResult(list); | ||
90 | result.setSuccess(true); | ||
91 | } catch (Exception e) { | ||
92 | log.error(e.getMessage(), e); | ||
93 | } | ||
94 | return result; | ||
95 | } | ||
96 | |||
79 | @ApiOperation(value="无token获取全部机构", notes="无token获取全部机构") | 97 | @ApiOperation(value="无token获取全部机构", notes="无token获取全部机构") |
80 | @RequestMapping(value = "/getTreeList", method = RequestMethod.GET) | 98 | @RequestMapping(value = "/getTreeList", method = RequestMethod.GET) |
81 | public Result<List<SysDepartTreeModel>> getTreeList() { | 99 | public Result<List<SysDepartTreeModel>> getTreeList() { | ... | ... |
... | @@ -183,4 +183,6 @@ public interface ISysDepartService extends IService<SysDepart>{ | ... | @@ -183,4 +183,6 @@ public interface ISysDepartService extends IService<SysDepart>{ |
183 | List<SysDepart> queryUserDepartList(String userId); | 183 | List<SysDepart> queryUserDepartList(String userId); |
184 | 184 | ||
185 | List<SysDepartTreeModel> getTreeList(); | 185 | List<SysDepartTreeModel> getTreeList(); |
186 | |||
187 | List<SysDepart> getDepartList(String departIds); | ||
186 | } | 188 | } | ... | ... |
... | @@ -24,6 +24,7 @@ import com.skua.modules.system.util.FindsDepartsChildrenUtil; | ... | @@ -24,6 +24,7 @@ import com.skua.modules.system.util.FindsDepartsChildrenUtil; |
24 | import com.skua.modules.system.vo.DepartTree; | 24 | import com.skua.modules.system.vo.DepartTree; |
25 | import com.skua.modules.system.vo.SysDeptUserVO; | 25 | import com.skua.modules.system.vo.SysDeptUserVO; |
26 | import com.skua.tool.dfs.MapDFS; | 26 | import com.skua.tool.dfs.MapDFS; |
27 | import com.skua.tool.util.JSUtils; | ||
27 | import io.netty.util.internal.StringUtil; | 28 | import io.netty.util.internal.StringUtil; |
28 | import org.apache.commons.lang3.StringUtils; | 29 | import org.apache.commons.lang3.StringUtils; |
29 | import org.springframework.beans.factory.annotation.Autowired; | 30 | import org.springframework.beans.factory.annotation.Autowired; |
... | @@ -590,4 +591,15 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart | ... | @@ -590,4 +591,15 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart |
590 | return listResult; | 591 | return listResult; |
591 | } | 592 | } |
592 | 593 | ||
594 | @Override | ||
595 | public List<SysDepart> getDepartList(String departIds) { | ||
596 | List<SysDepart> list = new ArrayList<>(); | ||
597 | QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<>(); | ||
598 | queryWrapper.in("id", departIds.split(",")); | ||
599 | queryWrapper.eq("depart_type","1"); | ||
600 | queryWrapper.orderByAsc("depart_order"); | ||
601 | list = sysDepartMapper.selectList(queryWrapper); | ||
602 | return list; | ||
603 | } | ||
604 | |||
593 | } | 605 | } | ... | ... |
-
请 注册 或 登录 后发表评论