订单管理相关
This commit is contained in:
@@ -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