Forráskód Böngészése

律师端支付交易服务

zhangchen 1 hónapja
szülő
commit
9021029ddc

+ 113 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/controller/LawyerPaymentTransactionController.java

@@ -0,0 +1,113 @@
+package shop.alien.lawyer.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.annotations.*;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+import shop.alien.entity.result.R;
+import shop.alien.entity.store.LawyerPaymentTransaction;
+import shop.alien.lawyer.service.LawyerPaymentTransactionService;
+import shop.alien.util.myBaticsPlus.QueryBuilder;
+
+import java.util.List;
+
+/**
+ * 支付交易 前端控制器
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+@Slf4j
+@Api(tags = {"律师平台-支付交易"})
+@ApiSort(20)
+@CrossOrigin
+@RestController
+@RequestMapping("/lawyer/paymentTransaction")
+@RequiredArgsConstructor
+public class LawyerPaymentTransactionController {
+
+    private final LawyerPaymentTransactionService paymentTransactionService;
+
+    @ApiOperation("新增支付交易")
+    @ApiOperationSupport(order = 1)
+    @PostMapping("/addPaymentTransaction")
+    public R<LawyerPaymentTransaction> addPaymentTransaction(@RequestBody LawyerPaymentTransaction paymentTransaction) {
+        log.info("LawyerPaymentTransactionController.addPaymentTransaction?paymentTransaction={}", paymentTransaction);
+        return paymentTransactionService.addPaymentTransaction(paymentTransaction);
+    }
+
+    @ApiOperation("编辑支付交易")
+    @ApiOperationSupport(order = 2)
+    @PostMapping("/editPaymentTransaction")
+    public R<LawyerPaymentTransaction> editPaymentTransaction(@RequestBody LawyerPaymentTransaction paymentTransaction) {
+        log.info("LawyerPaymentTransactionController.editPaymentTransaction?paymentTransaction={}", paymentTransaction);
+        return paymentTransactionService.editPaymentTransaction(paymentTransaction);
+    }
+
+    @ApiOperation("删除支付交易")
+    @ApiOperationSupport(order = 3)
+    @DeleteMapping("/deletePaymentTransaction")
+    public R<Boolean> deletePaymentTransaction(@RequestParam(value = "id") Integer id) {
+        log.info("LawyerPaymentTransactionController.deletePaymentTransaction?id={}", id);
+        return paymentTransactionService.deletePaymentTransaction(id);
+    }
+
+    @ApiOperation("保存或更新支付交易")
+    @ApiOperationSupport(order = 4)
+    @PostMapping("/saveOrUpdate")
+    public R<LawyerPaymentTransaction> saveOrUpdate(@RequestBody LawyerPaymentTransaction paymentTransaction) {
+        log.info("LawyerPaymentTransactionController.saveOrUpdate?paymentTransaction={}", paymentTransaction);
+        boolean result = paymentTransactionService.saveOrUpdate(paymentTransaction);
+        if (result) {
+            return R.data(paymentTransaction);
+        }
+        return R.fail("操作失败");
+    }
+
+    @ApiOperation("通用列表查询")
+    @ApiOperationSupport(order = 5)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "主键", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "consultationOrderId", value = "咨询订单ID", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "clientUserId", value = "客户端用户ID", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "transactionStatus", value = "交易状态", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "createdTime_Start", value = "创建时间开始(范围查询)", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "createdTime_End", value = "创建时间结束(范围查询)", dataType = "String", paramType = "query")
+    })
+    @GetMapping("/getList")
+    public R<List<LawyerPaymentTransaction>> getList(@ModelAttribute LawyerPaymentTransaction paymentTransaction) {
+        log.info("LawyerPaymentTransactionController.getList?paymentTransaction={}", paymentTransaction);
+        List<LawyerPaymentTransaction> list = QueryBuilder.of(paymentTransaction)
+                .build()
+                .list(paymentTransactionService);
+        return R.data(list);
+    }
+
+    @ApiOperation("通用分页查询")
+    @ApiOperationSupport(order = 6)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "page", value = "页数(默认1)", dataType = "int", paramType = "query"),
+            @ApiImplicitParam(name = "size", value = "页容(默认10)", dataType = "int", paramType = "query"),
+            @ApiImplicitParam(name = "id", value = "主键", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "consultationOrderId", value = "咨询订单ID", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "clientUserId", value = "客户端用户ID", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "transactionStatus", value = "交易状态", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "createdTime_Start", value = "创建时间开始(范围查询)", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "createdTime_End", value = "创建时间结束(范围查询)", dataType = "String", paramType = "query")
+    })
+    @GetMapping("/getPage")
+    public R<IPage<LawyerPaymentTransaction>> getPage(@ModelAttribute LawyerPaymentTransaction paymentTransaction,
+                                                      @RequestParam(defaultValue = "1") int page,
+                                                      @RequestParam(defaultValue = "10") int size) {
+        log.info("LawyerPaymentTransactionController.getPage?paymentTransaction={},page={},size={}", paymentTransaction, page, size);
+        int pageNum = page > 0 ? page : 1;
+        int pageSize = size > 0 ? size : 10;
+        IPage<LawyerPaymentTransaction> pageResult = QueryBuilder.of(paymentTransaction)
+                .page(pageNum, pageSize)
+                .build()
+                .page(paymentTransactionService);
+        return R.data(pageResult);
+    }
+}
+

+ 53 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/service/LawyerPaymentTransactionService.java

@@ -0,0 +1,53 @@
+package shop.alien.lawyer.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import shop.alien.entity.result.R;
+import shop.alien.entity.store.LawyerPaymentTransaction;
+
+/**
+ * 支付交易 服务类
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+public interface LawyerPaymentTransactionService extends IService<LawyerPaymentTransaction> {
+
+    /**
+     * 分页查询支付交易列表
+     *
+     * @param pageNum             页码
+     * @param pageSize            页容
+     * @param consultationOrderId 咨询订单ID
+     * @param clientUserId        客户端用户ID
+     * @param transactionStatus   交易状态
+     * @return IPage<LawyerPaymentTransaction>
+     */
+    R<IPage<LawyerPaymentTransaction>> getPaymentTransactionList(int pageNum, int pageSize, Integer consultationOrderId,
+                                                           Integer clientUserId, Integer transactionStatus);
+
+    /**
+     * 新增支付交易
+     *
+     * @param paymentTransaction 支付交易
+     * @return R<LawyerPaymentTransaction>
+     */
+    R<LawyerPaymentTransaction> addPaymentTransaction(LawyerPaymentTransaction paymentTransaction);
+
+    /**
+     * 编辑支付交易
+     *
+     * @param paymentTransaction 支付交易
+     * @return R<LawyerPaymentTransaction>
+     */
+    R<LawyerPaymentTransaction> editPaymentTransaction(LawyerPaymentTransaction paymentTransaction);
+
+    /**
+     * 删除支付交易
+     *
+     * @param id 主键
+     * @return R<Boolean>
+     */
+    R<Boolean> deletePaymentTransaction(Integer id);
+}
+

