| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.by4cloud.platformx.common.core.util.R; |
| | | import com.by4cloud.platformx.common.log.annotation.SysLog; |
| | | import com.by4cloud.platformx.device.constant.MaxSizeContant; |
| | | import com.by4cloud.platformx.device.entity.Contract; |
| | | import com.by4cloud.platformx.device.service.ContractService; |
| | | import com.by4cloud.platformx.device.service.JcMaxSizeService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import com.by4cloud.platformx.common.excel.annotation.ResponseExcel; |
| | | import io.swagger.v3.oas.annotations.security.SecurityRequirement; |
| | |
| | | public class ContractController { |
| | | |
| | | private final ContractService contractService; |
| | | private final JcMaxSizeService maxSizeService; |
| | | |
| | | /** |
| | | * 分页查询 |
| | |
| | | wrapper.eq(contract.getType()!=null,Contract::getType,contract.getType()); |
| | | wrapper.like(StringUtils.isNotEmpty(contract.getName()),Contract::getName,contract.getName()); |
| | | wrapper.like(StringUtils.isNotEmpty(contract.getNumber()),Contract::getNumber,contract.getNumber()); |
| | | wrapper.orderByDesc(Contract::getCreateTime); |
| | | return R.ok(contractService.page(page, wrapper)); |
| | | } |
| | | |
| | |
| | | @GetMapping("/{id}" ) |
| | | @PreAuthorize("@pms.hasPermission('platformx_contract_view')" ) |
| | | public R getById(@PathVariable("id" ) Long id) { |
| | | return R.ok(contractService.getById(id)); |
| | | return R.ok(contractService.getDetailById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping |
| | | @PreAuthorize("@pms.hasPermission('platformx_contract_add')" ) |
| | | public R save(@RequestBody Contract contract) { |
| | | return R.ok(contractService.save(contract)); |
| | | contract.setNumber(maxSizeService.nextNo(MaxSizeContant.CONTRACT_NUM)); |
| | | return R.ok(contractService.saveDeep(contract)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PutMapping |
| | | @PreAuthorize("@pms.hasPermission('platformx_contract_edit')" ) |
| | | public R updateById(@RequestBody Contract contract) { |
| | | return R.ok(contractService.updateById(contract)); |
| | | return R.ok(contractService.updateDeep(contract)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @DeleteMapping |
| | | @PreAuthorize("@pms.hasPermission('platformx_contract_del')" ) |
| | | public R removeById(@RequestBody Long[] ids) { |
| | | return R.ok(contractService.removeBatchByIds(CollUtil.toList(ids))); |
| | | return R.ok(contractService.removeDeep(ids)); |
| | | } |
| | | |
| | | |
| | |
| | | public List<Contract> export(Contract contract,Long[] ids) { |
| | | return contractService.list(Wrappers.lambdaQuery(contract).in(ArrayUtil.isNotEmpty(ids), Contract::getId, ids)); |
| | | } |
| | | |
| | | /** |
| | | * 审批通过合同 |
| | | * @param id id |
| | | * @return R |
| | | */ |
| | | @SysLog("审批通过合同" ) |
| | | @Operation(summary = "审批通过合同" , description = "审批通过合同" ) |
| | | @GetMapping("/approved/{id}" ) |
| | | public R approved(@PathVariable("id" ) Long id) { |
| | | return R.ok(contractService.approved(id)); |
| | | } |
| | | |
| | | /** |
| | | * 获取审批通过合同的下拉列表 |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "获取审批通过合同的下拉列表" , description = "获取审批通过合同的下拉列表" ) |
| | | @GetMapping("/getApprovedContractList" ) |
| | | public R getApprovedContractList() { |
| | | return R.ok(contractService.getApprovedContractList()); |
| | | } |
| | | |
| | | /** |
| | | * 合同申请作废 |
| | | * @param id id |
| | | * @return R |
| | | */ |
| | | @SysLog("合同申请作废" ) |
| | | @Operation(summary = "合同申请作废" , description = "合同申请作废" ) |
| | | @GetMapping("/approvelInvalid/{id}" ) |
| | | @PreAuthorize("@pms.hasPermission('platformx_contract_zfsq')") |
| | | public R approvelInvalid(@PathVariable("id" ) Long id) { |
| | | return contractService.approvelInvalid(id); |
| | | } |
| | | |
| | | /** |
| | | * 合同申请作废 |
| | | * @param id id |
| | | * @return R |
| | | */ |
| | | @SysLog("合同作废" ) |
| | | @Operation(summary = "合同作废" , description = "合同作废" ) |
| | | @GetMapping("/invalidById/{id}" ) |
| | | @PreAuthorize("@pms.hasPermission('platformx_contract_zf')") |
| | | public R invalidById(@PathVariable("id" ) Long id) { |
| | | return contractService.invalidById(id); |
| | | } |
| | | } |