| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.moral.api.entity.Device; |
| | | import com.moral.api.entity.MonitorPoint; |
| | | import com.moral.api.entity.Organization; |
| | | import com.moral.api.entity.SysArea; |
| | | import com.moral.api.mapper.DeviceMapper; |
| | | import com.moral.api.mapper.MonitorPointMapper; |
| | | import com.moral.api.mapper.OrganizationMapper; |
| | | import com.moral.api.mapper.SysAreaMapper; |
| | |
| | | @Autowired(required = false) |
| | | private SysAreaMapper sysAreaMapper; |
| | | |
| | | @Autowired |
| | | LogUtils logUtils; |
| | | @Autowired(required = false) |
| | | private DeviceMapper deviceMapper; |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | //操作插入日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | String content = "添加了站点:"+monitorPoint.getName()+";"; |
| | | logUtils.saveOperationForManage(request,content,Constants.INSERT_OPERATE_TYPE); |
| | | LogUtils.saveOperationForManage(request,content,Constants.INSERT_OPERATE_TYPE); |
| | | resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return resultMap; |
| | |
| | | int totalNumber = monitorPointMapper.selectCount(wrapper); |
| | | String orderType = map.get("orderType").toString(); |
| | | if (orderType.equals(Constants.ORDER_ASC)){ |
| | | wrapper.orderByAsc("create_time"); |
| | | wrapper.orderByAsc("update_time"); |
| | | }else { |
| | | wrapper.orderByDesc("create_time"); |
| | | wrapper.orderByDesc("update_time"); |
| | | } |
| | | Page resultPage = monitorPointMapper.selectPage(page,wrapper); |
| | | List<MonitorPoint> monitorPoints = resultPage.getRecords(); |
| | |
| | | } |
| | | } |
| | | monitorPointMapper.updateMonitorPoint(updateMap); |
| | | String deviceContent = ""; |
| | | if (!ObjectUtils.isEmpty(parameterMap.get("organizationId")) && parameterMap.get("organizationId") != null){ |
| | | Device device = new Device(); |
| | | device.setOrganizationId(Integer.parseInt(parameterMap.get("organizationId").toString())); |
| | | QueryWrapper<Device> deviceWrapper = new QueryWrapper(); |
| | | deviceWrapper.eq("monitor_point_id",oldMonitorPoint.getId()); |
| | | deviceWrapper.eq("is_delete",Constants.NOT_DELETE); |
| | | List<Device> devices = deviceMapper.selectList(deviceWrapper); |
| | | deviceMapper.update(device, deviceWrapper); |
| | | if (devices.size()>0){ |
| | | for (Device dev:devices) { |
| | | deviceContent = deviceContent+"修改了设备:"+dev.getName()+";organizationId:"+dev.getOrganizationId()+"->"+parameterMap.get("organizationId"); |
| | | } |
| | | } |
| | | } |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | String content = "修改了站点:"+oldMonitorPoint.getName()+";"; |
| | | for (Object key:updateMap.keySet()) { |
| | |
| | | content = content+"描述:"+oldMonitorPoint.getDesc()+"->"+updateMap.get(key)+";"; |
| | | } |
| | | } |
| | | logUtils.saveOperationForManage(request,content,Constants.UPDATE_OPERATE_TYPE); |
| | | content = content+deviceContent; |
| | | LogUtils.saveOperationForManage(request,content,Constants.UPDATE_OPERATE_TYPE); |
| | | resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return resultMap; |
| | |
| | | //操作插入日志 |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | String content = "删除了站点:"+monitorPoint.getName()+";"; |
| | | logUtils.saveOperationForManage(request,content,Constants.DELETE_OPERATE_TYPE); |
| | | LogUtils.saveOperationForManage(request,content,Constants.DELETE_OPERATE_TYPE); |
| | | resultMap.put("code",ResponseCodeEnum.SUCCESS.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.SUCCESS.getMsg()); |
| | | return resultMap; |
| | |
| | | int totalNumber = monitorPointMapper.selectCount(wrapper); |
| | | String orderType = map.get("orderType").toString(); |
| | | if (orderType.equals(Constants.ORDER_ASC)){ |
| | | wrapper.orderByAsc("create_time"); |
| | | wrapper.orderByAsc("update_time"); |
| | | }else { |
| | | wrapper.orderByDesc("create_time"); |
| | | wrapper.orderByDesc("update_time"); |
| | | } |
| | | Page resultPage = monitorPointMapper.selectPage(page,wrapper); |
| | | List<MonitorPoint> monitorPoints = resultPage.getRecords(); |
| | |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | public List<MonitorPoint> getMonitorPointsByOrganizationId(Integer organizationId) { |
| | | QueryWrapper<MonitorPoint> monitorPointQueryWrapper = new QueryWrapper<>(); |
| | | MonitorPoint monitorPoint = new MonitorPoint(); |
| | | monitorPoint.setOrganizationId(organizationId); |
| | | monitorPoint.setIsDelete(Constants.NOT_DELETE); |
| | | monitorPointQueryWrapper.setEntity(monitorPoint); |
| | | List<MonitorPoint> monitorPoints = monitorPointMapper.selectList(monitorPointQueryWrapper); |
| | | return monitorPoints; |
| | | } |
| | | |
| | | /** |
| | | * @Description: 获取地区名 |
| | | * @Param: [areaArr, menu]menuMap:key为menuid,value为menu |