d1036995 张雷

奥体项目分类统计流量接口开发

1 个父辈 2d3ecf2c
......@@ -283,4 +283,26 @@ public class OlympicCenterController {
result.setSuccess(true);
return result;
}
@ApiOperation(value="分组获取相同月份的累计流量数据", notes="分组获取相同月份的累计流量数据")
@GetMapping(value = "/getYearMonthSumFlowGroup")
public Result<Map<String,Object>> getYearMonthSumFlowGroup(SumFlowParams sumFlowParams){
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = new HashMap<>();
map = olympicCenterService.getYearMonthSumFlowGroup(sumFlowParams);
result.setResult(map);
result.setSuccess(true);
return result;
}
@ApiOperation(value="分组获取年度的累计流量数据", notes="分组获取年度的累计流量数据")
@GetMapping(value = "/getYearSumFlowGroup")
public Result<Map<String,Object>> getYearSumFlowGroup(SumFlowParams sumFlowParams){
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> map = new HashMap<>();
map = olympicCenterService.getYearSumFlowGroup(sumFlowParams);
result.setResult(map);
result.setSuccess(true);
return result;
}
}
......
......@@ -53,4 +53,8 @@ public interface IOlympicCenterService {
Map<String, Object> getYearMonthSumFlow(SumFlowParams sumFlowParams);
Map<String, Object> getYearSumFlow(SumFlowParams sumFlowParams);
Map<String, Object> getYearMonthSumFlowGroup(SumFlowParams sumFlowParams);
Map<String, Object> getYearSumFlowGroup(SumFlowParams sumFlowParams);
}
......
......@@ -1181,6 +1181,9 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("value","--");
dataMap.put("status","abnormal");
if("F0001".equals(whatStructData.getId())){
dataMap.put("status","normal");
}
kMap.put("flow", dataMap);
kMap.put("flow_ljll", dataMap);
kMap.put("flow_rljll", dataMap);
......@@ -1218,6 +1221,9 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("value","--");
dataMap.put("status","abnormal");
if("P0001".equals(whatStructData.getId())){
dataMap.put("status","normal");
}
map.put(whatStructData.getId(),dataMap);
}
}
......@@ -2585,6 +2591,212 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
return map;
}
@Override
public Map<String, Object> getYearMonthSumFlowGroup(SumFlowParams sumFlowParams) {
Map<String, Object> map = new HashMap<>();
List<EchartResult> shList = new ArrayList<>();
List<EchartResult> xfList = new ArrayList<>();
List<EchartResult> allList = new ArrayList<>();
//定义返回的结构MAP
Map<String,Object> shMap = new HashMap<>();
Map<String,Object> xfMap = new HashMap<>();
Map<String,Object> allMap = new HashMap<>();
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];
double shCount = 0.00;
double xfCount = 0.00;
double allCount = 0.00;
String value1 = "0";
String value2 = "0";
String value3 = "0";
String value4 = "0";
String value5 = "0";
EchartResult shResult = new EchartResult();
shResult.setName(echartName);
shResult.setSeries(month + "月");
EchartResult xfResult = new EchartResult();
xfResult.setName(echartName);
xfResult.setSeries(month + "月");
EchartResult allResult = new EchartResult();
allResult.setName(echartName);
allResult.setSeries(month + "月");
Map<String, Object> map001 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"");
if(map001!=null){
value1 = map001.get("value").toString();
}else{
value1 = "0.00";
}
allCount = allCount + Double.parseDouble(value1);
Map<String, Object> map002 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_FZLYL_XF_ACC_FIT0002");
if(map002!=null){
value2 = map002.get("value").toString();
}else{
value2 = "0.00";
}
allCount = allCount + Double.parseDouble(value2);
xfCount = xfCount + Double.parseDouble(value2);
Map<String, Object> map003 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_FZLYL_GS_ACC_FIT0003");
if(map003!=null){
value3 = map003.get("value").toString();
}else{
value3 = "0.00";
}
allCount = allCount + Double.parseDouble(value3);
shCount = shCount + Double.parseDouble(value3);
Map<String, Object> map004 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_GXEL_XF_ACC_FIT0004");
if(map004!=null){
value4 = map004.get("value").toString();
}else{
value4 = "0.00";
}
allCount = allCount + Double.parseDouble(value4);
xfCount = xfCount + Double.parseDouble(value4);
Map<String, Object> map005 = getMapFormList(monitorList,yearsArray[i]+"-"+month,"A01A21A03_GXEL_GS_ACC_FIT0005");
if(map005!=null){
value5 = map005.get("value").toString();
}else{
value5 = "0.00";
}
allCount = allCount + Double.parseDouble(value5);
shCount = shCount + Double.parseDouble(value5);
shResult.setValue(String.valueOf(shCount));
xfResult.setValue(String.valueOf(xfCount));
allResult.setValue(String.valueOf(allCount));
shList.add(shResult);
xfList.add(xfResult);
allList.add(allResult);
}
}
shMap.put("data",shList);
Map<String, Object> map1 = getMaxAndMin(shList);
shMap.put("max",map1.get("max"));
shMap.put("min",map1.get("min"));
xfMap.put("data",xfList);
Map<String, Object> map2 = getMaxAndMin(xfList);
xfMap.put("max",map2.get("max"));
xfMap.put("min",map2.get("min"));
allMap.put("data",allList);
Map<String, Object> map3 = getMaxAndMin(allList);
allMap.put("max",map3.get("max"));
allMap.put("min",map3.get("min"));
map.put("SHGS",shMap);
map.put("XFYS",xfMap);
map.put("ALL",allMap);
return map;
}
@Override
public Map<String, Object> getYearSumFlowGroup(SumFlowParams sumFlowParams) {
Map<String, Object> map = new HashMap<>();
List<EchartResult> shList = new ArrayList<>();
List<EchartResult> xfList = new ArrayList<>();
List<EchartResult> allList = new ArrayList<>();
//定义返回的结构MAP
Map<String,Object> shMap = new HashMap<>();
Map<String,Object> xfMap = new HashMap<>();
Map<String,Object> allMap = new HashMap<>();
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];
double shCount = 0.00;
double xfCount = 0.00;
double allCount = 0.00;
String value1 = "0";
String value2 = "0";
String value3 = "0";
String value4 = "0";
String value5 = "0";
EchartResult shResult = new EchartResult();
shResult.setName(echartName);
shResult.setSeries("年度");
EchartResult xfResult = new EchartResult();
xfResult.setName(echartName);
xfResult.setSeries("年度");
EchartResult allResult = new EchartResult();
allResult.setName(echartName);
allResult.setSeries("年度");
Map<String, Object> map001 = getMapFormList(monitorList,yearsArray[i],"");
if(map001!=null){
value1 = map001.get("value").toString();
}else{
value1 = "0.00";
}
allCount = allCount + Double.parseDouble(value1);
Map<String, Object> map002 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_FZLYL_XF_ACC_FIT0002");
if(map002!=null){
value2 = map002.get("value").toString();
}else{
value2 = "0.00";
}
allCount = allCount + Double.parseDouble(value2);
xfCount = xfCount + Double.parseDouble(value2);
Map<String, Object> map003 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_FZLYL_GS_ACC_FIT0003");
if(map003!=null){
value3 = map003.get("value").toString();
}else{
value3 = "0.00";
}
allCount = allCount + Double.parseDouble(value3);
shCount = shCount + Double.parseDouble(value3);
Map<String, Object> map004 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_GXEL_XF_ACC_FIT0004");
if(map004!=null){
value4 = map004.get("value").toString();
}else{
value4 = "0.00";
}
allCount = allCount + Double.parseDouble(value4);
xfCount = xfCount + Double.parseDouble(value4);
Map<String, Object> map005 = getMapFormList(monitorList,yearsArray[i],"A01A21A03_GXEL_GS_ACC_FIT0005");
if(map005!=null){
value5 = map005.get("value").toString();
}else{
value5 = "0.00";
}
allCount = allCount + Double.parseDouble(value5);
shCount = shCount + Double.parseDouble(value5);
shResult.setValue(String.valueOf(shCount));
xfResult.setValue(String.valueOf(xfCount));
allResult.setValue(String.valueOf(allCount));
shList.add(shResult);
xfList.add(xfResult);
allList.add(allResult);
}
}
shMap.put("data",shList);
Map<String, Object> map1 = getMaxAndMin(shList);
shMap.put("max",map1.get("max"));
shMap.put("min",map1.get("min"));
xfMap.put("data",xfList);
Map<String, Object> map2 = getMaxAndMin(xfList);
xfMap.put("max",map2.get("max"));
xfMap.put("min",map2.get("min"));
allMap.put("data",allList);
Map<String, Object> map3 = getMaxAndMin(allList);
allMap.put("max",map3.get("max"));
allMap.put("min",map3.get("min"));
map.put("SHGS",shMap);
map.put("XFYS",xfMap);
map.put("ALL",allMap);
return map;
}
//遍历两个年份之间的年份
private static String[] getYearsArray(String startYear, String endYear) {
int length = Integer.parseInt(endYear) - Integer.parseInt(startYear) + 1;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!