| | |
| | | import java.util.stream.Collectors;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.moral.mapper.DictionaryDataMapper;
|
| | | import com.moral.mapper.OrganizationMapper;
|
| | | import org.apache.commons.collections.CollectionUtils;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | |
| | | @Resource
|
| | | private DeviceMapper deviceMapper;
|
| | | @Resource
|
| | | private OrganizationMapper orgMapper;
|
| | | @Resource
|
| | | RedisUtils redisUtils;
|
| | | @Resource
|
| | | DictionaryDataMapper dictionaryDataMapper;
|
| | |
|
| | | private static Class ENTITY_CLASS = MonitorPoint.class;
|
| | | @Override
|
| | | public List<MonitorPoint> getMonitorPointsByAreaName(Map<String, Object> parameters) {
|
| | |
| | | @Override
|
| | | public List<MonitorPoint> queryWithStateByMap(Map<String, Object> params){
|
| | | params.put("isDelete",Constants.IS_DELETE_FALSE);
|
| | | List<MonitorPoint> monitorPointList = monitorPointMapper.selectByMap(params);
|
| | | for(MonitorPoint monitorPoint:monitorPointList){
|
| | | Integer state = getStateFromRedis(monitorPoint.getId());
|
| | | monitorPoint.setState(state);
|
| | | Object orgIdObj = params.get("orgId");
|
| | | List<MonitorPoint> monitorPointList = null;
|
| | | if(orgIdObj != null) {
|
| | | Integer orgId = Integer.parseInt(orgIdObj.toString());
|
| | | List<Integer> orgIds = orgMapper.selectLowerOrgIds(orgId);
|
| | | params.put("orgIds",orgIds);
|
| | | monitorPointList = monitorPointMapper.selectByMap(params);
|
| | | for(MonitorPoint monitorPoint:monitorPointList){
|
| | | Integer state = getStateFromRedis(monitorPoint.getId());
|
| | | monitorPoint.setState(state);
|
| | | }
|
| | | }
|
| | | return monitorPointList;
|
| | | return monitorPointList == null ? new ArrayList<>() : monitorPointList;
|
| | | }
|
| | | private Integer getStateFromRedis(Integer monitorPointId){
|
| | | StringBuilder key = new StringBuilder();
|
| | |
| | | criteria.andEqualTo(parameters.get("name").toString(), parameters.get("value"));
|
| | | return monitorPointMapper.selectByExample(example);
|
| | | }
|
| | | @Override
|
| | | public List<Integer> queryVersionsById(Integer id){
|
| | | return monitorPointMapper.selectVersionsById(id);
|
| | | }
|
| | | @Override
|
| | | public MonitorPoint queryMonitorPointById(Integer mpointId) {
|
| | | return this.monitorPointMapper.selectByPrimaryKey(mpointId);
|
| | | }
|
| | | }
|