From d9a0d443d8bcdf76d3c5e0a613546c0e0568d4fc Mon Sep 17 00:00:00 2001 From: sy200 <2063514638@qq.com> Date: Fri, 23 Aug 2024 20:58:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=AF=E4=BB=98=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/muyu/market/domian/Pay.java | 22 ++++ .../market/controller/DefinedController.java | 2 - .../market/controller/LogsController.java | 5 +- .../muyu/market/controller/PayController.java | 112 ++++++++++++++++++ .../com/muyu/market/mapper/PayMapper.java | 15 +++ .../com/muyu/market/service/PayService.java | 14 +++ .../market/service/impl/PayServiceImpl.java | 28 +++++ 7 files changed, 194 insertions(+), 4 deletions(-) create mode 100644 cloud-market-server/src/main/java/com/muyu/market/controller/PayController.java create mode 100644 cloud-market-server/src/main/java/com/muyu/market/mapper/PayMapper.java create mode 100644 cloud-market-server/src/main/java/com/muyu/market/service/PayService.java create mode 100644 cloud-market-server/src/main/java/com/muyu/market/service/impl/PayServiceImpl.java diff --git a/cloud-market-common/src/main/java/com/muyu/market/domian/Pay.java b/cloud-market-common/src/main/java/com/muyu/market/domian/Pay.java index bdddd5a..3de2913 100644 --- a/cloud-market-common/src/main/java/com/muyu/market/domian/Pay.java +++ b/cloud-market-common/src/main/java/com/muyu/market/domian/Pay.java @@ -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 supplier){ + return Pay.builder() + .payId(supplier.get()) + .payStatus(pay.payStatus) + .payTime(pay.payTime) + .payType(pay.payType) + .userId(pay.userId) + .build(); + } + } diff --git a/cloud-market-server/src/main/java/com/muyu/market/controller/DefinedController.java b/cloud-market-server/src/main/java/com/muyu/market/controller/DefinedController.java index 99ff8b7..897706d 100644 --- a/cloud-market-server/src/main/java/com/muyu/market/controller/DefinedController.java +++ b/cloud-market-server/src/main/java/com/muyu/market/controller/DefinedController.java @@ -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> selectList(PageParam page, diff --git a/cloud-market-server/src/main/java/com/muyu/market/controller/LogsController.java b/cloud-market-server/src/main/java/com/muyu/market/controller/LogsController.java index 6c86970..808303f 100644 --- a/cloud-market-server/src/main/java/com/muyu/market/controller/LogsController.java +++ b/cloud-market-server/src/main/java/com/muyu/market/controller/LogsController.java @@ -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> show(PageParampage){ // LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); // queryWrapper.select(Logs::getLogsId);//根据用户id查询 diff --git a/cloud-market-server/src/main/java/com/muyu/market/controller/PayController.java b/cloud-market-server/src/main/java/com/muyu/market/controller/PayController.java new file mode 100644 index 0000000..c8d6694 --- /dev/null +++ b/cloud-market-server/src/main/java/com/muyu/market/controller/PayController.java @@ -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> showList(){ + List list=service.showList(); + return Result.success(list); + } + + /** + * 添加支付信息 + * @param + * @return 添加结果 + */ + @PostMapping + @Operation(summary = "客户信息添加",description = "添加支付平台客户信息,添加成功之后才可以只用支付类的产品") + public Result save(@Validated @RequestBody Pay pay){ + service.save(Pay.addBuild(pay)); + return Result.success(null,"操作成功"); + } + + /** + * 修改客户 + * @param + * @return 修改结果 + */ + @PutMapping("/{payId}") + @Operation(summary = "客户信息修改",description = "通过ID修改客户信息") + public Result 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 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 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 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 enable(@PathVariable("payId") Long payId){ +// this.service.enable(payId); +// return Result.success(null,"操作成功"); +// } + +} diff --git a/cloud-market-server/src/main/java/com/muyu/market/mapper/PayMapper.java b/cloud-market-server/src/main/java/com/muyu/market/mapper/PayMapper.java new file mode 100644 index 0000000..eefe5ac --- /dev/null +++ b/cloud-market-server/src/main/java/com/muyu/market/mapper/PayMapper.java @@ -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 { + + +} diff --git a/cloud-market-server/src/main/java/com/muyu/market/service/PayService.java b/cloud-market-server/src/main/java/com/muyu/market/service/PayService.java new file mode 100644 index 0000000..7cceff6 --- /dev/null +++ b/cloud-market-server/src/main/java/com/muyu/market/service/PayService.java @@ -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 { + + + List showList(); +} diff --git a/cloud-market-server/src/main/java/com/muyu/market/service/impl/PayServiceImpl.java b/cloud-market-server/src/main/java/com/muyu/market/service/impl/PayServiceImpl.java new file mode 100644 index 0000000..7f07007 --- /dev/null +++ b/cloud-market-server/src/main/java/com/muyu/market/service/impl/PayServiceImpl.java @@ -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 + implements PayService { + + + @Override + public List showList() { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.select(Pay::getPayId); + List list = this.list(); + + list.stream().map(Pay::getPayId).collect(Collectors.toSet()); + return this.list(queryWrapper).stream().toList(); + } +}