订单管理相关

This commit is contained in:
潘荣晟
2025-10-13 11:10:41 +08:00
parent beb4f5ddaf
commit b50ec80484
5 changed files with 35 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package com.zt.plat.module.contractorder.api; package com.zt.plat.module.contractorder.api;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.contractorder.api.dto.ContractFormulaRespDTO; import com.zt.plat.module.contractorder.api.dto.ContractFormulaRespDTO;
import com.zt.plat.module.contractorder.enums.ApiConstants; import com.zt.plat.module.contractorder.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@@ -19,4 +20,7 @@ public interface ContractApi {
@GetMapping(PREFIX + "/formulas") @GetMapping(PREFIX + "/formulas")
@Operation(summary = "通过合同编号获取对应的结算条款数据") @Operation(summary = "通过合同编号获取对应的结算条款数据")
List<ContractFormulaRespDTO> getFormulas(@RequestParam("contractPaperNumber") String contractPaperNumber); List<ContractFormulaRespDTO> getFormulas(@RequestParam("contractPaperNumber") String contractPaperNumber);
@GetMapping(PREFIX + "/updateOrderStatus")
@Operation(summary = "更新订单状态")
CommonResult<Boolean> updateOrderStatus(@RequestParam("orderId") Long orderId, @RequestParam("status") String status);
} }

View File

@@ -14,4 +14,5 @@ public interface ErrorCodeConstants {
ErrorCode PURCHASE_ORDER_NOT_EXISTS = new ErrorCode(1_008_000_001, "采购订单不存在"); ErrorCode PURCHASE_ORDER_NOT_EXISTS = new ErrorCode(1_008_000_001, "采购订单不存在");
ErrorCode ORDER_ID_NOT_EXISTS = new ErrorCode(1_008_000_010, "订单id不能为空"); ErrorCode ORDER_ID_NOT_EXISTS = new ErrorCode(1_008_000_010, "订单id不能为空");
ErrorCode PRCH_ORD_DTL_NOT_EXISTS = new ErrorCode(1_008_001_001, "采购订单明细不存在"); ErrorCode PRCH_ORD_DTL_NOT_EXISTS = new ErrorCode(1_008_001_001, "采购订单明细不存在");
ErrorCode PURCHASE_ORDER_STATUS_ERROR = new ErrorCode(1_008_001_020, "订单状态不存在");
} }

View File

@@ -1,7 +1,9 @@
package com.zt.plat.module.contractorder.api; package com.zt.plat.module.contractorder.api;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.contractorder.api.dto.ContractFormulaRespDTO; import com.zt.plat.module.contractorder.api.dto.ContractFormulaRespDTO;
import com.zt.plat.module.contractorder.service.contract.ContractService; import com.zt.plat.module.contractorder.service.contract.ContractService;
import com.zt.plat.module.contractorder.service.purchaseorder.PurchaseOrderService;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -9,6 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
@RestController @RestController
@Validated @Validated
@Slf4j @Slf4j
@@ -16,9 +20,16 @@ public class ContractApiImpl implements ContractApi {
@Resource @Resource
private ContractService contractService; private ContractService contractService;
@Resource
private PurchaseOrderService purchaseOrderService;
@Override @Override
public List<ContractFormulaRespDTO> getFormulas(String contractPaperNumber) { public List<ContractFormulaRespDTO> getFormulas(String contractPaperNumber) {
return contractService.getFormulasByPaperNumber(contractPaperNumber); return contractService.getFormulasByPaperNumber(contractPaperNumber);
} }
@Override
public CommonResult<Boolean> updateOrderStatus(Long orderId, String status) {
return success(purchaseOrderService.updateOrderStatus(orderId, status));
}
} }

View File

@@ -67,4 +67,11 @@ public interface PurchaseOrderService {
String submitErp(List<Long> ids); String submitErp(List<Long> ids);
/**
* 通过订单id更新订单状态
*
* @param orderId status 订单id 订单状态
* @return boolean
*/
boolean updateOrderStatus(Long orderId, String status);
} }

View File

@@ -35,8 +35,7 @@ import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.contractorder.enums.purchaseorder.ErrorCodeConstants.ORDER_ID_NOT_EXISTS; import static com.zt.plat.module.contractorder.enums.purchaseorder.ErrorCodeConstants.*;
import static com.zt.plat.module.contractorder.enums.purchaseorder.ErrorCodeConstants.PURCHASE_ORDER_NOT_EXISTS;
/** /**
@@ -240,5 +239,16 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
} }
} }
@Override
public boolean updateOrderStatus(Long orderId, String status) {
// 校验存在
validatePurchaseOrderExists(orderId);
PurchaseOrderStatusEnum byCode = PurchaseOrderStatusEnum.getByCode(status);
if (byCode== null){
throw exception(PURCHASE_ORDER_STATUS_ERROR);
}
return purchaseOrderMapper.updateById(new PurchaseOrderDO().setId(orderId).setStatus(status))>0;
}
} }