Browse Source

从网站导入专利建表 lrj

lwhhszx 2 years ago
parent
commit
0444ef9f0c

+ 160 - 0
PAS/src/main/java/cn/cslg/pas/domain/WebConfig.java

@@ -0,0 +1,160 @@
+package cn.cslg.pas.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
+/**
+ * 网站配置
+ * @TableName web_config
+ */
+@TableName(value ="web_config")
+public class WebConfig implements Serializable {
+    /**
+     * ID
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 网站名称
+     */
+    private String webName;
+
+    /**
+     * 网站地址
+     */
+    private String webAddress;
+
+    /**
+     * 账号
+     */
+    private String webAccount;
+
+    /**
+     * 网站密码
+     */
+    private String webPassword;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * ID
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 网站名称
+     */
+    public String getWebName() {
+        return webName;
+    }
+
+    /**
+     * 网站名称
+     */
+    public void setWebName(String webName) {
+        this.webName = webName;
+    }
+
+    /**
+     * 网站地址
+     */
+    public String getWebAddress() {
+        return webAddress;
+    }
+
+    /**
+     * 网站地址
+     */
+    public void setWebAddress(String webAddress) {
+        this.webAddress = webAddress;
+    }
+
+    /**
+     * 账号
+     */
+    public String getWebAccount() {
+        return webAccount;
+    }
+
+    /**
+     * 账号
+     */
+    public void setWebAccount(String webAccount) {
+        this.webAccount = webAccount;
+    }
+
+    /**
+     * 网站密码
+     */
+    public String getWebPassword() {
+        return webPassword;
+    }
+
+    /**
+     * 网站密码
+     */
+    public void setWebPassword(String webPassword) {
+        this.webPassword = webPassword;
+    }
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        WebConfig other = (WebConfig) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getWebName() == null ? other.getWebName() == null : this.getWebName().equals(other.getWebName()))
+            && (this.getWebAddress() == null ? other.getWebAddress() == null : this.getWebAddress().equals(other.getWebAddress()))
+            && (this.getWebAccount() == null ? other.getWebAccount() == null : this.getWebAccount().equals(other.getWebAccount()))
+            && (this.getWebPassword() == null ? other.getWebPassword() == null : this.getWebPassword().equals(other.getWebPassword()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getWebName() == null) ? 0 : getWebName().hashCode());
+        result = prime * result + ((getWebAddress() == null) ? 0 : getWebAddress().hashCode());
+        result = prime * result + ((getWebAccount() == null) ? 0 : getWebAccount().hashCode());
+        result = prime * result + ((getWebPassword() == null) ? 0 : getWebPassword().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", webName=").append(webName);
+        sb.append(", webAddress=").append(webAddress);
+        sb.append(", webAccount=").append(webAccount);
+        sb.append(", webPassword=").append(webPassword);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 205 - 0
PAS/src/main/java/cn/cslg/pas/domain/WebTask.java

