| | |
| | | package com.wgcloud.service; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.wgcloud.entity.Equipment; |
| | | import com.wgcloud.entity.FailureLogging; |
| | | import com.wgcloud.mapper.EquipmentMapper; |
| | | import com.wgcloud.mapper.FailureLoggingMapper; |
| | | import com.wgcloud.util.DateUtil; |
| | | import com.wgcloud.util.HostUtil; |
| | | import com.wgcloud.util.UUIDUtil; |
| | | import com.wgcloud.util.staticvar.StaticKeys; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author kdq |
| | |
| | | */ |
| | | @Service |
| | | public class FailureLoggingService { |
| | | @Autowired |
| | | private FailureLoggingMapper failureLoggingMapper; |
| | | @Autowired |
| | | private LogInfoService logInfoService; |
| | | |
| | | public PageInfo selectByParams(Map<String, Object> params, Integer currPage, Integer pageSize)throws Exception { |
| | | PageHelper.startPage(currPage, pageSize); |
| | | List<FailureLogging> list = failureLoggingMapper.selectByParams(params); |
| | | PageInfo<FailureLogging> pageInfo = new PageInfo<FailureLogging>(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | public void save(FailureLogging failureLogging) throws Exception { |
| | | failureLogging.setId(UUIDUtil.getUUID()); |
| | | failureLoggingMapper.save(failureLogging); |
| | | } |
| | | |
| | | public void updateById(FailureLogging failureLogging) |
| | | throws Exception { |
| | | failureLoggingMapper.updateById(failureLogging); |
| | | } |
| | | |
| | | /** |
| | | * 保存操作日志 |
| | | * |
| | | * @param request 获取当前登录用户 |
| | | * @param action 操作标识 |
| | | */ |
| | | public void saveLog(HttpServletRequest request, String action, FailureLogging failureLogging) { |
| | | if (null == failureLogging) { |
| | | return; |
| | | } |
| | | logInfoService.save(HostUtil.getAccountByRequest(request).getAccount() + action + "设备更换名称:" + failureLogging.getOldDeviceName(), |
| | | "设备更换ip:" + failureLogging.getOldDeviceIp(), StaticKeys.LOG_XTCZ); |
| | | } |
| | | |
| | | public FailureLogging selectById(String id)throws Exception { |
| | | return failureLoggingMapper.selectById(id); |
| | | } |
| | | |
| | | public void deleteById(String[] ids)throws Exception { |
| | | failureLoggingMapper.deleteById(ids); |
| | | } |
| | | } |