+ 82 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerPaymentTransactionServiceImpl.java

@@ -0,0 +1,82 @@
+package shop.alien.lawyer.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import shop.alien.entity.result.R;
+import shop.alien.entity.store.LawyerPaymentTransaction;
+import shop.alien.lawyer.service.LawyerPaymentTransactionService;
+import shop.alien.mapper.LawyerPaymentTransactionMapper;
+
+/**
+ * 支付交易 服务实现类
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+@Slf4j
+@Transactional
+@Service
+@RequiredArgsConstructor
+public class LawyerPaymentTransactionServiceImpl extends ServiceImpl<LawyerPaymentTransactionMapper, LawyerPaymentTransaction> implements LawyerPaymentTransactionService {
+
+    private final LawyerPaymentTransactionMapper paymentTransactionMapper;
+
+    @Override
+    public R<IPage<LawyerPaymentTransaction>> getPaymentTransactionList(int pageNum, int pageSize, Integer consultationOrderId,
+                                                                   Integer clientUserId, Integer transactionStatus) {
+        log.info("LawyerPaymentTransactionServiceImpl.getPaymentTransactionList?pageNum={},pageSize={},consultationOrderId={},clientUserId={},transactionStatus={}",
+                pageNum, pageSize, consultationOrderId, clientUserId, transactionStatus);
+        Page<LawyerPaymentTransaction> page = new Page<>(pageNum, pageSize);
+        LambdaQueryWrapper<LawyerPaymentTransaction> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(LawyerPaymentTransaction::getDeleteFlag, 0);
+        if (consultationOrderId != null) {
+            queryWrapper.eq(LawyerPaymentTransaction::getConsultationOrderId, consultationOrderId);
+        }
+        if (clientUserId != null) {
+            queryWrapper.eq(LawyerPaymentTransaction::getClientUserId, clientUserId);
+        }
+        if (transactionStatus != null) {
+            queryWrapper.eq(LawyerPaymentTransaction::getTransactionStatus, transactionStatus);
+        }
+        queryWrapper.orderByDesc(LawyerPaymentTransaction::getTransactionTime);
+        IPage<LawyerPaymentTransaction> pageResult = this.page(page, queryWrapper);
+        return R.data(pageResult);
+    }
+
+    @Override
+    public R<LawyerPaymentTransaction> addPaymentTransaction(LawyerPaymentTransaction paymentTransaction) {
+        log.info("LawyerPaymentTransactionServiceImpl.addPaymentTransaction?paymentTransaction={}", paymentTransaction);
+        boolean result = this.save(paymentTransaction);
+        if (result) {
+            return R.data(paymentTransaction);
+        }
+        return R.fail("新增失败");
+    }
+
+    @Override
+    public R<LawyerPaymentTransaction> editPaymentTransaction(LawyerPaymentTransaction paymentTransaction) {
+        log.info("LawyerPaymentTransactionServiceImpl.editPaymentTransaction?paymentTransaction={}", paymentTransaction);
+        boolean result = this.updateById(paymentTransaction);
+        if (result) {
+            return R.data(paymentTransaction);
+        }
+        return R.fail("修改失败");
+    }
+
+    @Override
+    public R<Boolean> deletePaymentTransaction(Integer id) {
+        log.info("LawyerPaymentTransactionServiceImpl.deletePaymentTransaction?id={}", id);
+        boolean result = this.removeById(id);
+        if (result) {
+            return R.success("删除成功");
+        }
+        return R.fail("删除失败");
+    }
+}
+