添加支付接口
parent
5b7e09c250
commit
d9a0d443d8
|
@ -11,6 +11,7 @@ import lombok.NoArgsConstructor;
|
|||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/***
|
||||
* 支付表
|
||||
|
@ -45,4 +46,25 @@ public class Pay extends BaseEntity {
|
|||
*/
|
||||
private Date payTime;
|
||||
|
||||
//添加
|
||||
public static Pay addBuild(Pay pay){
|
||||
return Pay.builder()
|
||||
.payStatus(pay.payStatus)
|
||||
.payTime(pay.payTime)
|
||||
.payType(pay.payType)
|
||||
.userId(pay.userId)
|
||||
.build();
|
||||
}
|
||||
|
||||
//修改
|
||||
public static Pay updBuild(Pay pay, Supplier<Long> supplier){
|
||||
return Pay.builder()
|
||||
.payId(supplier.get())
|
||||
.payStatus(pay.payStatus)
|
||||
.payTime(pay.payTime)
|
||||
.payType(pay.payType)
|
||||
.userId(pay.userId)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,11 +44,9 @@ public class DefinedController {
|
|||
private DefinedService definedService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 接口列表 分页 查询
|
||||
*/
|
||||
@RequiresPermissions("market:market:list")
|
||||
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
||||
@Operation(summary = "查询",description = "根据接口的名称 有效期 等可以进行筛选")
|
||||
public Result<PageParam<Defined>> selectList(PageParam<Defined> page,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.market.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.market.domian.Logs;
|
||||
import com.muyu.market.service.LogsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -25,8 +26,8 @@ public class LogsController {
|
|||
* 查询日志列表
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "查询日志列表",description = "查询用户操作日志列表")
|
||||
@GetMapping("/list")
|
||||
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
||||
@Operation(summary = "查询",description = "查询日志列表")
|
||||
// public Result<PageParam<Logs>> show(PageParam<Logs>page){
|
||||
// LambdaQueryWrapper<Logs> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.select(Logs::getLogsId);//根据用户id查询
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
package com.muyu.market.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.market.domian.Pay;
|
||||
import com.muyu.market.service.PayService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Log4j2
|
||||
@RestController
|
||||
@RequestMapping("/pay")
|
||||
@Tag(name = "支付接口",description = "进行支付管理,查看等相关操作")
|
||||
public class PayController {
|
||||
|
||||
@Autowired
|
||||
private PayService service;
|
||||
|
||||
/**
|
||||
* 查询支付日志列表
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
||||
@Operation(summary = "支付接口查询",description = "查询支付接口日志列表")
|
||||
public Result<List<Pay>> showList(){
|
||||
List<Pay> list=service.showList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加支付信息
|
||||
* @param
|
||||
* @return 添加结果
|
||||
*/
|
||||
@PostMapping
|
||||
@Operation(summary = "客户信息添加",description = "添加支付平台客户信息,添加成功之后才可以只用支付类的产品")
|
||||
public Result<String> save(@Validated @RequestBody Pay pay){
|
||||
service.save(Pay.addBuild(pay));
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户
|
||||
* @param
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping("/{payId}")
|
||||
@Operation(summary = "客户信息修改",description = "通过ID修改客户信息")
|
||||
public Result<String> update(
|
||||
@Schema(title = "客户ID",type = "Long",defaultValue = "1",description = "修改客户信息需要依据的唯一条件")
|
||||
@PathVariable("payId") Long payId,
|
||||
@RequestBody @Validated Pay pay){
|
||||
service.updateById(Pay.updBuild(pay,
|
||||
() -> payId));
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户
|
||||
* @param payId 删除客户请求信息
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping("/{payId}")
|
||||
@Operation(summary = "客户信息删除",description = "通过ID删除客户信息,七天内存在支付先关记录的客户,不可进行删除")
|
||||
public Result<String> delete(@PathVariable("payId") Long payId){
|
||||
service.removeById(payId);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID获取客户
|
||||
* @param payId ID
|
||||
* @return 客户信息
|
||||
*/
|
||||
@GetMapping("/{payId}")
|
||||
@Operation(summary = "通过ID获取客户",description = "通过ID获取客户")
|
||||
public Result<Pay> findById(@PathVariable("payId") Long payId){
|
||||
return Result.success(service.getById(payId),"操作成功");
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 通过ID禁用
|
||||
// * @param payId ID
|
||||
// * @return 禁用结果
|
||||
// */
|
||||
// @GetMapping("/disable/{orderCustomerId}")
|
||||
// @Operation(summary = "通过ID禁用客户",description = "通过ID获取客户,禁用之后禁止调用支付相关接口")
|
||||
// public Result<String> disable(@PathVariable("payId") Long payId){
|
||||
// this.service.disable(payId);
|
||||
// return Result.success(null,"操作成功");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 通过ID启用
|
||||
// * @param payId ID
|
||||
// * @return 启用结果
|
||||
// */
|
||||
// @GetMapping("/enable/{orderCustomerId}")
|
||||
// @Operation(summary = "通过ID启用客户",description = "通过ID启用客户,启用之后可以进行支付相关接口的调用")
|
||||
// public Result<String> enable(@PathVariable("payId") Long payId){
|
||||
// this.service.enable(payId);
|
||||
// return Result.success(null,"操作成功");
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.market.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.market.domian.Pay;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Mapper
|
||||
public interface PayMapper extends BaseMapper<Pay> {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.muyu.market.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.market.domian.Logs;
|
||||
import com.muyu.market.domian.Pay;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface PayService extends IService<Pay> {
|
||||
|
||||
|
||||
List<Pay> showList();
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.market.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.market.domian.Pay;
|
||||
import com.muyu.market.mapper.PayMapper;
|
||||
import com.muyu.market.service.PayService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class PayServiceImpl
|
||||
extends ServiceImpl<PayMapper, Pay>
|
||||
implements PayService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<Pay> showList() {
|
||||
LambdaQueryWrapper<Pay> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(Pay::getPayId);
|
||||
List<Pay> list = this.list();
|
||||
|
||||
list.stream().map(Pay::getPayId).collect(Collectors.toSet());
|
||||
return this.list(queryWrapper).stream().toList();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue