feat():补齐订单客户相关Api接口
parent
2fb00c0451
commit
4a42089361
|
@ -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.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @Author:liuxinyue
|
||||
* @Package:com.muyu.cloud.pay.domain
|
||||
|
@ -62,4 +65,22 @@ public class OrderPayCustomer extends BaseEntity{
|
|||
|
||||
}
|
||||
|
||||
|
||||
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,51 @@
|
|||
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:liuxinyue
|
||||
* @Package:com.muyu.cloud.pay.domain.req
|
||||
* @Project:cloud-pay
|
||||
* @name:OrderCustomerUpdReq 修改支付客户
|
||||
* @Date:2024/8/9 8:40
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
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(description = "服务/客户备注",type = "String")
|
||||
private String remark;
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
package com.muyu.cloud.pay.controller;
|
||||
|
||||
import cn.hutool.db.sql.Order;
|
||||
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;
|
||||
|
@ -85,11 +87,50 @@ public class OrderPayCustomerController {
|
|||
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,
|
||||
@Validated @RequestBody 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> get(@PathVariable("orderCustomerId") Long orderCustomerId){
|
||||
|
||||
return Result.success(orderPayCustomerService.getById(orderCustomerId),"操作成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -105,6 +105,11 @@ public class OrderPayCustomerServiceImpl
|
|||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param orderPayCustomer
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean save(OrderPayCustomer orderPayCustomer) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue