feat():补齐订单客户的API接口
parent
9bf97676b2
commit
58088c358d
|
@ -5,10 +5,13 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.cloud.pay.domain.req.OrderCustomerAddReq;
|
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 com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:zhangchengzhi
|
* @Author:zhangchengzhi
|
||||||
* @Package:com.muyu.cloud.pay.domain
|
* @Package:com.muyu.cloud.pay.domain
|
||||||
|
@ -67,6 +70,19 @@ public static OrderPayCustomer addBuild(OrderCustomerAddReq req){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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,67 @@
|
||||||
|
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:zhangchengzhi
|
||||||
|
* @Package:com.muyu.cloud.pay.domain.req
|
||||||
|
* @Project:cloud-pay
|
||||||
|
* @name:OrderCustomerUpdReq
|
||||||
|
* @Date:2024/8/7 17:07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package com.muyu.cloud.pay.controller;
|
||||||
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
import com.muyu.cloud.pay.domain.OrderPayCustomer;
|
||||||
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
import com.muyu.cloud.pay.domain.req.CustomerListReq;
|
||||||
import com.muyu.cloud.pay.domain.req.OrderCustomerAddReq;
|
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.domain.resp.CustomerResp;
|
||||||
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
import com.muyu.cloud.pay.service.OrderPayCustomerService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
@ -80,8 +81,51 @@ orderPayCustomerService.save(OrderPayCustomer.addBuild(orderCustomerAddReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修盖客户
|
||||||
|
* @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){
|
||||||
|
|
||||||
|
|
||||||
|
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