trade:初始化
This commit is contained in:
@@ -5,13 +5,18 @@ import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
||||
import cn.iocoder.yudao.module.pay.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
// TODO 芋艿:CommonResult;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 支付单")
|
||||
public interface PayOrderApi {
|
||||
@@ -27,4 +32,13 @@ public interface PayOrderApi {
|
||||
@Parameter(name = "id", description = "支付单编号", example = "1", required = true)
|
||||
PayOrderRespDTO getOrder(Long id);
|
||||
|
||||
@PutMapping(PREFIX + "/update-price")
|
||||
@Operation(summary = "更新支付订单价格")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "支付单编号", example = "1", required = true),
|
||||
@Parameter(name = "payPrice", description = "支付单价格", example = "100", required = true)
|
||||
})
|
||||
void updatePayOrderPrice(@RequestParam("id") Long id,
|
||||
@RequestParam("payPrice") Integer payPrice);
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class PayOrderCreateReqDTO implements Serializable {
|
||||
|
||||
public static final int SUBJECT_MAX_LENGTH = 32;
|
||||
|
||||
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@NotNull(message = "应用编号不能为空")
|
||||
private Long appId;
|
||||
|
||||
@@ -30,4 +30,9 @@ public class PayOrderApiImpl implements PayOrderApi {
|
||||
return PayOrderConvert.INSTANCE.convert2(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePayOrderPrice(Long id, Integer payPrice) {
|
||||
payOrderService.updatePayOrderPrice(id, payPrice);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -98,6 +98,14 @@ public interface PayOrderService {
|
||||
*/
|
||||
void updateOrderRefundPrice(Long id, Integer incrRefundPrice);
|
||||
|
||||
/**
|
||||
* 更新支付订单价格
|
||||
*
|
||||
* @param id 支付单编号
|
||||
* @param payPrice 支付单价格
|
||||
*/
|
||||
void updatePayOrderPrice(Long id, Integer payPrice);
|
||||
|
||||
/**
|
||||
* 更新支付订单价格
|
||||
*
|
||||
|
||||
@@ -407,6 +407,24 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePayOrderPrice(Long id, Integer payPrice) {
|
||||
PayOrderDO order = orderMapper.selectById(id);
|
||||
if (order == null) {
|
||||
throw exception(ORDER_NOT_FOUND);
|
||||
}
|
||||
if (ObjectUtil.notEqual(PayOrderStatusEnum.WAITING.getStatus(), order.getStatus())) {
|
||||
throw exception(ORDER_STATUS_IS_NOT_WAITING);
|
||||
}
|
||||
if (ObjectUtil.equal(order.getPrice(), payPrice)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO 芋艿:应该 new 出来更新
|
||||
order.setPrice(payPrice);
|
||||
orderMapper.updateById(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePayOrderPriceById(Long payOrderId, Integer payPrice) {
|
||||
// TODO @puhui999:不能直接这样修改哈;应该只有未支付状态的订单才可以改;另外,如果价格如果没变,可以直接 return 哈;
|
||||
|
||||
Reference in New Issue
Block a user