Commit 6068daf4 authored by zhengjiangtao's avatar zhengjiangtao

Merge branch 'develop_20200601' of http://172.16.10.76/bank/AmosBankRoot into develop_20200601

parents 3dcf3e19 8f14decd
...@@ -148,7 +148,6 @@ public class AlarmPointController extends BaseController { ...@@ -148,7 +148,6 @@ public class AlarmPointController extends BaseController {
map.put("level",listyc.get(i).get("code")); map.put("level",listyc.get(i).get("code"));
lista.add(map); lista.add(map);
} }
......
...@@ -18,8 +18,8 @@ public interface IAlarmRepository extends IBaseRepository<Alarm, String> { ...@@ -18,8 +18,8 @@ public interface IAlarmRepository extends IBaseRepository<Alarm, String> {
@Query(value="select * from spc_alarm where query_column =?1 AND current_state in ('未确认未清除','已确认未清除','异常','告警')",nativeQuery=true ) @Query(value="select * from spc_alarm where query_column =?1 AND current_state in ('未确认未清除','已确认未清除','异常','告警')",nativeQuery=true )
public List<Alarm> selectByQueryColumn(String type); public List<Alarm> selectByQueryColumn(String type);
@Query(value="select COUNT(*) value,spc_alarm.alarm_level name from spc_alarm where spc_alarm.org_code like CONCAT('%', ?1, '%' ) and spc_alarm.current_state in ('未确认未清除','已确认未清除','异常','告警') GROUP BY spc_alarm.alarm_level ",nativeQuery=true ) @Query(value="select COUNT(*) value,sa.alarm_level name, sa.org_code orgCode from spc_alarm sa where sa.org_code like CONCAT('%', ?1, '%' ) and sa.current_state in ('未确认未清除','已确认未清除','异常','告警') GROUP BY sa.alarm_level, sa.org_code",nativeQuery=true )
public List<Object[]> countnum(String code); public List<Map<String, Object>> countnum(String code);
} }
...@@ -20,7 +20,7 @@ public void saveBatch(List<Alarm> alarms); ...@@ -20,7 +20,7 @@ public void saveBatch(List<Alarm> alarms);
public List<Alarm> findByQueryColumn(String queryColumn); public List<Alarm> findByQueryColumn(String queryColumn);
public List<Object[]> countnum(String code); public List<Map<String, Object>> countnum(String code);
List<HashMap<String, Object>> getcountxd(String code); List<HashMap<String, Object>> getcountxd(String code);
List<HashMap<String, Object>> getcountnum(String code); List<HashMap<String, Object>> getcountnum(String code);
List<HashMap<String, Object>> getcountyc( String code); List<HashMap<String, Object>> getcountyc( String code);
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.bank.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.bank.service.impl;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -46,8 +47,7 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl ...@@ -46,8 +47,7 @@ public class spcAlarmServiceImpl extends GenericManagerImpl<Alarm, String> impl
return iAlarmDao.selectByQueryColumn(queryColumn); return iAlarmDao.selectByQueryColumn(queryColumn);
} }
public List<Object[]> countnum(String code) { public List<Map<String, Object>> countnum(String code) {
return iAlarmDao.countnum(code); return iAlarmDao.countnum(code);
} }
......
...@@ -3,9 +3,13 @@ package com.yeejoin.amos.spc.business.controller; ...@@ -3,9 +3,13 @@ package com.yeejoin.amos.spc.business.controller;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.amos.bank.dto.TopographyTreeDTO;
import liquibase.pro.packaged.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -79,7 +83,6 @@ public class AlarmController extends BaseController { ...@@ -79,7 +83,6 @@ public class AlarmController extends BaseController {
String code = reginParams.getCompany().getOrgCode(); String code = reginParams.getCompany().getOrgCode();
List<Map<String, Object>> listdate2 = new ArrayList<>(); List<Map<String, Object>> listdate2 = new ArrayList<>();
List<String> listd = new ArrayList<>(); List<String> listd = new ArrayList<>();
listd.add("紧急告警"); listd.add("紧急告警");
...@@ -87,17 +90,21 @@ public class AlarmController extends BaseController { ...@@ -87,17 +90,21 @@ public class AlarmController extends BaseController {
listd.add("次要告警"); listd.add("次要告警");
listd.add("警告告警"); listd.add("警告告警");
List<Map<String, Object>> listdate1 = new ArrayList<>(); List<Map<String, Object>> listdate1 = new ArrayList<>();
List<Object[]> list = iAlarmService.countnum(code);
List<Map<String, Object>> listdate = new ArrayList<>(); List<Map<String, Object>> listdate = iAlarmService.countnum(code);
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) { //list.forEach();
Map<String, Object> map = new HashMap<>();
Object[] h = list.get(i); // List<Map<String, Object>> listdate = new ArrayList<>();
map.put("name", h[1]); // if (list != null && list.size() > 0) {
map.put("value", h[0]); // for (int i = 0; i < list.size(); i++) {
listdate.add(map); // Map<String, Object> map = new HashMap<>();
} // Object[] h = list.get(i);
} // map.put("name", h[1]);
// map.put("value", h[0]);
// listdate.add(map);
// }
// }
if (listdate != null && listdate.size() > 0) { if (listdate != null && listdate.size() > 0) {
if (listdate.size() == 4) { if (listdate.size() == 4) {
...@@ -108,7 +115,6 @@ public class AlarmController extends BaseController { ...@@ -108,7 +115,6 @@ public class AlarmController extends BaseController {
} }
} }
} }
return CommonResponseUtil.success(listdate2); return CommonResponseUtil.success(listdate2);
} else { } else {
for (int i = 0; i < listd.size(); i++) { for (int i = 0; i < listd.size(); i++) {
...@@ -122,14 +128,19 @@ public class AlarmController extends BaseController { ...@@ -122,14 +128,19 @@ public class AlarmController extends BaseController {
if (map.isEmpty()) { if (map.isEmpty()) {
map.put("value", 0); map.put("value", 0);
if ((listd.get(i) + "").equals("紧急告警")) { switch (listd.get(i)) {
map.put("name", "紧急告警"); case "紧急告警":
} else if ((listd.get(i) + "").equals("重要告警")) { map.put("name", "紧急告警");
map.put("name", "重要告警"); break;
} else if ((listd.get(i) + "").equals("警告告警")) { case "重要告警":
map.put("name", "警告告警"); map.put("name", "重要告警");
} else { break;
map.put("name", "次要告警"); case "警告告警":
map.put("name", "警告告警");
break;
case "次要告警":
map.put("name", "次要告警");
break;
} }
} }
listdate1.add(map); listdate1.add(map);
...@@ -150,7 +161,6 @@ public class AlarmController extends BaseController { ...@@ -150,7 +161,6 @@ public class AlarmController extends BaseController {
map.put("name", "次要告警"); map.put("name", "次要告警");
} }
} }
listdate1.add(map); listdate1.add(map);
} }
} }
...@@ -166,7 +176,8 @@ public class AlarmController extends BaseController { ...@@ -166,7 +176,8 @@ public class AlarmController extends BaseController {
} }
} }
return CommonResponseUtil.success(listdate2); List<Map<String, Object>> result = refactorByOrgCode(listdate2, code);
return CommonResponseUtil.success(result);
} }
private List<CommonRequest> toNewQuery(List<CommonRequest> queryRequests, CommonRequest commonRequest) { private List<CommonRequest> toNewQuery(List<CommonRequest> queryRequests, CommonRequest commonRequest) {
...@@ -183,4 +194,34 @@ public class AlarmController extends BaseController { ...@@ -183,4 +194,34 @@ public class AlarmController extends BaseController {
); );
return newQueryRequests; return newQueryRequests;
} }
private List<Map<String, Object>> refactorByOrgCode(List<Map<String, Object>> list, String orgCode) {
List<Map<String, Object>> result = new ArrayList<>();
list.forEach(
x -> {
HashMap<String, Object> newMap = new HashMap<>();
newMap.putAll(x);
if (!contrastStr(newMap.get("orgCode"), orgCode) && Integer.valueOf(newMap.get("value").toString()) != 0) {
newMap.put("value", 0);
}
newMap.remove("orgCode");
result.add(newMap);
}
);
return result;
}
private boolean contrastStr(Object mapOrgCode, String orgCode) {
boolean flag = false;
if (ObjectUtils.isEmpty(mapOrgCode)) {
return flag;
}
if (mapOrgCode.toString().contains("-")) {
mapOrgCode = mapOrgCode.toString().replace("-", "#");
}
if ((mapOrgCode + "#").contains(orgCode + "#")) {
flag = true;
}
return flag;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment