| | |
| | | |
| | | 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.service.ContractService; |
| | | import com.by4cloud.platformx.common.security.annotation.Inner; |
| | | import com.by4cloud.platformx.common.security.util.SecurityUtils; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import com.by4cloud.platformx.common.excel.annotation.ResponseExcel; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | 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)); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过id合同生效 |
| | | * 启动审核流程 |
| | | * @param id id |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "通过id合同生效" , description = "通过id合同生效" ) |
| | | @GetMapping("/takeEffect/{id}" ) |
| | | @PreAuthorize("@pms.hasPermission('business_contract_effect')" ) |
| | | public R takeEffect(@PathVariable("id" ) Long id) { |
| | | return R.ok(contractService.takeEffect(id)); |
| | | @Operation(summary = "通过id启动审核流程" , description = "通过id合同生效" ) |
| | | @GetMapping("/startApproval/{id}" ) |
| | | public R startApproval(@PathVariable("id" ) Long id) { |
| | | return contractService.startApproval(id); |
| | | } |
| | | |
| | | |
| | |
| | | public R genCurrentOverdue() { |
| | | return contractService.genCurrentOverdue(); |
| | | } |
| | | |
| | | /** |
| | | * 生成新合同 |
| | | * @param id id |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "通过id生成新合同" , description = "通过id生成新合同" ) |
| | | @GetMapping("/copyNewContract/{id}" ) |
| | | public R copyNewContract(@PathVariable("id" ) Long id) { |
| | | return contractService.copyNewContract(id); |
| | | } |
| | | |
| | | /** |
| | | * 根据客商查询合同 |
| | | * @param busId id |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "根据客商查询合同" , description = "根据客商查询合同" ) |
| | | @GetMapping("/listByBusId/{busId}" ) |
| | | public R listByBusId(@PathVariable("busId" ) Long busId) { |
| | | return R.ok(contractService.listByScope(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyAId,busId) |
| | | .gt(Contract::getBillingAmout,new BigDecimal("0")))); |
| | | } |
| | | |
| | | /** |
| | | * 根据模版生成word一煤机加工承揽合同 |
| | | * @param id id |
| | | * @return R |
| | | */ |
| | | @Operation(summary = "根据模版生成word合同" , description = "根据模版生成word合同" ) |
| | | @GetMapping("/exportContractYMJJGCLWord/{id}" ) |
| | | public void exportContractYMJJGCLWord(@PathVariable("id" ) Long id, HttpServletResponse response) { |
| | | contractService.exportContractYMJJGCLWord(id,response); |
| | | } |
| | | } |