@@ -0,0 +1,205 @@
+package cn.cslg.pas.domain;
+
+import cn.cslg.pas.common.model.BaseEntity;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
+/**
+ * 网络拉取任务
+ * @TableName web_task
+ */
+@TableName(value ="web_task")
+public class WebTask extends BaseEntity<WebTask> {
+    /**
+     * ID
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 任务状态
+     */
+    private Integer taskState;
+
+    /**
+     * 网络id
+     */
+    private Integer webId;
+
+    /**
+     * 成功条数
+     */
+    private Integer successNum;
+
+    /**
+     * 失败条数
+     */
+    private Integer defaultNum;
+
+    /**
+     * 查询条件
+     */
+    private String searchCondition;
+
+    /**
+     * 任务进度
+     */
+    private Double taskProcess;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * ID
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 任务状态
+     */
+    public Integer getTaskState() {
+        return taskState;
+    }
+
+    /**
+     * 任务状态
+     */
+    public void setTaskState(Integer taskState) {
+        this.taskState = taskState;
+    }
+
+    /**
+     * 网络id
+     */
+    public Integer getWebId() {
+        return webId;
+    }
+
+    /**
+     * 网络id
+     */
+    public void setWebId(Integer webId) {
+        this.webId = webId;
+    }
+
+    /**
+     * 成功条数
+     */
+    public Integer getSuccessNum() {
+        return successNum;
+    }
+
+    /**
+     * 成功条数
+     */
+    public void setSuccessNum(Integer successNum) {
+        this.successNum = successNum;
+    }
+
+    /**
+     * 失败条数
+     */
+    public Integer getDefaultNum() {
+        return defaultNum;
+    }
+
+    /**
+     * 失败条数
+     */
+    public void setDefaultNum(Integer defaultNum) {
+        this.defaultNum = defaultNum;
+    }
+
+    /**
+     * 查询条件
+     */
+    public String getSearchCondition() {
+        return searchCondition;
+    }
+
+    /**
+     * 查询条件
+     */
+    public void setSearchCondition(String searchCondition) {
+        this.searchCondition = searchCondition;
+    }
+
+    /**
+     * 任务进度
+     */
+    public Double getTaskProcess() {
+        return taskProcess;
+    }
+
+    /**
+     * 任务进度
+     */
+    public void setTaskProcess(Double taskProcess) {
+        this.taskProcess = taskProcess;
+    }
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        WebTask other = (WebTask) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getTaskState() == null ? other.getTaskState() == null : this.getTaskState().equals(other.getTaskState()))
+            && (this.getWebId() == null ? other.getWebId() == null : this.getWebId().equals(other.getWebId()))
+            && (this.getSuccessNum() == null ? other.getSuccessNum() == null : this.getSuccessNum().equals(other.getSuccessNum()))
+            && (this.getDefaultNum() == null ? other.getDefaultNum() == null : this.getDefaultNum().equals(other.getDefaultNum()))
+            && (this.getSearchCondition() == null ? other.getSearchCondition() == null : this.getSearchCondition().equals(other.getSearchCondition()))
+            && (this.getTaskProcess() == null ? other.getTaskProcess() == null : this.getTaskProcess().equals(other.getTaskProcess()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getTaskState() == null) ? 0 : getTaskState().hashCode());
+        result = prime * result + ((getWebId() == null) ? 0 : getWebId().hashCode());
+        result = prime * result + ((getSuccessNum() == null) ? 0 : getSuccessNum().hashCode());
+        result = prime * result + ((getDefaultNum() == null) ? 0 : getDefaultNum().hashCode());
+        result = prime * result + ((getSearchCondition() == null) ? 0 : getSearchCondition().hashCode());
+        result = prime * result + ((getTaskProcess() == null) ? 0 : getTaskProcess().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", taskState=").append(taskState);
+        sb.append(", webId=").append(webId);
+        sb.append(", successNum=").append(successNum);
+        sb.append(", defaultNum=").append(defaultNum);
+        sb.append(", searchCondition=").append(searchCondition);
+        sb.append(", taskProcess=").append(taskProcess);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 160 - 0
PAS/src/main/java/cn/cslg/pas/domain/WebTaskField.java

