Parcourir la source

4/2 以图搜图检索

lwhhszx il y a 1 an
Parent
commit
98ddba6d76
50 fichiers modifiés avec 4754 ajouts et 20 suppressions
  1. 1 1
      src/main/java/com/example/xiaoshiweixinback/business/config/ElasticSearchClientConfig.java
  2. 47 0
      src/main/java/com/example/xiaoshiweixinback/business/config/XDns.java
  3. 737 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/DateUtils.java
  4. 85 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/DateUtils2.java
  5. 59 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/FileUtils.java
  6. 109 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/FormatUtil.java
  7. 69 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/esDataForm/AddressSplitter.java
  8. 49 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/esDataForm/PatentClassifySplitter.java
  9. 36 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/Symbol.java
  10. 13 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/enuType.java
  11. 420 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/expressManager.java
  12. 42 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/operate.java
  13. 53 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/operateNode.java
  14. 25 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/pairSymbol.java
  15. 58 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/treeNode.java
  16. 16 0
      src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/valueNode.java
  17. 6 19
      src/main/java/com/example/xiaoshiweixinback/controller/PatentController.java
  18. 31 0
      src/main/java/com/example/xiaoshiweixinback/domain/es/PatentVector.java
  19. 26 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/common/SqlObject.java
  20. 25 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/ImportTaskText.java
  21. 48 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentAffair.java
  22. 20 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentAgent.java
  23. 57 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentApplicant.java
  24. 25 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentInstructionText.java
  25. 43 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentInventor.java
  26. 25 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentLabel.java
  27. 30 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentLicensor.java
  28. 30 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentPledge.java
  29. 26 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentRight.java
  30. 35 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/Calculate.java
  31. 95 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/ImportTaskAMVO.java
  32. 9 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/PatentSearchDTO.java
  33. 47 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/PatentStarDTO.java
  34. 63 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/PatentStarListDTO.java
  35. 164 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/StarPatentVO.java
  36. 22 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/UploadPatentWebDTO.java
  37. 99 0
      src/main/java/com/example/xiaoshiweixinback/entity/vo/patent/ChinaPatentZhuLu.java
  38. 22 0
      src/main/java/com/example/xiaoshiweixinback/entity/vo/patent/PatentWithIdVO.java
  39. 99 0
      src/main/java/com/example/xiaoshiweixinback/entity/vo/patent/WorldPatentZhuLu.java
  40. 61 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/CommonService.java
  41. 192 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsService.java
  42. 137 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/FormatQueryService.java
  43. 437 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetCataloguingFromWebService.java
  44. 46 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetPatentPictureFromWebService.java
  45. 152 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/ImportFromWebToEsService.java
  46. 742 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/PatentStarApiService.java
  47. 58 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/SavePatentToEsService.java
  48. 19 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/getSqlFactorys/GetSqlFactory.java
  49. 11 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/getSqlFactorys/GetSqlObject.java
  50. 33 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/getSqlFactorys/GetWebQuerySql.java

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/business/config/ElasticSearchClientConfig.java

@@ -29,7 +29,7 @@ public class ElasticSearchClientConfig {
         //注入IOC容器
         @Bean
         public ElasticsearchClient elasticsearchClient() throws Exception {
-            RestClientBuilder builder = RestClient.builder(new HttpHost("http://es-cn-em93o8856000ho9e7.public.elasticsearch.aliyuncs.com", 9200, "http"));
+            RestClientBuilder builder = RestClient.builder(new HttpHost("es-cn-em93o8856000ho9e7.public.elasticsearch.aliyuncs.com", 9200, "http"));
             CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
             credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "Xiaoshi221101"));
             SSLContext sslContext = SSLContextBuilder.create()

+ 47 - 0
src/main/java/com/example/xiaoshiweixinback/business/config/XDns.java

@@ -0,0 +1,47 @@
+package com.example.xiaoshiweixinback.business.config;
+
+import okhttp3.Dns;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
+
+public class XDns implements Dns {
+    private long timeout;
+
+    public XDns(long timeout) {
+        this.timeout = timeout;
+    }
+
+    @Override
+    public List<InetAddress> lookup(final String hostname) throws UnknownHostException {
+        if (hostname == null) {
+            throw new UnknownHostException("hostname == null");
+        } else {
+            List<InetAddress> inetAddresses =new ArrayList<>();
+            Boolean falg =true;
+            while (falg){
+                try {
+                    FutureTask<List<InetAddress>>  task = new FutureTask<>(
+                            new Callable<List<InetAddress>>() {
+                                @Override
+                                public List<InetAddress> call() throws Exception {
+                                    return Arrays.asList(InetAddress.getAllByName(hostname));
+                                }
+                            });
+                    new Thread(task).start();
+                    inetAddresses=task.get(timeout, TimeUnit.MILLISECONDS);
+                    falg =false;
+                } catch (Exception var4) {
+                  continue;
+                }
+            }
+                return inetAddresses;
+        }
+    }
+}

+ 737 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/DateUtils.java

@@ -0,0 +1,737 @@
+package com.example.xiaoshiweixinback.business.utils;
+
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.date.DateTime;
+
+import com.example.xiaoshiweixinback.entity.dto.patent.Calculate;
+import org.joda.time.format.DateTimeFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.management.ManagementFactory;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.regex.Pattern;
+
+public class DateUtils {
+
+    public static final String START_TIME = " 00:00:00";
+    public static final String END_TIME = " 23:59:59";
+    public final static String FORMAT_STRING = "yyyy-MM-dd HH:mm:ss";
+    public final static String[] REPLACE_STRING = new String[]{"GMT+0800", "GMT+08:00"};
+    public final static String SPLIT_STRING = "(中国标准时间)";
+    public static Logger log = LoggerFactory.getLogger(DateUtils.class);
+    public static String YYYY = "yyyy";
+    public static String YYYY_MM = "yyyy-MM";
+    public static String YYYY_MM_DD = "yyyy-MM-dd";
+    public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
+    public static String YYYYMMDD = "yyyyMMdd";
+    public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
+    private static String[] parsePatterns = {
+            "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
+            "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
+            "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
+
+    public static String getDateSourceName(Date startTime, Date endTime, Integer offset, Integer index) {
+        String ret = null;
+        switch (offset) {
+            //月份
+            case -1:
+                ret = DateUtil.format(startTime, "yyyy-MM");
+                break;
+            //季度
+            case -3:
+                ret = String.format("%s-Q%s", DateUtil.format(startTime, "yyyy"), (index % 4) + 1);
+                break;
+            //半年
+            case -6:
+                ret = String.format("%s-%s", DateUtil.format(startTime, "yyyy"), index % 2 == 0 ? "H1" : "H2");
+                break;
+            //1年
+            case -12:
+                ret = DateUtil.format(startTime, "yyyy");
+                break;
+            //2年,3年,5年
+            case -24:
+            case -36:
+            case -60:
+                ret = String.format("%s-%s", DateUtil.format(DateUtil.offsetMonth(endTime, offset / 12 * -1), "yyyy"), DateUtil.format(startTime, "yyyy"));
+                break;
+        }
+        return ret;
+    }
+
+    private DateUtils() {
+    }
+
+    public static Integer getWeek(String beginDateStr, String endDateStr, String date) {
+        DateTime beginDate = DateUtil.parseDate(beginDateStr);
+        DateTime endDate = DateUtil.parseDate(endDateStr);
+        DateTime currentDate = DateUtil.parseDate(date);
+        int week = 1;
+        if (DateUtil.isIn(currentDate, beginDate, endDate)) {
+            Date endDateOfWeek = DateUtil.endOfWeek(beginDate);
+            while (!DateUtil.isIn(currentDate, beginDate, endDateOfWeek)) {
+                ++week;
+                endDateOfWeek = DateUtil.endOfWeek(DateUtil.offsetDay(endDateOfWeek, 1));
+            }
+            return week;
+        }
+        return -1;
+    }
+
+    public static boolean belongCalendar(Date nowTime, Date beginTime, Date endTime) {
+        Calendar date = Calendar.getInstance();
+        date.setTime(nowTime);
+        Calendar begin = Calendar.getInstance();
+        begin.setTime(beginTime);
+        Calendar end = Calendar.getInstance();
+        end.setTime(endTime);
+        return date.after(begin) && date.before(end);
+    }
+
+    /**
+     * 获取现在的时间 yyyy-MM-dd HH:mm:ss
+     */
+    public static String getNowTime() {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date date = new Date(System.currentTimeMillis());
+        return format.format(date);
+    }
+
+    /**
+     * 获取当前Date型日期
+     *
+     * @return Date() 当前日期
+     */
+    public static Date getNowDate() {
+        return new Date();
+    }
+
+    public static Integer getDateTime() {
+        return (int) (new Date().getTime() / 1000);
+    }
+
+//    public static Integer getDateTime(String date) {
+//        int dateTime = 0;
+//        if (date.contains("/")) {
+//            dateTime = Math.toIntExact(strToDateTime(date, parsePatterns[4]).getTime() / 1000);
+//        } else if (date.contains("-")) {
+//            dateTime = Math.toIntExact(strToDateTime(date, YYYY_MM_DD).getTime() / 1000);
+//        }
+//        return dateTime;
+//    }
+
+        public static Date getDateTime(String date) {
+        Date dateTime = null;
+        if (date.contains("/")) {
+            dateTime = strToDateTime(date, parsePatterns[4]);
+        } else if (date.contains("-")) {
+            dateTime = strToDateTime(date, YYYY_MM_DD);
+        }
+        return dateTime;
+    }
+
+    /**
+     * @author 陌溪
+     * @date 2018年6月14日
+     */
+    public static String getNowTimeFormat(String format) {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
+        Date date = new Date(System.currentTimeMillis());
+        return simpleDateFormat.format(date);
+    }
+
+
+    public static Date str2Date(String dateString) {
+        try {
+            dateString = dateString.split(Pattern.quote(SPLIT_STRING))[0].replace(REPLACE_STRING[0], REPLACE_STRING[1]);
+            SimpleDateFormat sf1 = new SimpleDateFormat("E MMM dd yyyy HH:mm:ss z", Locale.US);
+            return sf1.parse(dateString);
+        } catch (Exception e) {
+            throw new RuntimeException("时间转化格式错误" + "[dateString=" + dateString + "]" + "[FORMAT_STRING=" + FORMAT_STRING + "]");
+        }
+    }
+
+    public static Date strToDate(String dateString) {
+        try {
+            SimpleDateFormat sf1;
+            if (dateString.contains("-")) {
+                sf1 = new SimpleDateFormat("yyyy-MM-dd");
+            } else if (dateString.contains("/")) {
+                sf1 = new SimpleDateFormat("yyyy/MM/dd");
+            } else if (dateString.contains(":")) {
+                sf1 = new SimpleDateFormat("yyyy:MM:dd");
+            } else if (dateString.contains(".")) {
+                sf1 = new SimpleDateFormat("yyyy.MM.dd");
+            } else {
+                sf1 = new SimpleDateFormat("yyyyMMdd");
+            }
+
+            return sf1.parse(dateString);
+        } catch (Exception e) {
+            throw new RuntimeException("时间转化格式错误" + "[dateString=" + dateString + "]" + "[FORMAT_STRING=" + FORMAT_STRING + "]");
+        }
+    }
+
+    /**
+     * 获取今天开始的时间
+     */
+    public static String getToDayStartTime() {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+        Date date = new Date(System.currentTimeMillis());
+        return format.format(date);
+    }
+
+    /**
+     * 获取今天结束的时间
+     */
+    public static String getToDayEndTime() {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
+        Date date = new Date(System.currentTimeMillis());
+        return format.format(date);
+    }
+
+    /**
+     * 获取昨天开始的时间
+     */
+    public static String getYesterdayStartTime() {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+        Date date = new Date(System.currentTimeMillis() - 24 * 60 * 60 * 1000L);
+        return format.format(date);
+    }
+
+    /**
+     * 获取昨天结束的时间
+     */
+    public static String getYesterdayEndTime() {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
+        Date date = new Date(System.currentTimeMillis() - 24 * 60 * 60 * 1000L);
+        return format.format(date);
+    }
+
+    /**
+     * 获取某天开始的时间
+     */
+    public static String getOneDayStartTime(String oneDay) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+        Date date = new Date(oneDay);
+        return format.format(oneDay);
+    }
+
+    /**
+     * 获取某天开始的日期
+     */
+    public static String getOneDayStartTime(Date oneDay) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+        return format.format(oneDay);
+    }
+
+    /**
+     * 获取某天结束的时间
+     */
+    public static String getOneDayEndTime(String oneDay) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+        Date date = new Date(oneDay);
+        return format.format(date);
+    }
+
+    /**
+     * 获取某天结束的日期
+     */
+    public static String getOneDayEndTime(Date oneDay) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+        return format.format(oneDay);
+    }
+
+    /**
+     * 获取本周开始的时间
+     */
+    public static Date getWeekStartTime() {
+        //获得本周一0点时间
+        Calendar cal = Calendar.getInstance();
+        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+        cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
+        return cal.getTime();
+    }
+
+    /**
+     * 将 String 转换成 Date
+     */
+    public static Date strToDateTime(String dateTime) {
+        Date date = null;
+        try {
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            date = format.parse(dateTime);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+
+    /**
+     * 将 String 转换成 Date (转换格式可传入)
+     */
+    public static Date strToDateTime(String dateTime, String fmt) {
+        Date date = null;
+        try {
+            SimpleDateFormat format = new SimpleDateFormat(fmt);
+            date = format.parse(dateTime);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+
+    /**
+     * 将 Date 转换成时间戳
+     */
+    public static Long dateToStamp(String s) throws ParseException {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date date = simpleDateFormat.parse(s);
+        return date.getTime();
+    }
+
+    /**
+     * 将 Date 转换成 String
+     */
+    public static String dateTimeToStr(Date dateTime) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        return format.format(dateTime);
+    }
+
+    public static String dateTimeToStr(Date dateTime, String fmt) {
+
+        SimpleDateFormat format = new SimpleDateFormat(fmt);
+        return format.format(dateTime);
+    }
+
+    /**
+     * 获取本周开始的时间的字符串
+     */
+    public static String getWeekStartTimeStr() {
+        //获得本周一0点时间
+        Calendar cal = Calendar.getInstance();
+        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+        cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+        return format.format(cal.getTime());
+    }
+
+    /**
+     * 获取本周结束的时间
+     */
+    public static Date getWeekEndTime() {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(getWeekStartTime());
+        cal.add(Calendar.DAY_OF_WEEK, 7);
+        return cal.getTime();
+    }
+
+    /**
+     * 获取本周结束的时间的字符串
+     */
+    public static String getWeekEndTimeStr() {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(getWeekStartTime());
+        cal.add(Calendar.DAY_OF_WEEK, 7);
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
+        return format.format(cal.getTime());
+    }
+
+    /**
+     * 获取上周开始的时间的字符串
+     */
+    public static String getLastWeekStartTimeStr() {
+        int weeks = -1;
+        int mondayPlus = getMondayPlus();
+        GregorianCalendar currentDate = new GregorianCalendar();
+        currentDate.add(GregorianCalendar.DATE, mondayPlus + 7 * weeks);
+        Date monday = currentDate.getTime();
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+        return format.format(monday);
+    }
+
+    /**
+     * 获取本月开始的时间
+     */
+    public static Date getMonthStartTime() {
+        Calendar cal = Calendar.getInstance();
+        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
+        return cal.getTime();
+    }
+
+    /**
+     * 获取本月开始的时间的字符串
+     */
+    public static String getMonthStartTimeStr() {
+        Calendar cal = Calendar.getInstance();
+        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
+        return format.format(cal.getTime());
+    }
+
+    /**
+     * 获取本月结束的时间
+     */
+    public static Date getMonthEndTime() {
+        Calendar cal = Calendar.getInstance();
+        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
+        cal.set(Calendar.HOUR_OF_DAY, 24);
+        return cal.getTime();
+    }
+
+    /**
+     * 获取本月结束的时间的字符串
+     */
+    public static String getMonthEndTimeStr() {
+        Calendar cal = Calendar.getInstance();
+        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
+        cal.set(Calendar.HOUR_OF_DAY, 24);
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
+        return format.format(cal.getTime());
+    }
+
+    /**
+     * 获取当月的 天数
+     */
+    public static int getCurrentMonthDay() {
+        Calendar a = Calendar.getInstance();
+        a.set(Calendar.DATE, 1);
+        a.roll(Calendar.DATE, -1);
+        return a.get(Calendar.DATE);
+    }
+
+    /**
+     * 得到二个日期间的间隔天数
+     */
+    public static int getDayByTwoDay(String date1, String date2) {
+        SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
+        long day;
+        try {
+            Date date = myFormatter.parse(date1);
+            Date myDate = myFormatter.parse(date2);
+            day = (date.getTime() - myDate.getTime()) / (24 * 60 * 60 * 1000);
+        } catch (Exception e) {
+            return 0;
+        }
+        return (int) day;
+    }
+
+    /**
+     * 得到两个日期相差的秒数
+     */
+    public static int getSecondByTwoDay(Date lastDate, Date date) {
+        long second;
+        try {
+            second = (lastDate.getTime() - date.getTime()) / 1000;
+        } catch (Exception e) {
+            return 0;
+        }
+        return (int) second;
+    }
+
+    /**
+     * 判断某个日期属于本周的第几天 (星期一代表第一天)
+     */
+    public static int getDaysByWeek(String dateTime) throws ParseException {
+        Calendar cal = Calendar.getInstance();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date date = dateFormat.parse(dateTime);
+        cal.setTime(date);
+        int day = cal.get(Calendar.DAY_OF_WEEK);
+        day = day - 1;
+        if (day == 0) {
+            day = 7;
+        }
+        return day;
+    }
+
+    /**
+     * 判断某个日期属于本月的第几天
+     */
+    public static int getDaysByMonth(String dateTime) throws ParseException {
+        Calendar cal = Calendar.getInstance();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date date = dateFormat.parse(dateTime);
+        cal.setTime(date);
+        return cal.get(Calendar.DAY_OF_MONTH);
+    }
+
+    /**
+     * 根据年 月 获取对应的月份 天数
+     */
+    public static int getDaysByYearMonth(int year, int month) {
+        Calendar a = Calendar.getInstance();
+        a.set(Calendar.YEAR, year);
+        a.set(Calendar.MONTH, month - 1);
+        a.set(Calendar.DATE, 1);
+        a.roll(Calendar.DATE, -1);
+        return a.get(Calendar.DATE);
+    }
+
+
+    /**
+     * 获取当前的年
+     */
+    public static Integer getYears() {
+        Calendar calendar = new GregorianCalendar(TimeZone
+                .getDefault());
+        return calendar.get(Calendar.YEAR);
+    }
+
+    /**
+     * 获取当前的月
+     */
+    public static Integer getMonth() {
+        Calendar calendar = new GregorianCalendar(TimeZone
+                .getDefault());
+        return calendar.get(Calendar.MONTH) + 1;
+    }
+
+    /**
+     * 获取当前天
+     */
+    public static Integer getDay() {
+        Calendar calendar = new GregorianCalendar(TimeZone
+                .getDefault());
+        return calendar.get(Calendar.DAY_OF_MONTH);
+    }
+
+    /**
+     * wx支付的过期时间
+     */
+    public static String getTime(double hour) {
+        long time = (long) (System.currentTimeMillis() + hour * 60 * 60 * 1000L);
+        Date date = new Date(time);
+        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
+        return format.format(date);
+    }
+
+    /**
+     * 获得当前日期与本周日相差的天数
+     */
+    private static int getMondayPlus() {
+        Calendar cd = Calendar.getInstance();
+        // 获得今天是一周的第几天,星期日是第一天,星期二是第二天......
+        // 因为按中国礼拜一作为第一天所以这里减1
+        int dayOfWeek = cd.get(Calendar.DAY_OF_WEEK) - 1;
+        if (dayOfWeek == 1) {
+            return 0;
+        } else {
+            return 1 - dayOfWeek;
+        }
+    }
+
+    /**
+     * 获取几天之后的日期
+     *
+     * @param date yyyy-MM-dd HH:mm:ss
+     * @param day  加减的天数
+     */
+    public static Date getDate(String date, int day) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar cal = Calendar.getInstance();
+        Date beforeDate;
+        try {
+            beforeDate = format.parse(date);
+            cal.setTime(beforeDate);
+            cal.add(Calendar.DAY_OF_MONTH, day);
+            return cal.getTime();
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 获取某个日期 在加上 秒数的时间
+     *
+     * @param beforeDate yyyy-MM-dd HH:mm:ss
+     * @param timeSecond 加减的秒数
+     */
+    public static String getDateStr(Date beforeDate, Long timeSecond) {
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            // 返回毫秒数 + 添加的毫秒数
+            Long time = beforeDate.getTime() + timeSecond * 1000;
+            return format.format(time);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+        return "";
+    }
+
+    /**
+     * 把date转换成字符串
+     */
+    public static String formatDate(Date date, String code) {
+        SimpleDateFormat format = new SimpleDateFormat(code);
+        return format.format(date);
+    }
+
+    public static String formatDate(Integer timestamp, String code) {
+        if (timestamp == null || timestamp == 0) {
+            return "";
+        }
+        return formatDate(new Date(timestamp * 1000L), code);
+    }
+
+    /**
+     * 获取过去N天内的日期数组
+     *
+     * @param intervals intervals天内
+     * @param formatStr 格式化字符串   yyyy-MM-dd
+     * @return 日期数组
+     */
+    public static ArrayList<String> getDaysByN(int intervals, String formatStr) {
+        ArrayList<String> pastDaysList = new ArrayList<>();
+        for (int i = intervals - 1; i >= 0; i--) {
+            pastDaysList.add(getPastDate(i, formatStr));
+        }
+        return pastDaysList;
+    }
+
+    /**
+     * 获取过去第几天的日期
+     */
+    public static String getPastDate(int past, String formatStr) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - past);
+        Date today = calendar.getTime();
+        SimpleDateFormat format = new SimpleDateFormat(formatStr);
+        return format.format(today);
+    }
+
+    /**
+     * 获取某个时间段内所有日期
+     */
+    public static List<String> getDayBetweenDates(String begin, String end) {
+        Date dBegin = strToDateTime(begin);
+        Date dEnd = strToDateTime(end);
+        List<String> lDate = new ArrayList<>();
+        SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
+        lDate.add(sd.format(dBegin));
+        Calendar calBegin = Calendar.getInstance();
+        // 使用给定的 Date 设置此 Calendar 的时间
+        calBegin.setTime(dBegin);
+        Calendar calEnd = Calendar.getInstance();
+        // 使用给定的 Date 设置此 Calendar 的时间
+        calEnd.setTime(dEnd);
+        // 测试此日期是否在指定日期之后
+        while (dEnd.after(calBegin.getTime())) {
+            // 根据日历的规则,为给定的日历字段添加或减去指定的时间量
+            calBegin.add(Calendar.DAY_OF_MONTH, 1);
+            lDate.add(sd.format(calBegin.getTime()));
+        }
+        return lDate;
+    }
+
+    /**
+     * 获取服务器启动时间
+     */
+    public static Date getServerStartDate() {
+        long time = ManagementFactory.getRuntimeMXBean().getStartTime();
+        return new Date(time);
+    }
+
+    /**
+     * 计算两个时间差
+     */
+    public static String getDatePoor(Date endDate, Date nowDate) {
+        long nd = 1000 * 24 * 60 * 60;
+        long nh = 1000 * 60 * 60;
+        long nm = 1000 * 60;
+        // 获得两个时间的毫秒时间差异
+        long diff = endDate.getTime() - nowDate.getTime();
+        // 计算差多少天
+        long day = diff / nd;
+        // 计算差多少小时
+        long hour = diff % nd / nh;
+        // 计算差多少分钟
+        long min = diff % nd % nh / nm;
+        return day + "天" + hour + "小时" + min + "分钟";
+    }
+
+    public static long getTimeDiff(Date date) {
+        long NTime = date.getTime();
+        long OTime = getNowDate().getTime();
+        return (NTime - OTime) / 1000 / 60;
+    }
+
+    public static Date setDateHourAndMinute(Date date, int hour, int minute) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.set(Calendar.HOUR_OF_DAY, hour);
+        calendar.set(Calendar.MINUTE, minute);
+        calendar.set(Calendar.SECOND, 0);
+        return calendar.getTime();
+    }
+
+
+    /**
+     * 根据起止条数计算开始页数、开始页数的开始位置、结束页数、结束页数的结束位置
+     *
+     * @param startNumber 起始条数
+     * @param endNumber   终止条数
+     * @return 返回计算结果对象(开始页数、开始页数的开始位置、结束页数、结束页数的结束位置)
+     */
+    public static Calculate calculateFromStartAndEndNumber(Integer startNumber, Integer endNumber, Integer pageSize) {
+        int startPage;  //检索开始页数
+        int startNum;  //检索开始页数的开始专利位置
+        int endPage;  //检索结束页数
+        int endNum;  //检索结束页数的结束专利位置
+        if (startNumber % pageSize != 0) {
+            startPage = startNumber / pageSize;
+            startNum = startNumber % pageSize;
+        } else {
+            startPage = startNumber / pageSize;
+            startNum = pageSize;
+        }
+        if (endNumber % pageSize != 0) {
+            endPage = endNumber / pageSize + 1;
+            endNum = endNumber % pageSize;
+        } else {
+            endPage = endNumber / pageSize;
+            endNum = pageSize;
+        }
+
+        Calculate calculate = new Calculate()
+                .setStartPage(startPage)
+                .setStartNum(startNum)
+                .setEndPage(endPage)
+                .setEndNum(endNum);
+
+        return calculate;
+    }
+    /**
+     * 专利之星返回日期格式为字符串 yyyyMMdd,如 "20230713",本方法将其转成10位数字时间戳
+     *
+     * @param dateStr yyyyMMdd格式字符串日期
+     * @return 返回10位数字时间戳
+     */
+    public static int  stringDateToTimeStamp(String dateStr) {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
+        Date date;
+        try {
+            date = dateFormat.parse(dateStr);
+        } catch (ParseException e) {
+            //日期格式转换异常
+            e.printStackTrace();
+            return Integer.parseInt(dateStr);
+        }
+        long timeStamp = date.getTime() / 1000;
+        return (int) timeStamp;
+    }
+
+    public static void main(String[] args) {
+        System.out.println(12%50);
+    }
+}

