| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | |
| | | deviceLogMapper.insert(deviceLog); |
| | | } else { |
| | | DeviceBorrow borrow = deviceBorrowMapper.selectById(deviceBorrow.getId()); |
| | | if (borrow == null) { |
| | | throw new ServiceException("单据不存在"); |
| | | } |
| | | if ("关闭".equals(borrow.getNowState())) { |
| | | throw new ServiceException("该流程已结束,不能再操作"); |
| | | } |
| | | String expectedUser = null; |
| | | if ("归还".equals(borrow.getNowState())) { |
| | | expectedUser = borrow.getNowUser(); |
| | | } else if ("借出".equals(borrow.getNowState())) { |
| | | expectedUser = borrow.getSubmitOperationUser(); |
| | | } |
| | | if (expectedUser != null && !expectedUser.isBlank() && !expectedUser.equals(user.getName())) { |
| | | throw new ServiceException("您不是当前环节责任人,无权操作"); |
| | | } |
| | | deviceBorrowMapper.updateById(deviceBorrow); |
| | | //通过或者驳回增加流程跟踪 |
| | | if (deviceBorrow.getNowState().equals("关闭")) { |