@@ -0,0 +1,160 @@
+package cn.cslg.pas.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
+/**
+ * 网络任务字段
+ * @TableName web_task_field
+ */
+@TableName(value ="web_task_field")
+public class WebTaskField implements Serializable {
+    /**
+     * ID
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 网络任务ID
+     */
+    private Integer webTaskId;
+
+    /**
+     * 字段名
+     */
+    private String fieldName;
+
+    /**
+     * 字段解释
+     */
+    private String fieldExplain;
+
+    /**
+     * 字段进度
+     */
+    private Double fieldProcess;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * ID
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 网络任务ID
+     */
+    public Integer getWebTaskId() {
+        return webTaskId;
+    }
+
+    /**
+     * 网络任务ID
+     */
+    public void setWebTaskId(Integer webTaskId) {
+        this.webTaskId = webTaskId;
+    }
+
+    /**
+     * 字段名
+     */
+    public String getFieldName() {
+        return fieldName;
+    }
+
+    /**
+     * 字段名
+     */
+    public void setFieldName(String fieldName) {
+        this.fieldName = fieldName;
+    }
+
+    /**
+     * 字段解释
+     */
+    public String getFieldExplain() {
+        return fieldExplain;
+    }
+
+    /**
+     * 字段解释
+     */
+    public void setFieldExplain(String fieldExplain) {
+        this.fieldExplain = fieldExplain;
+    }
+
+    /**
+     * 字段进度
+     */
+    public Double getFieldProcess() {
+        return fieldProcess;
+    }
+
+    /**
+     * 字段进度
+     */
+    public void setFieldProcess(Double fieldProcess) {
+        this.fieldProcess = fieldProcess;
+    }
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        WebTaskField other = (WebTaskField) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getWebTaskId() == null ? other.getWebTaskId() == null : this.getWebTaskId().equals(other.getWebTaskId()))
+            && (this.getFieldName() == null ? other.getFieldName() == null : this.getFieldName().equals(other.getFieldName()))
+            && (this.getFieldExplain() == null ? other.getFieldExplain() == null : this.getFieldExplain().equals(other.getFieldExplain()))
+            && (this.getFieldProcess() == null ? other.getFieldProcess() == null : this.getFieldProcess().equals(other.getFieldProcess()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getWebTaskId() == null) ? 0 : getWebTaskId().hashCode());
+        result = prime * result + ((getFieldName() == null) ? 0 : getFieldName().hashCode());
+        result = prime * result + ((getFieldExplain() == null) ? 0 : getFieldExplain().hashCode());
+        result = prime * result + ((getFieldProcess() == null) ? 0 : getFieldProcess().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", webTaskId=").append(webTaskId);
+        sb.append(", fieldName=").append(fieldName);
+        sb.append(", fieldExplain=").append(fieldExplain);
+        sb.append(", fieldProcess=").append(fieldProcess);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 18 - 0
PAS/src/main/java/cn/cslg/pas/mapper/WebConfigMapper.java

@@ -0,0 +1,18 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.WebConfig;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author admin
+* @description 针对表【web_config(网站配置)】的数据库操作Mapper
+* @createDate 2023-03-08 18:51:17
+* @Entity cn.cslg.pas.domain.WebConfig
+*/
+public interface WebConfigMapper extends BaseMapper<WebConfig> {
+
+}
+
+
+
+

+ 18 - 0
PAS/src/main/java/cn/cslg/pas/mapper/WebTaskFieldMapper.java

@@ -0,0 +1,18 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.WebTaskField;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author admin
+* @description 针对表【web_task_field(网络任务字段)】的数据库操作Mapper
+* @createDate 2023-03-08 18:51:40
+* @Entity cn.cslg.pas.domain.WebTaskField
+*/
+public interface WebTaskFieldMapper extends BaseMapper<WebTaskField> {
+
+}
+
+
+
+

+ 18 - 0
PAS/src/main/java/cn/cslg/pas/mapper/WebTaskMapper.java

@@ -0,0 +1,18 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.WebTask;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author admin
+* @description 针对表【web_task(网络拉取任务)】的数据库操作Mapper
+* @createDate 2023-03-08 18:51:06
+* @Entity cn.cslg.pas.domain.WebTask
+*/
+public interface WebTaskMapper extends BaseMapper<WebTask> {
+
+}
+
+
+
+

+ 31 - 0
PAS/src/main/java/cn/cslg/pas/service/WebConfigService.java

@@ -0,0 +1,31 @@
+package cn.cslg.pas.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import cn.cslg.pas.domain.WebConfig;
+import cn.cslg.pas.mapper.WebConfigMapper;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+/**
+* @author admin
+* @description 针对表【web_config(网站配置)】的数据库操作Service实现
+* @createDate 2023-03-08 18:51:17
+*/
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class WebConfigService extends ServiceImpl<WebConfigMapper, WebConfig>
+  {
+     public WebConfig  getConfigById(Integer id){
+       WebConfig webConfig = this.getById(id);
+       if(webConfig !=null){
+         return webConfig;
+       }
+       return new WebConfig();
+  }
+
+}
+
+
+
+

+ 21 - 0
PAS/src/main/java/cn/cslg/pas/service/WebTaskFieldService.java

@@ -0,0 +1,21 @@
+package cn.cslg.pas.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import cn.cslg.pas.domain.WebTaskField;
+import cn.cslg.pas.mapper.WebTaskFieldMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author admin
+* @description 针对表【web_task_field(网络任务字段)】的数据库操作Service实现
+* @createDate 2023-03-08 18:51:40
+*/
+@Service
+public class WebTaskFieldService extends ServiceImpl<WebTaskFieldMapper, WebTaskField>
+    {
+
+}
+
+
+
+

