feat(): 补齐订单客户相关API接口
parent
1ae28fe247
commit
00dc5444aa
|
@ -4,11 +4,14 @@ 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.utils.bean.BeanUtils;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/7/30
|
||||
|
@ -59,4 +62,15 @@ public class OrderPayCustomer extends BaseEntity {
|
|||
.remark(req.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static OrderPayCustomer updBuild(OrderCustomerUpdReq req, Supplier<Long> idSupplier){
|
||||
|
||||
return OrderPayCustomer.builder()
|
||||
.id(idSupplier.get())
|
||||
.appName(req.getAppName())
|
||||
.appDesc(req.getAppDesc())
|
||||
.status(req.getStatus())
|
||||
.remark(req.getRemark())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.muyu.cloud.pay.domain.req;
|
||||
|
||||
import com.muyu.common.core.validation.custom.IsSystemYesNo;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Author: DongZeLiang
|
||||
* @date: 2024/8/5
|
||||
* @Description: 修改支付客户
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderCustomerUpdReq {
|
||||
|
||||
/**
|
||||
* 服务/客户名称
|
||||
*/
|
||||
@NotEmpty(message = "服务客户名称不可为空")
|
||||
@Schema(title = "服务/客户名称", type = "String", defaultValue = "会员服务",
|
||||
description = "客户名称一般为微服务的中文名称,方便使用者进行区分", requiredProperties = {"appName"})
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 服务/客户描述
|
||||
*/
|
||||
@Schema(title = "服务/客户描述", type = "String")
|
||||
private String appDesc;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@NotBlank(message = "客户使用状态不可为空")
|
||||
@IsSystemYesNo
|
||||
@Schema(title = "服务/客户开通状态", type = "String", defaultValue = "Y",
|
||||
description = "状态为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;
|
||||
|
@ -75,6 +76,44 @@ public class OrderPayCustomerController {
|
|||
@Operation(summary = "客户信息添加",description = "添加支付平台客户信息,添加成功之后才可以使用支付类的产品")
|
||||
public Result<String> save(@Validated @RequestBody OrderCustomerAddReq orderCustomerAddReq) {
|
||||
orderPayCustomerService.save(OrderPayCustomer.addBuild(orderCustomerAddReq));
|
||||
return Result.success();
|
||||
return Result.success(null, "操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
* @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){
|
||||
orderPayCustomerService.updateById(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 ID
|
||||
* @return 客户信息
|
||||
*/
|
||||
@GetMapping("/{orderCustomerId}")
|
||||
@Operation(summary = "通过ID获取客户信息", description = "通过ID获取客户信息")
|
||||
public Result<OrderPayCustomer> findById(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
return Result.success(orderPayCustomerService.getById(orderCustomerId), "操作成功");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue