| | |
| | | |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.by4cloud.platformx.business.dto.ContractAddDTO; |
| | | import com.by4cloud.platformx.business.dto.ContractUpdateDTO; |
| | | import com.by4cloud.platformx.business.entity.Contract; |
| | | import com.by4cloud.platformx.common.core.util.R; |
| | | import com.by4cloud.platformx.common.data.mybatis.BaseModel; |
| | | import com.by4cloud.platformx.common.log.annotation.SysLog; |
| | | import com.by4cloud.platformx.business.service.ContractService; |
| | | import com.by4cloud.platformx.common.security.annotation.Inner; |
| | | import com.by4cloud.platformx.common.security.util.SecurityUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | LambdaQueryWrapper<Contract> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.like(StringUtils.isNotBlank(contract.getContractName()),Contract::getContractName,contract.getContractName()); |
| | | wrapper.like(StringUtils.isNotBlank(contract.getPartyA()),Contract::getPartyA,contract.getPartyA()); |
| | | wrapper.eq(ObjUtil.isNotNull(contract.getContractStatus()),Contract::getContractStatus,contract.getContractStatus()); |
| | | wrapper.orderByDesc(BaseModel::getCreateTime); |
| | | return R.ok(contractService.pageByScope(page, wrapper)); |
| | | } |
| | |
| | | @GetMapping("/{id}" ) |
| | | @PreAuthorize("@pms.hasPermission('business_contract_view')" ) |
| | | public R getById(@PathVariable("id" ) Long id) { |
| | | return R.ok(contractService.getById(id)); |
| | | return R.ok(contractService.detail(id)); |
| | | } |
| | | |
| | | /** |
| | | * 新增合同管理 |
| | | * @param contract 合同管理 |
| | | * @param addDTO 合同管理 |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "新增合同管理" , description = "新增合同管理" ) |
| | | @SysLog("新增合同管理" ) |
| | | @PostMapping |
| | | @PreAuthorize("@pms.hasPermission('business_contract_add')" ) |
| | | public R save(@RequestBody Contract contract) { |
| | | Long compId = SecurityUtils.getUser().getCompId(); |
| | | contract.setPartyBId(contract.getCompId()); |
| | | contract.setPartyB(contract.getCompName()); |
| | | return R.ok(contractService.save(contract)); |
| | | public R save(@RequestBody ContractAddDTO addDTO) { |
| | | return contractService.add(addDTO); |
| | | } |
| | | |
| | | /** |
| | | * 修改合同管理 |
| | | * @param contract 合同管理 |
| | | * @param updateDTO 合同管理 |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "修改合同管理" , description = "修改合同管理" ) |
| | | @SysLog("修改合同管理" ) |
| | | @PutMapping |
| | | @PreAuthorize("@pms.hasPermission('business_contract_edit')" ) |
| | | public R updateById(@RequestBody Contract contract) { |
| | | return R.ok(contractService.updateById(contract)); |
| | | public R updateById(@RequestBody ContractUpdateDTO updateDTO) { |
| | | return contractService.edit(updateDTO); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 |
| | | */ |
| | | @Operation(summary = "通过id启动审核流程" , description = "通过id合同生效" ) |
| | | @GetMapping("/startApproval/{id}" ) |
| | | public R startApproval(@PathVariable("id" ) Long id) { |
| | | return contractService.startApproval(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时生成应收款账目 |
| | | * @return R |
| | | */ |
| | | @GetMapping("/genCurrentOverdue" ) |
| | | @Inner(value = false) |
| | | public R genCurrentOverdue() { |
| | | return contractService.genCurrentOverdue(); |
| | | } |
| | | |
| | | |
| | | } |