+ 26 - 0
PAS/src/main/java/cn/cslg/pas/service/WebTaskService.java

@@ -0,0 +1,26 @@
+package cn.cslg.pas.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import cn.cslg.pas.domain.WebTask;
+import cn.cslg.pas.mapper.WebTaskMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author admin
+* @description 针对表【web_task(网络拉取任务)】的数据库操作Service实现
+* @createDate 2023-03-08 18:51:06
+*/
+@Service
+public class WebTaskService extends ServiceImpl<WebTaskMapper, WebTask>
+   {
+  public Integer addWebTask(WebTask webTask){
+     webTask.insert();
+     return  webTask.getId();
+
+  }
+
+}
+
+
+
+

+ 33 - 0
PAS/src/main/java/cn/cslg/pas/service/webImportService.java

@@ -0,0 +1,33 @@
+package cn.cslg.pas.service;
+
+
+import cn.cslg.pas.common.config.WebSocketConfig;
+import cn.cslg.pas.domain.WebConfig;
+import cn.cslg.pas.domain.WebTask;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class webImportService {
+    private final WebConfigService webConfigService;
+    private final WebTaskService webTaskService;
+    /**
+     *
+     * @param id
+     */
+  public void importWebSource(Integer id,String conditions){
+      //获得网站配置
+      WebConfig webConfig = webConfigService.getConfigById(id);
+      //新建任务
+      WebTask webTask =new WebTask();
+      webTask.setWebId(id);
+      webTask.setTaskProcess(0.0);
+      webTask.setSearchCondition(conditions);
+      webTask.setTaskState(0);
+      webTaskService.addWebTask(webTask);
+  }
+
+
+}

+ 19 - 0
PAS/src/main/resources/mapper/WebConfigMapper.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.cslg.pas.mapper.WebConfigMapper">
+
+    <resultMap id="BaseResultMap" type="cn.cslg.pas.domain.WebConfig">
+            <id property="id" column="id" jdbcType="INTEGER"/>
+            <result property="webName" column="web_name" jdbcType="VARCHAR"/>
+            <result property="webAddress" column="web_address" jdbcType="VARCHAR"/>
+            <result property="webAccount" column="web_account" jdbcType="VARCHAR"/>
+            <result property="webPassword" column="web_password" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,web_name,web_address,
+        web_account,web_password
+    </sql>
+</mapper>

+ 19 - 0
PAS/src/main/resources/mapper/WebTaskFieldMapper.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.cslg.pas.mapper.WebTaskFieldMapper">
+
+    <resultMap id="BaseResultMap" type="cn.cslg.pas.domain.WebTaskField">
+            <id property="id" column="id" jdbcType="INTEGER"/>
+            <result property="webTaskId" column="web_task_id" jdbcType="INTEGER"/>
+            <result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
+            <result property="fieldExplain" column="field_explain" jdbcType="VARCHAR"/>
+            <result property="fieldProcess" column="field_process" jdbcType="DOUBLE"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,web_task_id,field_name,
+        field_explain,field_process
+    </sql>
+</mapper>

+ 22 - 0
PAS/src/main/resources/mapper/WebTaskMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.cslg.pas.mapper.WebTaskMapper">
+
+    <resultMap id="BaseResultMap" type="cn.cslg.pas.domain.WebTask">
+            <id property="id" column="id" jdbcType="INTEGER"/>
+            <result property="taskState" column="task_state" jdbcType="INTEGER"/>
+            <result property="webId" column="web_id" jdbcType="INTEGER"/>
+            <result property="successNum" column="success_num" jdbcType="INTEGER"/>
+            <result property="defaultNum" column="default_num" jdbcType="INTEGER"/>
+            <result property="searchCondition" column="search_condition" jdbcType="VARCHAR"/>
+            <result property="taskProcess" column="task_process" jdbcType="DOUBLE"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,task_state,web_id,
+        success_num,default_num,search_condition,
+        task_process
+    </sql>
+</mapper>