| | |
| | | import com.moral.api.util.LogUtils; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.util.ConvertUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Map<String, Object> updateMonitorPoint(Map<String,Object> updateMap) { |
| | | public Map<String, Object> updateMonitorPoint(Map<String,Object> parameterMap) { |
| | | Map resultMap = new HashMap(); |
| | | Map<String,Object> updateMap = new HashMap<>(); |
| | | for (String key : parameterMap.keySet()) { |
| | | updateMap.put(ConvertUtils.toLine(key),parameterMap.get(key)); |
| | | } |
| | | if(!updateMap.containsKey("id")){ |
| | | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | |
| | | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_NOT_EXIST.getMsg()); |
| | | return resultMap; |
| | | } |
| | | if (updateMap.get("name")==null||updateMap.get("name")==""){ |
| | | if (updateMap.get("name").equals("")){ |
| | | resultMap.put("code",ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | return resultMap; |
| | | } |
| | | QueryWrapper<MonitorPoint> wapper_name = new QueryWrapper<>(); |
| | | wapper_name.eq("name",updateMap.get("name")); |
| | | wapper_name.eq("is_delete",Constants.NOT_DELETE); |
| | | MonitorPoint monitorPoint_name = monitorPointMapper.selectOne(wapper_name); |
| | | if(monitorPoint_name!=null&&!monitorPoint_name.getId().toString().equals(updateMap.get("id").toString())){ |
| | | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getMsg()); |
| | | return resultMap; |
| | | if (updateMap.get("name")!=null){ |
| | | QueryWrapper<MonitorPoint> wapper_name = new QueryWrapper<>(); |
| | | wapper_name.eq("name",updateMap.get("name")); |
| | | wapper_name.eq("is_delete",Constants.NOT_DELETE); |
| | | MonitorPoint monitorPoint_name = monitorPointMapper.selectOne(wapper_name); |
| | | if(monitorPoint_name!=null&&!monitorPoint_name.getId().toString().equals(updateMap.get("id").toString())){ |
| | | resultMap.put("code",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getCode()); |
| | | resultMap.put("msg",ResponseCodeEnum.MONITOR_POINT_IS_EXIST.getMsg()); |
| | | return resultMap; |
| | | } |
| | | } |
| | | monitorPointMapper.updateMonitorPoint(updateMap); |
| | | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |