feat():补齐订单客户相关API接口
parent
bdf408f73c
commit
55f941b50a
|
@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.cloud.pay.domain.req.OrderCustomerAddReq;
|
||||
import com.muyu.cloud.pay.domain.req.OrderCustomerUpdReq;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
|
@ -47,4 +50,16 @@ public class OrderPayCustomer extends BaseEntity {
|
|||
.remark(orderCustomerAddReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static OrderPayCustomer updBuild(OrderCustomerUpdReq orderCustomerUpdReq, Supplier<Long> idSupplier){
|
||||
return OrderPayCustomer.builder()
|
||||
.id(idSupplier.get())
|
||||
.appDesc(orderCustomerUpdReq.getAppDesc())
|
||||
.appName(orderCustomerUpdReq.getAppName())
|
||||
.status(orderCustomerUpdReq.getStatus())
|
||||
.remark(orderCustomerUpdReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 增加支付客户
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.muyu.cloud.pay.domain.req;
|
||||
|
||||
import com.muyu.common.core.validation.IsSystemPayType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 修改支付客户
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderCustomerUpdReq {
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@NotEmpty(message = "服务/客户名称不能为空")
|
||||
@Schema(title = "服务/客户名称",type = "String",defaultValue = "会员服务",description = "客户名称一般为微服务的中文名称,方便使用者进行区分")
|
||||
private String appName;
|
||||
/**
|
||||
* 客户描述
|
||||
*/
|
||||
@Schema(title = "服务/客户描述",type = "String")
|
||||
private String appDesc;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@NotBlank(message = "状态不能为空")
|
||||
@IsSystemPayType
|
||||
@Schema(title = "状态为Y和N,如果为Y则客户可以使用支付接口,若为N则客户不可以使用支付类接口")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 客户备注
|
||||
*/
|
||||
@Schema(title = "服务/客户备注",type = "String")
|
||||
private String remark;
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
|||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||
import com.muyu.cloud.pay.domain.req.OrderCustomerAddReq;
|
||||
import com.muyu.cloud.pay.domain.req.OrderCustomerUpdReq;
|
||||
import com.muyu.cloud.pay.domain.resp.CustomerResp;
|
||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
|
@ -66,9 +67,52 @@ public class OrderPayCustomerController {
|
|||
* @param orderCustomerAddReq
|
||||
* @return 添加结果
|
||||
*/
|
||||
@PostMapping
|
||||
@Operation(summary = "客户信息添加",description = "添加支付平台客户信息,添加成功之后才可以使用支付类的产品")
|
||||
public Result<String> save(@Validated @RequestBody OrderCustomerAddReq orderCustomerAddReq){
|
||||
orderPayCustomerService.save(OrderPayCustomer.addBuild(orderCustomerAddReq));
|
||||
return Result.success();
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
* @param orderCustomerId
|
||||
* @param orderCustomerUpdReq
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息修改",description = "通过ID修改客户信息")
|
||||
public Result<String> update(
|
||||
@Schema(title = "客户ID",type = "Long",defaultValue = "1",description = "修改客户信息需要依据的唯一条件")
|
||||
@PathVariable("orderCustomerId") Long orderCustomerId,
|
||||
@RequestBody @Validated OrderCustomerUpdReq orderCustomerUpdReq){
|
||||
OrderPayCustomer.updBuild(orderCustomerUpdReq,()->orderCustomerId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户
|
||||
* @param orderCustomerId
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息删除",description = "通过ID删除客户信息")
|
||||
public Result<String> delete(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
orderPayCustomerService.removeById(orderCustomerId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID获取客户
|
||||
* @param orderCustomerId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "客户信息查询",description = "通过ID查询客户信息")
|
||||
public Result<OrderPayCustomer> findById(@PathVariable Long orderCustomerId){
|
||||
return Result.success(orderPayCustomerService.getById(orderCustomerId),"操作成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue