订单管理相关
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
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.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -19,4 +20,7 @@ public interface ContractApi {
|
||||
@GetMapping(PREFIX + "/formulas")
|
||||
@Operation(summary = "通过合同编号获取对应的结算条款数据")
|
||||
List<ContractFormulaRespDTO> getFormulas(@RequestParam("contractPaperNumber") String contractPaperNumber);
|
||||
@GetMapping(PREFIX + "/updateOrderStatus")
|
||||
@Operation(summary = "更新订单状态")
|
||||
CommonResult<Boolean> updateOrderStatus(@RequestParam("orderId") Long orderId, @RequestParam("status") String status);
|
||||
}
|
||||
|
||||
@@ -14,4 +14,5 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode PURCHASE_ORDER_NOT_EXISTS = new ErrorCode(1_008_000_001, "采购订单不存在");
|
||||
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 PURCHASE_ORDER_STATUS_ERROR = new ErrorCode(1_008_001_020, "订单状态不存在");
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
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.service.contract.ContractService;
|
||||
import com.zt.plat.module.contractorder.service.purchaseorder.PurchaseOrderService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -9,6 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@Validated
|
||||
@Slf4j
|
||||
@@ -16,9 +20,16 @@ public class ContractApiImpl implements ContractApi {
|
||||
|
||||
@Resource
|
||||
private ContractService contractService;
|
||||
@Resource
|
||||
private PurchaseOrderService purchaseOrderService;
|
||||
|
||||
@Override
|
||||
public List<ContractFormulaRespDTO> getFormulas(String contractPaperNumber) {
|
||||
return contractService.getFormulasByPaperNumber(contractPaperNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateOrderStatus(Long orderId, String status) {
|
||||
return success(purchaseOrderService.updateOrderStatus(orderId, status));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,4 +67,11 @@ public interface PurchaseOrderService {
|
||||
|
||||
String submitErp(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 通过订单id更新订单状态
|
||||
*
|
||||
* @param orderId status 订单id 订单状态
|
||||
* @return boolean
|
||||
*/
|
||||
boolean updateOrderStatus(Long orderId, String status);
|
||||
}
|
||||
|
||||
@@ -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.module.contractorder.enums.purchaseorder.ErrorCodeConstants.ORDER_ID_NOT_EXISTS;
|
||||
import static com.zt.plat.module.contractorder.enums.purchaseorder.ErrorCodeConstants.PURCHASE_ORDER_NOT_EXISTS;
|
||||
import static com.zt.plat.module.contractorder.enums.purchaseorder.ErrorCodeConstants.*;
|
||||
|
||||
|
||||
/**
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user