Browse Source

增加接口平台管理后台接口

longhu 1 tháng trước cách đây
mục cha
commit
cc73dd8c2d

+ 9 - 8
pom.xml

@@ -95,12 +95,6 @@
         </dependency>
 
 
-        <dependency>
-            <groupId>com.basedevelop</groupId>
-            <artifactId>basedevelop</artifactId>
-            <version>1.0</version>
-        </dependency>
-
 
 
         <dependency>
@@ -110,10 +104,17 @@
         </dependency>
 
 
+        <dependency>
+            <groupId>com.basedevelop</groupId>
+            <artifactId>basedevelop</artifactId>
+            <version>1.0</version>
+        </dependency>
+
+
         <dependency>
             <groupId>org.springdoc</groupId>
-            <artifactId>springdoc-openapi-ui</artifactId>
-            <version>1.6.9</version>
+            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
+            <version>2.1.0</version>
         </dependency>
 
 

+ 31 - 44
src/main/java/com/hr/controller/IpAccountController.java

@@ -1,16 +1,17 @@
 package com.hr.controller;
 
-import com.hr.common.core.context.SecurityContextHolder;
 import com.hr.param.IpAccountParam;
-import com.hr.repository.domain.IpAccountPO;
+import com.hr.param.SwitchStatusParam;
 import com.hr.service.IpAccountService;
 import com.hr.vo.IpAccountVO;
+import com.yy.basedevelop.common.data.BasePageResult;
+import com.yy.basedevelop.common.data.BaseReturnDto;
+import com.yy.basedevelop.common.http.config.TokenUtil;
+import com.yy.basedevelop.dto.LoginUser;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
 /**
@@ -19,74 +20,60 @@ import org.springframework.web.bind.annotation.*;
  * @date : 2025-10-10
  */
 @RestController
