| | |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.dto.asset.OaApprovalApplicationAssetReceiveDTO; |
| | | import com.ruoyi.system.dto.asset.OaApprovalApplicationAssetReturnDTO; |
| | | import com.ruoyi.system.query.OaApprovalApplicationAssetPageQuery; |
| | | import com.ruoyi.system.service.OaApprovalApplicationAssetService; |
| | | import com.ruoyi.system.vo.asset.OaApprovalApplicationAssetPageVO; |
| | | import com.ruoyi.system.vo.asset.AssetMainVO; |
| | | import com.ruoyi.system.vo.asset.OaApprovalApplicationAssetDetailVO; |
| | | import com.ruoyi.system.vo.asset.OaApprovalApplicationAssetPageVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @PostMapping("/submit-receive") |
| | | @Log(title = "资产领用申请-提交", businessType = BusinessType.INSERT) |
| | | public R<Void> submitReceive(@Valid @RequestBody OaApprovalApplicationAssetReceiveDTO dto) { |
| | | //TODO 提交时需要校验资产状态,是否已经被领用借用处置 |
| | | oaApprovalApplicationAssetService.submitReceiveBorrow(dto); |
| | | return R.ok(); |
| | | } |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation("获取资产借用详情") |
| | | @GetMapping("/detail/borrow/{id}") |
| | | public R<OaApprovalApplicationAssetDetailVO> getBorrowDetail(@ApiParam(name = "id", value = "审批单ID", required = true) @PathVariable Integer id) { |
| | | OaApprovalApplicationAssetDetailVO detail = oaApprovalApplicationAssetService.getBorrowDetail(id); |
| | | return R.ok(detail); |
| | | } |
| | | |
| | | @ApiOperation("查询当前登录用户提交的借用申请记录列表") |
| | | @GetMapping("/borrow-list") |
| | | public R<List<OaApprovalApplicationAssetDetailVO>> getBorrowDetailByApplicationCode() { |
| | | List<OaApprovalApplicationAssetDetailVO> detail = oaApprovalApplicationAssetService.getBorrowDetailByApplicationCode(); |
| | | return R.ok(detail); |
| | | } |
| | | |
| | | @ApiOperation(("根据借用单ID获取借用资产列表")) |
| | | @GetMapping("/borrow-detail-list/{id}") |
| | | public R<List<AssetMainVO>> getBorrowDetailList(@ApiParam(name = "id", value = "审批单ID", required = true) @PathVariable Integer id) { |
| | | List<AssetMainVO> list = oaApprovalApplicationAssetService.getBorrowDetailList(id); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation("提交资产归还申请") |
| | | @PostMapping("/submit-return") |
| | | @Log(title = "资产归还申请-提交", businessType = BusinessType.INSERT) |
| | | public R<Void> submitReturn(@Valid @RequestBody OaApprovalApplicationAssetReturnDTO dto) { |
| | | oaApprovalApplicationAssetService.submitReturn(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation("获取资产归还申请分页列表") |
| | | @PostMapping("/page-return-list") |
| | | public R<IPage<OaApprovalApplicationAssetPageVO>> getReturnPageList(@RequestBody OaApprovalApplicationAssetPageQuery pageQuery) { |
| | | // 数据权限:非管理员仅能查看本部门 |
| | | Long userId = SecurityUtils.getUserId(); |
| | | boolean isAdmin = SecurityUtils.isAdmin(userId); |
| | | if (!isAdmin) { |
| | | try { |
| | | pageQuery.setDeptId(Integer.valueOf(SecurityUtils.getDeptId())); |
| | | } catch (Exception e) { |
| | | // ignore parse, leave null if cannot parse |
| | | } |
| | | } |
| | | IPage<OaApprovalApplicationAssetPageVO> page = oaApprovalApplicationAssetService.getReturnPageList(pageQuery); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation("获取资产归还提醒分页列表") |
| | | @PostMapping("/page-return-notify-list") |
| | | public R<IPage<OaApprovalApplicationAssetPageVO>> getReturnNotifyPageList(@RequestBody OaApprovalApplicationAssetPageQuery pageQuery) { |
| | | // 数据权限:非管理员仅能查看本部门 |
| | | Long userId = SecurityUtils.getUserId(); |
| | | boolean isAdmin = SecurityUtils.isAdmin(userId); |
| | | if (!isAdmin) { |
| | | try { |
| | | pageQuery.setDeptId(Integer.valueOf(SecurityUtils.getDeptId())); |
| | | } catch (Exception e) { |
| | | // ignore parse, leave null if cannot parse |
| | | } |
| | | } |
| | | IPage<OaApprovalApplicationAssetPageVO> page = oaApprovalApplicationAssetService.getReturnNotifyPageList(pageQuery); |
| | | return R.ok(page); |
| | | } |
| | | } |