feat(bpm): 增加客户合同列表查询功能并优化采购和退款相关逻辑

- 在 BpmOAContractController 中添加了 getContractByCustomerId 方法,用于获取指定客户的合同列表
- 在 BpmOAContractService 接口中添加了 getListByCustomerId 方法
- 在 BpmOAContractServiceImpl 中实现了 getListByCustomerId 方法
- 优化了 BpmOAProcureController 中的项目编号判断逻辑
- 改进了 BpmOARefundServiceImpl 中的 getListByOrderNo 方法,增加了非空判断
- 在 BpmProcessInstanceServiceImpl 中的 transform 方法中添加了空字符串判断
This commit is contained in:
furongxin 2024-12-20 15:37:09 +08:00
parent af22e311ec
commit 1c07abebb0
7 changed files with 31 additions and 4 deletions

View File

@ -61,6 +61,7 @@ public interface ErrorCodeConstants {
ErrorCode OA_PROJECT_NOT_EXISTS = new ErrorCode(1_009_001_124, "项目申请不存在");
ErrorCode OA_CONTRACT_INVOICE_AMOUNT_LACK = new ErrorCode(1_009_001_125, "该合同的开票余额不足!");
ErrorCode OA_PAYMENT_NOT_EXISTS = new ErrorCode(1_009_001_126, "付款申请不存在");
ErrorCode OA_RECEIPT_NOT_EXISTS = new ErrorCode(1_009_001_127, "回款申请不存在");
// ========== 流程模型 1-009-002-000 ==========
ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1_009_002_000, "已经存在流程标识为【{}】的流程");

View File

@ -159,5 +159,14 @@ public class BpmOAContractController {
return success(respVO);
}
@GetMapping("/getContractByCustomerId")
@Operation(summary = "获得指定客户的合同列表")
@Parameter(name = "customerId", description = "客户编号", required = true)
public CommonResult<List<BpmOAContractRespVO>> getListByCustomerId(@RequestParam("customerId") Long customerId) {
List<BpmOAContractDO> respVOs = contractService.getListByCustomerId(customerId);
return success(BeanUtils.toBean(respVOs, BpmOAContractRespVO.class));
}
}

View File

@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.logging.log4j.util.Strings;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -63,7 +64,7 @@ public class BpmOAProcureController {
public CommonResult<BpmOAProcureRespVO> getOaProcure(@RequestParam("id") Long id) {
BpmOAProcureDO oaProcure = bpmOaProcureService.getOaProcure(id);
BpmOAProcureRespVO respVO = BpmOAProcureConvert.INSTANCE.convert(oaProcure);
if (respVO != null && respVO.getProjectNo() != null) {
if (respVO != null && Strings.isNotEmpty(respVO.getProjectNo())) {
ProjectDTO projectDTO = projectApi.getProject(respVO.getProjectNo()).getCheckedData();
respVO.setProjectName(projectDTO.getName());
}
@ -86,7 +87,7 @@ public class BpmOAProcureController {
BpmOAProcureDO oaProcure = bpmOaProcureService.getByProcessInstanceId(processInstanceId);
BpmOAProcureRespVO respVO = BpmOAProcureConvert.INSTANCE.convert(oaProcure);
if (respVO != null && respVO.getProjectNo() != null) {
if (respVO != null && Strings.isNotEmpty(respVO.getProjectNo())) {
ProjectDTO projectDTO = projectApi.getProject(respVO.getProjectNo()).getCheckedData();
respVO.setProjectName(projectDTO.getName());
}

View File

@ -104,4 +104,11 @@ public interface BpmOAContractService {
* @return 合同列表
*/
List<BpmOAContractDO> getContractList(BpmOAContractVO respVO);
/**
* 获得指定客户合同列表
* @param customerId 客户编号
* @return 合同列表
*/
List<BpmOAContractDO> getListByCustomerId(Long customerId);
}

View File

@ -325,6 +325,14 @@ public class BpmOAContractServiceImpl extends BpmOABaseService implements BpmOAC
.eq(BpmOAContractDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult()));
}
@Override
public List<BpmOAContractDO> getListByCustomerId(Long customerId) {
return contractMapper.selectList(new LambdaQueryWrapperX<BpmOAContractDO>()
.eq(BpmOAContractDO::getCustomerId, customerId)
.eq(BpmOAContractDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult()));
}
public static BigDecimal calculatePercentageChange(Object today, Object yesterday) {
// 转换为 BigDecimal 进行高精度计算

View File

@ -28,6 +28,7 @@ import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -203,7 +204,7 @@ public class BpmOARefundServiceImpl extends BpmOABaseService implements BpmOARef
public List<BpmOARefundDO> getListByOrderNo(List<String> orderNos) {
return refundMapper.selectList(new LambdaQueryWrapperX<BpmOARefundDO>()
.inIfPresent(BpmOARefundDO::getOrderNo, orderNos)
.eq(BpmOARefundDO::getStatus, 0));
.eq(Objects.nonNull(orderNos) ,BpmOARefundDO::getStatus, 0));
}
@Override