+ 85 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/DateUtils2.java

@@ -0,0 +1,85 @@
+package com.example.xiaoshiweixinback.business.utils;
+
+
+import org.joda.time.DateTime;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class DateUtils2 {
+
+    public static DateTime formStrToDateTime(String dateString) {
+        try {
+            DateTimeFormatter formatter;
+
+            if (dateString.contains("-")) {
+                formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
+            } else if (dateString.contains("//")) {
+                formatter = DateTimeFormat.forPattern("yyyy/MM/dd");
+            } else if (dateString.contains(":")) {
+                formatter = DateTimeFormat.forPattern("yyyy:MM:dd");
+            } else if (dateString.contains(".")) {
+                formatter = DateTimeFormat.forPattern("yyyy.MM.dd");
+            } else {
+                formatter = DateTimeFormat.forPattern("yyyyMMdd");
+            }
+
+            return formatter.parseDateTime(dateString);
+        } catch (Exception e) {
+          throw new RuntimeException("时间转化格式错误" + "[dateString=" + dateString + "]" + "[FORMAT_STRING=" + "]");
+        }
+    }
+
+
+    public static List<DateTime> formStrToDateTime(DateTime dateStart, DateTime dateEnd) {
+        List<DateTime> dateTimes = new ArrayList<>();
+        dateTimes.add(dateStart);
+        DateTime minDate1 = new DateTime();
+        DateTime minDate2= new DateTime();
+        Integer startYear = dateStart.getYear();
+        Integer startMonth = dateStart.getMonthOfYear();
+        Integer startDay = dateStart.getDayOfYear();
+        Integer endYear = dateEnd.getYear();
+        Integer endMonth = dateEnd.getMonthOfYear();
+        Integer endDay = dateEnd.getDayOfYear();
+        if (startYear.equals(endYear) ) {
+            if (startMonth.equals(endMonth)) {
+                if (startDay .equals(endDay) ) {
+                    minDate1=dateStart;
+                } else {
+                    int diffDay = endDay - startDay;
+                    int minDay = diffDay / 2;
+                    minDate1 = dateStart.plusDays(minDay);
+                }
+            } else {
+                int diffMonth = endYear - startYear;
+                int minMonth = diffMonth / 2;
+                if(minMonth==0){
+                    minMonth=1;
+                }
+                minDate1 = dateStart.plusMonths(minMonth).minusDays(1);
+                minDate2 =dateStart.plusMonths(minMonth);
+            }
+        } else {
+            int diffYear = endYear - startYear;
+            int minYear = diffYear / 2;
+            if(minYear==0){
+                minYear=1;
+            }
+            minDate1 = dateStart.plusYears(minYear).minusDays(1);
+            minDate2 =dateStart.plusYears(minYear);
+            if(minDate1.isAfter(minDate2)){
+                System.out.println("aa");
+            }
+        }
+        dateTimes.add(minDate1);
+        dateTimes.add(minDate2);
+        dateTimes.add(dateEnd);
+        return dateTimes;
+    }
+
+
+}

+ 59 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/FileUtils.java

@@ -0,0 +1,59 @@
+package com.example.xiaoshiweixinback.business.utils;
+
+import cn.hutool.core.util.IdUtil;
+import com.example.xiaoshiweixinback.XiaoshiWeixinbackApplication;
+import org.springframework.boot.system.ApplicationHome;
+import org.springframework.stereotype.Service;
+
+import java.io.*;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+
+@Service
+public class FileUtils {
+
+    public static final String FILE_SEPARATOR = System.getProperty("file.separator");
+    public static final String COMMON_FILE = "file";
+    public static final String BACKUP_FILE = "backup";
+
+    public static String getStaticPath(String fileName) {
+        //ApplicationHome类 返回target目录层级
+        ApplicationHome ah = new ApplicationHome(XiaoshiWeixinbackApplication.class);
+        //获取 applicationHome 内的路径 ...\target\classes 到这一层级下
+        File file = ah.getSource();
+        //获取 file的parentFile 即最后一级之前的所有层级路径(包括盘符) 这里能获得到的最终层级为  ...\target 后续用FILE_SEPARATOR(系统路径分割通配符 即 "\") 以及fileName拼接生成存放文件的目录层级 即为根目录 root
+        String rootPath =null;
+
+        if (fileName!=null&&!fileName.equals(""))
+        {
+            rootPath= file.getParentFile().toString() + FILE_SEPARATOR + fileName;
+        }
+        else {
+            rootPath = file.getParentFile().toString();
+        }
+        //根据上方生成的根目录路径 生成对应文件夹 没有就新建
+        File root = new File(rootPath);
+        if (!root.exists()) {
+            root.mkdir();
+        }
+        //返回的最终形式为 盘符:\项目层级\target\file
+        return rootPath;
+    }
+    public static  File getPictureFileByUrl(String dataUrl) throws IOException {
+
+        URL url = new URL(dataUrl);  //想要读取的url地址
+        InputStream in = url.openStream();
+        File file = File.createTempFile("new_url", ".jpg");  //创建文件
+        OutputStream os = new FileOutputStream(file);  //创建文件输出流
+        int bytesRead;
+        byte[] buffer = new byte[8192];
+        int len = 8192;
+        while ((bytesRead = in.read(buffer, 0, len)) != -1) {
+            os.write(buffer, 0, bytesRead);
+        }
+        //关闭释放流
+        os.close();
+        in.close();
+        return file;
+    }
+}

+ 109 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/FormatUtil.java