-@RequestMapping("/IpAccountPO")
+@RequestMapping("/ipAccount")
 @Tag(name = "账户管理")
 public class IpAccountController{
     @Autowired
     private IpAccountService ipAccountService;
     
-    /** 
-     * 通过ID查询单条数据 
-     *
-     * @param aid 主键
-     * @return 实例对象
-     */
-    @Operation(summary = "通过ID查询单条数据")
-    @GetMapping("{aid}")
-    public ResponseEntity<IpAccountVO> queryById(@PathVariable("aid") Long aid){
-        return ResponseEntity.ok(ipAccountService.queryById(aid));
-    }
-    
     /** 
      * 分页查询
      *
-     * @param IpAccountPO 筛选条件
-     * @param pageRequest 分页对象
+     * @param ipAccountParam 筛选条件
      * @return 查询结果
      */
     @Operation(summary = "分页查询")
     @GetMapping
-    public Page<IpAccountPO> paginQuery(IpAccountPO IpAccountPO, PageRequest pageRequest){
-        return ipAccountService.paginQuery(IpAccountPO, pageRequest.getPageNumber(), pageRequest.getPageSize());
+    public BasePageResult<IpAccountVO> paginQuery(@RequestBody IpAccountParam ipAccountParam){
+        Page<IpAccountVO> ipAccountPOS = ipAccountService.paginQuery(ipAccountParam, ipAccountParam.getPageNum(), ipAccountParam.getPageSize());
+        return BasePageResult.success(ipAccountPOS.getContent(), ipAccountPOS.getTotalElements(), ipAccountParam.getPageNum(), ipAccountParam.getPageSize());
     }
     
     /** 
      * 新增数据
      *
-     * @param IpAccountPO 实例对象
+     * @param accountParam 实例对象
      * @return 实例对象
      */
     @Operation(summary = "新增/更新数据")
     @PostMapping
-    public ResponseEntity<IpAccountVO> saveOrUpdate(@RequestBody IpAccountParam accountParam){
-        String userName = SecurityContextHolder.getUserName();
-        Long userId = SecurityContextHolder.getUserId();
-        ipAccountService.saveOrUpdate(accountParam,userName,userId);
-        return ResponseEntity.ok().build();
+    public BaseReturnDto<IpAccountVO> saveOrUpdate(@RequestBody IpAccountParam accountParam){
+        LoginUser user= TokenUtil.getUser();
+        ipAccountService.saveOrUpdate(accountParam,user.getUsername(),user.getUserid());
+        return BaseReturnDto.success();
     }
-    
-    /** 
-     * 更新数据
-     *
-     * @param IpAccountPO 实例对象
-     * @return 实例对象
-     */
-    @Operation(summary = "更新数据")
-    @PutMapping
-    public ResponseEntity edit(IpAccountPO IpAccountPO){
-        ipAccountService.update(IpAccountPO);
-        return ResponseEntity.ok("success");
-    }
-    
+
     /** 
      * 通过主键删除数据
      *
-     * @param aid 主键
+     * @param id 主键
      * @return 是否成功
      */
     @Operation(summary = "通过主键删除数据")
     @DeleteMapping
-    public ResponseEntity<Boolean> deleteById(Long aid){
-        return ResponseEntity.ok(ipAccountService.deleteById(aid));
+    public BaseReturnDto<Boolean> deleteById(Long id){
+        return BaseReturnDto.success(ipAccountService.deleteById(id));
+    }
+
+    /**
+     * 修改状态
+     *
+     * @param switchStatusParam 主键
+     * @return 是否成功
+     */
+    @Operation(summary = "修改状态")
+    @PostMapping("/switchStatus")
+    public BaseReturnDto<Boolean> switchStatus(@RequestBody SwitchStatusParam switchStatusParam){
+        return BaseReturnDto.success(ipAccountService.switchStatus(switchStatusParam));
     }
 }

+ 82 - 0
src/main/java/com/hr/controller/IpInterfaceController.java

@@ -0,0 +1,82 @@
+package com.hr.controller;
+
+import com.hr.param.IpInterfaceParam;
+import com.hr.param.SwitchStatusParam;
+import com.hr.service.IpInterfaceService;
+import com.hr.vo.IpAccountVO;
+import com.hr.vo.IpInterfaceVO;
+import com.yy.basedevelop.common.data.BasePageResult;
+import com.yy.basedevelop.common.data.BaseReturnDto;
+import com.yy.basedevelop.common.http.config.TokenUtil;
+import com.yy.basedevelop.dto.LoginUser;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 接口管理
+ * @author : longhoo
+ * @date : 2025-10-10
+ */
+@RestController
+@RequestMapping("/ipInterface")
+@Tag(name = "接口管理")
+public class IpInterfaceController {
+    @Autowired
+    private IpInterfaceService ipInterfaceService;
+    
+    /** 
+     * 分页查询
+     *
+     * @param ipInterfaceParam 筛选条件
+     * @return 查询结果
+     */
+    @Operation(summary = "分页查询")
+    @GetMapping
+    public BasePageResult<IpInterfaceVO> paginQuery(@RequestBody IpInterfaceParam ipInterfaceParam){
+        Page<IpInterfaceVO> ipAccountPOS = ipInterfaceService.paginQuery(ipInterfaceParam, ipInterfaceParam.getPageNum(), ipInterfaceParam.getPageSize());
+        return BasePageResult.success(ipAccountPOS.getContent(), ipAccountPOS.getTotalElements(), ipInterfaceParam.getPageNum(), ipInterfaceParam.getPageSize());
+    }
+    
+    /** 
+     * 新增数据
+     *
+     * @param ipInterfaceParam 实例对象
+     * @return 实例对象
+     */
+    @Operation(summary = "新增/更新数据")
+    @PostMapping
+    public BaseReturnDto<IpAccountVO> saveOrUpdate(@RequestBody IpInterfaceParam ipInterfaceParam){
+        LoginUser user= TokenUtil.getUser();
+        ipInterfaceService.saveOrUpdate(ipInterfaceParam,user.getUsername(),user.getUserid());
+        return BaseReturnDto.success();
+    }
+
+    /** 
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 是否成功
+     */
+    @Operation(summary = "通过主键删除数据")
+    @DeleteMapping
+    public BaseReturnDto<Boolean> deleteById(Long id){
+        return BaseReturnDto.success(ipInterfaceService.deleteById(id));
+    }
+
+    /**
+     * 修改状态
+     *
+     * @param switchStatusParam 主键
+     * @return 是否成功
+     */
+    @Operation(summary = "修改状态")
+    @PostMapping("/switchStatus")
+    public BaseReturnDto<Boolean> switchStatus(@RequestBody SwitchStatusParam switchStatusParam){
+        return BaseReturnDto.success(ipInterfaceService.switchStatus(switchStatusParam));
+    }
+
+
+}

+ 2 - 2
src/main/java/com/hr/param/IpAccountParam.java

@@ -8,7 +8,7 @@ import lombok.Data;
  * @date : 2025-10-10
  */
 @Data
-public class IpAccountParam{
+public class IpAccountParam extends PageParam{
     /** 主键 */
     private Long id ;
     /** 账户编号 */
@@ -16,6 +16,6 @@ public class IpAccountParam{
     /** 备注 */
     private String remark ;
     /** 状态,normal 有效,disable 禁用,delete 删除 */
-    private String accStatus ;
+    private String status ;
 
 }

+ 48 - 0
src/main/java/com/hr/param/IpInterfaceParam.java

@@ -0,0 +1,48 @@
+package com.hr.param;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import lombok.Data;
+import org.hibernate.query.Page;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+ /**
+ * 接口表;IpInterface数据表的PO对象
+ * @author : longhoo
+ * @date : 2025-10-10
+ */
+@Data
+public class IpInterfaceParam extends PageParam {
+
+    /** 主键,; */
+    private Long id ;
+    /** 接口名称,名称唯一,; */
+    private String interfaceName ;
+     /** 接口编号,标号唯一,; */
+     private String interfaceNo ;
+    /** 接口厂商,; */
+    private String manufacturer ;
+    /** 备注,; */
+    private String remark ;
+    /** 状态,normal 有效,disable 禁用,delete 删除,; */
+    private String status ;
+    /** 接口配置,JSON格式的配置文件,存放接口参数,; */
+    private String interfaceConfig ;
+    /** 创建时间,; */
+    private LocalDateTime addTime ;
+    /** 更新时间,; */
+    private LocalDateTime updateTime ;
+    /** 创建人id,; */
+    private Long addUserId ;
+    /** 更新人id,; */
+    private Long updateUserId ;
+    /** 创建人姓名,; */
+    private String addUserName ;
+    /** 更新人姓名,; */
+    private String updateUserName ;
+
+}

+ 14 - 0
src/main/java/com/hr/param/PageParam.java

@@ -0,0 +1,14 @@
+package com.hr.param;
+
+import lombok.Data;
+
+@Data
+public class PageParam {
+
+    private Integer pageNum;
+    private Integer pageSize;
+
+    public Integer getPageNum(){
+        return pageNum == null ? 0 : pageNum - 1;
+    }
+}

+ 11 - 0
src/main/java/com/hr/param/SwitchStatusParam.java

@@ -0,0 +1,11 @@
+package com.hr.param;
+
+import lombok.Data;
+
+@Data
+public class SwitchStatusParam {
+
+    private Long id;
+
+    private String status;
+}

+ 10 - 5
src/main/java/com/hr/repository/domain/IpAccountPO.java

@@ -1,9 +1,6 @@
 package com.hr.repository.domain;
 
-import jakarta.persistence.Entity;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
+import jakarta.persistence.*;
 import lombok.Data;
 import org.springframework.web.bind.annotation.ModelAttribute;
 
@@ -23,21 +20,29 @@ public class IpAccountPO implements Serializable,Cloneable{
     /** 主键 */
     private Long id ;
     /** 账户编号 */
+    @Column(name = "acc_no")
     private String accNo ;
     /** 备注 */
     private String remark ;
     /** 状态,normal 有效,disable 禁用,delete 删除 */
-    private String accStatus ;
+    @Column(name = "status")
+    private String status ;
     /** 创建时间 */
+    @Column(name = "add_time")
     private LocalDateTime addTime ;
     /** 更新时间 */
+    @Column(name = "update_time")
     private LocalDateTime updateTime ;
     /** 创建人id */
+    @Column(name = "add_user_id")
     private Long addUserId ;
     /** 更新人id */
+    @Column(name = "update_user_id")
     private Long updateUserId ;
     /** 创建人姓名 */
+    @Column(name = "add_user_name")
     private String addUserName ;
     /** 更新人姓名 */
+    @Column(name = "update_user_name")
     private String updateUserName ;
 }

+ 20 - 3
src/main/java/com/hr/repository/domain/IpInterfacePO.java

@@ -1,5 +1,6 @@
 package com.hr.repository.domain;
 
+import jakarta.persistence.Column;
 import jakarta.persistence.Entity;
 import jakarta.persistence.Id;
 import lombok.Data;
@@ -20,27 +21,43 @@ public class IpInterfacePO implements Serializable,Cloneable{
     /** 主键,; */
     @Id
     private Long id ;
+    @Column(name="interface_name")
     /** 接口名称,名称唯一,; */
     private String interfaceName ;
+
+    /** 接口编号,标号唯一,; */
+    @Column(name="interface_no")
+    private String interfaceNo ;
+
     /** 接口厂商,; */
+    @Column(name="manufacturer")
     private String manufacturer ;
     /** 备注,; */
+    @Column(name="remark")
     private String remark ;
     /** 状态,normal 有效,disable 禁用,delete 删除,; */
-    private String interfaceStatus ;
+    @Column(name="status")
+    private String status ;
     /** 接口配置,JSON格式的配置文件,存放接口参数,; */
+    @Column(name="interface_config")
     private String interfaceConfig ;
     /** 创建时间,; */
+    @Column(name="add_time")
     private LocalDateTime addTime ;
     /** 更新时间,; */
+    @Column(name="update_time")
     private LocalDateTime updateTime ;
     /** 创建人id,; */
-    private String addUserId ;
+    @Column(name="add_user_id")
+    private Long addUserId ;
     /** 更新人id,; */
-    private String updateUserId ;
+    @Column(name="update_user_id")
+    private Long updateUserId ;
     /** 创建人姓名,; */
+    @Column(name="add_user_name")
     private String addUserName ;
     /** 更新人姓名,; */
+    @Column(name="update_user_name")
     private String updateUserName ;
 
 }

+ 18 - 2
src/main/java/com/hr/repository/domain/IpLogPO.java

@@ -1,5 +1,6 @@
 package com.hr.repository.domain;
 
+import jakarta.persistence.Column;
 import jakarta.persistence.Entity;
 import jakarta.persistence.Id;
 import lombok.Data;
@@ -19,36 +20,51 @@ public class IpLogPO implements Serializable,Cloneable{
     @Id
     /** 主键,; */
     private Long id ;
+    @Column(name="oid")
     /** 调用记录表主键,; */
     private String oid ;
     /** 调用编号(业务编号),唯一,格式为年月日时分秒毫秒加6位随机数
 20250918010256001000001,; */
+    @Column(name="order_no")
     private String orderNo ;
     /** 执行类型,request请求,callback回调,; */
+    @Column(name="execute_type")
     private String executeType ;
     /** 请求地址/回调地址,如果是请求类型则记录请求地址。若是回调类型则记录回调地址。,; */
+    @Column(name="url")
     private String url ;
     /** 请求状态,handle处理中,success成功,fail失败,; */
+    @Column(name="status")
     private String status ;
     /** 请求参数,临时存储json格式,通过定时任务上传到OSS后更换为oss存储url,; */
+    @Column(name="request_param")
     private String requestParam ;
     /** 响应结果,临时存储json格式,通过定时任务上传到OSS后更换为oss存储url,; */
+    @Column(name="response_result")
     private String responseResult ;
     /** 响应状态码,; */
+    @Column(name="http_status")
     private String httpStatus ;
     /** 异常信息,存储调用时的各种程序异常信息,; */
+    @Column(name="msg")
     private String msg ;
     /** 创建时间,; */
+    @Column(name="add_time")
     private LocalDateTime addTime ;
     /** 更新时间,; */
+    @Column(name="update_time")
     private LocalDateTime updateTime ;
     /** 创建人id,; */
-    private String addUserId ;
+    @Column(name="add_user_id")
+    private Long addUserId ;
     /** 更新人id,; */
-    private String updateUserId ;
+    @Column(name="update_user_id")
+    private Long updateUserId ;
     /** 创建人姓名,; */
+    @Column(name="add_user_name")
     private String addUserName ;
     /** 更新人姓名,; */
+    @Column(name="update_user_name")
     private String updateUserName ;
     
 }

+ 18 - 2
src/main/java/com/hr/repository/domain/IpOrderPO.java

@@ -1,5 +1,6 @@
 package com.hr.repository.domain;
 
+import jakarta.persistence.Column;
 import jakarta.persistence.Entity;
 import jakarta.persistence.Id;
 import lombok.Data;
@@ -25,61 +26,76 @@ public class IpOrderPO implements Serializable, Cloneable {
     /**
      * 调用编号(业务编号),唯一,格式为年月日时分秒毫秒加6位随机数20250918010256001000001,;
      */
+    @Column(name = "order_no")
     private String orderNo;
     /**
      * 接口名称,;
      */
+    @Column(name = "interface_name")
     private String interfaceName;
     /**
      * 账户编号,;
      */
+    @Column(name = "acc_no")
     private String accNo;
     /**
      * token值,;
      */
+    @Column(name = "token")
     private String token;
     /**
      * 回调地址,;
      */
+    @Column(name = "callback_url")
     private String callbackUrl;
     /**
      * 是否支持回调,yes支持,no不支持,;
      */
+    @Column(name = "is_callback")
     private String isCallback;
     /**
      * 回调次数,尝试回调的次数,超过次数则不再回调,;
      */
+    @Column(name = "callback_num")
     private int callbackNum;
     /**
      * 调用状态,handle处理中,success成功,fail失败,;
      */
+    @Column(name = "order_status")
     private String orderStatus;
     /**
      * 回调状态,handle处理中,success成功,fail失败,;
      */
+    @Column(name = "callback_status")
     private String callbackStatus;
     /**
      * 创建时间,;
      */
+    @Column(name = "add_time")
     private LocalDateTime addTime;
     /**
      * 更新时间,;
      */
+    @Column(name = "update_time")
     private LocalDateTime updateTime;
     /**
      * 创建人id,;
      */
-    private String addUserId;
+    @Column(name = "add_user_id")
+    private Long addUserId;
     /**
      * 更新人id,;
      */
-    private String updateUserId;
+    @Column(name = "update_user_id")
+    private Long updateUserId;
     /**
      * 创建人姓名,;
      */
+    @Column(name = "add_user_name")
     private String addUserName;
     /**
      * 更新人姓名,;
      */
+    @Column(name = "update_user_name")
     private String updateUserName;
 }

+ 14 - 2
src/main/java/com/hr/repository/domain/IpTokenInterfacePO.java

@@ -1,5 +1,6 @@
 package com.hr.repository.domain;
 
+import jakarta.persistence.Column;
 import jakarta.persistence.Entity;
 import jakarta.persistence.Id;
 import lombok.Data;
@@ -22,25 +23,36 @@ public class IpTokenInterfacePO implements Serializable,Cloneable{
     /** 主键,; */
     private Long id ;
     /** token表主键,; */
+    @Column(name = "tid")
     private String tid ;
     /** 接口表主键,; */
+    @Column(name = "iid")
     private String iid ;
     /** 是否支持回调,yes支持,no不支持,; */
+    @Column(name = "is_callback")
     private String isCallback ;
     /** 回调地址(回调url),回调的url,只有在支持回调时才有,; */
+    @Column(name = "callback_url")
     private String callbackUrl ;
     /** 回调次数,尝试回调的次数,超过次数则不再回调,; */
+    @Column(name = "callback_num")
     private int callbackNum ;
     /** 创建时间,; */
+    @Column(name = "add_time")
     private LocalDateTime addTime ;
     /** 更新时间,; */
+    @Column(name = "update_time")
     private LocalDateTime updateTime ;
     /** 创建人id,; */
-    private String addUserId ;
+    @Column(name = "add_user_id")
+    private Long addUserId ;
     /** 更新人id,; */
-    private String updateUserId ;
+    @Column(name = "update_user_id")
+    private Long updateUserId ;
     /** 创建人姓名,; */
+    @Column(name = "add_user_name")
     private String addUserName ;
     /** 更新人姓名,; */
+    @Column(name = "update_user_name")
     private String updateUserName ;
 }

+ 14 - 2
src/main/java/com/hr/repository/domain/IpTokenPO.java

@@ -1,5 +1,6 @@
 package com.hr.repository.domain;
 
+import jakarta.persistence.Column;
 import jakarta.persistence.Entity;
 import jakarta.persistence.Id;
 import lombok.Data;
@@ -21,25 +22,36 @@ public class IpTokenPO implements Serializable,Cloneable{
     /** 主键,; */
     private Long id ;
     /** 账户表主键,; */
+    @Column(name = "aid")
     private Long aid ;
     /** token值,; */
+    @Column(name = "token")
     private String token ;
     /** 密钥值,; */
+    @Column(name = "secret")
     private String secret ;
     /** 备注,; */
+    @Column(name = "remark")
     private String remark ;
     /** 状态,normal 有效,disable 禁用,delete 删除,; */
+    @Column(name = "token_status")
     private String tokenStatus ;
     /** 创建时间,; */
+    @Column(name = "add_time")
     private LocalDateTime addTime ;
     /** 更新时间,; */
+    @Column(name = "update_time")
     private LocalDateTime updateTime ;
     /** 创建人id,; */
-    private String addUserId ;
+    @Column(name = "add_user_id")
+    private Long addUserId ;
     /** 更新人id,; */
-    private String updateUserId ;
+    @Column(name = "update_user_id")
+    private Long updateUserId ;
     /** 创建人姓名,; */
+    @Column(name = "add_user_name")
     private String addUserName ;
     /** 更新人姓名,; */
+    @Column(name = "update_user_name")
     private String updateUserName ;
 }

+ 3 - 0
src/main/java/com/hr/repository/jpa/IpInterfaceRepository.java

@@ -14,4 +14,7 @@ public interface IpInterfaceRepository extends JpaRepository<IpInterfacePO,Long>
 
     IpInterfacePO queryById(Long id);
 
+    IpInterfacePO findByInterfaceName(String interfaceName);
+    IpInterfacePO findByInterfaceNo(String interfaceNo);
+
 }

+ 0 - 79
src/main/java/com/hr/repository/service/impl/IpInterfaceServiceImpl.java

@@ -1,79 +0,0 @@
-package com.hr.repository.service.impl;
-
-import com.hr.repository.domain.IpInterfacePO;
-import com.hr.repository.jpa.IpInterfaceRepository;
-import com.hr.repository.service.IpInterfaceService;
-import com.hr.vo.IpInterfaceVO;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.*;
-import org.springframework.stereotype.Service;
-
-/**
- * 接口表;(ip_interface)表服务接口实现类
- * @author : http://www.yonsum.com
- * @date : 2025-10-10
- */
-@Service
-public class IpInterfaceServiceImpl implements IpInterfaceService {
-    @Autowired
-    private IpInterfaceRepository ipInterfaceRepository;
-    
-    /** 
-     * 通过ID查询单条数据 
-     *
-     * @param id 主键
-     * @return 实例对象
-     */
-    public IpInterfaceVO queryById(Long id){
-        IpInterfacePO ipInterfacePO = ipInterfaceRepository.queryById(id);
-        IpInterfaceVO ipInterfaceVO = new IpInterfaceVO();
-        if(ipInterfacePO != null){
-            BeanUtils.copyProperties(ipInterfacePO, ipInterfaceVO);
-            return ipInterfaceVO;
-        }
-        return null;
-    }
-
-     @Override
-     public Page<IpInterfacePO> paginQuery(IpInterfacePO IpInterfacePO, Integer current, Integer size) {
-         ExampleMatcher matcher = ExampleMatcher.matchingAll()
-                 .withIgnoreNullValues()                              // 忽略 null 字段
-                 .withIgnoreCase();
-         Pageable pageAble = PageRequest.of(current, size);
-         Example<IpInterfacePO> example = Example.of(IpInterfacePO, matcher);
-         Page<IpInterfacePO> result = ipInterfaceRepository.findAll(example, pageAble);
-         return result;
-     }
-
-     /**
-     * 新增数据
-     *
-     * @param IpInterfacePO 实例对象
-     * @return 实例对象
-     */
-    public void insert(IpInterfacePO IpInterfacePO){
-        ipInterfaceRepository.save(IpInterfacePO);
-    }
-    
-    /** 
-     * 更新数据
-     *
-     * @param IpInterfacePO 实例对象
-     * @return 实例对象
-     */
-    public void  update(IpInterfacePO IpInterfacePO){
-        ipInterfaceRepository.save(IpInterfacePO);
-    }
-    
-    /** 
-     * 通过主键删除数据
-     *
-     * @param iid 主键
-     * @return 是否成功
-     */
-    public boolean deleteById(Long iid){
-        ipInterfaceRepository.deleteById(iid);
-        return true;
-    }
-}

+ 5 - 1
src/main/java/com/hr/service/IpAccountService.java

@@ -3,6 +3,7 @@ package com.hr.service;
 
 import com.github.pagehelper.PageInfo;
 import com.hr.param.IpAccountParam;
+import com.hr.param.SwitchStatusParam;
 import com.hr.repository.domain.IpAccountPO;
 import com.hr.vo.IpAccountVO;
 import org.springframework.data.domain.Page;
@@ -30,7 +31,7 @@ public interface IpAccountService{
      * @param size  每页大小
      * @return
      */
-    Page<IpAccountPO> paginQuery(IpAccountPO IpAccountPO, Integer current, Integer size);
+    Page<IpAccountVO> paginQuery(IpAccountParam ipAccountParam, Integer current, Integer size);
     /** 
      * 新增数据
      *
@@ -54,4 +55,7 @@ public interface IpAccountService{
     boolean deleteById(Long aid);
 
     void saveOrUpdate(IpAccountParam accountParam, String userName, Long userId);
+
+    Boolean switchStatus(SwitchStatusParam switchStatusParam);
+
 }

+ 10 - 4
src/main/java/com/hr/repository/service/IpInterfaceService.java → src/main/java/com/hr/service/IpInterfaceService.java

@@ -1,6 +1,7 @@
-package com.hr.repository.service;
+package com.hr.service;
 
-import com.github.pagehelper.PageInfo;
+import com.hr.param.IpInterfaceParam;
+import com.hr.param.SwitchStatusParam;
 import com.hr.repository.domain.IpInterfacePO;
 import com.hr.vo.IpInterfaceVO;
 import org.springframework.data.domain.Page;
@@ -23,12 +24,12 @@ public interface IpInterfaceService{
     /**
      * 分页查询
      *
-     * @param IpInterfacePO 筛选条件
+     * @param interfaceParam 筛选条件
      * @param current 当前页码
      * @param size  每页大小
      * @return
      */
-    Page<IpInterfacePO> paginQuery(IpInterfacePO IpInterfacePO, Integer current, Integer size);
+    Page<IpInterfaceVO> paginQuery(IpInterfaceParam interfaceParam, Integer current, Integer size);
     /** 
      * 新增数据
      *
@@ -50,4 +51,9 @@ public interface IpInterfaceService{
      * @return 是否成功
      */
     boolean deleteById(Long iid);
+
+    void saveOrUpdate(IpInterfaceParam ipInterfaceParam, String username, Long userid);
+
+    Boolean switchStatus(SwitchStatusParam switchStatusParam);
+
 }

+ 31 - 6
src/main/java/com/hr/service/impl/IpAccountServiceImpl.java

@@ -1,19 +1,23 @@
 package com.hr.service.impl;
 
 
-import cn.hutool.core.lang.Snowflake;
-import cn.hutool.core.util.IdUtil;
 import com.hr.param.IpAccountParam;
+import com.hr.param.SwitchStatusParam;
 import com.hr.repository.domain.IpAccountPO;
+import com.hr.repository.domain.IpInterfacePO;
 import com.hr.repository.jpa.IpAccountRepository;
 import com.hr.service.IpAccountService;
+import com.hr.util.SnowflakeIdWorker;
 import com.hr.vo.IpAccountVO;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
 import org.springframework.data.domain.*;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 账户表;(ip_account)表服务接口实现类
@@ -42,14 +46,25 @@ public class IpAccountServiceImpl implements IpAccountService {
     }
 
     @Override
-    public Page<IpAccountPO> paginQuery(IpAccountPO ipAccountPO, Integer current, Integer size) {
+    public Page<IpAccountVO> paginQuery(IpAccountParam ipAccountParam, Integer current, Integer size) {
+        IpAccountPO ipAccountPO = new IpAccountPO();
+        BeanUtils.copyProperties(ipAccountParam, ipAccountPO);
         ExampleMatcher matcher = ExampleMatcher.matchingAll()
                 .withIgnoreNullValues()                              // 忽略 null 字段
                 .withIgnoreCase();
         Pageable pageAble = PageRequest.of(current, size);
         Example<IpAccountPO> example = Example.of(ipAccountPO, matcher);
         Page<IpAccountPO> page = ipAccountRepository.findAll(example, pageAble);
-        return page;
+        List<IpAccountVO> resultList = new ArrayList<>();
+
+        page.getContent().forEach(item -> {
+            IpAccountVO vo = new IpAccountVO();
+            BeanUtils.copyProperties(item, vo);
+            resultList.add(vo);
+        });
+        Page<IpAccountVO> resultPage = new PageImpl(resultList);
+        BeanUtils.copyProperties(page, resultPage);
+        return resultPage;
     }
     
     /** 
@@ -72,6 +87,17 @@ public class IpAccountServiceImpl implements IpAccountService {
         ipAccountRepository.save(IpAccountPO);
     }
 
+    @Override
+    public Boolean switchStatus(SwitchStatusParam switchStatusParam) {
+        IpAccountPO ipAccountPO = ipAccountRepository.queryById(switchStatusParam.getId());
+        if(ipAccountPO == null){
+            throw new RuntimeException("接口不存在");
+        }
+        ipAccountPO.setStatus(switchStatusParam.getStatus());
+        ipAccountRepository.save(ipAccountPO);
+        return true;
+    }
+
     @Override
     public void saveOrUpdate(IpAccountParam accountParam, String userName, Long userId) {
         IpAccountPO ipAccountPO ;
@@ -84,8 +110,7 @@ public class IpAccountServiceImpl implements IpAccountService {
         ipAccountPO = new IpAccountPO();
         BeanUtils.copyProperties(accountParam, ipAccountPO);
         if(accountParam.getId() == null){
-            Snowflake snowflake = IdUtil.getSnowflake(1, 1);
-            ipAccountPO.setId(Id);
+            ipAccountPO.setId(SnowflakeIdWorker.nextId());
             ipAccountPO.setAddTime(LocalDateTime.now());
             ipAccountPO.setAddUserId(userId);
             ipAccountPO.setAddUserName(userName);

+ 145 - 0
src/main/java/com/hr/service/impl/IpInterfaceServiceImpl.java

@@ -0,0 +1,145 @@
+package com.hr.service.impl;
+
+import com.hr.param.IpInterfaceParam;
+import com.hr.param.SwitchStatusParam;
+import com.hr.repository.domain.IpInterfacePO;
+import com.hr.repository.jpa.IpInterfaceRepository;
+import com.hr.service.IpInterfaceService;
+import com.hr.util.SnowflakeIdWorker;
+import com.hr.vo.IpInterfaceVO;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.*;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 接口表;(ip_interface)表服务接口实现类
+ * @author : http://www.yonsum.com
+ * @date : 2025-10-10
+ */
+@Service
+public class IpInterfaceServiceImpl implements IpInterfaceService {
+    @Autowired
+    private IpInterfaceRepository ipInterfaceRepository;
+    
+    /** 
+     * 通过ID查询单条数据 
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    public IpInterfaceVO queryById(Long id){
+        IpInterfacePO ipInterfacePO = ipInterfaceRepository.queryById(id);
+        IpInterfaceVO ipInterfaceVO = new IpInterfaceVO();
+        if(ipInterfacePO != null){
+            BeanUtils.copyProperties(ipInterfacePO, ipInterfaceVO);
+            return ipInterfaceVO;
+        }
+        return null;
+    }
+
+     @Override
+     public Page<IpInterfaceVO> paginQuery(IpInterfaceParam interfaceParam, Integer current, Integer size) {
+         IpInterfacePO ipInterfacePO = new IpInterfacePO();
+         BeanUtils.copyProperties(interfaceParam, ipInterfacePO);
+         ExampleMatcher matcher = ExampleMatcher.matchingAll()
+                 .withIgnoreNullValues()                              // 忽略 null 字段
+                 .withIgnoreCase();
+         Pageable pageAble = PageRequest.of(current, size);
+         Example<IpInterfacePO> example = Example.of(ipInterfacePO, matcher);
+         Page<IpInterfacePO> page = ipInterfaceRepository.findAll(example, pageAble);
+         List<IpInterfaceVO> resultList = new ArrayList<>();
+
+         page.getContent().forEach(item -> {
+             IpInterfaceVO vo = new IpInterfaceVO();
+             BeanUtils.copyProperties(item, vo);
+             resultList.add(vo);
+         });
+         Page<IpInterfaceVO> resultPage = new PageImpl(resultList);
+         BeanUtils.copyProperties(page, resultPage);
+         return resultPage;
+     }
+
+     /**
+     * 新增数据
+     *
+     * @param IpInterfacePO 实例对象
+     * @return 实例对象
+     */
+    public void insert(IpInterfacePO IpInterfacePO){
+        ipInterfaceRepository.save(IpInterfacePO);
+    }
+    
+    /** 
+     * 更新数据
+     *
+     * @param IpInterfacePO 实例对象
+     * @return 实例对象
+     */
+    public void  update(IpInterfacePO IpInterfacePO){
+        ipInterfaceRepository.save(IpInterfacePO);
+    }
+
+    @Override
+    public Boolean switchStatus(SwitchStatusParam switchStatusParam) {
+        IpInterfacePO ipInterfacePO = ipInterfaceRepository.queryById(switchStatusParam.getId());
+        if(ipInterfacePO == null){
+            throw new RuntimeException("接口不存在");
+        }
+        ipInterfacePO.setStatus(switchStatusParam.getStatus());
+        ipInterfaceRepository.save(ipInterfacePO);
+        return true;
+    }
+
+    @Override
+    public void saveOrUpdate(IpInterfaceParam ipInterfaceParam, String username, Long userid) {
+        IpInterfacePO ipInterfacePO ;
+        if(ipInterfaceParam.getId() == null){
+            ipInterfacePO = ipInterfaceRepository.findByInterfaceName(ipInterfaceParam.getInterfaceName());
+            if(ipInterfacePO != null){
+                throw new RuntimeException("接口名称已存在");
+            }
+
+            ipInterfacePO = ipInterfaceRepository.findByInterfaceNo(ipInterfaceParam.getInterfaceNo());
+            if(ipInterfacePO != null){
+                throw new RuntimeException("接口编号已存在");
+            }
+        }else{
+            ipInterfacePO = ipInterfaceRepository.findByInterfaceName(ipInterfaceParam.getInterfaceName());
+            if(ipInterfaceParam != null && ipInterfacePO.getInterfaceName().equals(ipInterfaceParam.getInterfaceName()) && !ipInterfacePO.getId().equals(ipInterfaceParam.getId())){
+                throw new RuntimeException("接口名称已存在");
+            }
+            ipInterfacePO = ipInterfaceRepository.findByInterfaceNo(ipInterfaceParam.getInterfaceNo());
+            if(ipInterfaceParam != null && ipInterfacePO.getInterfaceNo().equals(ipInterfaceParam.getInterfaceNo()) && !ipInterfacePO.getId().equals(ipInterfaceParam.getId())){
+                throw new RuntimeException("接口编号已存在");
+            }
+        }
+        ipInterfacePO = new IpInterfacePO();
+        BeanUtils.copyProperties(ipInterfaceParam, ipInterfacePO);
+        if(ipInterfaceParam.getId() == null){
+            ipInterfacePO.setId(SnowflakeIdWorker.nextId());
+            ipInterfacePO.setAddTime(LocalDateTime.now());
+            ipInterfacePO.setAddUserId(userid);
+            ipInterfacePO.setAddUserName(username);
+        }
+        ipInterfacePO.setUpdateTime(LocalDateTime.now());
+        ipInterfacePO.setUpdateUserId(userid);
+        ipInterfacePO.setUpdateUserName(username);
+        ipInterfaceRepository.save(ipInterfacePO);
+    }
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param iid 主键
+     * @return 是否成功
+     */
+    public boolean deleteById(Long iid){
+        ipInterfaceRepository.deleteById(iid);
+        return true;
+    }
+}

+ 1 - 3
src/main/java/com/hr/util/SnowflakeIdWorker.java

@@ -1,8 +1,6 @@
 package com.hr.util;
 
-
-import java.util.concurrent.TimeUtil
-
+import java.util.concurrent.TimeUnit;
 /**
  * <p>TODO</p>
  *

+ 4 - 1
src/main/java/com/hr/vo/IpAccountVO.java

@@ -1,5 +1,6 @@
 package com.hr.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import jakarta.persistence.Entity;
 import jakarta.persistence.Id;
 import lombok.Data;
@@ -22,10 +23,12 @@ public class IpAccountVO implements Serializable,Cloneable{
     /** 备注,; */
     private String remark ;
     /** 状态,normal 有效,disable 禁用,delete 删除,; */
-    private String accStatus ;
+    private String status ;
     /** 创建时间,; */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime addTime ;
     /** 更新时间,; */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime updateTime ;
     /** 创建人id,; */
     private String addUserId ;

+ 6 - 3
src/main/java/com/hr/vo/IpInterfaceVO.java

@@ -1,5 +1,6 @@
 package com.hr.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -22,17 +23,19 @@ public class IpInterfaceVO implements Serializable,Cloneable{
     /** 备注,; */
     private String remark ;
     /** 状态,normal 有效,disable 禁用,delete 删除,; */
-    private String interfaceStatus ;
+    private String status ;
     /** 接口配置,JSON格式的配置文件,存放接口参数,; */
     private String interfaceConfig ;
     /** 创建时间,; */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime addTime ;
     /** 更新时间,; */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime updateTime ;
     /** 创建人id,; */
-    private String addUserId ;
+    private Long addUserId ;
     /** 更新人id,; */
-    private String updateUserId ;
+    private Long updateUserId ;
     /** 创建人姓名,; */
     private String addUserName ;
     /** 更新人姓名,; */