| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | |
| | |
| | | /** |
| | | * 批量报警类型用户关联 |
| | | * |
| | | * @param commands 报警类型列表 |
| | | * @param configInfo 报警类型列表 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertArdAlarmTypeConfig(List<Integer> commands) { |
| | | public int insertArdAlarmTypeConfig(Map<String,Object> configInfo) { |
| | | String userId =(String) configInfo.get("userId"); |
| | | if(userId==null) |
| | | { |
| | | return 0; |
| | | } |
| | | ardAlarmTypeConfigMapper.deleteArdAlarmTypeConfigByCurrentUserId(userId); |
| | | List<Integer> commands=(List<Integer>) configInfo.get("commands"); |
| | | if(commands==null) |
| | | { |
| | | return 0; |
| | | } |
| | | if(commands.size()==0) |
| | | { |
| | | return 0; |
| | | } |
| | | int resNum=0; |
| | | for(Integer command :commands) |
| | | { |
| | |
| | | List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType("alarm_type"); |
| | | SysDictData sysDictData = dictDatas.stream().filter(s -> Objects.equals(s.getDictValue(), command.toString())).findFirst().orElse(null); |
| | | config.setAlarmType(sysDictData.getDictLabel()); |
| | | config.setUserId(SecurityUtils.getUserId()); |
| | | config.setUserId(userId); |
| | | config.setCreateTime(DateUtils.getNowDate()); |
| | | int i = ardAlarmTypeConfigMapper.insertArdAlarmTypeConfig(config); |
| | | if(i>0) |
| | |
| | | } |
| | | } |
| | | return resNum; |
| | | } |
| | | |
| | | @Override |
| | | public int deleteArdAlarmTypeConfigByCurrentUserId() { |
| | | return ardAlarmTypeConfigMapper.deleteArdAlarmTypeConfigByCurrentUserId(SecurityUtils.getUserId()); |
| | | } |
| | | } |