@@ -0,0 +1,109 @@
+package com.example.xiaoshiweixinback.business.utils;
+
+
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.BeanWrapperImpl;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class FormatUtil {
+
+    private List<String> s;
+    private List<String> strs;
+
+    public static String toString(Object o) {
+        return o == null ? "" : o.toString();
+    }
+
+    public static String MD5(String src) {
+        // 需要加密的字符串
+        try {
+            // 加密对象,指定加密方式
+            MessageDigest md5 = MessageDigest.getInstance("md5");
+            // 准备要加密的数据
+            byte[] b = src.getBytes();
+            // 加密
+            byte[] digest = md5.digest(b);
+            // 十六进制的字符
+            char[] chars = new char[]{'0', '1', '2', '3', '4', '5',
+                    '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+            StringBuffer sb = new StringBuffer();
+            // 处理成十六进制的字符串(通常)
+            for (byte bb : digest) {
+                sb.append(chars[(bb >> 4) & 15]);
+                sb.append(chars[bb & 15]);
+            }
+            return sb.toString();
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
+
+    public static String[] getNullPropertyNames(Object source) {
+        final BeanWrapper src = new BeanWrapperImpl(source);
+        java.beans.PropertyDescriptor[] pds = src.getPropertyDescriptors();
+        Set emptyNames = new HashSet();
+        for (java.beans.PropertyDescriptor pd : pds) {
+            //check if value of this property is null then add it to the collection
+            Object srcValue = src.getPropertyValue(pd.getName());
+            if (srcValue == null) {//特定字符写在此处过滤,收集不需要copy的字段列表。此处过滤null为例
+                emptyNames.add(pd.getName());
+            }
+        }
+        String[] result = new String[emptyNames.size()];
+        return (String[]) emptyNames.toArray(result);
+
+
+    }
+
+    public static String getPictureFormat(String appAn) {
+        return appAn + "_p";
+
+    }
+
+    public static String getPDFFormat(String appAn, Integer type) {
+        if (type.equals(0)) {
+            return appAn + "_public";
+        } else {
+            return appAn + "_grant";
+        }
+    }
+
+    public static List<String> getDistinctList(List<String> a, List<String> b) {
+        if (a == null || a.size() == 0 &&(b==null||b.size()==0)) {
+            return null;
+        } else if (b == null || b.size() == 0) {
+            return  new ArrayList<>(a);
+        }
+        else if(a==null||a.size()==0){
+            return new ArrayList<>(b);
+        }
+        a.addAll(b);
+        List<String> newList = new ArrayList<>(new HashSet<>(a));
+        return newList;
+    }
+
+
+    public static List<Integer> StringTOIntegerList(List<String> strs) {
+        List<Integer> integers =new ArrayList<>();
+        strs.forEach(item->{
+            integers.add(Integer.parseInt(item));
+        });
+        return  integers;
+    }
+
+    public static List<String> IntegerTOStringList(List<Integer> integers) {
+        List<String> strs =new ArrayList<>();
+        integers.forEach(item->{
+            strs.add(item.toString());
+        });
+        return  strs;
+    }
+
+}

+ 69 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/esDataForm/AddressSplitter.java

@@ -0,0 +1,69 @@
+package com.example.xiaoshiweixinback.business.utils.esDataForm;
+
+
+
+import com.example.xiaoshiweixinback.domain.es.PersonAddress;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class AddressSplitter {
+
+    public static PersonAddress splitAddress(String address, String provinceStr) {
+//        List<String> addresses = new ArrayList<>();
+        PersonAddress personAddress =null;
+        // 初始化省、市、区
+        String province = "";
+
+        Pattern pattern = Pattern.compile("\\((.*?)\\)"); // 匹配(文本)形式的括号
+        Matcher matcher = pattern.matcher(provinceStr);
+        while (matcher.find()) {
+            province = matcher.group(1);// 输出括号内的文本
+        }
+        if (!province.equals("")) {
+            personAddress =new PersonAddress();
+            String p = provinceStr.substring(0, 2);
+            Boolean f = AddressSplitter.isNumeric(p);
+            if (f) {
+               personAddress.setAddress(address);
+               personAddress.setProvince(province);
+            }
+            else {
+                personAddress.setAddress(address);
+                personAddress.setCountry(province);
+            }
+        }
+
+//        // 匹配省份
+//        String[] provinceArray = StringUtils.splitByWholeSeparatorPreserveAllTokens(address, "省");
+//        if (provinceArray.length > 1) {
+//            province = provinceArray[0] + "省";
+//            address = provinceArray[1];
+//        }
+//
+//        // 匹配城市
+//        String[] cityArray = StringUtils.splitByWholeSeparatorPreserveAllTokens(address, "市");
+//        if (cityArray.length > 1) {
+//            city = cityArray[0] + "市";
+//            address = cityArray[1];
+//        }
+//
+//        // 匹配区县
+//        String[] districtArray = StringUtils.splitByWholeSeparatorPreserveAllTokens(address, "区");
+//        if (districtArray.length > 1) {
+//            district = districtArray[0] + "区";
+//        }
+
+        // 输出结果
+//        addresses.add(province);
+//        addresses.add(city);
+//        addresses.add(district);
+        return personAddress;
+
+    }
+
+
+    public static boolean isNumeric(String str) {
+        return str.matches("-?\\d+(\\.\\d+)?");  // 正则表达式
+    }
+}

+ 49 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/esDataForm/PatentClassifySplitter.java

@@ -0,0 +1,49 @@
+package com.example.xiaoshiweixinback.business.utils.esDataForm;
+
+
+import com.example.xiaoshiweixinback.domain.es.PatentClassify;
+
+public class PatentClassifySplitter {
+    public static void main(String[] args) {
+        String address = "G06V10/56";
+        PatentClassify strings = split(address);
+        System.out.println(strings);
+    }
+
+    public static PatentClassify split(String classify) {
+        if(classify==null||classify.trim().equals(""))
+        {
+            return null;
+        }
+        PatentClassify patentClassify = new PatentClassify();
+        Integer length = classify.length();
+        String level1 = "";
+        String level2 = "";
+        String level3 = "";
+        String level4 = "";
+        String level5 = "";
+        level1 = classify.substring(0, 1);
+        patentClassify.setLevel1(level1);
+        level2 = classify.substring(0, 3);
+        patentClassify.setLevel2(level2);
+
+        if (length >= 4) {
+            level3 = classify.substring(0, 4);
+            patentClassify.setLevel3(level3);
+
+            if (length >= 8) {
+                Integer s =classify.length();
+
+                if(classify.contains("/"))
+                {
+                    s =classify.indexOf("/");
+                }
+                level4 = classify.substring(0, s);
+                patentClassify.setLevel4(level4);
+                level5 = classify;
+                patentClassify.setLevel5(level5);
+            }
+        }
+        return patentClassify;
+    }
+}

+ 36 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/Symbol.java

@@ -0,0 +1,36 @@
+package com.example.xiaoshiweixinback.business.utils.parseQueryToTree;
+
+public class Symbol {
+    //符号
+    String Code;
+    //名称
+    String ShowName;
+
+
+    public Symbol(){
+
+    }
+
+    public Symbol(String code, String showname) {
+        this.Code = code;
+        this.ShowName= showname;
+    }
+
+    public void setCode(String code)
+    {
+        this.Code = code;
+    }
+
+    public String getCode(){
+        return this.Code;
+    }
+
+    public void setShowName(String showname)
+    {
+        this.ShowName= showname;
+    }
+
+    public String getShowName(){
+        return this.ShowName;
+    }
+}

+ 13 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/enuType.java

@@ -0,0 +1,13 @@
+package com.example.xiaoshiweixinback.business.utils.parseQueryToTree;
+
+public enum enuType {
+    /// <summary>
+    /// 逻辑操作符号,比如AND、OR、NOT
+    /// </summary>
+    Logic,
+
+    /// <summary>
+    /// 赋值操作符号,比如:=、>、< 、>=、<=、like等
+    /// </summary>
+    Assignment
+}

+ 420 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/expressManager.java

@@ -0,0 +1,420 @@
+package com.example.xiaoshiweixinback.business.utils.parseQueryToTree;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Stack;
+
+public class expressManager {
+    HashMap<String, Symbol> hSymbols = new HashMap<String, Symbol>();
+    private static expressManager instance = new expressManager();
+
+
+    private expressManager() {
+        //#region 添加逻辑符号
+        operate oAnd = new operate();
+        oAnd.Code = "AND";
+        oAnd.ShowName = "AND";
+        oAnd.type = enuType.Logic;
+        oAnd.priorityVale = 11;
+        oAnd.operateValue = 2;
+        hSymbols.put(oAnd.Code, oAnd);
+
+        operate oOR = new operate();
+        oOR.Code = "OR";
+        oOR.ShowName = "OR";
+        oOR.type = enuType.Logic;
+        oOR.priorityVale = 11;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = "NOT";
+        oOR.ShowName = "NOT";
+        oOR.type = enuType.Logic;
+        oOR.priorityVale = 12;
+        oOR.operateValue = 1;
+        hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = "TO";
+        oOR.ShowName = "TO";
+        oOR.type = enuType.Logic;
+        oOR.priorityVale = 21;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = "~";
+        oOR.ShowName = "TO";
+        oOR.type = enuType.Logic;
+        oOR.priorityVale = 21;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = "=";
+        oOR.ShowName = "=";
+        oOR.type = enuType.Assignment;
+        oOR.priorityVale = 20;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = ">";
+        oOR.ShowName = ">";
+        oOR.type = enuType.Assignment;
+        oOR.priorityVale = 20;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = "<";
+        oOR.ShowName = "<";
+        oOR.type = enuType.Assignment;
+        oOR.priorityVale = 20;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = ">=";
+        oOR.ShowName = ">=";
+        oOR.type = enuType.Assignment;
+        oOR.priorityVale = 20;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = "<=";
+        oOR.ShowName = "<=";
+        oOR.type = enuType.Assignment;
+        oOR.priorityVale = 20;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = "CONTAIN";
+        oOR.ShowName = " LIKE ";
+        oOR.type = enuType.Assignment;
+        oOR.priorityVale = 20;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
+
+        oOR = new operate();
+        oOR.Code = "≡";
+        oOR.ShowName = " LIKE ";
+        oOR.type = enuType.Assignment;
+        oOR.priorityVale = 20;
+        oOR.operateValue = 2;
+        hSymbols.put(oOR.Code, oOR);
+        //#endregion
+
+        //#region 添加成对出现的符号
+        pairSymbol first = new pairSymbol();
+        first.Code = "(";
+        first.isEndSymbol = false;
+
+        pairSymbol end = new pairSymbol();
+        end.Code = ")";
+        end.previewSymbol = first;
+        end.isEndSymbol = true;
+
+        hSymbols.put(first.Code, first);
+        hSymbols.put(end.Code, end);
+
+        pairSymbol first1 = new pairSymbol();
+        first1.Code = "[";
+        first1.isEndSymbol = false;
+
+        pairSymbol end1 = new pairSymbol();
+        end1.Code = "]";
+        end1.previewSymbol = first1;
+        end1.isEndSymbol = true;
+
+        hSymbols.put(first1.Code, first1);
+        hSymbols.put(end1.Code, end1);
+
+        end = new pairSymbol();
+        end.Code = "\"";
+        end.previewSymbol = end;
+
+        hSymbols.put(end.Code, end);
+        //#endregion
+    }
+
+    public static expressManager getInstance() {
+        return instance;
+    }
+
+    public Symbol getSymbol(String strSymbol) {
+        String strKey = strSymbol.trim().toUpperCase();
+        if ((strKey != null && !strKey.trim().equals("")) && hSymbols.containsKey(strKey)) {
+            return hSymbols.get(strKey);
+        } else {
+            return null;
+        }
+    }
+
+    /// <summary>
+    /// 解析表达式字符串,返回表达式树
+    /// </summary>
+    /// <param name="strExpress">表达式字符串</param>
+    /// <param name="isAnd">如果输入的是多个条件,之间的关系是and还是or,true为and,false为or</param>
+    /// <returns>表达式树节点</returns>
+    public treeNode Parse(String strExpress, boolean isAnd) throws Exception {
+        ArrayList<String> Tokens = GetTokens(strExpress);
+        Stack<Symbol> symbolStack = new Stack<Symbol>();
+        Stack<treeNode> valueStack = new Stack<treeNode>();
+        for (String strTem : Tokens) {
+            Symbol temSymbol = expressManager.getInstance().getSymbol(strTem);
+            if (temSymbol != null) {
+                if (temSymbol instanceof operate) {
+                    //#region 如果是操作符,从操作符堆栈中取出优先级大于等于该操作符的结合值堆栈生成节点后压入值堆栈,然后将该操作符压入堆栈
+                    operate temOperate = (operate) temSymbol;
+                    if (symbolStack.size() > 0) {
+                        Symbol lastSymbol = symbolStack.peek();
+
+                        while (lastSymbol instanceof operate && ((operate) lastSymbol).priorityVale >= temOperate.priorityVale) {
+                            operateNode temSymbolNode = new operateNode();
+                            temSymbolNode.operate = (operate) lastSymbol;
+                            if (((operate) lastSymbol).operateValue == 1) {
+                                temSymbolNode.Right = valueStack.pop();
+                            } else {
+                                temSymbolNode.Right = valueStack.pop();
+                                temSymbolNode.Left = valueStack.pop();
+                            }
+
+                            valueStack.push(temSymbolNode);
+
+                            symbolStack.pop();
+
+                            if (symbolStack.size() > 0) {
+                                lastSymbol = symbolStack.peek();
+                            } else {
+                                break;
+                            }
+                        }
+                    }
+                    symbolStack.push(temSymbol);
+                    //#endregion
+                } else {
+                    //#region 括号处理
+                    if (temSymbol instanceof pairSymbol && ((pairSymbol) temSymbol).isEndSymbol) {
+                        Symbol lastSymbol = symbolStack.peek();
+
+                        if (lastSymbol == null) {
+                            throw new Exception("无效的括号!");
+                        }
+
+                        while (lastSymbol instanceof operate ||
+                                (lastSymbol instanceof pairSymbol && ((pairSymbol) lastSymbol).Code != ((pairSymbol) temSymbol).previewSymbol.Code)) {
+                            operateNode temSymbolNode = new operateNode();
+                            temSymbolNode.operate = (operate) lastSymbol;
+
+                            if (((operate) lastSymbol).operateValue == 1) {
+                                temSymbolNode.Right = valueStack.pop();
+                            } else {
+                                temSymbolNode.Right = valueStack.pop();
+                                temSymbolNode.Left = valueStack.pop();
+                            }
+                            valueStack.push(temSymbolNode);
+
+                            symbolStack.pop();
+                            lastSymbol = symbolStack.peek();
+                        }
+
+                        if ((lastSymbol instanceof pairSymbol && ((pairSymbol) temSymbol).previewSymbol.Code == ((pairSymbol) lastSymbol).Code)) {
+                            symbolStack.pop();
+                        } else {
+                            throw new Exception("无效的括号");
+                        }
+
+                    } else {
+                        symbolStack.push(temSymbol);
+                    }
+                    //#endregion
+                }
+            } else {
+                valueNode temNode = new valueNode();
+                temNode.value = strTem;
+
+                valueStack.push(temNode);
+            }
+        }
+
+        while (symbolStack.size() > 0) {
+            Symbol temSymbol = symbolStack.pop();
+
+            if (temSymbol instanceof operate) {
+                operateNode temNode = new operateNode();
+                temNode.operate = (operate) temSymbol;
+
+                if (((operate) temSymbol).operateValue == 1) {
+                    temNode.Right = valueStack.pop();
+                } else {
+                    temNode.Right = valueStack.pop();
+                    temNode.Left = valueStack.pop();
+                }
+
+                valueStack.push(temNode);
+
+            } else {
+                throw new Exception("无效的括号!");
+            }
+        }
+
+        if (valueStack.size() == 1) {
+            return valueStack.pop();
+        } else {
+
+            if (valueStack.size() > 1) {
+                List<treeNode> lstValues = new ArrayList<treeNode>();
+
+                while (valueStack.size() > 0) {
+                    treeNode temNode = valueStack.pop();
+
+                    if (temNode instanceof valueNode) {
+                        lstValues.add(temNode);
+                    } else {
+                        throw new Exception("无效的检索式!");
+                    }
+                }
+
+                treeNode retNode = null;
+
+                for (treeNode temNode : lstValues) {
+                    if (retNode == null) {
+                        retNode = temNode;
+                    } else {
+                        operateNode sNode = new operateNode();
+
+                        if (!isAnd) {
+                            sNode.operate = (operate) expressManager.getInstance().getSymbol("OR");
+                        } else {
+                            sNode.operate = (operate) expressManager.getInstance().getSymbol("AND");
+                        }
+
+                        sNode.Left = retNode;
+                        sNode.Right = temNode;
+                        retNode = sNode;
+                    }
+                }
+
+                return retNode;
+            }
+
+            throw new Exception("无效的检索式!");
+
+        }
+    }
+
+
+    /// <summary>
+    /// 语法分析,将表达式字符按照空格分开,
+    /// 且将双引号或者是括号从字符串中拿出来
+    /// </summary>
+    /// <param name="strExpress"></param>
+    /// <returns></returns>
+    public ArrayList<String> GetTokens(String strExpress) {
+        if (strExpress != null) {
+            ArrayList<String> Tokens = new ArrayList<String>();
+            //#region
+            String strTem = strExpress.trim();
+
+            String strTemToken = "";
+            Boolean isFindingEndYinHao = false;
+            int step = -1;
+            for (int i = 0; i < strTem.length(); i++) {
+                char c = strTem.charAt(i);
+
+                switch (c) {
+                    case '"':
+                        if (!isFindingEndYinHao) {
+                            isFindingEndYinHao = true;
+                            step = i;
+                        } else {
+                            if ((i < strTem.length() - 1 && strTem.charAt(i + 1) == ' ')
+                                    || (i < strTem.length() - 1 && strTem.charAt(i + 1) == ')')
+                                    || (i < strTem.length() - 1 && strTem.charAt(i + 1) == ']')
+                                    || i == strTem.length() - 1) {
+                                strTemToken = strTem.substring(step + 1, i);
+                                Tokens.add(strTemToken);
+                                step = i;
+                                isFindingEndYinHao = false;
+                            }
+
+                        }
+                        break;
+                    case ' ':
+                        if (!isFindingEndYinHao) {
+                            if (step == (i - 1)) {
+                                step = i;
+                            } else {
+                                strTemToken = strTem.substring(step + 1, i);
+                                Tokens.add(strTemToken);
+                                step = i;
+
+                            }
+                        }
+                        break;
+                    case '(':
+                    case '[':
+                        if (i == 0 || strTem.charAt(i - 1) == ' ' || (Tokens.size() > 0 && Tokens.get(Tokens.size() - 1) == String.valueOf(c)) || strTem.charAt(i - 1) == '=') {
+                            Tokens.add(String.valueOf(c));
+                            step = i;
+                        }
+                        break;
+                    case ')':
+                    case ']':
+                        if ((i < strTem.length() - 1 && (strTem.charAt(i + 1) == ' ' || strTem.charAt(i + 1) == c)) || i == strTem.length() - 1) {
+                            Boolean isAdd = false;
+                            for (int index = Tokens.size() - 1; index >= 0; index--) {
+                                if ((c == ')' && Tokens.get(index).equals("(")) || (c == ']' && Tokens.get(index).equals("["))) {
+                                    isAdd = true;
+                                    break;
+                                }
+                            }
+                            if (isAdd) {
+                                strTemToken = strTem.substring(step + 1, i);
+                                if (strTemToken != null && !strTemToken.equals("")) {
+                                    Tokens.add(strTemToken);
+                                }
+                                Tokens.add(String.valueOf(c));
+                                step = i;
+                            }
+                        }
+                        break;
+                    case '=':
+                    case '~':
+                    case '>':
+                    case '>':
+                    case '<':
+                    case '<':
+                        strTemToken = strTem.substring(step + 1, i);
+
+                        if (strTemToken != null && strTemToken != "") {
+                            Tokens.add(strTemToken);
+                        }
+
+                        if (strTem.charAt(i + 1) == '=') {
+                            Tokens.add(String.valueOf(c) + "=");
+                            step = i + 1;
+                            i++;
+                        } else {
+                            Tokens.add(String.valueOf(c));
+                            step = i;
+                        }
+                        break;
+                }
+            }
+
+            if (step < strTem.length() - 1) {
+                Tokens.add(strTem.substring(step + 1));
+            }
+            //#endregion
+            return Tokens;
+        } else {
+            return null;
+        }
+    }
+}

+ 42 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/operate.java

@@ -0,0 +1,42 @@
+package com.example.xiaoshiweixinback.business.utils.parseQueryToTree;
+
+public class operate extends Symbol {
+    
+    /// <summary>
+    /// 优先级
+    /// </summary>
+    int priorityVale;
+    public void setpriorityVale(int v){
+        this.priorityVale = v;
+    }
+
+    public int getpriorityVale(){
+        return this.priorityVale;
+    }
+
+    /// <summary>
+    /// 操作符元数
+    /// 1表示一元操作符 NOT
+    /// 2表示二元操作符 AND、OR、>、<、= 、>=、<=、like等
+    /// </summary>
+    int operateValue;
+
+    public void setoperateValue(int v){
+        this.operateValue = v;
+    }
+
+    public int getoperateValue(){
+        return this. operateValue;
+    }
+
+
+    enuType type;
+
+    public void setenyType(enuType type){
+        this.type = type;
+    }
+
+    public enuType gettype(){
+        return this.type;
+    }
+}

+ 53 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/operateNode.java

@@ -0,0 +1,53 @@
+package com.example.xiaoshiweixinback.business.utils.parseQueryToTree;
+
+public class operateNode extends treeNode {
+    operate operate ;
+
+    public void setoperate(operate op){
+        this.operate = op;
+    }
+
+    public operate getoperate(){
+        return this.operate;
+    }
+
+    public String ToString(){
+        String strCode = "";
+            if ((operate.getShowName()!=null))
+            {
+                strCode = operate.getShowName();
+            }
+            else
+            {
+                strCode = operate.Code;
+            }
+
+            if(Left != null)
+            {
+                if((operate.type == enuType.Logic || operate.type == enuType.Assignment ) && (Left.Left != null || Left.Right != null))
+                {
+                    strCode = "(" + Left.ToString() +") " + strCode;
+                }
+                else
+                {
+                    strCode = Left.ToString() +" " + strCode;
+                }
+                
+            }
+
+            if(Right!= null)
+            {
+                if ((operate.type == enuType.Logic || operate.type == enuType.Assignment ) && (Right.Left != null || Right.Right != null))
+                {
+                    strCode = strCode +" (" + Right.ToString()+ ") ";
+                }
+                else
+                {
+                    strCode = strCode + " " + Right.ToString();
+                }
+                
+            }
+
+            return strCode;
+    }
+}

+ 25 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/pairSymbol.java

@@ -0,0 +1,25 @@
+package com.example.xiaoshiweixinback.business.utils.parseQueryToTree;
+
+public class pairSymbol extends Symbol {
+    Boolean isEndSymbol;
+    pairSymbol previewSymbol;
+
+    public void setisEndSymbol(Boolean endflag)
+    {
+        this.isEndSymbol = endflag;
+    }
+
+    public Boolean getisEndSymbol(){
+        return this.isEndSymbol;
+    }
+
+    public void setpreviewSymbol(pairSymbol pre)
+    {
+        this.previewSymbol= pre;
+    }
+
+    public pairSymbol getpreviewSymbol(){
+        return this.previewSymbol;
+    }
+    
+}

+ 58 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/treeNode.java

@@ -0,0 +1,58 @@
+package com.example.xiaoshiweixinback.business.utils.parseQueryToTree;
+
+public class treeNode {
+    treeNode Left ;
+    treeNode Right;
+
+    public void setLeft(treeNode node){
+        this.Left = node;
+    }
+
+    public treeNode getLeft(){
+        return Left;
+    }
+
+    public void setRight(treeNode node){
+        this.Right = node;
+    }
+
+    public treeNode getRight(){
+        return Right;
+    }
+
+    public String ToString(){
+        return "";
+    }
+
+    public treeNode AND(treeNode expressNode)
+    {
+        operateNode AndNode = new operateNode();
+        AndNode.operate = (operate)expressManager.getInstance().getSymbol("and");
+        AndNode.Left = this;
+        AndNode.Right = expressNode;
+        return AndNode;
+    }
+
+    public treeNode OR(treeNode expressNode)
+    {
+        operateNode retNode = new operateNode();
+        retNode.operate = (operate) expressManager.getInstance().getSymbol("or");
+        retNode.Left = this;
+        retNode.Right = expressNode;
+        return retNode;
+    }
+
+    public treeNode NOT(treeNode expressNode) 
+    {
+        operateNode AndNode = new operateNode();
+        AndNode.operate = (operate) expressManager.getInstance().getSymbol("AND");
+        AndNode.Left = this;
+
+        operateNode NotNode = new operateNode();
+        AndNode.operate = (operate) expressManager.getInstance().getSymbol("not");
+        AndNode.Right = expressNode;
+
+        AndNode.Right = NotNode;
+        return AndNode;
+    }
+}

+ 16 - 0
src/main/java/com/example/xiaoshiweixinback/business/utils/parseQueryToTree/valueNode.java

@@ -0,0 +1,16 @@
+package com.example.xiaoshiweixinback.business.utils.parseQueryToTree;
+
+public class valueNode extends treeNode {
+    String value;
+    public void setvalue(String v){
+        this.value =v;
+    }
+
+    public String getvalue(){
+        return this.value;
+    }
+
+    public String ToString(){
+        return this.value;
+    }
+}

+ 6 - 19
src/main/java/com/example/xiaoshiweixinback/controller/PatentController.java

@@ -2,40 +2,27 @@ package com.example.xiaoshiweixinback.controller;
 
 import com.example.xiaoshiweixinback.business.common.Constants;
 import com.example.xiaoshiweixinback.business.common.Response;
-import com.example.xiaoshiweixinback.business.utils.FileUtil;
-import com.example.xiaoshiweixinback.business.utils.JsonUtils;
-import com.example.xiaoshiweixinback.entity.dto.person.LoginDTO;
-import com.example.xiaoshiweixinback.entity.vo.person.LoginVO;
+import com.example.xiaoshiweixinback.entity.dto.patent.ImportTaskAMVO;
 import com.example.xiaoshiweixinback.service.common.FileManagerService;
-import com.example.xiaoshiweixinback.service.common.GetVectorService;
+import com.example.xiaoshiweixinback.service.importPatent.ImportFromWebToEsService;
 import io.swagger.v3.oas.annotations.Operation;
-import jakarta.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
 
-import java.io.File;
-import java.util.List;
 
 @RequestMapping(Constants.XIAOSHI_WEIXINBACK + "/patent")
 @RestController
 public class PatentController {
     @Autowired
-    private GetVectorService getVectorService;
+    private ImportFromWebToEsService importFromWebToEsService;
     @Autowired
     private FileManagerService fileManagerService;
 
     @Operation(summary = "手机号/账号登录")
-    @GetMapping(value = "/getVector")
-    public Response loginByPhone(String guid) {
+    @GetMapping(value = "/importPatent")
+    public Response queryPatent(@RequestBody ImportTaskAMVO importTaskAMVO) {
         try {
-//            byte[] bytes = fileManagerService.downloadSystemFileFromFMS(guid);
-//            File file = new File("111.png");
-//            FileUtil.byteToFile(file, bytes);
-//            List<String> a = getVectorService.uploadFile(file);
-//            System.out.println(a);
-          List<String> b =getVectorService.getVectorByText(guid);
-          System.out.println(b);
+           importFromWebToEsService.ImportTask(importTaskAMVO);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 31 - 0
src/main/java/com/example/xiaoshiweixinback/domain/es/PatentVector.java

@@ -0,0 +1,31 @@
+package com.example.xiaoshiweixinback.domain.es;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class PatentVector {
+    /**
+     * 专利号
+     */
+    @JsonProperty("app_no")
+    private String appNo;
+
+    /**
+     * 权利人
+     */
+    @JsonProperty("right_holder")
+    private List<PatentPerson> rightHolder;
+
+    @JsonProperty("public_date")
+    private Date publicDate;
+
+    /**
+     * 标题
+     */
+    @JsonProperty("title")
+    private List<Text> title;
+}

+ 26 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/common/SqlObject.java

@@ -0,0 +1,26 @@
+package com.example.xiaoshiweixinback.entity.dto.common;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @author 沈永艺
+ * @date 2022-8-4
+ * @description 人员类 前台对应实体
+ */
+
+@Data
+@Accessors(chain = true)
+public class SqlObject {
+    /**
+     * ID
+     */
+    private String field;
+    private String sqlField;
+    private String value;
+    private String sqlClass;
+    private String option;
+    private Boolean ifSearch;
+    private Boolean ifAsCondition;
+
+}

+ 25 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/ImportTaskText.java

@@ -0,0 +1,25 @@
+package com.example.xiaoshiweixinback.entity.dto.importTaskModel;
+
+
+import lombok.Data;
+
+/**
+ * <p>
+ * 专利信息标签表
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-03-07
+ */
+@Data
+
+public class ImportTaskText {
+
+    /**
+     * 标签名称
+     */
+
+    private String name;
+    private String nameOut;
+
+}

+ 48 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentAffair.java

@@ -0,0 +1,48 @@
+package com.example.xiaoshiweixinback.entity.dto.importTaskModel;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+
+/**
+ * <p>
+ * 专利信息事务信息表
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-02-24
+ */
+@Data
+
+public class PatentAffair {
+
+    /**
+     * 发生日期
+     */
+    @TableField("datetime")
+    private Integer dateTime;
+
+    /**
+     * 法律状态
+     */
+    private String status;
+
+    /**
+     * 简单法律状态
+     */
+    @TableField("simplestatus")
+    private Integer simpleStatus;
+
+    /**
+     * 事务内容(INPADOC法律状态)
+     */
+    private String content;
+
+
+    @Data
+    public static class INPADOC {
+        private String year;
+        private String content;
+        private String country;
+    }
+}

+ 20 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentAgent.java

@@ -0,0 +1,20 @@
+package com.example.xiaoshiweixinback.entity.dto.importTaskModel;
+
+import lombok.Data;
+
+/**
+ * <p>
+ * 专利信息代理人表
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-02-24
+ */
+@Data
+public class PatentAgent {
+    /**
+     * 代理人
+     */
+    private String name;
+
+}

+ 57 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentApplicant.java

@@ -0,0 +1,57 @@
+package com.example.xiaoshiweixinback.entity.dto.importTaskModel;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+/**
+ * <p>
+ * 专利信息申请人表
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-02-24
+ */
+@Data
+
+public class PatentApplicant  {
+    /**
+     * 申请人名称
+     */
+    private String name;
+
+
+
+
+
+    /**
+     * 1.个人 2.企业 3.院校 4.科研机构
+     */
+    private Integer type;
+
+    /**
+     * 国家
+     */
+    private String country;
+
+    /**
+     * 地址
+     */
+    @TableField("address")
+    private String addressStr;
+
+    /**
+     * 省ID
+     */
+    private Integer provinceId;
+
+    /**
+     * 市级ID
+     */
+    private Integer cityId;
+
+    /**
+     * 地区关联表
+     */
+    private Integer areaId;
+
+}

+ 25 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentInstructionText.java

@@ -0,0 +1,25 @@
+package com.example.xiaoshiweixinback.entity.dto.importTaskModel;
+
+
+
+import lombok.Data;
+
+/**
+ * 专利说明书(文本)
+ * @TableName os_patent_instruction_text
+ */
+@Data
+
+public class PatentInstructionText  {
+
+    /**
+     * 说明书
+     */
+    private String manual;
+
+    /**
+     * 说明书(译)
+     */
+    private String manualOut;
+
+}

+ 43 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentInventor.java

@@ -0,0 +1,43 @@
+package com.example.xiaoshiweixinback.entity.dto.importTaskModel;
+
+
+import lombok.Data;
+
+
+/**
+ * <p>
+ * 专利信息发明人表
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-02-24
+ */
+@Data
+
+public class PatentInventor  {
+
+    /**
+     * 合并前发明人名称
+     */
+    private String name;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+    /**
+     * 国家
+     */
+    private String country;
+
+
+    /**
+     * 类型【个人、企业、研究机构、院校】
+     */
+    private Integer type;
+
+
+
+
+}

+ 25 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentLabel.java

@@ -0,0 +1,25 @@
+package com.example.xiaoshiweixinback.entity.dto.importTaskModel;
+
+
+import lombok.Data;
+
+/**
+ * <p>
+ * 专利信息标签表
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-03-07
+ */
+@Data
+
+public class PatentLabel  {
+
+    /**
+     * 标签名称
+     */
+
+    private String name;
+
+
+}

+ 30 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentLicensor.java

@@ -0,0 +1,30 @@
+package com.example.xiaoshiweixinback.entity.dto.importTaskModel;
+
+
+import lombok.Data;
+
+/**
+ * <p>
+ * 专利信息许可人表
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-02-24
+ */
+@Data
+
+public class PatentLicensor  {
+    /**
+     * 被许可人
+     */
+    private String licensee;
+    /**
+     * 许可人
+     */
+    private String licensor;
+    /**
+     * 许可类型
+     */
+    private String type;
+
+}

+ 30 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentPledge.java

@@ -0,0 +1,30 @@
+package com.example.xiaoshiweixinback.entity.dto.importTaskModel;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * <p>
+ * 专利信息质押质权人表
+ * </p>
+ *
+ * @author 王岩
+ * @since 2022-02-24
+ */
+@Data
+@TableName("os_patent_pledge")
+public class PatentPledge  {
+
+    /**
+     * 质押人
+     */
+    private String pledgor;
+
+    /**
+     * 质权人
+     */
+    private String pledgee;
+
+
+}

+ 26 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/importTaskModel/PatentRight.java

@@ -0,0 +1,26 @@
+package com.example.xiaoshiweixinback.entity.dto.importTaskModel;
+
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 专利权利要求
+ *
+ * @TableName os_patent_right
+ */
+@Data
+@Accessors(chain = true)
+
+public class PatentRight  {
+
+    /**
+     * 权利要求原文
+     */
+    private String name;
+    /**
+     * 权利要求译文
+     */
+    private String nameOut;
+
+}

+ 35 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/Calculate.java

@@ -0,0 +1,35 @@
+package com.example.xiaoshiweixinback.entity.dto.patent;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 根据起止条数计算开始页数、开始页数的开始位置、结束页数、结束页数的结束位置
+ *
+ * @Author chenyu
+ * @Date 2023/7/14
+ */
+@Accessors(chain = true)
+@Data
+public class Calculate implements Serializable {
+    /**
+     * 检索开始页数
+     */
+    private Integer startPage;
+    /**
+     * 检索开始页数的开始专利位置
+     */
+    private Integer startNum;
+    /**
+     * 检索结束页数
+     */
+    private Integer endPage;
+    /**
+     * 检索结束页数的结束专利位置
+     */
+    private Integer endNum;
+
+
+}

+ 95 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/ImportTaskAMVO.java

@@ -0,0 +1,95 @@
+package com.example.xiaoshiweixinback.entity.dto.patent;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 实体类表以及栏位信息
+ */
+@Data
+public class ImportTaskAMVO {
+    /**
+     * 查询条件
+     */
+    private String searchCondition;
+    /**
+     * 任务id
+     */
+    private Integer id;
+    private String fileGuid;
+
+    /**
+     * 导入总条数
+     */
+    private Integer allNum;
+
+    /**
+     * 进度
+     */
+    private Double progress;
+
+    /**
+     * 完成条数
+     */
+    private Integer successNum;
+
+    /**
+     * 失败条数
+     */
+    private Integer defaultNum;
+    /**
+     * 任务类型
+     * 1.excel导入 2.专利号导入 3.专利号文件导入 4.检索导入 5.pdf文档导入
+     */
+    private Integer type;
+
+    /**
+     * 状态
+     */
+    private Integer state;
+    private Integer sourceId;
+    /**
+     * 报告或数据库id
+     */
+    private Integer projectId;
+    /**
+     * 报告类型
+     */
+    private Integer reportType;
+    /**
+     * 产品id
+     */
+    private Integer productId;
+
+    /**
+     * 若是检索导入/专利号导入则必填
+     * 五位数字
+     * 第1著录项目2附图
+     * 3权利要求,4说明书文本,5pdf文档
+     */
+    private Integer importContent;
+
+    private Integer endNum;
+    private String orderBy;
+    private  String orderByType;
+    private String dbType;
+    private Integer doneNum;
+    private String createId;
+     private Integer projectType;
+    private char ifAddPicture;
+    private char ifAddFullText;
+    private char ifAddPDF;
+    private char  ifAddCatalogue;
+
+    private Integer threadCounter;
+
+    private Integer threadDoneCounter;
+
+    private Integer messageThreadDoneCounter;
+
+
+    private Integer messageThreadCounter;
+    private String patentNoStr;
+}

+ 9 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/PatentSearchDTO.java

@@ -0,0 +1,9 @@
+package com.example.xiaoshiweixinback.entity.dto.patent;
+
+import lombok.Data;
+
+@Data
+public class PatentSearchDTO {
+    private String title;
+    private String applicantName;
+}

+ 47 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/PatentStarDTO.java

@@ -0,0 +1,47 @@
+package com.example.xiaoshiweixinback.entity.dto.patent;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 专利之星检索dto类
+ *
+ * @author 李仁杰
+ */
+
+@Accessors(chain = true)
+@Data
+public class PatentStarDTO {
+    /**
+     * 检索式
+     */
+    @JsonProperty(value = "CurrentQuery")
+    private String CurrentQuery;
+    /**
+     * 表示检索中文库或世界库(CN中文专利库 WD世界专利库)
+     */
+    @JsonProperty(value = "DBType")
+    private String DBType;
+    /**
+     * 当前页,最多 200 页
+     */
+    @JsonProperty(value = "PageNum")
+    private Integer PageNum;
+    /**
+     * 每页条数,最多 50 条
+     */
+    @JsonProperty(value = "RowCount")
+    private Integer RowCount;
+    /**
+     * 排序字段:“AD”,“PD”,“GD”, “ID”
+     */
+    @JsonProperty(value = "OrderBy")
+    private String OrderBy;
+    /**
+     * 排序方式:“ASC”,“DESC”
+     */
+    @JsonProperty(value = "OrderByType")
+    private String OrderByType;
+
+}

+ 63 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/PatentStarListDTO.java

@@ -0,0 +1,63 @@
+package com.example.xiaoshiweixinback.entity.dto.patent;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.joda.time.DateTime;
+
+import java.util.List;
+
+/**
+ * 专利之星检索dto类
+ *
+ * @author 李仁杰
+ */
+
+@Accessors(chain = true)
+@Data
+public class PatentStarListDTO {
+    private Integer retrieveRecordId;
+    /**
+     * 检索式
+     */
+    @JsonProperty(value = "CurrentQuery")
+    private String CurrentQuery;
+    /**
+     * 表示检索中文库或世界库(CN中文专利库 WD世界专利库)
+     */
+    @JsonProperty(value = "DBType")
+    private String DBType;
+    /**
+     * 当前页,最多 200 页
+     */
+    @JsonProperty(value = "PageNum")
+    private Integer PageNum;
+    /**
+     * 每页条数,最多 50 条
+     */
+    @JsonProperty(value = "RowCount")
+    private Integer RowCount;
+    /**
+     * 排序字段:“AD”,“PD”,“GD”, “ID”
+     */
+    @JsonProperty(value = "OrderBy")
+    private String OrderBy;
+    /**
+     * 排序方式:“ASC”,“DESC”
+     */
+    @JsonProperty(value = "OrderByType")
+    private String OrderByType;
+
+    private Integer total;
+
+    private DateTime startTime;
+
+    private DateTime endTime;
+
+    private String orginCondition;
+
+    private Boolean formed;
+
+    private List<String> nos;
+
+}

+ 164 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/StarPatentVO.java

@@ -0,0 +1,164 @@
+package com.example.xiaoshiweixinback.entity.dto.patent;
+
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.example.xiaoshiweixinback.entity.dto.importTaskModel.PatentAgent;
+import com.example.xiaoshiweixinback.entity.dto.importTaskModel.PatentApplicant;
+import com.example.xiaoshiweixinback.entity.dto.importTaskModel.PatentInventor;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Accessors(chain = true)
+@Data
+public class StarPatentVO  {
+    /**
+     * 原始申请号
+     */
+    @JSONField(name = "ANO")
+    private String rowApplicationNo;
+    /**
+     * 专利类型(1和8为发明 2和9为新型 3为外观)
+     */
+    @JSONField(name = "PT")
+    private Integer patentType;
+    /**
+     * 申请人地址
+     */
+    @JSONField(name = "DZ")
+    private String applicationAddress;
+    /**
+     * 主分类号
+     */
+    @JSONField(name = "MC")
+    private String mainIpc;
+    /**
+     * IPC分类号
+     */
+    @JSONField(name = "IC")
+    private String ipcListStr;
+    /**
+     * 公告日
+     */
+    @JSONField(name = "GD")
+    private String publicAccreditDate;
+    /**
+     * 摘要
+     */
+    @JSONField(name = "AB")
+    private String abstractStr;
+    /**
+     * 权利要求
+     */
+    @JSONField(name = "CL")
+    private String claimStr;
+    /**
+     * 申请日
+     */
+    @JSONField(name = "AD")
+    private String applicationDate;
+    /**
+     * 发明人
+     */
+    @JSONField(name = "IN")
+    private String inventorStr;
+    /**
+     * 专利号
+     */
+    private String patentNo;
+    /**
+     * 公告号
+     */
+    @JSONField(name = "GN")
+    private String publicAccreditNo;
+    /**
+     * 代理机构
+     */
+    @JSONField(name = "AGN")
+    private String agencyStr;
+    /**
+     * 申请号
+     */
+    @JSONField(name = "AN")
+    private String applicationNo;
+    /**
+     * 申请人
+     */
+    @JSONField(name = "PA")
+    private String applicantStr;
+    /**
+     * 代理人
+     */
+    @JSONField(name = "AT")
+    private String agentStr;
+    /**
+     * 公开日
+     */
+    @JSONField(name = "PD")
+    private String publicDate;
+    /**
+     * 标题
+     */
+    @JSONField(name = "TI")
+    private String name;
+    /**
+     * 权利人
+     */
+    @JSONField(name = "PE")
+    private String currentApplicantStr;
+    /**
+     * 法律状态
+     */
+    @JSONField(name = "LG")
+    private Integer LG;
+    /**
+     * 公开号
+     */
+    @JSONField(name = "PN")
+    private String publicNo;
+    /**
+     * 受理局
+     */
+    @JSONField(name = "GJ")
+    private String bureau;
+    /**
+     * 优先权
+     */
+    @JSONField(name = "PR")
+    private String priorityNo;
+    /**
+     * 优先权日
+     */
+    @JSONField(name = "PRD")
+    private String priorityDate;
+
+    /**
+     * 引用专利
+     */
+    @JSONField(name = "CC")
+    private String quoteNos;
+    /**
+     * 省?国家
+     */
+    @JSONField(name = "CO")
+    private String provinceStr;
+
+    private List<PatentInventor> inventor;
+
+    private List<String> ipcList;
+
+    private List<PatentApplicant> applicant;
+//    private PatentAgency agency;
+
+    private List<PatentAgent> agent;
+
+    private String simpleStatus;
+    /**
+     * 摘要附图路径
+     */
+    private String abstractPath;
+
+    private Integer counter;
+}

+ 22 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/UploadPatentWebDTO.java

@@ -0,0 +1,22 @@
+package com.example.xiaoshiweixinback.entity.dto.patent;
+
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.example.xiaoshiweixinback.domain.es.Patent;
+import lombok.Data;
+import lombok.Synchronized;
+import org.apache.poi.ss.usermodel.PictureData;
+
+import java.util.List;
+
+@Data
+
+public class UploadPatentWebDTO {
+    private StarPatentVO starPatentVO;
+    private Patent patent;
+    private Integer counter;
+    private Integer totalCounter;
+    private PictureData pictureData;
+    private Integer haveSaveCounter;
+    private Integer index;
+}

+ 99 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vo/patent/ChinaPatentZhuLu.java

@@ -0,0 +1,99 @@
+package com.example.xiaoshiweixinback.entity.vo.patent;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 专利之星中国专利著录实体类
+ *
+ * @Author chenyu
+ * @Date 2023/6/25
+ */
+@Accessors(chain = true)
+@Data
+public class ChinaPatentZhuLu implements Serializable {
+    /**
+     * 申请号
+     */
+    private String AN;
+    /**
+     * 申请日
+     */
+    private String AD;
+    private String CPT;
+    /**
+     * 公开日
+     */
+    private String PD;
+    private String CGT;
+    /**
+     * 公告日
+     */
+    private String GD;
+    private String ZLTP;
+    /**
+     * 标题
+     */
+    private String TI;
+    /**
+     * 国省代码
+     */
+    private String CO;
+    private String MingCheng;
+    /**
+     * 代理人
+     */
+    private String AT;
+    /**
+     * 代理机构代码
+     */
+    private String AG;
+    /**
+     * 代理机构名称
+     */
+    private String AGN;
+    /**
+     * 主分类号
+     */
+    private String MC;
+    /**
+     * 分类号
+     */
+    private String IC;
+    /**
+     * 范畴分类
+     */
+    private String CT;
+    /**
+     * 申请人
+     */
+    private String PA;
+    /**
+     * 发明人
+     */
+    private String IV;
+    /**
+     * 申请人地址
+     */
+    private String DZ;
+    private String ZipCode;
+    /**
+     * 优先权号
+     */
+    private String PR;
+    private String PRD;
+    private String Examiner;
+    private String CiteInfo;
+    private String NoCiteInfo;
+    /**
+     * 摘要
+     */
+    private String AB;
+    /**
+     * 主权要
+     */
+    private String CL1;
+
+}

+ 22 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vo/patent/PatentWithIdVO.java

@@ -0,0 +1,22 @@
+package com.example.xiaoshiweixinback.entity.vo.patent;
+
+import com.example.xiaoshiweixinback.domain.es.Patent;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+
+
+/**
+ * @Author chenyu
+ * @Date 2023/5/31
+ */
+@Accessors(chain = true)
+@Data
+public class PatentWithIdVO {
+
+    private String id;
+    /**
+     * 专利摘要附图
+     */
+    private Patent patent;
+}

+ 99 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vo/patent/WorldPatentZhuLu.java

@@ -0,0 +1,99 @@
+package com.example.xiaoshiweixinback.entity.vo.patent;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 专利之星世界专利著录实体类
+ *
+ * @Author chenyu
+ * @Date 2023/7/19
+ */
+@Accessors(chain = true)
+@Data
+public class WorldPatentZhuLu implements Serializable {
+    /**
+     * 公开号(DocDB)
+     */
+    private String DocdbPubNo;
+    /**
+     * 申请号(Epo)
+     */
+    private String EpoAppNo;
+    /**
+     * 申请日
+     */
+    private String AppDate;
+    /**
+     * 公开日
+     */
+    private String PubDate;
+    /**
+     * IPC分类号
+     */
+    private String Ipc;
+    /**
+     * CPC分类号
+     */
+    private String cpc;
+    /**
+     * ECLA分类号
+     */
+    private String Ecla;
+    /**
+     * 申请人
+     */
+    private String Pa;
+    /**
+     * 申请人国别
+     */
+    private String PaAllCountry;
+    /**
+     * 发明人
+     */
+    private String Iv;
+    /**
+     * 发明人国别
+     */
+    private String IvAllCountry;
+    /**
+     * 引用文献号
+     */
+    private String Patcit;
+    /**
+     * 公开号(Original)
+     */
+    private String OriPubNo;
+    /**
+     * 申请号(Original)
+     */
+    private String OriAppNo;
+    /**
+     * 申请号(DocDB)
+     */
+    private String DocdbAppNo;
+    /**
+     * 公开号(EPO)
+     */
+    private String EpoPubNo;
+    /**
+     * 优先权
+     */
+    private String Pr;
+    /**
+     * 简单同族docdb
+     */
+    private String DocdbFamily;
+    /**
+     * 标题
+     */
+    private String Title;
+    /**
+     * 摘要
+     */
+    private String Abstract;
+
+
+}

+ 61 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/CommonService.java

@@ -0,0 +1,61 @@
+package com.example.xiaoshiweixinback.service.importPatent;
+
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.example.xiaoshiweixinback.XiaoshiWeixinbackApplication;
+import com.example.xiaoshiweixinback.business.utils.FileUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.system.ApplicationHome;
+import org.springframework.stereotype.Service;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 公用服务类
+ *
+ * @author lrj
+ */
+@Service
+@Slf4j
+public class CommonService {
+
+    /**
+     * 根据获得文件json
+     *
+     * @param fileName
+     * @return
+     */
+    public static String readJsonFile(String fileName) {
+        String json = "";
+        try {
+            ApplicationHome ah = new ApplicationHome(XiaoshiWeixinbackApplication.class);
+            //获取 applicationHome 内的路径 ...\target\classes 到这一层级下
+            File fileTem = ah.getSource();
+            //获取 file的parentFile 即最后一级之前的所有层级路径(包括盘符) 这里能获得到的最终层级为  ...\target 后续用FILE_SEPARATOR(系统路径分割通配符 即 "\") 以及fileName拼接生成存放文件的目录层级 即为根目录 root
+            String rootPath = fileTem.getParentFile().toString() + FileUtils.FILE_SEPARATOR+"jsons/";
+//            String filePath = fileUtils.getPath("/11.docx");
+            File file = new File(rootPath + fileName);
+            Reader reader = new InputStreamReader(new FileInputStream(file), "utf-8");
+            int ch = 0;
+            StringBuffer buffer = new StringBuffer();
+            while ((ch = reader.read()) != -1) {
+                buffer.append((char) ch);
+            }
+            reader.close();
+            json = buffer.toString();
+            return json;
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+
+
+}

+ 192 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsService.java

@@ -0,0 +1,192 @@
+package com.example.xiaoshiweixinback.service.importPatent;
+
+
+import co.elastic.clients.elasticsearch.ElasticsearchClient;
+import co.elastic.clients.elasticsearch._types.*;
+import co.elastic.clients.elasticsearch._types.aggregations.*;
+import co.elastic.clients.elasticsearch._types.query_dsl.HasChildQuery;
+import co.elastic.clients.elasticsearch._types.query_dsl.Query;
+import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
+import co.elastic.clients.elasticsearch.core.*;
+import co.elastic.clients.elasticsearch.core.search.Hit;
+import co.elastic.clients.json.JsonData;
+import com.alibaba.fastjson.JSON;
+import com.example.xiaoshiweixinback.domain.es.Patent;
+import com.example.xiaoshiweixinback.domain.es.PatentVector;
+import com.example.xiaoshiweixinback.entity.vo.patent.PatentWithIdVO;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class EsService {
+    public final List<String> dateList = Arrays.asList("AD", "PD", "GD", "EXD", "PAD", "PED", "PPD", "EPD");
+    private final ElasticsearchClient client;
+
+    @Autowired
+    private PatentStarApiService patentStarApiService;
+
+
+
+    /**
+     * @param patent
+     * @throws Exception
+     */
+    public String addPatent(Patent patent) throws Exception {
+        IndexResponse indexResponse = client.index(i -> i
+                .index("wxpatent")
+                //传入user对象
+                .document(patent)
+        );
+        return indexResponse.id();
+    }
+
+    public String addPatentVector(PatentVector patentVector) throws Exception {
+        IndexResponse indexResponse = client.index(i -> i
+                .index("patent_vector")
+                //传入user对象
+                .document(patentVector)
+        );
+        return indexResponse.id();
+    }
+
+    /**
+     * 根据专利号获取专利id
+     *
+     * @param patentNo
+     * @return
+     * @throws Exception
+     */
+    public PatentWithIdVO getIdByPatentNo(String patentNo) throws Exception {
+        SearchRequest.Builder builder = new SearchRequest.Builder();
+        //设置查询索引
+        builder.index("wxpatent");
+        PatentWithIdVO patentWithIdVO = null;
+        String id = null;
+        Query q1 = QueryBuilders.term(t -> t.field("app_no.keyword").value(patentNo));
+        //公开号
+        Query q2 = QueryBuilders.term(t -> t.field("public_no.keyword").value(patentNo));
+        //授权号
+        Query q3 = QueryBuilders.term(t -> t.field("grant_no.keyword").value(patentNo));
+        Query query = QueryBuilders.bool(i -> i.should(q1, q2, q3));
+        builder.query(query);
+        SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
+        List<Hit<Patent>> hits = response.hits().hits();
+        if (hits != null && hits.size() > 0) {
+            id = hits.get(0).id();
+            Patent patent = hits.get(0).source();
+            patentWithIdVO = new PatentWithIdVO();
+            patentWithIdVO.setPatent(patent);
+            patentWithIdVO.setId(id);
+        }
+        return patentWithIdVO;
+    }
+
+
+
+    //拼接专题库id或其他id条件
+    public String appendIdsCondition(String searchCondition,Integer taskId,String productFrom,Integer projectId,Integer productId) {
+        String condition = "";
+        if (taskId != null) {
+            if (searchCondition != null && !"".equals(searchCondition.trim())) {
+                searchCondition = "taskId = " + taskId + " AND " + searchCondition;
+            } else {
+                searchCondition = "taskId = " + taskId;
+            }
+        } else {
+            if (StringUtils.isNotEmpty(productFrom)) {
+                if (productId != null) {
+                    if (searchCondition != null && !"".equals(searchCondition.trim())) {
+                        searchCondition = "productId = " + productId + " AND " + searchCondition;
+                    } else {
+                        searchCondition = "productId = " + productId;
+                    }
+                }
+            } else {
+                if (projectId != null) {
+                    if (searchCondition != null && !"".equals(searchCondition.trim())) {
+                        searchCondition = "projectId = " + projectId + " AND " + searchCondition;
+                    } else {
+                        searchCondition = "projectId = " + projectId;
+                    }
+                }
+            }
+        }
+        condition = searchCondition;
+        return condition;
+    }
+
+
+
+    //拼接专利号
+    public String appendPatentNo(List<String> nos) {
+        String str = "NO = ";
+        if (nos.size() > 1) {
+            str = str + "(";
+            for (int i = 0; i < nos.size(); i++) {
+                String s = nos.get(i);
+                if (i != nos.size() - 1) {
+                    str = str + s + " " + "OR" + " ";
+                } else {
+                    str = str + s + ")";
+                }
+            }
+        } else {
+            for (String no : nos) {
+                str = str + no;
+            }
+        }
+        return str;
+    }
+
+    //更新patent
+    public Integer updatePatent(Patent patent, String id) {
+        UpdateRequest<Patent, Patent> req;
+
+        req = UpdateRequest.of(
+                b -> b.index("wxpatent").id(id)
+                        .doc(patent)
+        );
+
+        try {
+            client.update(req, Patent.class);
+            return 1;
+        } catch (IOException e) {
+            return -1;
+        }
+    }
+
+    //更新patent
+    public Integer updatePatentShouldWait(Patent patent, String id) {
+        UpdateRequest<Patent, Patent> req;
+
+        req = UpdateRequest.of(
+                b -> b.index("patent").id(id)
+                        .doc(patent).refresh(Refresh.True).waitForActiveShards(WaitForActiveShards.of(i -> i.count(1)))
+        );
+
+        try {
+            client.update(req, Patent.class);
+            return 1;
+        } catch (IOException e) {
+            return -1;
+        }
+    }
+
+
+}
+
+

+ 137 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/FormatQueryService.java

@@ -0,0 +1,137 @@
+package com.example.xiaoshiweixinback.service.importPatent;
+
+
+import com.alibaba.fastjson.JSON;
+import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.*;
+import com.example.xiaoshiweixinback.entity.dto.common.SqlObject;
+import com.example.xiaoshiweixinback.service.importPatent.getSqlFactorys.GetSqlFactory;
+import com.example.xiaoshiweixinback.service.importPatent.getSqlFactorys.GetSqlObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 格式化检索式类
+ */
+
+@Service
+@Slf4j
+public class FormatQueryService {
+    @Autowired
+    private GetSqlFactory getSqlFactory;
+
+
+
+    /**
+     * 网站检索式格式化
+     *
+     * @param node
+     * @param getSqlObject
+     * @param tableName
+     * @return
+     */
+    public String webQueryToString(operateNode node, GetSqlObject getSqlObject, String tableName) {
+        operate operate1 = node.getoperate();
+        treeNode Left = node.getLeft();
+        treeNode Right = node.getRight();
+        String strCode = "";
+        String optionName = "";
+        if ((operate1.getShowName() != null)) {
+            if (operate1.getShowName().equals("AND")) {
+                operate1.setShowName("*");
+            } else if (operate1.getShowName().equals("OR")) {
+                operate1.setShowName("+");
+            } else if (operate1.getShowName().equals("NOT")) {
+                operate1.setShowName("-");
+            }
+            strCode = operate1.getShowName();
+            optionName = operate1.getShowName();
+        } else {
+            if (operate1.getCode().equals("AND")) {
+                operate1.setCode("*");
+            } else if (operate1.getCode().equals("OR")) {
+                operate1.setCode("+");
+            } else if (operate1.getCode().equals("NOT")) {
+                operate1.setCode("-");
+            }
+            strCode = operate1.getCode();
+            optionName = operate1.getCode();
+        }
+
+        GetSqlObject getSqlObjectLocal = null;
+        if (Left != null) {
+            if ((operate1.gettype() == enuType.Logic || operate1.gettype() == enuType.Assignment) && (Left instanceof operateNode)) {
+                strCode = "(" + this.webQueryToString((operateNode) Left, getSqlObject, tableName) + ")" + strCode;
+            } else {  //获得栏位名称
+                String field = Left.ToString();
+
+                if (getSqlObject != null) {
+                    strCode = getSqlObject.getSql(field) + strCode;
+                } else {
+                    strCode = Left.ToString() + strCode;
+                    //判断 参数类型
+                    String json = CommonService.readJsonFile(tableName + ".json");
+                    List<SqlObject> sqlObjects = JSON.parseArray(json, SqlObject.class);
+                    SqlObject sqlObject = sqlObjects.stream().filter(item -> item.getField().equals(field)).findFirst().orElse(null);
+                    if (sqlObject != null) {
+                        getSqlObjectLocal = getSqlFactory.getClass(sqlObject.getSqlClass());
+                        sqlObject.setOption(optionName);
+                        getSqlObjectLocal.setSqlObject(sqlObject);
+                        getSqlObject = getSqlObjectLocal;
+                    }
+                }
+            }
+        }
+        if (Right != null) {
+            String rightValue = "";
+            if ((operate1.gettype() == enuType.Logic || operate1.gettype() == enuType.Assignment) && (Right instanceof operateNode)) {
+                if (((operateNode) Right).getoperate().getCode().equals("~")) {
+                    rightValue = this.webQueryToString((operateNode) Right, null, tableName);
+                    strCode = getSqlObject.getSql(rightValue);
+                } else {
+                    rightValue = this.webQueryToString((operateNode) Right, getSqlObject, tableName);
+                    if (getSqlObject != null) {
+                        return rightValue;
+                    }
+                    strCode = strCode + "(" + rightValue + ")";
+                }
+
+            } else {
+                if (getSqlObjectLocal != null) {
+                    rightValue = Right.ToString();
+                    strCode = getSqlObject.getSql(rightValue);
+                } else if (getSqlObject != null) {
+                    rightValue = Right.ToString();
+                    strCode = strCode + getSqlObject.getSql(rightValue);
+                } else if (!(Left instanceof operateNode)) {
+                    rightValue = Right.ToString();
+                    strCode += rightValue;
+                }
+            }
+        }
+        return strCode;
+    }
+
+    public String reQuery(String query, String configName) {
+
+        //将检索式转换为二叉树
+        treeNode tree = null;
+        try {
+            tree = expressManager.getInstance().Parse(query, false);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        //格式化检索式
+        String reQuery = this.webQueryToString((operateNode) tree, null, configName);
+        reQuery = "F XX (" + reQuery + ")";
+        return reQuery;
+    }
+
+
+
+
+}

+ 437 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetCataloguingFromWebService.java

@@ -0,0 +1,437 @@
+package com.example.xiaoshiweixinback.service.importPatent;
+
+import com.alibaba.fastjson.JSON;
+import com.example.xiaoshiweixinback.business.utils.DateUtils;
+import com.example.xiaoshiweixinback.business.utils.esDataForm.AddressSplitter;
+import com.example.xiaoshiweixinback.business.utils.esDataForm.PatentClassifySplitter;
+import com.example.xiaoshiweixinback.domain.es.*;
+import com.example.xiaoshiweixinback.entity.dto.patent.StarPatentVO;
+import com.example.xiaoshiweixinback.entity.dto.patent.UploadPatentWebDTO;
+import com.example.xiaoshiweixinback.entity.vo.patent.ChinaPatentZhuLu;
+import com.example.xiaoshiweixinback.entity.vo.patent.WorldPatentZhuLu;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Configurable;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+@Service
+public class GetCataloguingFromWebService {
+
+    @Autowired
+    private PatentStarApiService patentStarApiService;
+
+
+    public void loadPatentMessage(UploadPatentWebDTO uploadPatentWebDTO) {
+
+        //根据专利申请号查询著录并装载信息
+        StarPatentVO starPatentVO = uploadPatentWebDTO.getStarPatentVO();
+        String patentZhuLuStr = "";
+        if (starPatentVO.getApplicationNo().startsWith("CN")) {
+            patentZhuLuStr = patentStarApiService.getCnBibApi(uploadPatentWebDTO.getStarPatentVO().getRowApplicationNo());
+        } else {
+            patentZhuLuStr = patentStarApiService.getENBibApi(uploadPatentWebDTO.getStarPatentVO().getPublicNo());
+        }
+        if (patentZhuLuStr != null && !patentZhuLuStr.trim().equals("") && !patentZhuLuStr.equals("{}") && !patentZhuLuStr.contains("请求不合法")) {
+            this.loadPatent(uploadPatentWebDTO);
+            if (starPatentVO.getApplicationNo().startsWith("CN")) {
+                this.loadCNPatent(patentZhuLuStr, uploadPatentWebDTO.getPatent(), starPatentVO);
+
+                //装载专利号
+                if (uploadPatentWebDTO.getPatent().getAppNo() != null) {
+                    uploadPatentWebDTO.getPatent().setPatentNo(uploadPatentWebDTO.getPatent().getAppNo());
+                } else if (uploadPatentWebDTO.getPatent().getGrantNo() != null) {
+                    uploadPatentWebDTO.getPatent().setPatentNo(uploadPatentWebDTO.getPatent().getGrantNo());
+                } else if (uploadPatentWebDTO.getPatent().getPublicNo() != null) {
+                    uploadPatentWebDTO.getPatent().setPatentNo(uploadPatentWebDTO.getPatent().getPublicNo());
+                }
+            } else {
+                this.loadWorldPatent(patentZhuLuStr, uploadPatentWebDTO.getPatent());
+                //装载专利号
+                if (uploadPatentWebDTO.getPatent().getGrantNo() != null) {
+                    uploadPatentWebDTO.getPatent().setPatentNo(uploadPatentWebDTO.getPatent().getGrantNo());
+                } else if (uploadPatentWebDTO.getPatent().getPublicNo() != null) {
+                    uploadPatentWebDTO.getPatent().setPatentNo(uploadPatentWebDTO.getPatent().getPublicNo());
+                } else if (uploadPatentWebDTO.getPatent().getAppNo() != null) {
+                    uploadPatentWebDTO.getPatent().setPatentNo(uploadPatentWebDTO.getPatent().getAppNo());
+                }
+            }
+        }
+    }
+
+
+    //装载专利信息
+    private void loadPatent(UploadPatentWebDTO uploadPatentWebDTO) {
+        String country = "";
+        Patent patent = uploadPatentWebDTO.getPatent();
+        StarPatentVO starPatentVO = uploadPatentWebDTO.getStarPatentVO();
+        //装载专利类型
+        Integer patentType = starPatentVO.getPatentType();
+        if (patentType != null) {
+            if (patentType.equals(2) || patentType.equals(9)) {
+                patent.setPatentType("2");  //实用新型
+            } else if (patentType.equals(1) || patentType.equals(8)) {
+                patent.setPatentType("1");  //发明
+            } else if (patentType.equals(3)) {
+                patent.setPatentType("3");  //外观设计
+            }
+        }
+
+        //装载申请人地址
+        if (starPatentVO.getApplicationAddress() != null && !starPatentVO.getApplicationAddress().equals("")) {
+            String applicationAddress = starPatentVO.getApplicationAddress();
+            PersonAddress personAddress = AddressSplitter.splitAddress(applicationAddress, starPatentVO.getProvinceStr());
+            patent.setApplicantAddr(personAddress);
+        }
+
+        //装载IPC分类号
+        if (starPatentVO.getIpcListStr() != null && !starPatentVO.getIpcListStr().equals("")) {
+            List<PatentClassify> patentClassifies = new ArrayList<>();
+            List<String> ipcArr = Arrays.asList(starPatentVO.getIpcListStr().split(";"));
+            for (int i = 0; i < ipcArr.size(); i++) {
+                PatentClassify patentClassify = PatentClassifySplitter.split(ipcArr.get(i));
+                patentClassifies.add(patentClassify);
+                if (i == 0) {
+                    patent.setMipc(patentClassify);
+                }
+            }
+            patent.setIpc(patentClassifies);
+        }
+
+        //装载公告日
+        if (starPatentVO.getPublicAccreditDate() != null && !starPatentVO.getPublicAccreditDate().equals("")) {
+//
+//            patent.setGrantDate();
+            Date date = DateUtils.strToDate(starPatentVO.getPublicAccreditDate());
+            patent.setGrantDate(date);
+        }
+
+        //装载摘要
+        if (starPatentVO.getAbstractStr() != null && !starPatentVO.getAbstractStr().equals("")) {
+            Text text = new Text();
+            text.setLanguage(patent.getAppCountry());
+            text.setIfOrigin(true);
+            text.setTextContent(starPatentVO.getAbstractStr());
+            patent.setAbstractStr(Arrays.asList(text));
+        }
+
+        //装载申请日
+        if (starPatentVO.getApplicationDate() != null && !starPatentVO.getApplicationDate().equals("")) {
+            Date date = DateUtils.strToDate(starPatentVO.getApplicationDate());
+            patent.setAppDate(date);
+        }
+
+        //装载发明人
+        if (starPatentVO.getInventorStr() != null && !starPatentVO.getInventorStr().equals("")) {
+            List<String> patentInventorNames = Arrays.asList(starPatentVO.getInventorStr().split(";"));
+            List<PatentPerson> patentPeople = new ArrayList<>();
+            for (int i = 0; i < patentInventorNames.size(); i++) {
+                PatentPerson patentPerson = new PatentPerson();
+                patentPerson.setOrder(i + 1);
+                patentPerson.setType("1");
+                patentPerson.setName(patentInventorNames.get(i));
+                patentPeople.add(patentPerson);
+            }
+            patent.setInventor(patentPeople);
+        }
+
+        //装载申请号
+        if (starPatentVO.getApplicationNo() != null && !starPatentVO.getApplicationNo().equals("")) {
+            patent.setAppNo(starPatentVO.getApplicationNo());
+            country = starPatentVO.getApplicationNo().substring(0, 2);
+
+        }
+
+        //装载公开号
+        if (starPatentVO.getPublicNo() != null && !starPatentVO.getPublicNo().equals("")) {
+            patent.setPublicNo(starPatentVO.getPublicNo());
+        }
+
+        if (starPatentVO.getPublicAccreditNo() != null && !starPatentVO.getPublicAccreditNo().equals("")) {
+            patent.setGrantNo(starPatentVO.getPublicAccreditNo());
+        }
+
+        //装载申请人
+        if (starPatentVO.getApplicantStr() != null && !starPatentVO.getApplicantStr().equals("")) {
+            List<String> names = Arrays.asList(starPatentVO.getApplicantStr().split(";"));
+            List<PatentPerson> patentPeople = new ArrayList<>();
+            for (int i = 0; i < names.size(); i++) {
+                PatentPerson patentPerson = new PatentPerson();
+                patentPerson.setOrder(i + 1);
+                patentPerson.setType("1");
+                patentPerson.setName(names.get(i));
+                patentPeople.add(patentPerson);
+            }
+            patent.setApplicant(patentPeople);
+        }
+
+        //装载代理人
+        if (starPatentVO.getAgentStr() != null && !starPatentVO.getAgentStr().equals("")) {
+            List<String> patentAgents = Arrays.asList(starPatentVO.getAgentStr().split(";"));
+            if (patentAgents != null && patentAgents.size() != 0) {
+                patent.setAgent(patentAgents);
+            }
+        }
+
+        if (starPatentVO.getAgencyStr() != null && !starPatentVO.getAgencyStr().equals("")) {
+            patent.setAgency(starPatentVO.getAgencyStr());
+
+        }
+        //装载公开日
+        if (starPatentVO.getPublicDate() != null && !starPatentVO.getPublicDate().equals("")) {
+            Date date = DateUtils.strToDate(starPatentVO.getPublicDate());
+            patent.setPublicDate(date);
+        }
+
+        //装载标题
+        if (starPatentVO.getName() != null && !starPatentVO.getName().equals("")) {
+            Text text = new Text();
+            text.setLanguage(country);
+            text.setIfOrigin(true);
+            text.setTextContent(starPatentVO.getName());
+            patent.setTitle(Arrays.asList(text));
+        }
+
+        //装载权利人
+        if (starPatentVO.getCurrentApplicantStr() != null && !starPatentVO.getCurrentApplicantStr().equals("")) {
+            List<String> names = Arrays.asList(starPatentVO.getCurrentApplicantStr().split(";"));
+            List<PatentPerson> patentPeople = new ArrayList<>();
+            for (int i = 0; i < names.size(); i++) {
+                PatentPerson patentPerson = new PatentPerson();
+                patentPerson.setOrder(0);
+                patentPerson.setType("1");
+                patentPerson.setName(names.get(i));
+                patentPeople.add(patentPerson);
+            }
+            patent.setRightHolder(patentPeople);
+        } else if (patent.getApplicant() != null) {
+            patent.setRightHolder(patent.getApplicant());
+        }
+
+        //装载法律状态(os_patent表status字段值)
+        Integer status = starPatentVO.getLG();
+        if (status != null) {
+            //有效(有权)
+            if (status == 1) {
+                patent.setSimpleStatus("3");
+                //失效(无权)
+            } else if (status == 2) {
+                patent.setSimpleStatus("2");
+                //审中(审中)
+            } else if (status == 3) {
+                patent.setSimpleStatus("1");
+            }
+        }
+
+        //装载优先权
+        if (starPatentVO.getPriorityNo() != null && !starPatentVO.getPriorityNo().equals("")) {
+            Priorities priorities = new Priorities();
+            priorities.setPriorityNo(starPatentVO.getPriorityNo());
+            String pCountry = starPatentVO.getApplicationNo().substring(0, 2);
+            priorities.setPriorityCountry(pCountry);
+            //装载优先权日
+            if (starPatentVO.getPriorityDate() != null && !starPatentVO.getPriorityDate().equals("")) {
+                DateUtils.str2Date(starPatentVO.getPriorityDate());
+            }
+            patent.setPriorities(Arrays.asList(priorities));
+        }
+
+        //装载受理局
+        if (starPatentVO.getBureau() != null && !starPatentVO.getBureau().equals("")) {
+            patent.setAppCountry(starPatentVO.getBureau().substring(0, starPatentVO.getBureau().indexOf("(")));
+        }
+    }
+
+    //装载中国专利
+    private void loadCNPatent(String chinaPatentZhuLuStr, Patent patent, StarPatentVO starPatentVO) {
+        patent.setPatentNo(patent.getAppNo());
+        if (chinaPatentZhuLuStr != null && !chinaPatentZhuLuStr.trim().equals("") && !chinaPatentZhuLuStr.equals("{}") && !chinaPatentZhuLuStr.contains("请求不合法")) {
+            List<ChinaPatentZhuLu> chinaPatentZhuLus = JSON.parseArray(chinaPatentZhuLuStr, ChinaPatentZhuLu.class);
+            ChinaPatentZhuLu chinaPatentZhuLu = chinaPatentZhuLus.get(0);
+            //装载申请人地址
+            if (patent.getApplicantAddr() == null) {
+                if (chinaPatentZhuLu.getDZ() != null && !chinaPatentZhuLu.getDZ().equals("")) {
+                    PersonAddress personAddress = AddressSplitter.splitAddress(chinaPatentZhuLu.getDZ(), starPatentVO.getProvinceStr());
+                    patent.setApplicantAddr(personAddress);
+                    patent.setApplicantAddr(personAddress);
+                }
+            }
+            //装载代理人
+            if (patent.getAgent() == null || patent.getAgent().size() == 0) {
+                if (chinaPatentZhuLu.getAT() != null && !chinaPatentZhuLu.getAT().equals("")) {
+                    List<String> patentAgents = Arrays.asList(chinaPatentZhuLu.getAT().split(";"));
+                    if (patentAgents != null && patentAgents.size() != 0) {
+                        patent.setAgent(patentAgents);
+                    }
+                }
+            }
+
+            //装载发明人
+            if (patent.getInventor() == null || patent.getInventor().size() == 0) {
+
+                if (chinaPatentZhuLu.getIV() != null && !chinaPatentZhuLu.getIV().equals("")) {
+                    List<String> patentInventorNames = Arrays.asList(chinaPatentZhuLu.getIV().split(";"));
+                    List<PatentPerson> patentPeople = new ArrayList<>();
+                    for (int i = 0; i < patentInventorNames.size(); i++) {
+                        PatentPerson patentPerson = new PatentPerson();
+                        patentPerson.setOrder(0);
+                        patentPerson.setType("1");
+                        patentPerson.setName(patentInventorNames.get(i));
+                        patentPeople.add(patentPerson);
+                    }
+                    patent.setInventor(patentPeople);
+                }
+            }
+            //装载优先权号、优先权国家、优先权日
+            if (patent.getPriorities() == null && chinaPatentZhuLu.getPR() != null && chinaPatentZhuLu.getPR() != "") {
+                Priorities priorities = new Priorities();
+                priorities.setPriorityNo(chinaPatentZhuLu.getPR());
+                String pCountry = chinaPatentZhuLu.getPR().substring(0, 2);
+                priorities.setPriorityCountry(pCountry);
+                patent.setPriorities(Arrays.asList(priorities));
+            }
+
+        }
+    }
+
+    // 装载世界专利
+    private void loadWorldPatent(String worldPatentZhuLuStr, Patent patent) {
+        String country = "";
+        List<WorldPatentZhuLu> worldPatentZhuLus = JSON.parseArray(worldPatentZhuLuStr, WorldPatentZhuLu.class);
+        WorldPatentZhuLu worldPatentZhuLu = worldPatentZhuLus.get(0);
+
+        //装载公开号
+        if (patent.getPublicNo() == null || patent.getPublicNo().equals("")) {
+            patent.setPublicNo(worldPatentZhuLu.getDocdbPubNo());
+        }
+        //装载申请号
+        if (patent.getAppNo() == null || patent.getAppNo().equals("")) {
+            patent.setAppNo(worldPatentZhuLu.getEpoAppNo());
+        }
+        //装载申请日
+        if (patent.getAppDate() == null) {
+            Date date = DateUtils.strToDate(worldPatentZhuLu.getAppDate());
+            patent.setAppDate(date);
+        }
+        //装载公开日
+        if (patent.getPublicDate() == null) {
+            Date date = DateUtils.strToDate(worldPatentZhuLu.getPubDate());
+            patent.setPublicDate(date);
+        }
+        //装载IPC分类号
+        if (patent.getIpc() == null || patent.getIpc().size() == 0) {
+            List<PatentClassify> patentClassifies = new ArrayList<>();
+            List<String> ipcArr = Arrays.asList(worldPatentZhuLu.getIpc().split(";"));
+            for (int i = 0; i < ipcArr.size(); i++) {
+                PatentClassify patentClassify = PatentClassifySplitter.split(ipcArr.get(i));
+                patentClassifies.add(patentClassify);
+                if (i == 0) {
+                    patent.setMipc(patentClassify);
+                }
+            }
+            patent.setIpc(patentClassifies);
+        }
+
+        //装载CPC分类号
+        if (patent.getCpc() == null || patent.getCpc().size() == 0) {
+            if (worldPatentZhuLu.getCpc() != null && !worldPatentZhuLu.getCpc().equals("")) {
+                List<PatentClassify> patentClassifies = new ArrayList<>();
+                List<String> cpcArr = Arrays.asList(worldPatentZhuLu.getCpc().split(";"));
+                for (int i = 0; i < cpcArr.size(); i++) {
+                    PatentClassify patentClassify = PatentClassifySplitter.split(cpcArr.get(i));
+                    patentClassifies.add(patentClassify);
+                    if (i == 0) {
+                        patent.setMipc(patentClassify);
+                    }
+                }
+                patent.setCpc(patentClassifies);
+            }
+        }
+
+        //装载申请人
+        if (patent.getApplicant() == null || patent.getApplicant().size() == 0) {
+            List<String> names = Arrays.asList(worldPatentZhuLu.getPa().split(";"));
+            List<PatentPerson> patentPeople = new ArrayList<>();
+            for (int i = 0; i < names.size(); i++) {
+                PatentPerson patentPerson = new PatentPerson();
+                patentPerson.setOrder(0);
+                patentPerson.setType("1");
+                patentPerson.setName(names.get(i));
+                patentPeople.add(patentPerson);
+            }
+            patent.setApplicant(patentPeople);
+            if (patent.getRightHolder() == null || patent.getRightHolder().size() == 0) {
+                patent.setRightHolder(patent.getApplicant());
+            }
+        }
+
+
+        //装载发明人
+        if (patent.getInventor() == null || patent.getInventor().size() == 0) {
+            if (worldPatentZhuLu.getIv() != null && !worldPatentZhuLu.getIv().equals("")) {
+                List<String> patentInventorNames = Arrays.asList(worldPatentZhuLu.getIv().split(";"));
+                List<PatentPerson> patentPeople = new ArrayList<>();
+                for (int i = 0; i < patentInventorNames.size(); i++) {
+                    PatentPerson patentPerson = new PatentPerson();
+                    patentPerson.setOrder(0);
+                    patentPerson.setType("1");
+                    patentPerson.setName(patentInventorNames.get(i));
+                    patentPeople.add(patentPerson);
+                }
+                patent.setInventor(patentPeople);
+            }
+        }
+
+        //装载优先权号、优先权国家、优先权日
+        if (patent.getPriorities() == null && worldPatentZhuLu.getPr() != null && worldPatentZhuLu.getPr() != "") {
+            Priorities priorities = new Priorities();
+            priorities.setPriorityNo(worldPatentZhuLu.getPr());
+            String pCountry = worldPatentZhuLu.getPr().substring(0, 2);
+            priorities.setPriorityCountry(pCountry);
+            patent.setPriorities(Arrays.asList(priorities));
+        }
+
+        //装载标题
+        if (patent.getTitle() == null || patent.getTitle().size() != 0) {
+            Text text = new Text();
+            text.setLanguage(country);
+            text.setIfOrigin(true);
+            text.setTextContent(worldPatentZhuLu.getTitle());
+            patent.setTitle(Arrays.asList(text));
+        }
+        //装载摘要
+        if (patent.getAbstractStr() == null || patent.getAbstractStr().equals("")) {
+            Text text = new Text();
+            text.setLanguage(patent.getAppCountry());
+            text.setIfOrigin(true);
+            text.setTextContent(worldPatentZhuLu.getAbstract());
+            patent.setAbstractStr(Arrays.asList(text));
+        }
+
+
+    }
+
+    public List<String> reQuotedNos(String str) {
+        List<String> strings = Arrays.asList(str.split(";"));
+        List<String> nos = new ArrayList<>();
+        strings.forEach(item -> {
+            List<String> string2 = Arrays.asList(item.split(","));
+            if (string2.size() > 0) {
+                nos.add(string2.get(0).replace(" ", ""));
+            }
+
+        });
+        return nos;
+
+    }
+
+
+}

+ 46 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetPatentPictureFromWebService.java

@@ -0,0 +1,46 @@
+package com.example.xiaoshiweixinback.service.importPatent;
+
+import com.example.xiaoshiweixinback.business.utils.FileUtils;
+import com.example.xiaoshiweixinback.business.utils.FormatUtil;
+import com.example.xiaoshiweixinback.domain.es.Patent;
+import com.example.xiaoshiweixinback.domain.es.PatentVector;
+import com.example.xiaoshiweixinback.entity.dto.patent.UploadPatentWebDTO;
+import com.example.xiaoshiweixinback.service.common.FileManagerService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+
+
+@Service
+public class GetPatentPictureFromWebService  {
+@Autowired
+private PatentStarApiService patentStarApiService;
+@Autowired
+private FileManagerService fileManagerService;
+@Autowired
+private EsService esService;
+    public void getPatentPicture(UploadPatentWebDTO uploadPatentWebDTO) {
+            try {
+
+                String pictureUrl = patentStarApiService.getPictureApi(uploadPatentWebDTO.getStarPatentVO().getRowApplicationNo());
+                Patent patent =uploadPatentWebDTO.getPatent();
+                if (pictureUrl != null && !pictureUrl.contains("408")) {
+                    File file = FileUtils.getPictureFileByUrl(pictureUrl);
+                    String guid = FormatUtil.getPictureFormat(uploadPatentWebDTO.getStarPatentVO().getApplicationNo());
+                    fileManagerService.uploadFileWithGuid(file, guid);
+                    PatentVector patentVector =new PatentVector();
+                    patentVector.setAppNo(patent.getAppNo());
+                    patentVector.setTitle(patent.getTitle());
+                    patentVector.setRightHolder(patent.getRightHolder());
+                    esService.addPatentVector(patentVector);
+                }
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+    }
+
+
+
+}

+ 152 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/ImportFromWebToEsService.java

@@ -0,0 +1,152 @@
+package com.example.xiaoshiweixinback.service.importPatent;
+
+
+import com.alibaba.fastjson.JSONArray;
+
+import com.example.xiaoshiweixinback.business.utils.DateUtils;
+import com.example.xiaoshiweixinback.domain.es.Patent;
+import com.example.xiaoshiweixinback.entity.dto.patent.*;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+@Scope("prototype")
+@Service
+public class ImportFromWebToEsService {
+    @Autowired
+    private PatentStarApiService patentStarApiService;
+    @Autowired
+    private GetCataloguingFromWebService getCataloguingFromWebService;
+
+    @Autowired
+    private SavePatentToEsService savePatentToEsService;
+
+    public Boolean ImportTask(ImportTaskAMVO importTaskAMVO) {
+
+        return excuteLessThan10000(importTaskAMVO);
+    }
+
+
+    private Boolean excuteLessThan10000(ImportTaskAMVO importTaskAMVO) {
+        Boolean ifHaveGet = false;
+        try {
+            String orderBy = importTaskAMVO.getOrderBy();  //排序字段
+            String orderByType = importTaskAMVO.getOrderByType();  //排序类型
+            String dbType = importTaskAMVO.getDbType();  //检索数据库类型
+            Integer taskStartNum = 0;
+            int patentNum = 10000;
+
+            //检索式
+            String conditions = importTaskAMVO.getSearchCondition();
+
+            List<PatentStarListDTO> patentStarListDtos = new ArrayList<>();
+
+            //获得返回的的多个检索式 patentStarListDtos
+
+            patentStarListDtos = patentStarApiService.getSplitedConditions(new PatentStarListDTO()
+                    .setCurrentQuery(conditions)
+                    .setOrderBy(orderBy)
+                    .setOrderByType(orderByType)
+                    .setDBType(dbType), patentNum);
+
+
+            //下载字段
+            int index = taskStartNum;
+
+            //已经跳过的数量
+            Integer overNum = 0;
+
+            Integer lastOverNum = overNum;
+
+            //检索式检索
+            while (patentStarListDtos.size() > 0) {
+                PatentStarListDTO patentStarListDto = patentStarListDtos.remove(0);
+                Integer total = patentStarListDto.getTotal();
+                lastOverNum = overNum;
+                overNum += total;
+
+                if (overNum < taskStartNum) {
+                    continue;
+                }
+
+                Integer startNum = 0;
+                if (taskStartNum > lastOverNum) {
+                    startNum = taskStartNum - lastOverNum;
+                }
+
+                List<String> nos = patentStarListDto.getNos();
+                if (nos != null) {
+                    nos = nos.subList(startNum, nos.size());
+                }
+
+                Calculate calculate = DateUtils.calculateFromStartAndEndNumber(startNum, total, 50);
+                Integer startPage = calculate.getStartPage();
+                Integer endPage = calculate.getEndPage();
+
+                for (int i = startPage; i < endPage; i++) {
+                    PatentStarListDTO patentStarListDTOTemp = new PatentStarListDTO();
+                    BeanUtils.copyProperties(patentStarListDto, patentStarListDTOTemp);
+                    patentStarListDTOTemp.setPageNum(i + 1);
+                    patentStarListDTOTemp.setRowCount(50);
+                    //调用一般接口返回一批专利著录相关数据
+
+                    Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDTOTemp);
+
+                    if (resultMap == null || (Integer) resultMap.get("total") == 0) {
+                        continue;
+                    }
+                    List<StarPatentVO> starPatents = (List<StarPatentVO>) resultMap.get("records");
+
+
+                    Integer pageStartNum = (i * 50) >= startNum ? 0 : startNum - (i * 50);
+                    Integer pageEndNum = starPatents.size();
+                    //遍历这一页的专利
+                    for (int j = pageStartNum; j < pageEndNum; j++) {
+                        StarPatentVO starPatentVO = starPatents.get(j);
+
+                        if (nos != null) {
+                            nos.removeIf(item -> item.equals(starPatentVO.getApplicationNo())
+                                    || item.equals(starPatentVO.getPublicNo())
+                                    || item.equals(starPatentVO.getPublicAccreditNo())
+                                    || item.equals(starPatentVO.getRowApplicationNo()));
+                        }
+                        UploadPatentWebDTO uploadPatentWebDTO = new UploadPatentWebDTO();
+                        Patent patent = new Patent();
+                        //装载start
+                        uploadPatentWebDTO.setStarPatentVO(starPatentVO);
+                        uploadPatentWebDTO.setPatent(patent);
+                        uploadPatentWebDTO.setCounter(0);
+                        uploadPatentWebDTO.setIndex(index);
+                        uploadPatentWebDTO.setHaveSaveCounter(0);
+                        getCataloguingFromWebService.loadPatentMessage(uploadPatentWebDTO);
+                         savePatentToEsService.saveOrUpdate(uploadPatentWebDTO);
+                        ifHaveGet = true;
+                        index += 1;
+                    }
+
+                }
+
+            }
+
+            return ifHaveGet;
+        } catch (Exception e) {
+            e.printStackTrace();
+            //生产消费到一半时,发生错误异常,将任务状态置为完成
+            return ifHaveGet;
+        }
+    }
+
+
+    private void loadPatent(StarPatentVO starPatentVO, Patent patent) {
+
+
+    }
+}

+ 742 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/PatentStarApiService.java

@@ -0,0 +1,742 @@
+package com.example.xiaoshiweixinback.service.importPatent;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.example.xiaoshiweixinback.business.config.XDns;
+import com.example.xiaoshiweixinback.business.utils.DateUtils2;
+import com.example.xiaoshiweixinback.business.utils.FormatUtil;
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+import com.example.xiaoshiweixinback.entity.dto.patent.PatentStarDTO;
+import com.example.xiaoshiweixinback.entity.dto.patent.PatentStarListDTO;
+import com.example.xiaoshiweixinback.entity.dto.patent.StarPatentVO;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.FormBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.XPath;
+import org.dom4j.io.SAXReader;
+import org.joda.time.DateTime;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * 调用外部接口的Service类 PCS:权限系统
+ *
+ * @Author chenyu
+ * @Date 2023/4/25
+ */
+@RequiredArgsConstructor
+@Slf4j
+@Service
+
+public class PatentStarApiService {
+    private ApplicationContext applicationContext;
+    @Autowired
+    private FormatQueryService formatQueryService;
+
+
+
+    public Map<String, Object> patentStarSearchApi(PatentStarListDTO PatentStarListDTO) throws IOException {
+        try {
+            if (PatentStarListDTO.getFormed() == null || PatentStarListDTO.getFormed() == false) {
+                String formQuery = PatentStarListDTO.getCurrentQuery();
+                PatentStarListDTO.setCurrentQuery(formatQueryService.reQuery(formQuery, "webSearchConfig"));
+                if (PatentStarListDTO.getDBType().equals("WD")) {
+                    StringBuilder stringBuilder = new StringBuilder(PatentStarListDTO.getCurrentQuery());
+                    stringBuilder.insert(PatentStarListDTO.getCurrentQuery().length() - 1, "-CN/GJ");
+                    PatentStarListDTO.setCurrentQuery(stringBuilder.toString());
+
+                }
+                PatentStarListDTO.setFormed(true);
+            }
+        } catch (Exception e) {
+            return null;
+        }
+        JSONObject configObject = this.getConfigObject(4, 1);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+        PatentStarDTO patentStarDto = new PatentStarDTO();
+        BeanUtils.copyProperties(PatentStarListDTO, patentStarDto);
+        String json = JSONObject.toJSONString(patentStarDto);
+        String url = "http://s.patentstar.com.cn/SearchAPI/PatentSearch/ResultGet";
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个RequestBody(参数1:数据类型 参数2传递的json串)
+        FormBody.Builder builder = new FormBody.Builder();
+        builder.add("AppID", appId);
+        builder.add("Stamp", currentTimeMillis.toString());
+        builder.add("Sign", signMd5);
+        builder.add("QueryJson", json);
+        FormBody requestBody = builder.build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url).post(requestBody).build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful()) {
+                JSONObject jsonObject = JSONObject.parseObject(Objects.requireNonNull(response.body()).string());
+                if (jsonObject.get("Ret").equals(500) || jsonObject.get("Data") == null) {
+                    return null;
+                }
+                JSONObject Data = (JSONObject) jsonObject.get("Data");
+                List<StarPatentVO> starPatentVOS = JSONArray.parseArray(Data.get("List").toString(), StarPatentVO.class);
+                Map<String, Object> reMap = new HashMap<>();
+                reMap.put("size", PatentStarListDTO.getRowCount());
+                reMap.put("current", PatentStarListDTO.getPageNum());
+                reMap.put("records", starPatentVOS);
+                reMap.put("total", Data.get("HitCount"));
+                return reMap;
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+        return null;
+    }
+
+    public List<PatentStarListDTO> getSplitedConditions(PatentStarListDTO patentStarListDTO, int patentNum) throws IOException {
+        DateTime nowDate = new DateTime();
+        DateTime date = DateUtils2.formStrToDateTime("1900-01-01");
+        //超过1万的列表
+        List<PatentStarListDTO> PatentStarListDTOs = new ArrayList<>();
+        //返回的列表
+        List<PatentStarListDTO> reDtos = new ArrayList<>();
+        patentStarListDTO.setStartTime(date);
+        patentStarListDTO.setEndTime(nowDate);
+        patentStarListDTO.setOrginCondition(patentStarListDTO.getCurrentQuery());
+        String formQuery = patentStarListDTO.getCurrentQuery();
+//        patentStarListDTO.setOrginCondition(PatentStarApiService.formatQuery(formQuery));
+        PatentStarListDTOs.add(patentStarListDTO);
+        while (PatentStarListDTOs.size() > 0) {
+            PatentStarListDTO dto = PatentStarListDTOs.get(0);
+            PatentStarListDTOs.remove(dto);
+            Map<String, Object> map1 = this.patentStarSearchApi(dto);
+            Integer total1 = Integer.parseInt(map1.get("total").toString());
+            dto.setTotal(total1);
+            patentStarListDTO.setFormed(true);
+            if (total1 > patentNum) {
+                DateTime startTime1 = dto.getStartTime();
+                DateTime endTime1 = dto.getEndTime();
+                List<DateTime> dateTimes = DateUtils2.formStrToDateTime(startTime1, endTime1);
+                PatentStarListDTO dto1 = new PatentStarListDTO();
+                BeanUtils.copyProperties(dto, dto1);
+                dto1.setStartTime(dateTimes.get(0));
+                dto1.setEndTime(dateTimes.get(1));
+
+                this.setConditions(dto1);
+                PatentStarListDTO dto2 = new PatentStarListDTO();
+                BeanUtils.copyProperties(dto, dto2);
+                dto2.setStartTime(dateTimes.get(2));
+                dto2.setEndTime(dateTimes.get(3));
+                this.setConditions(dto2);
+                PatentStarListDTOs.add(dto1);
+                PatentStarListDTOs.add(dto2);
+            } else if (total1 != 0) {
+                reDtos.add(dto);
+            }
+
+        }
+
+        return reDtos;
+    }
+
+    public void setConditions(PatentStarListDTO PatentStarListDTO) {
+        PatentStarListDTO.setFormed(false);
+        DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyyMMdd");
+        String startStr = formatter.print(PatentStarListDTO.getStartTime());
+        String endStr = formatter.print(PatentStarListDTO.getEndTime());
+        String cond = " AND AD=" + startStr + "~" + endStr;
+        Integer len = PatentStarListDTO.getOrginCondition().length();
+        StringBuilder stringBuilder = new StringBuilder(PatentStarListDTO.getOrginCondition());
+        stringBuilder.insert(len - 1, cond);
+        PatentStarListDTO.setCurrentQuery(stringBuilder.toString());
+    }
+
+    /**
+     * @param appNo
+     * @return
+     * @throws IOException
+     * @author 李仁杰
+     * 从专利之星获取中国专利著录
+     */
+    public String getCnBibApi(String appNo) {
+        String url = "https://api.patentstar.com.cn/api/Patent/CnBibo/" + appNo;
+        JSONObject configObject = this.getConfigObject(4, 2);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appId + appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url)
+                .addHeader("_appid", appId)
+                .addHeader("_timestamp", currentTimeMillis.toString())
+                .addHeader("_sign", signMd5)
+                .get().build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful()) {
+                // 打印服务端返回结果
+                return Objects.requireNonNull(response.body()).string();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return "{}";
+
+    }
+
+
+    /**
+     * @param
+     * @return
+     * @throws IOException
+     * @author 李仁杰
+     * 从专利之星获取中国专利摘要附图
+     */
+    public String getPictureApi(String appNo) {
+        String url = "https://api.patentstar.com.cn/api/Patent/CnMainImage/" + appNo;
+        JSONObject configObject = this.getConfigObject(4, 2);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appId + appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url)
+                .addHeader("_appid", appId)
+                .addHeader("_timestamp", currentTimeMillis.toString())
+                .addHeader("_sign", signMd5)
+                .get().build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful() && response.code() == 200) {
+                // 打印服务端返回结果
+                return Objects.requireNonNull(response.body()).string();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+        return "{}";
+    }
+
+    /**
+     * @param appNo
+     * @return
+     * @throws IOException
+     * @author 李仁杰
+     * 从专利之星获取中国专利外观图
+     */
+    public String getWGPictureApi(String appNo) throws IOException {
+
+        String url = "https://api.patentstar.com.cn/api/Patent/CnWGImage/" + appNo;
+        JSONObject configObject = this.getConfigObject(4, 2);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appId + appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url)
+                .addHeader("_appid", appId)
+                .addHeader("_timestamp", currentTimeMillis.toString())
+                .addHeader("_sign", signMd5)
+                .get().build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful()) {
+                // 打印服务端返回结果
+                return Objects.requireNonNull(response.body()).string();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return "{}";
+    }
+
+    /**
+     * @param appNo
+     * @return
+     * @throws IOException
+     * @author 李仁杰
+     * 从专利之星获取中国专利法律状态
+     */
+    public String getCnLegalApi(String appNo) {
+        String url = "https://api.patentstar.com.cn/api/Patent/CnLegal/" + appNo;
+        JSONObject configObject = this.getConfigObject(4, 2);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appId + appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url)
+                .addHeader("_appid", appId)
+                .addHeader("_timestamp", currentTimeMillis.toString())
+                .addHeader("_sign", signMd5)
+                .get().build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful()) {
+                // 打印服务端返回结果
+                return Objects.requireNonNull(response.body()).string();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return "{}";
+    }
+
+    /**
+     * @param appNo
+     * @return
+     * @throws IOException
+     * @author 李仁杰
+     * 从专利之星获取中国专利全文图片
+     */
+    public String getCnPdfApi(String appNo) throws IOException {
+        String url = "https://api.patentstar.com.cn/api/Patent/CnPdf/" + appNo;
+        JSONObject configObject = this.getConfigObject(4, 2);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appId + appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url)
+                .addHeader("_appid", appId)
+                .addHeader("_timestamp", currentTimeMillis.toString())
+                .addHeader("_sign", signMd5)
+                .get().build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful()) {
+                // 打印服务端返回结果
+                return Objects.requireNonNull(response.body()).string();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return "{}";
+    }
+
+    /**
+     * @param appNo
+     * @return
+     * @throws IOException
+     * @author 李仁杰
+     * 从专利之星获取中国专利全文文本
+     */
+
+    public String getCnFullXmlApi(String appNo) throws IOException {
+        String url = "https://api.patentstar.com.cn/api/Patent/CnFullXml/" + appNo;
+        JSONObject configObject = this.getConfigObject(4, 2);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appId + appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url)
+                .addHeader("_appid", appId)
+                .addHeader("_timestamp", currentTimeMillis.toString())
+                .addHeader("_sign", signMd5)
+                .get().build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful()) {
+                // 打印服务端返回结果
+                return Objects.requireNonNull(response.body()).string();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return "{}";
+    }
+
+
+
+
+    /**
+     * @param patentNo
+     * @return
+     * @throws IOException
+     * @author 李仁杰
+     * 从专利之星获取世界专利pdf
+     */
+    public String getEnPdfApi(String patentNo) {
+        String url = "  https://api.patentstar.com.cn/api/Patent/EnPdf/" + patentNo;
+        JSONObject configObject = this.getConfigObject(4, 2);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+//        String appId = "1000046";
+//        String appkey = "6AE6D4DC6AF94F26862501EDEE9E27A2";
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appId + appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url)
+                .addHeader("_appid", appId)
+                .addHeader("_timestamp", currentTimeMillis.toString())
+                .addHeader("_sign", signMd5)
+                .get().build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful()) {
+                // 打印服务端返回结果
+                return Objects.requireNonNull(response.body()).string();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return "{}";
+    }
+
+    /**
+     * @param patentNo
+     * @return
+     * @throws IOException
+     * @author 李仁杰
+     * 从专利之星获取世界专利著录信息
+     */
+    public String getENBibApi(String patentNo) {
+        String url = "https://api.patentstar.com.cn/api/Patent/EnBib/" + patentNo;
+        JSONObject configObject = this.getConfigObject(4, 2);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appId + appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url)
+                .addHeader("_appid", appId)
+                .addHeader("_timestamp", currentTimeMillis.toString())
+                .addHeader("_sign", signMd5)
+                .get().build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful()) {
+                // 打印服务端返回结果
+                return Objects.requireNonNull(response.body()).string();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return "{}";
+    }
+
+    /**
+     * @param patentNo
+     * @return
+     * @throws IOException
+     * @author 李仁杰
+     * 从专利之星获取同族专利
+     */
+    public String getFamilyByPubNoApi(String patentNo) {
+        String url = "https://api.patentstar.com.cn/api/Patent/FamilyByPubNo/" + patentNo;
+        JSONObject configObject = this.getConfigObject(4, 2);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appId + appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url)
+                .addHeader("_appid", appId)
+                .addHeader("_timestamp", currentTimeMillis.toString())
+                .addHeader("_sign", signMd5)
+                .get().build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful()) {
+                // 打印服务端返回结果
+                return Objects.requireNonNull(response.body()).string();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return "{}";
+    }
+
+    /**
+     * @param patentNo
+     * @return
+     * @throws IOException
+     * @author 李仁杰
+     * 获得专利被引用次数api
+     */
+    public String getCitedNumByPubNoApi(String patentNo) throws IOException {
+        String url = "https://api.patentstar.com.cn/api/Patent/CitedNumByPubNo/" + patentNo;
+        JSONObject configObject = this.getConfigObject(4, 2);
+        String appId = configObject.getString("appId");
+        String appKey = configObject.getString("appKey");
+        Long currentTimeMillis = System.currentTimeMillis() / 1000;
+        String Sign = appId + appKey + currentTimeMillis.toString();
+        String signMd5 = FormatUtil.MD5(Sign);
+        // 创建一个OkHttpClient对象
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .dns(new XDns(100000))
+                .build();
+        // 创建一个请求对象
+        Request request = new Request.Builder().url(url)
+                .addHeader("_appid", appId)
+                .addHeader("_timestamp", currentTimeMillis.toString())
+                .addHeader("_sign", signMd5)
+                .get().build();
+        // 发送请求获取响应
+        try {
+            Response response = okHttpClient.newCall(request).execute();
+            // 判断请求是否成功
+            if (response.isSuccessful()) {
+                // 打印服务端返回结果
+                return Objects.requireNonNull(response.body()).string();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return "{}";
+    }
+
+
+    public JSONObject getConfigObject(Integer webId, Integer webGroup) {
+
+        String config ="";
+        if(webId==4&&webGroup==1){
+            config="{\"appId\":\"K8FFB741E163BE6536\",\"appKey\":\"FNYJD7902206FFB741E163BE6536C3689D55\"}";
+        }
+         else {
+             config="{\"appId\":\"1000046\",\"appKey\":\"6AE6D4DC6AF94F26862501EDEE9E27A2\"}";
+        }
+        JSONObject jsonObject = JSONObject.parseObject(config);
+        return jsonObject;
+    }
+
+    public List<PatentStarListDTO> splitPatentNoByType(List<String> originalList, PatentStarListDTO patentStarListDTO) {
+        List<String> cnStrings = new ArrayList<>();
+        List<String> wdStrings = new ArrayList<>();
+        List<List<String>> result = new ArrayList<>();
+        result.add(cnStrings);
+        result.add(wdStrings);
+        // 记录CN类型的字符串数量
+        int cnCount = 0;
+        // 记录WD类型的字符串数量
+        int wdCount = 0;
+
+        List<PatentStarListDTO> patentStarListDTOS = new ArrayList<>();
+        //遍历初始集合
+        for (String str : originalList) {
+            if (str.startsWith("CN")) {
+                cnStrings.add(str);
+                cnCount++;
+                if (cnCount >= 100) {
+                    cnStrings = new ArrayList<>();
+                    result.add(cnStrings);
+                    cnCount = 0;
+                }
+            } else {
+                wdStrings.add(str);
+                wdCount++;
+                if (wdCount >= 100) {
+                    wdStrings = new ArrayList<>();
+                    result.add(wdStrings);
+                    wdCount = 0;
+                }
+            }
+        }
+
+        result.forEach(item -> {
+            if (item.size() > 0) {
+                String dbType = "CN";
+                String patentNo = item.get(0);
+                if (!patentNo.startsWith("CN")) {
+                    dbType = "WD";
+                }
+                String join = StringUtils.join(item, " OR ");
+                String conditions = "AN=(" + join + ") OR PN=(" + join + ") OR GN=(" + join + ")";
+                PatentStarListDTO patentStarListDTO1 = new PatentStarListDTO();
+                patentStarListDTO1.setOrderByType(patentStarListDTO.getOrderByType());
+                patentStarListDTO1.setCurrentQuery(conditions);
+                patentStarListDTO1.setPageNum(patentStarListDTO.getPageNum());
+                patentStarListDTO1.setDBType(dbType);
+                patentStarListDTO1.setCurrentQuery(conditions);
+                patentStarListDTO1.setRowCount(50);
+                patentStarListDTO1.setTotal(item.size());
+                patentStarListDTO1.setNos(item);
+                patentStarListDTOS.add(patentStarListDTO1);
+            }
+        });
+
+        return patentStarListDTOS;
+    }
+
+    public StarPatentVO getPatentByNo(String patentNo) {
+        StarPatentVO starPatentVO = null;
+        String condition = "AN=(" + patentNo + ") OR PN=(" + patentNo + ") OR GN=(" + patentNo + ") OR ANO=(" + patentNo + ")";
+        String dbType = "CN";
+        if (!patentNo.startsWith("CN")) {
+            dbType = "WD";
+        }
+        PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
+        patentStarListDTO.setCurrentQuery(condition);
+        patentStarListDTO.setPageNum(1);
+        patentStarListDTO.setRowCount(50);
+        patentStarListDTO.setDBType(dbType);
+        try {
+            Map<String, Object> resultMap = this.patentStarSearchApi(patentStarListDTO);
+            if (resultMap == null || (Integer) resultMap.get("total") == 0) {
+                return starPatentVO;
+            }
+            List<StarPatentVO> starPatents = (List<StarPatentVO>) resultMap.get("records");
+            starPatentVO = starPatents.get(0);
+
+        } catch (Exception e) {
+        }
+        return starPatentVO;
+    }
+
+
+
+    /**
+     * 获取附图
+     *
+     * @param appNo
+     * @return
+     */
+    public List<String> getExternalFigure(String appNo) throws IOException {
+        List<String> list = new ArrayList<>();
+        String wgPictureApi = this.getWGPictureApi(appNo);
+        if (StringUtils.isNotEmpty(wgPictureApi)) {
+            if (wgPictureApi.contains("|http")) {
+                String[] urlArr = wgPictureApi.split("\\|");
+                list.addAll(Arrays.asList(urlArr));
+            } else {
+                list.add(wgPictureApi);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 获取摘要附图
+     *
+     * @param appNo
+     * @return
+     */
+    public String getPictureGuid(String appNo) {
+        return this.getPictureApi(appNo);
+    }
+
+}

+ 58 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/SavePatentToEsService.java

@@ -0,0 +1,58 @@
+package com.example.xiaoshiweixinback.service.importPatent;
+
+
+import com.example.xiaoshiweixinback.business.utils.FormatUtil;
+import com.example.xiaoshiweixinback.domain.es.Patent;
+import com.example.xiaoshiweixinback.domain.es.PatentJoin;
+import com.example.xiaoshiweixinback.entity.dto.patent.UploadPatentWebDTO;
+import com.example.xiaoshiweixinback.entity.vo.patent.PatentWithIdVO;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+@Service
+public class SavePatentToEsService {
+
+    @Autowired
+    private EsService esService;
+
+    public void saveOrUpdate(UploadPatentWebDTO uploadPatentWebDTO) {
+
+        Patent patent = uploadPatentWebDTO.getPatent();
+        try {
+            //根据专利号查询专利
+            PatentWithIdVO patentWithIdVO = esService.getIdByPatentNo(patent.getPatentNo());
+            String patentId = null;
+            // 若查出专利则更新
+            Patent orgPatent = null;
+
+            if (patentWithIdVO != null) {
+                patentId = patentWithIdVO.getId();
+                orgPatent = patentWithIdVO.getPatent();
+                BeanUtils.copyProperties(patent, orgPatent, FormatUtil.getNullPropertyNames(patent));
+                esService.updatePatent(orgPatent, patentWithIdVO.getId());
+            }
+            else {
+                PatentJoin patentJoin = new PatentJoin();
+                patentJoin.setName("patent");
+                patent.setPatentJoin(patentJoin);
+                patentId = esService.addPatent(patent);
+                orgPatent = patent;
+            }
+
+
+            //导入完成,通知前台
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        System.out.println("专利信息装载完毕");
+    }
+
+}

+ 19 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/getSqlFactorys/GetSqlFactory.java

@@ -0,0 +1,19 @@
+package com.example.xiaoshiweixinback.service.importPatent.getSqlFactorys;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Component
+public class GetSqlFactory {
+    @Autowired
+    private Map<String, GetSqlObject> getSqlObjectMap;
+
+
+    public GetSqlObject getClass(String sqlType) {
+        GetSqlObject bean1 = getSqlObjectMap.get(sqlType);
+        System.out.println(bean1);
+        return bean1;
+    }
+}

+ 11 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/getSqlFactorys/GetSqlObject.java

@@ -0,0 +1,11 @@
+package com.example.xiaoshiweixinback.service.importPatent.getSqlFactorys;
+
+
+import com.example.xiaoshiweixinback.entity.dto.common.SqlObject;
+
+public interface GetSqlObject {
+    public SqlObject sqlObject = null;
+    public String getSql(String value);
+    public void setSqlObject(SqlObject sqlObject);
+    public SqlObject getSqlObject();
+}

+ 33 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/getSqlFactorys/GetWebQuerySql.java

@@ -0,0 +1,33 @@
+package com.example.xiaoshiweixinback.service.importPatent.getSqlFactorys;
+
+
+import com.example.xiaoshiweixinback.entity.dto.common.SqlObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+
+@Slf4j
+@Component
+public class GetWebQuerySql implements GetSqlObject {
+
+    private SqlObject sqlObject;
+
+    @Override
+    public String getSql(String value) {
+        String filed = sqlObject.getSqlField();
+        String option = sqlObject.getOption();
+        String trueOption = "";
+        if (option.equals("=")) {
+            option = "/";
+        }
+        return value +option+ filed;
+    }
+
+    public void setSqlObject(SqlObject sqlObject) {
+        this.sqlObject = sqlObject;
+    }
+
+    public SqlObject getSqlObject() {
+        return sqlObject;
+    }
+}