f8d3f276 张雷

奥体项目接口修改

1 个父辈 035378aa
......@@ -261,4 +261,26 @@ public class OlympicCenterController {
result.setSuccess(true);
return result;
}
@ApiOperation(value="获取相同月份的累计流量数据", notes="获取相同月份的累计流量数据")
@GetMapping(value = "/getYearMonthSumFlow")
public Result<Map<String,Object>> getYearMonthSumFlow(SumFlowParams sumFlowParams){
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = new HashMap<>();
map = olympicCenterService.getYearMonthSumFlow(sumFlowParams);
result.setResult(map);
result.setSuccess(true);
return result;
}
@ApiOperation(value="获取年度的累计流量数据", notes="获取年度的累计流量数据")
@GetMapping(value = "/getYearSumFlow")
public Result<Map<String,Object>> getYearSumFlow(SumFlowParams sumFlowParams){
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = new HashMap<>();
map = olympicCenterService.getYearSumFlow(sumFlowParams);
result.setResult(map);
result.setSuccess(true);
return result;
}
}
......
......@@ -49,4 +49,8 @@ public interface IOlympicCenterService {
List<Map<String, Object>> getAlarmList(AlarmParams alarmParams);
Map<String, Object> getSumFlowData(SumFlowParams sumFlowParams);
Map<String, Object> getYearMonthSumFlow(SumFlowParams sumFlowParams);
Map<String, Object> getYearSumFlow(SumFlowParams sumFlowParams);
}
......
......@@ -34,6 +34,8 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
@Autowired
private WhatStructDataMapper whatStructDataMapper;
private static String AT_ID = "A01A21A03";//奥体项目厂ID
private static String LJLL_FIELDS = "A01A21A03_FZLYL_XF_ACC_FIT0002,A01A21A03_FZLYL_GS_ACC_FIT0003," +
"A01A21A03_GXEL_XF_ACC_FIT0004,A01A21A03_GXEL_GS_ACC_FIT0005";//累计流量点位
@Override
public Map<String,Object> getRealTimeData(String sourceType) {
......@@ -1974,13 +1976,6 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
@Override
public Map<String, Object> getSumFlowData(SumFlowParams sumFlowParams) {
String fields = "A01A21A03_FZLYL_XF_ACC_FIT0002,A01A21A03_FZLYL_GS_ACC_FIT0003," +
"A01A21A03_GXEL_XF_ACC_FIT0004,A01A21A03_GXEL_GS_ACC_FIT0005";
Map<String,Object> monitorMap = new HashMap<>();
monitorMap.put("A01A21A03_FZLYL_XF_ACC_FIT0002","F0002");
monitorMap.put("A01A21A03_FZLYL_GS_ACC_FIT0003","F0003");
monitorMap.put("A01A21A03_GXEL_XF_ACC_FIT0004","F0004");
monitorMap.put("A01A21A03_GXEL_GS_ACC_FIT0005","F0005");
List<EchartResult> f1List = new ArrayList<>();
List<EchartResult> f2List = new ArrayList<>();
List<EchartResult> f3List = new ArrayList<>();
......@@ -2027,11 +2022,13 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
startTime = lastMonthYearMonth + "-01 00:00:00";
endTime = nextMonthYearMonth + "-01 00:00:00";
}
monitorList = fmPgQueryService.queryAotiCurveData(fields,startTime,endTime,sumType,strCount);
monitorList = fmPgQueryService.queryAotiCurveData(LJLL_FIELDS,startTime,endTime,sumType,strCount);
if("day".equals(sumType)){
for (int i = 0; i < currentYearMonthMap.length; i++) {
String dateTime = currentYearMonthMap[i];
String echartName = dateTime.substring(dateTime.length() - 2);
EchartResult echartResult1 = new EchartResult();
echartResult1.setName(currentYearMonthMap[i]);
echartResult1.setName(echartName);
echartResult1.setValue("--");
echartResult1.setSeries("本月");
Map<String, Object> map1 = getMapFormList(monitorList,currentYearMonthMap[i],"");
......@@ -2040,7 +2037,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f1List.add(echartResult1);
EchartResult echartResult2 = new EchartResult();
echartResult2.setName(currentYearMonthMap[i]);
echartResult2.setName(echartName);
echartResult2.setValue("--");
echartResult2.setSeries("本月");
Map<String, Object> map2 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
......@@ -2049,7 +2046,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f2List.add(echartResult2);
EchartResult echartResult3 = new EchartResult();
echartResult3.setName(currentYearMonthMap[i]);
echartResult3.setName(echartName);
echartResult3.setValue("--");
echartResult3.setSeries("本月");
Map<String, Object> map3 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
......@@ -2058,7 +2055,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f3List.add(echartResult3);
EchartResult echartResult4 = new EchartResult();
echartResult4.setName(currentYearMonthMap[i]);
echartResult4.setName(echartName);
echartResult4.setValue("--");
echartResult4.setSeries("本月");
Map<String, Object> map4 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
......@@ -2067,7 +2064,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f4List.add(echartResult4);
EchartResult echartResult5 = new EchartResult();
echartResult5.setName(currentYearMonthMap[i]);
echartResult5.setName(echartName);
echartResult5.setValue("--");
echartResult5.setSeries("本月");
Map<String, Object> map5 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
......@@ -2077,8 +2074,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
f5List.add(echartResult5);
}
for (int i = 0; i < lastMonthYearMonthMap.length; i++) {
String dateTime = lastMonthYearMonthMap[i];
String echartName = dateTime.substring(dateTime.length() - 2);
EchartResult echartResult1 = new EchartResult();
echartResult1.setName(lastMonthYearMonthMap[i]);
echartResult1.setName(echartName);
echartResult1.setValue("--");
echartResult1.setSeries("上月");
Map<String, Object> map1 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"");
......@@ -2087,7 +2086,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f1List.add(echartResult1);
EchartResult echartResult2 = new EchartResult();
echartResult2.setName(lastMonthYearMonthMap[i]);
echartResult2.setName(echartName);
echartResult2.setValue("--");
echartResult2.setSeries("上月");
Map<String, Object> map2 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
......@@ -2096,7 +2095,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f2List.add(echartResult2);
EchartResult echartResult3 = new EchartResult();
echartResult3.setName(lastMonthYearMonthMap[i]);
echartResult3.setName(echartName);
echartResult3.setValue("--");
echartResult3.setSeries("上月");
Map<String, Object> map3 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
......@@ -2105,7 +2104,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f3List.add(echartResult3);
EchartResult echartResult4 = new EchartResult();
echartResult4.setName(lastMonthYearMonthMap[i]);
echartResult4.setName(echartName);
echartResult4.setValue("--");
echartResult4.setSeries("上月");
Map<String, Object> map4 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
......@@ -2114,7 +2113,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f4List.add(echartResult4);
EchartResult echartResult5 = new EchartResult();
echartResult5.setName(lastMonthYearMonthMap[i]);
echartResult5.setName(echartName);
echartResult5.setValue("--");
echartResult5.setSeries("上月");
Map<String, Object> map5 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
......@@ -2125,8 +2124,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
}else if("month".equals(sumType)){
for (int i = 0; i < currentYearMap.length; i++) {
String dateTime = currentYearMap[i];
String echartName = dateTime.substring(dateTime.length() - 2);
EchartResult echartResult1 = new EchartResult();
echartResult1.setName(currentYearMap[i]);
echartResult1.setName(echartName);
echartResult1.setValue("--");
echartResult1.setSeries("本年");
Map<String, Object> map1 = getMapFormList(monitorList,currentYearMap[i],"");
......@@ -2135,7 +2136,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f1List.add(echartResult1);
EchartResult echartResult2 = new EchartResult();
echartResult2.setName(currentYearMap[i]);
echartResult2.setName(echartName);
echartResult2.setValue("--");
echartResult2.setSeries("本年");
Map<String, Object> map2 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
......@@ -2144,7 +2145,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f2List.add(echartResult2);
EchartResult echartResult3 = new EchartResult();
echartResult3.setName(currentYearMap[i]);
echartResult3.setName(echartName);
echartResult3.setValue("--");
echartResult3.setSeries("本年");
Map<String, Object> map3 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
......@@ -2153,7 +2154,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f3List.add(echartResult3);
EchartResult echartResult4 = new EchartResult();
echartResult4.setName(currentYearMap[i]);
echartResult4.setName(echartName);
echartResult4.setValue("--");
echartResult4.setSeries("本年");
Map<String, Object> map4 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
......@@ -2162,7 +2163,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f4List.add(echartResult4);
EchartResult echartResult5 = new EchartResult();
echartResult5.setName(currentYearMap[i]);
echartResult5.setName(echartName);
echartResult5.setValue("--");
echartResult5.setSeries("本年");
Map<String, Object> map5 = getMapFormList(monitorList,currentYearMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
......@@ -2172,8 +2173,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
f5List.add(echartResult5);
}
for (int i = 0; i < lastYearMap.length; i++) {
String dateTime = lastYearMap[i];
String echartName = dateTime.substring(dateTime.length() - 2);
EchartResult echartResult1 = new EchartResult();
echartResult1.setName(lastYearMap[i]);
echartResult1.setName(echartName);
echartResult1.setValue("--");
echartResult1.setSeries("去年");
Map<String, Object> map1 = getMapFormList(monitorList,lastYearMap[i],"");
......@@ -2182,7 +2185,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f1List.add(echartResult1);
EchartResult echartResult2 = new EchartResult();
echartResult2.setName(lastYearMap[i]);
echartResult2.setName(echartName);
echartResult2.setValue("--");
echartResult2.setSeries("去年");
Map<String, Object> map2 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
......@@ -2191,7 +2194,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f2List.add(echartResult2);
EchartResult echartResult3 = new EchartResult();
echartResult3.setName(lastYearMap[i]);
echartResult3.setName(echartName);
echartResult3.setValue("--");
echartResult3.setSeries("去年");
Map<String, Object> map3 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
......@@ -2200,7 +2203,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f3List.add(echartResult3);
EchartResult echartResult4 = new EchartResult();
echartResult4.setName(lastYearMap[i]);
echartResult4.setName(echartName);
echartResult4.setValue("--");
echartResult4.setSeries("去年");
Map<String, Object> map4 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
......@@ -2209,7 +2212,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f4List.add(echartResult4);
EchartResult echartResult5 = new EchartResult();
echartResult5.setName(lastYearMap[i]);
echartResult5.setName(echartName);
echartResult5.setValue("--");
echartResult5.setSeries("去年");
Map<String, Object> map5 = getMapFormList(monitorList,lastYearMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
......@@ -2218,12 +2221,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f5List.add(echartResult5);
}
}else if("year".equals(sumType)){
}else{
for (int i = 0; i < currentYearMonthMap.length; i++) {
String dateTime = currentYearMonthMap[i];
String echartName = dateTime.substring(dateTime.length() - 2);
EchartResult echartResult1 = new EchartResult();
echartResult1.setName(currentYearMonthMap[i]);
echartResult1.setName(echartName);
echartResult1.setValue("--");
echartResult1.setSeries("本月");
Map<String, Object> map1 = getMapFormList(monitorList,currentYearMonthMap[i],"");
......@@ -2232,7 +2235,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f1List.add(echartResult1);
EchartResult echartResult2 = new EchartResult();
echartResult2.setName(currentYearMonthMap[i]);
echartResult2.setName(echartName);
echartResult2.setValue("--");
echartResult2.setSeries("本月");
Map<String, Object> map2 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
......@@ -2241,7 +2244,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f2List.add(echartResult2);
EchartResult echartResult3 = new EchartResult();
echartResult3.setName(currentYearMonthMap[i]);
echartResult3.setName(echartName);
echartResult3.setValue("--");
echartResult3.setSeries("本月");
Map<String, Object> map3 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
......@@ -2250,7 +2253,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f3List.add(echartResult3);
EchartResult echartResult4 = new EchartResult();
echartResult4.setName(currentYearMonthMap[i]);
echartResult4.setName(echartName);
echartResult4.setValue("--");
echartResult4.setSeries("本月");
Map<String, Object> map4 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
......@@ -2259,7 +2262,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f4List.add(echartResult4);
EchartResult echartResult5 = new EchartResult();
echartResult5.setName(currentYearMonthMap[i]);
echartResult5.setName(echartName);
echartResult5.setValue("--");
echartResult5.setSeries("本月");
Map<String, Object> map5 = getMapFormList(monitorList,currentYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
......@@ -2269,8 +2272,10 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
f5List.add(echartResult5);
}
for (int i = 0; i < lastMonthYearMonthMap.length; i++) {
String dateTime = lastMonthYearMonthMap[i];
String echartName = dateTime.substring(dateTime.length() - 2);
EchartResult echartResult1 = new EchartResult();
echartResult1.setName(lastMonthYearMonthMap[i]);
echartResult1.setName(echartName);
echartResult1.setValue("--");
echartResult1.setSeries("上月");
Map<String, Object> map1 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"");
......@@ -2279,7 +2284,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f1List.add(echartResult1);
EchartResult echartResult2 = new EchartResult();
echartResult2.setName(lastMonthYearMonthMap[i]);
echartResult2.setName(echartName);
echartResult2.setValue("--");
echartResult2.setSeries("上月");
Map<String, Object> map2 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
......@@ -2288,7 +2293,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f2List.add(echartResult2);
EchartResult echartResult3 = new EchartResult();
echartResult3.setName(lastMonthYearMonthMap[i]);
echartResult3.setName(echartName);
echartResult3.setValue("--");
echartResult3.setSeries("上月");
Map<String, Object> map3 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
......@@ -2297,7 +2302,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f3List.add(echartResult3);
EchartResult echartResult4 = new EchartResult();
echartResult4.setName(lastMonthYearMonthMap[i]);
echartResult4.setName(echartName);
echartResult4.setValue("--");
echartResult4.setSeries("上月");
Map<String, Object> map4 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
......@@ -2306,7 +2311,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
}
f4List.add(echartResult4);
EchartResult echartResult5 = new EchartResult();
echartResult5.setName(lastMonthYearMonthMap[i]);
echartResult5.setName(echartName);
echartResult5.setValue("--");
echartResult5.setSeries("上月");
Map<String, Object> map5 = getMapFormList(monitorList,lastMonthYearMonthMap[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
......@@ -2324,6 +2329,165 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return map;
}
@Override
public Map<String, Object> getYearMonthSumFlow(SumFlowParams sumFlowParams) {
Map<String, Object> map = new HashMap<>();
List<EchartResult> f1List = new ArrayList<>();
List<EchartResult> f2List = new ArrayList<>();
List<EchartResult> f3List = new ArrayList<>();
List<EchartResult> f4List = new ArrayList<>();
List<EchartResult> f5List = new ArrayList<>();
if(!"".equals(sumFlowParams.getYearMonth())&&sumFlowParams.getYearMonth()!=null){
List<Map<String, Object>> monitorList = new ArrayList<>();
int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear
String[] ymArray = sumFlowParams.getYearMonth().split("-");
String year = ymArray[0];
String month = ymArray[1];
String[] yearsArray = getYearsArray(year,String.valueOf(currentYear));
String startTime = year + "-01-01 00:00:00";
String endTime = currentYear + "-12-31 23:59:59";
monitorList = fmPgQueryService.queryAotiCurveDataByMonth(LJLL_FIELDS,startTime,endTime,month);
for (int i = 0; i < yearsArray.length; i++) {
String echartName = yearsArray[i];
EchartResult echartResult1 = new EchartResult();
echartResult1.setName(echartName);
echartResult1.setValue("--");
echartResult1.setSeries(month + "月");
Map<String, Object> map1 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"");
if(map1!=null){
echartResult1.setValue(map1.get("value").toString());
}
f1List.add(echartResult1);
EchartResult echartResult2 = new EchartResult();
echartResult2.setName(echartName);
echartResult2.setValue("--");
echartResult2.setSeries(month + "月");
Map<String, Object> map2 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_FZLYL_XF_ACC_FIT0002");
if(map2!=null){
echartResult2.setValue(map2.get("value").toString());
}
f2List.add(echartResult2);
EchartResult echartResult3 = new EchartResult();
echartResult3.setName(echartName);
echartResult3.setValue("--");
echartResult3.setSeries(month + "月");
Map<String, Object> map3 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_FZLYL_GS_ACC_FIT0003");
if(map3!=null){
echartResult3.setValue(map3.get("value").toString());
}
f3List.add(echartResult3);
EchartResult echartResult4 = new EchartResult();
echartResult4.setName(echartName);
echartResult4.setValue("--");
echartResult4.setSeries(month + "月");
Map<String, Object> map4 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_GXEL_XF_ACC_FIT0004");
if(map4!=null){
echartResult4.setValue(map4.get("value").toString());
}
f4List.add(echartResult4);
EchartResult echartResult5 = new EchartResult();
echartResult5.setName(echartName);
echartResult5.setValue("--");
echartResult5.setSeries(month + "月");
Map<String, Object> map5 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_GXEL_GS_ACC_FIT0005");
if(map5!=null){
echartResult5.setValue(map5.get("value").toString());
}
f5List.add(echartResult5);
}
}
map.put("F0001",f1List);
map.put("F0002",f2List);
map.put("F0003",f3List);
map.put("F0004",f4List);
map.put("F0005",f5List);
return map;
}
@Override
public Map<String, Object> getYearSumFlow(SumFlowParams sumFlowParams) {
Map<String, Object> map = new HashMap<>();
List<EchartResult> f1List = new ArrayList<>();
List<EchartResult> f2List = new ArrayList<>();
List<EchartResult> f3List = new ArrayList<>();
List<EchartResult> f4List = new ArrayList<>();
List<EchartResult> f5List = new ArrayList<>();
if(!"".equals(sumFlowParams.getYear())&&sumFlowParams.getYear()!=null){
List<Map<String, Object>> monitorList = new ArrayList<>();
int currentYear = LocalDate.now().getYear();// 获取当前年份 currentYear
String year = sumFlowParams.getYear();
String[] yearsArray = getYearsArray(year,String.valueOf(currentYear));
String startTime = year + "-01-01 00:00:00";
String endTime = currentYear + "-12-31 23:59:59";
monitorList = fmPgQueryService.queryAotiCurveDataByYear(LJLL_FIELDS,startTime,endTime);
for (int i = 0; i < yearsArray.length; i++) {
String echartName = yearsArray[i];
EchartResult echartResult1 = new EchartResult();
echartResult1.setName(echartName);
echartResult1.setValue("--");
echartResult1.setSeries("年度");
Map<String, Object> map1 = getMapFormList(monitorList,yearsArray[i],"");
if(map1!=null){
echartResult1.setValue(map1.get("value").toString());
}
f1List.add(echartResult1);
EchartResult echartResult2 = new EchartResult();
echartResult2.setName(echartName);
echartResult2.setValue("--");
echartResult2.setSeries("年度");
Map<String, Object> map2 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
if(map2!=null){
echartResult2.setValue(map2.get("value").toString());
}
f2List.add(echartResult2);
EchartResult echartResult3 = new EchartResult();
echartResult3.setName(echartName);
echartResult3.setValue("--");
echartResult3.setSeries("年度");
Map<String, Object> map3 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
if(map3!=null){
echartResult3.setValue(map3.get("value").toString());
}
f3List.add(echartResult3);
EchartResult echartResult4 = new EchartResult();
echartResult4.setName(echartName);
echartResult4.setValue("--");
echartResult4.setSeries("年度");
Map<String, Object> map4 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
if(map4!=null){
echartResult4.setValue(map4.get("value").toString());
}
f4List.add(echartResult4);
EchartResult echartResult5 = new EchartResult();
echartResult5.setName(echartName);
echartResult5.setValue("--");
echartResult5.setSeries("年度");
Map<String, Object> map5 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
if(map5!=null){
echartResult5.setValue(map5.get("value").toString());
}
f5List.add(echartResult5);
}
}
map.put("F0001",f1List);
map.put("F0002",f2List);
map.put("F0003",f3List);
map.put("F0004",f4List);
map.put("F0005",f5List);
return map;
}
//遍历两个年份之间的年份
private static String[] getYearsArray(String startYear, String endYear) {
int length = Integer.parseInt(endYear) - Integer.parseInt(startYear) + 1;
String[] years = new String[length];
for (int i = 0; i < length; i++) {
years[i] = String.valueOf(Integer.parseInt(startYear) + i);
}
return years;
}
//List中精确查找元素
public Map<String, Object> getMapFormList(List<Map<String, Object>> list,String dataTime,String monitorId){
Map<String, Object> resultMap = new HashMap<>();
Optional<Map<String, Object>> result = list.stream()
......
......@@ -10,9 +10,16 @@ public class SumFlowParams {
/**聚合类型 日:day, 月:month,年:year*/
private String sumType;
/**开始时间 yyyy-MM-DD*/
private String start;
/**结束时间 yyyy-MM-DD*/
private String end;
/**时间 年月 yyyy-MM*/
private String yearMonth;
/**时间 年 yyyy*/
private String year;
}
......
......@@ -21,10 +21,13 @@ public interface IFmPgQueryService {
* @param tableType 表类型 0实时 1计算
* @return
*/
public List<Map<String,Object>> queryFactoryInfos(String departId,String fields,String startTime,String endTime,String tableType);
List<Map<String,Object>> queryFactoryInfos(String departId,String fields,String startTime,String endTime,String tableType);
public List<Map<String, Object>> queryReportData(String departId,String fields,String startTime,String endTime,String reportType);
List<Map<String, Object>> queryReportData(String departId,String fields,String startTime,String endTime,String reportType);
public List<Map<String, Object>> queryAotiCurveData(String fields,String startTime,String endTime,String sumType,int strCount);
List<Map<String, Object>> queryAotiCurveData(String fields,String startTime,String endTime,String sumType,int strCount);
List<Map<String, Object>> queryAotiCurveDataByMonth(String fields, String startTime, String endTime, String month);
List<Map<String, Object>> queryAotiCurveDataByYear(String fields, String startTime, String endTime);
}
......
......@@ -393,4 +393,75 @@ public class FmPgQueryServiceImpl implements IFmPgQueryService {
}
return dataList;
}
@Override
public List<Map<String, Object>> queryAotiCurveDataByMonth(String fields, String startTime, String endTime, String month) {
List<Map<String, Object>> dataList = new ArrayList<>();
//获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db");
String countTableName = "a01a21a03_count";
//获取要查询的指标
String fieldSqlPart = "";
String[] fieldsArr = fields.split(",");
for (int i = 0; i < fieldsArr.length; ++i){
fieldSqlPart = fieldSqlPart + (",'"+fieldsArr[i]+"'");
}
if(!StringUtils.isEmpty(fieldSqlPart)) {
fieldSqlPart = fieldSqlPart.substring(1);
}
try{
String tsStartTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(startTime, "yyyy-MM-dd HH:mm:ss"))/1000);
String tsEndTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(endTime, "yyyy-MM-dd HH:mm:ss"))/1000);
String sql = "SELECT * FROM (" +
"SELECT nm, " +
" LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 7) AS time, " +
" SUM(v::numeric) AS value " +
" FROM " + countTableName +
" WHERE nm in ("+fieldSqlPart+")" +
" AND type = 'def'" +
" AND ts >= ? AND ts < ? " +
" GROUP BY nm, time " +
" ORDER BY time" +
") a " +
"WHERE RIGHT(a.time,2) = '"+month+"' ";
dataList = pgDB.queryForList(sql,tsStartTime,tsEndTime);
}catch (Exception e){
e.printStackTrace();
}
return dataList;
}
@Override
public List<Map<String, Object>> queryAotiCurveDataByYear(String fields, String startTime, String endTime) {
List<Map<String, Object>> dataList = new ArrayList<>();
//获取数据采集pg数据库,实时数据获取统一从数据采集pg库获取
JdbcTemplate pgDB = (JdbcTemplate)SpringContextUtils.getBean("pg-db");
String countTableName = "a01a21a03_count";
//获取要查询的指标
String fieldSqlPart = "";
String[] fieldsArr = fields.split(",");
for (int i = 0; i < fieldsArr.length; ++i){
fieldSqlPart = fieldSqlPart + (",'"+fieldsArr[i]+"'");
}
if(!StringUtils.isEmpty(fieldSqlPart)) {
fieldSqlPart = fieldSqlPart.substring(1);
}
try{
String tsStartTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(startTime, "yyyy-MM-dd HH:mm:ss"))/1000);
String tsEndTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(endTime, "yyyy-MM-dd HH:mm:ss"))/1000);
String sql = "SELECT nm, " +
" LEFT(TO_CHAR(TO_TIMESTAMP(CAST(ts AS INTEGER)), 'YYYY-MM-DD HH24:MI:SS'), 4) AS time, " +
" SUM(v::numeric) AS value " +
" FROM " + countTableName +
" WHERE nm in ("+fieldSqlPart+")" +
" AND type = 'def'" +
" AND ts >= ? AND ts < ? " +
" GROUP BY nm, time " +
" ORDER BY time";
dataList = pgDB.queryForList(sql,tsStartTime,tsEndTime);
}catch (Exception e){
e.printStackTrace();
}
return dataList;
}
}
......
......@@ -96,17 +96,17 @@ spring:
username: jk_test
password: Jk_test1211rw
driver-class-name: com.mysql.jdbc.Driver
# mysql-alarm:
# url: jdbc:mysql://47.104.99.86:3306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false
# username: id_rw
# password: s2eCvUEPO2Vk3U1w
# driver-class-name: com.mysql.jdbc.Driver
# # 多数据源配置
# pg-db:
# url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8
# username: postgres
# password: JKjnf9713xt
# driver-class-name: org.postgresql.Driver
mysql-alarm:
url: jdbc:mysql://47.104.99.86:3306/intelligent-devices?characterEncoding=UTF-8&useUnicode=true&useSSL=false
username: id_rw
password: s2eCvUEPO2Vk3U1w
driver-class-name: com.mysql.jdbc.Driver
# 多数据源配置
pg-db:
url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8
username: postgres
password: JKjnf9713xt
driver-class-name: org.postgresql.Driver
#redis 配置
redis:
database: 0
......
spring:
profiles:
active: dev
active: prod
# 信息安全
security:
csrf:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!