Prechádzať zdrojové kódy

4/22 查询工单流程,查询工单详情

lwhhszx 1 rok pred
rodič
commit
11244dc3d2
38 zmenil súbory, kde vykonal 1524 pridanie a 97 odobranie
  1. 740 0
      src/main/java/cn/cslg/pas/common/utils/DateUtils.java
  2. 46 0
      src/main/java/cn/cslg/pas/common/utils/handler/DataProcessHandler.java
  3. 5 0
      src/main/java/cn/cslg/pas/common/utils/handler/IProcessData.java
  4. 23 0
      src/main/java/cn/cslg/pas/common/utils/handler/IncoPatInventorAddressHandler.java
  5. 59 0
      src/main/java/cn/cslg/pas/common/utils/handler/IncoPatPatentAffairHandler.java
  6. 17 0
      src/main/java/cn/cslg/pas/common/utils/handler/IncoPatUCMainHandler.java
  7. 15 0
      src/main/java/cn/cslg/pas/common/utils/handler/IntegerHandler.java
  8. 42 0
      src/main/java/cn/cslg/pas/common/utils/handler/PatSnapPatentAffairHandler.java
  9. 24 0
      src/main/java/cn/cslg/pas/common/utils/handler/PatentTypeHandler.java
  10. 23 0
      src/main/java/cn/cslg/pas/common/utils/handler/PatenticsAgencyAndAgentHandler.java
  11. 73 0
      src/main/java/cn/cslg/pas/common/utils/handler/PatenticsPatentAffairHandler.java
  12. 18 0
      src/main/java/cn/cslg/pas/common/utils/handler/PatenticsStringHandler.java
  13. 20 0
      src/main/java/cn/cslg/pas/common/utils/handler/SplitBySerialNumberAndRemoveLineFeedHandler.java
  14. 28 0
      src/main/java/cn/cslg/pas/common/utils/handler/SplitOriginalAndTranslationHandler.java
  15. 22 0
      src/main/java/cn/cslg/pas/common/utils/handler/StringHandler.java
  16. 22 0
      src/main/java/cn/cslg/pas/common/utils/handler/StringSpecialHandler.java
  17. 18 0
      src/main/java/cn/cslg/pas/common/utils/handler/TimeHandler.java
  18. 1 1
      src/main/java/com/example/xiaoshiweixinback/business/config/ElasticSearchClientConfig.java
  19. 8 6
      src/main/java/com/example/xiaoshiweixinback/business/utils/DateUtils.java
  20. 6 1
      src/main/java/com/example/xiaoshiweixinback/controller/ImportPatentController.java
  21. 8 2
      src/main/java/com/example/xiaoshiweixinback/controller/ProductController.java
  22. 1 0
      src/main/java/com/example/xiaoshiweixinback/domain/es/PatentVector.java
  23. 10 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/PatentVectorWithId.java
  24. 12 0
      src/main/java/com/example/xiaoshiweixinback/entity/dto/ticket/TicketQueryDTO.java
  25. 3 1
      src/main/java/com/example/xiaoshiweixinback/entity/vo/TicketVO.java
  26. 1 1
      src/main/java/com/example/xiaoshiweixinback/entity/vo/ticket/TicketDetailVO.java
  27. 36 16
      src/main/java/com/example/xiaoshiweixinback/service/AssoPersonProductService.java
  28. 14 9
      src/main/java/com/example/xiaoshiweixinback/service/ProductService.java
  29. 2 2
      src/main/java/com/example/xiaoshiweixinback/service/TicketFlowService.java
  30. 40 12
      src/main/java/com/example/xiaoshiweixinback/service/TicketService.java
  31. 3 4
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsDenseVectorService.java
  32. 72 2
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsService.java
  33. 40 22
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetPatentFromExcelService.java
  34. 21 1
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetPatentPictureFromExcelService.java
  35. 39 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/excel/GetPatentFromSzService.java
  36. 3 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/excel/UploadParamsVO.java
  37. 1 1
      src/main/java/com/example/xiaoshiweixinback/service/weixinpay/WeixinPayService.java
  38. 8 16
      src/main/resources/application-prodNetOut.yml

+ 740 - 0
src/main/java/cn/cslg/pas/common/utils/DateUtils.java

@@ -0,0 +1,740 @@
+package cn.cslg.pas.common.utils;
+
+
+import cn.hutool.core.date.DateUtil;
+import com.example.xiaoshiweixinback.entity.dto.patent.Calculate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.management.ManagementFactory;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+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 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);
+        } else if (date.contains(".")) {
+            dateTime =strToDateTime(date,parsePatterns[8]);
+        }
+        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;
+    }
+
+    /**
+     * 获取几天之后的日期
+     *
+     * @param date  yyyy-MM-dd HH:mm:ss
+     * @param
+     */
+    public static Date getPlusMonthDate(Date date, int month) {
+        Calendar cal = Calendar.getInstance();
+        try {
+            cal.setTime(date);
+            cal.add(Calendar.MONTH, month);
+            return cal.getTime();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+
+    public static void main(String[] args) {
+        System.out.println(12 % 50);
+    }
+}

+ 46 - 0
src/main/java/cn/cslg/pas/common/utils/handler/DataProcessHandler.java

@@ -0,0 +1,46 @@
+package cn.cslg.pas.common.utils.handler;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class DataProcessHandler {
+    public interface IProcessData {
+        Object processData(Object data, Object code);
+    }
+
+    public DataProcessHandler() {
+    }
+
+    public static Object getData(String typeName, String jarOrClassPath) {
+
+        if (jarOrClassPath != null) {
+            try {
+                //用路径创建Url
+                URL url = new URL("file:" + jarOrClassPath);
+                //通过Url加载外部的jar包
+                URLClassLoader urlClassLoader = new URLClassLoader(new URL[]{url});
+                Class<?> clazz = urlClassLoader.loadClass(typeName);
+                return clazz.newInstance();
+            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | MalformedURLException e) {
+                e.printStackTrace();
+            }
+        } else {
+            try {
+                return Class.forName(typeName).newInstance();
+            } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+    public static void main(String[] args) {
+        System.out.println("启动成功");
+    }
+
+}
+
+
+
+

+ 5 - 0
src/main/java/cn/cslg/pas/common/utils/handler/IProcessData.java

@@ -0,0 +1,5 @@
+package cn.cslg.pas.common.utils.handler;
+
+public interface IProcessData {
+    Object processData(Object data, Object code);
+}

+ 23 - 0
src/main/java/cn/cslg/pas/common/utils/handler/IncoPatInventorAddressHandler.java

@@ -0,0 +1,23 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+import java.util.List;
+
+public class IncoPatInventorAddressHandler implements IProcessData {
+    public IncoPatInventorAddressHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object code) {
+        List<String> splitStr = StringUtils.changeStringToString(data.toString().replaceAll(" ", ""), ";");
+        if (code.toString().equals("1")) {
+            return splitStr;
+        } else if (code.toString().equals("2")) {
+            return splitStr.get(0);
+        }
+        return null;
+    }
+}

+ 59 - 0
src/main/java/cn/cslg/pas/common/utils/handler/IncoPatPatentAffairHandler.java

@@ -0,0 +1,59 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class IncoPatPatentAffairHandler implements IProcessData {
+    public IncoPatPatentAffairHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object code) {
+        String processedData = data.toString().replaceAll("\r\n", "");
+        List<String> contentList = StringUtils.changeStringToString(processedData, "([\\u4e00-\\u9fa5]+):");
+        contentList.remove(0);
+
+        List<String> tableList = new ArrayList<>();
+        Pattern p = Pattern.compile("([\\u4e00-\\u9fa5]+):");
+        Matcher m = p.matcher(data.toString());
+        while (m.find()) {
+            tableList.add(m.group(1));
+        }
+
+        StringBuilder all = new StringBuilder();
+        StringBuilder one = new StringBuilder();
+        for (int i = 0; i < tableList.size(); i++) {
+            if (tableList.get(i).contains("法律状态公告日")) {
+                if (!one.toString().equals("")) {
+                    if (!all.toString().equals("")) {
+                        all.append(",{").append(one).append("]").append("}");
+                    } else {
+                        all = new StringBuilder("{" + one + "]}");
+                    }
+                }
+                one = new StringBuilder();
+            }
+
+            if (one.toString().equals("")) {
+                one = new StringBuilder("\"inpadocData\"" + ":[" + "{" + "\"name\"" + ":" + "\"" + tableList.get(i) + "\"" + ",\"" + "content\"" + ":" + "\"" + contentList.get(i).replaceAll(";", "") + "\"" + "}");
+            } else {
+                one.append(",").append("{" + "\"name\"" + ":").append("\"").append(tableList.get(i)).append("\"" + "," + "\"" + "content\"" + ":" + "\"").append(contentList.get(i).replaceAll(";", "")).append("\"" + "}");
+            }
+
+        }
+        if (!one.toString().equals("")) {
+            if (!all.toString().equals("")) {
+                all.append(",{").append(one).append("]").append("}");
+            } else {
+                all = new StringBuilder("{" + one + "]}");
+            }
+        }
+        all = new StringBuilder("[" + all + "]");
+        return all.toString();
+    }
+}

+ 17 - 0
src/main/java/cn/cslg/pas/common/utils/handler/IncoPatUCMainHandler.java

@@ -0,0 +1,17 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+import java.util.List;
+
+public class IncoPatUCMainHandler implements IProcessData {
+    public IncoPatUCMainHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object splitSymbol) {
+        List<String> splitList = StringUtils.changeStringToString(data.toString(), splitSymbol.toString());
+        return splitList.get(0);
+    }
+}

+ 15 - 0
src/main/java/cn/cslg/pas/common/utils/handler/IntegerHandler.java

@@ -0,0 +1,15 @@
+package cn.cslg.pas.common.utils.handler;
+
+/**
+ * @name 数字处理类
+ * @description 1.传入的字符型数字数据转换为int型
+ */
+public class IntegerHandler implements IProcessData {
+    public IntegerHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object splitSymbol) {
+        return Integer.parseInt(data.toString());
+    }
+}

+ 42 - 0
src/main/java/cn/cslg/pas/common/utils/handler/PatSnapPatentAffairHandler.java

@@ -0,0 +1,42 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+import java.util.List;
+
+public class PatSnapPatentAffairHandler implements IProcessData {
+    public PatSnapPatentAffairHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object code) {
+        List<String> splitStr = StringUtils.changeStringToString(data.toString(), "\\|");
+        if (splitStr.size() % 3 != 0) {
+            return null;
+        }
+        StringBuilder all = new StringBuilder();
+        StringBuilder one = new StringBuilder();
+        for (int i = 0; i < splitStr.size(); i += 3) {
+            if (one.toString().equals("")) {
+                one = new StringBuilder("\"inpadocData\"" + ":[" + "{" + "\"name\"" + ":" + "\"发生日期\"" + "," + "\"content\"" + ":" + "\"" + splitStr.get(i).trim() + "\"" + "}");
+            } else {
+                one.append("," + "{" + "\"name\"" + ":" + "\"发生日期\"" + "," + "\"content\"" + ":" + "\"").append(splitStr.get(i).trim()).append("\"").append("}");
+            }
+            one.append(",{").append("\"name\":\"国家\"").append(",").append("\"content\":").append("\"").append(splitStr.get(i + 2).trim()).append("\"").append("}");
+            one.append("," + "{" + "\"name\"" + ":" + "\"内容\"" + "," + "\"content\"" + ":" + "\"").append(splitStr.get(i + 1).trim()).append("\"").append("}]");
+
+            if (!one.toString().equals("")) {
+                if (!all.toString().equals("")) {
+                    all.append(",{").append(one).append("}");
+                } else {
+                    all = new StringBuilder("{" + one + "}");
+                }
+            }
+            one = new StringBuilder();
+        }
+
+        all = new StringBuilder("[" + all + "]");
+        return all.toString();
+    }
+}

+ 24 - 0
src/main/java/cn/cslg/pas/common/utils/handler/PatentTypeHandler.java

@@ -0,0 +1,24 @@
+package cn.cslg.pas.common.utils.handler;
+
+/**
+ * @name 专利类型处理类
+ * @description 1.将传入的专利类型转换成不同的ID 2.目前这个没有用字典项的原因是因为不同数据源的叫法不一致 无法统一进行分类
+ */
+public class PatentTypeHandler implements IProcessData {
+    public PatentTypeHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object ob) {
+        if (data.toString().contains("实用新型")) {
+            return "2";
+        } else if (data.toString().contains("发明申请") || data.toString().contains("发明公布")) {
+            return "1";
+        } else if (data.toString().contains("外观设计")) {
+            return "3";
+        } else if (data.toString().contains("授权")) {
+            return "4";
+        }
+        return null;
+    }
+}

+ 23 - 0
src/main/java/cn/cslg/pas/common/utils/handler/PatenticsAgencyAndAgentHandler.java

@@ -0,0 +1,23 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+import java.util.List;
+
+public class PatenticsAgencyAndAgentHandler implements IProcessData {
+    public PatenticsAgencyAndAgentHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object code) {
+        List<String> splitStr = StringUtils.changeStringToString(data.toString().replaceAll(" ", ""), ";");
+        if (code.toString().equals("1")) {
+            return splitStr.get(0);
+        } else if (code.toString().equals("2")) {
+            splitStr.remove(0);
+            return splitStr;
+        }
+        return null;
+    }
+}

+ 73 - 0
src/main/java/cn/cslg/pas/common/utils/handler/PatenticsPatentAffairHandler.java

@@ -0,0 +1,73 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+public class PatenticsPatentAffairHandler implements IProcessData {
+    public PatenticsPatentAffairHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object code) {
+        List<String> splitStr = StringUtils.changeStringToString(data.toString(), "\n");
+        splitStr.removeIf(item -> item.equals(""));
+
+        List<String> processList = splitStr.stream().map(item -> item.replaceAll(" ", "\\|")).collect(Collectors.toList());
+
+        StringBuilder all = new StringBuilder();
+        StringBuilder one = new StringBuilder();
+        List<String> messageList;
+        Pattern p = Pattern.compile("[\\d]*");
+        int flag1 = 0;
+        for (int j = 0; j < processList.size(); j++) {
+            if (j < processList.size() - 1) {
+                Matcher m = p.matcher(processList.get(j).substring(0, 4));
+                if (m.matches()) {
+                    flag1 = j;
+                }
+                if (!m.matches()) {
+                    String replace = processList.get(j).replaceAll("\\|", " ");
+                    processList.set(flag1, processList.get(flag1) + "<br>" + replace);
+                    processList.set(j, replace);
+                }
+            }
+        }
+
+        for (String s : processList) {
+            messageList = StringUtils.changeStringToString(s, "\\|");
+
+            if (messageList.size() == 4 && messageList.contains("授权")) {
+                messageList.remove(0);
+            } else if (messageList.size() % 3 != 0) {
+                continue;
+            }
+
+            for (int i = 0; i < messageList.size(); i += 3) {
+                if (one.toString().equals("")) {
+                    one = new StringBuilder("\"inpadocData\"" + ":[" + "{" + "\"name\"" + ":" + "\"发生日期\"" + "," + "\"content\"" + ":" + "\"" + messageList.get(i).trim() + "\"" + "}");
+                } else {
+                    one.append("," + "{" + "\"name\"" + ":" + "\"发生日期\"" + "," + "\"content\"" + ":" + "\"").append(messageList.get(i).trim()).append("\"").append("}");
+                }
+                one.append(",{").append("\"name\":\"法律状态\"").append(",").append("\"content\":").append("\"").append(messageList.get(i + 1).trim()).append("\"").append("}");
+                one.append("," + "{" + "\"name\"" + ":" + "\"描述信息\"" + "," + "\"content\"" + ":" + "\"").append(messageList.get(i + 2).trim()).append("\"").append("}]");
+
+                if (!one.toString().equals("")) {
+                    if (!all.toString().equals("")) {
+                        all.append(",{").append(one).append("}");
+                    } else {
+                        all = new StringBuilder("{" + one + "}");
+                    }
+                }
+                one = new StringBuilder();
+            }
+
+        }
+        all = new StringBuilder("[" + all + "]");
+        return all.toString();
+    }
+}

+ 18 - 0
src/main/java/cn/cslg/pas/common/utils/handler/PatenticsStringHandler.java

@@ -0,0 +1,18 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+public class PatenticsStringHandler implements IProcessData {
+    public PatenticsStringHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object splitSymbol) {
+        if (!"".equals(splitSymbol)) {
+            return StringUtils.changeStringToString(data.toString().replaceAll(" ", "").replaceAll("\n", ""), splitSymbol.toString());
+        } else {
+            return data.toString().replaceAll(" ", "");
+        }
+    }
+}

+ 20 - 0
src/main/java/cn/cslg/pas/common/utils/handler/SplitBySerialNumberAndRemoveLineFeedHandler.java

@@ -0,0 +1,20 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+public class SplitBySerialNumberAndRemoveLineFeedHandler implements IProcessData {
+    public SplitBySerialNumberAndRemoveLineFeedHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object splitSymbol) {
+        return Arrays.stream(data.toString().replaceAll("\n", "").split(splitSymbol.toString()))
+                .filter(StringUtils::isNotEmpty)
+                .collect(Collectors.toList());
+    }
+}

+ 28 - 0
src/main/java/cn/cslg/pas/common/utils/handler/SplitOriginalAndTranslationHandler.java

@@ -0,0 +1,28 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+import java.util.List;
+
+/**
+ * @name
+ * @description
+ */
+public class SplitOriginalAndTranslationHandler implements IProcessData {
+    public SplitOriginalAndTranslationHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object splitSymbol) {
+        List<String> splitList = StringUtils.changeStringToString(splitSymbol.toString(), ",");
+        if (splitList.get(0).equals("1")) {
+            return StringUtils.changeStringToString(data.toString(), splitList.get(1)).get(0);
+        } else if (splitList.get(0).equals("2")) {
+            if (StringUtils.changeStringToString(data.toString(), splitList.get(1)).size() == 2) {
+                return StringUtils.changeStringToString(data.toString(), splitList.get(1)).get(1);
+            }
+        }
+        return null;
+    }
+}

+ 22 - 0
src/main/java/cn/cslg/pas/common/utils/handler/StringHandler.java

@@ -0,0 +1,22 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+/**
+ * @name 一般字符串处理类
+ * @description 1.带有分隔符按照分隔符拆分(去除所有空格) 2.不带分隔符直接返回原数据
+ */
+public class StringHandler implements IProcessData {
+    public StringHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object splitSymbol) {
+        if (!"".equals(splitSymbol)) {
+            return StringUtils.changeStringToString(data.toString().trim(), splitSymbol.toString());
+        } else {
+            return data.toString();
+        }
+    }
+}

+ 22 - 0
src/main/java/cn/cslg/pas/common/utils/handler/StringSpecialHandler.java

@@ -0,0 +1,22 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+
+/**
+ * @name 特殊字符串处理类
+ * @description 1.带有分隔符按照分隔符拆分(去除 '>' 符号) 2.不带分隔符直接返回原数据 3.目前只有两个字段会使用 (1)标签(2)自定义字段
+ */
+public class StringSpecialHandler implements IProcessData {
+    public StringSpecialHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object splitSymbol) {
+        if (!"".equals(splitSymbol)) {
+            return StringUtils.changeStringToString(data.toString().replaceAll(">", ""), splitSymbol.toString());
+        } else {
+            return data.toString();
+        }
+    }
+}

+ 18 - 0
src/main/java/cn/cslg/pas/common/utils/handler/TimeHandler.java

@@ -0,0 +1,18 @@
+package cn.cslg.pas.common.utils.handler;
+
+
+import com.example.xiaoshiweixinback.business.utils.DateUtils;
+
+/**
+ * @name 时间处理类
+ * @description 1.将时间类型数据转换为int型 2.现支持格式为 yyyy-MM-dd yyyy/MM/dd 可后需添加
+ */
+public class TimeHandler implements IProcessData {
+    public TimeHandler() {
+    }
+
+    @Override
+    public Object processData(Object data, Object splitSymbol) {
+        return DateUtils.getDateTime(data.toString());
+    }
+}

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

@@ -63,7 +63,7 @@ public class ElasticSearchClientConfig {
 //            ElasticsearchTransport transport = new RestClientTransport(client,new JacksonJsonpMapper());
 //            return new ElasticsearchClient(transport);
 //        }
-
+//
 //        @Bean
 //        public ElasticsearchClient elasticsearchClient() throws Exception {
 //            RestClientBuilder builder = RestClient.builder(new HttpHost("es-cn-em93o8856000ho9e7.elasticsearch.aliyuncs.com", 9200, "http"));

+ 8 - 6
src/main/java/com/example/xiaoshiweixinback/business/utils/DateUtils.java

@@ -69,7 +69,6 @@ public class DateUtils {
     }
 
 
-
     public static boolean belongCalendar(Date nowTime, Date beginTime, Date endTime) {
         Calendar date = Calendar.getInstance();
         date.setTime(nowTime);
@@ -112,12 +111,14 @@ public class DateUtils {
 //        return dateTime;
 //    }
 
-        public static Date getDateTime(String date) {
+    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);
+        } else if (date.contains(".")) {
+            dateTime =strToDateTime(date,parsePatterns[8]);
         }
         return dateTime;
     }
@@ -698,13 +699,14 @@ public class DateUtils {
 
         return calculate;
     }
+
     /**
      * 专利之星返回日期格式为字符串 yyyyMMdd,如 "20230713",本方法将其转成10位数字时间戳
      *
      * @param dateStr yyyyMMdd格式字符串日期
      * @return 返回10位数字时间戳
      */
-    public static int  stringDateToTimeStamp(String dateStr) {
+    public static int stringDateToTimeStamp(String dateStr) {
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
         Date date;
         try {
@@ -721,8 +723,8 @@ public class DateUtils {
     /**
      * 获取几天之后的日期
      *
-     * @param date yyyy-MM-dd HH:mm:ss
-     * @param   加减的天数
+     * @param date  yyyy-MM-dd HH:mm:ss
+     * @param
      */
     public static Date getPlusMonthDate(Date date, int month) {
         Calendar cal = Calendar.getInstance();
@@ -738,6 +740,6 @@ public class DateUtils {
 
 
     public static void main(String[] args) {
-        System.out.println(12%50);
+        System.out.println(12 % 50);
     }
 }

+ 6 - 1
src/main/java/com/example/xiaoshiweixinback/controller/ImportPatentController.java

@@ -29,5 +29,10 @@ private final GetPatentFromSzService getPatentFromSzService;
         return Response.success("records");
     }
 
-
+    @Operation(summary = "查询会员")
+    @GetMapping("/import2")
+    private Response importPatent2(String path) throws Exception {
+        getPatentFromSzService.test2(path);
+        return Response.success("records");
+    }
 }

+ 8 - 2
src/main/java/com/example/xiaoshiweixinback/controller/ProductController.java

@@ -4,6 +4,7 @@ package com.example.xiaoshiweixinback.controller;
 import com.example.xiaoshiweixinback.business.common.Constants;
 import com.example.xiaoshiweixinback.business.common.Response;
 import com.example.xiaoshiweixinback.business.common.base.Records;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
 import com.example.xiaoshiweixinback.checkLogin.checkLogin;
 import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
 import com.example.xiaoshiweixinback.entity.dto.AssoPersonProductDTO;
@@ -36,8 +37,13 @@ public class ProductController {
     @PostMapping("/addOrUpdateProduct")
     public Response addOrUpdateProduct(@RequestBody ProductAddDTO productAddDTO) {
         Records records = new Records();
-        Integer id = productService.addOrUpdateProduct(productAddDTO);
-        records.setData(id);
+        try {
+            Integer id = productService.addOrUpdateProduct(productAddDTO);
+            records.setData(id);
+        }
+      catch (BusinessException e){
+            return Response.error(e.getErrorCode(),e.getMessage());
+      }
         return Response.success(records);
     }
 

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

@@ -71,4 +71,5 @@ public class PatentVector {
     @JsonProperty("asso_person_product_id")
     PatentJoin assoPersonProductId;
 
+    private String id;
 }

+ 10 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/PatentVectorWithId.java

@@ -0,0 +1,10 @@
+package com.example.xiaoshiweixinback.entity.dto;
+
+import com.example.xiaoshiweixinback.domain.es.PatentVector;
+import lombok.Data;
+
+@Data
+public class PatentVectorWithId {
+   private PatentVector patentVector;
+   private String id;
+}

+ 12 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/ticket/TicketQueryDTO.java

@@ -1,6 +1,9 @@
 package com.example.xiaoshiweixinback.entity.dto.ticket;
 
+import cn.hutool.core.date.DateTime;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
 
@@ -12,4 +15,13 @@ public class TicketQueryDTO {
     private Integer id;
     private Integer current;
     private Integer size;
+   private String contactPerson;
+
+
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date createTime;
 }

+ 3 - 1
src/main/java/com/example/xiaoshiweixinback/entity/vo/TicketVO.java

@@ -1,5 +1,6 @@
 package com.example.xiaoshiweixinback.entity.vo;
 
+import com.example.xiaoshiweixinback.business.common.base.SystemFile;
 import lombok.Data;
 
 import java.util.Date;
@@ -55,7 +56,7 @@ public class TicketVO {
     /**
      * 价格
      */
-    private Integer price;
+    private Double price;
 
     private TicketFillInVO ticketFillInVO;
     private TicketPatentApplyVO ticketPatentApplyVO;
@@ -63,4 +64,5 @@ public class TicketVO {
     private TicketRightsProtectionVO ticketRightsProtectionVO;
 
     private List<String> fileGuids;
+    private List<SystemFile> systemFiles;
 }

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/entity/vo/ticket/TicketDetailVO.java

@@ -61,7 +61,7 @@ public class TicketDetailVO {
     /**
      * 价格
      */
-    private Integer price;
+    private Double price;
 
     private TicketFillInVO ticketFillInVO;
     private TicketPatentApplyVO ticketPatentApplyVO;

+ 36 - 16
src/main/java/com/example/xiaoshiweixinback/service/AssoPersonProductService.java

@@ -3,6 +3,7 @@ package com.example.xiaoshiweixinback.service;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
 import com.example.xiaoshiweixinback.business.utils.CacheUtil;
 import com.example.xiaoshiweixinback.business.utils.LoginUtils;
 import com.example.xiaoshiweixinback.business.utils.ToolUtil;
@@ -30,22 +31,7 @@ public class AssoPersonProductService extends ServiceImpl<AssoPersonProductMappe
 
     public Integer add(AssoPersonProductDTO assoPersonProductDTO) {
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
-        AssoPersonFunction assoPersonFunction = vipService.getAssoPersonFunction("6");
-        if (assoPersonFunction == null) {
-          return  -2;
-        }
-        Integer totalNum = 5;
-        FunctionConfig functionConfig = JSON.parseObject(assoPersonFunction.getFunctionParameter(), FunctionConfig.class);
-        totalNum = functionConfig.getCanGetNum();
-
-        //查看关注的数量
-        LambdaQueryWrapper<AssoPersonProduct> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(AssoPersonProduct::getPersonUuid, personnelVO.getUuid());
-        Long total = this.count(queryWrapper);
-
-        if (total >= totalNum) {
-            return null;
-        }
+        checkAdmin();
         if (ToolUtil.isNotEmpty(personnelVO)) {
             AssoPersonProduct assoPersonProduct = new AssoPersonProduct();
             BeanUtils.copyProperties(assoPersonProductDTO, assoPersonProduct);
@@ -73,6 +59,40 @@ public class AssoPersonProductService extends ServiceImpl<AssoPersonProductMappe
         }
         return -1;
     }
+
+    public void checkAdmin() {
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        AssoPersonFunction assoPersonFunction = vipService.getAssoPersonFunction("6");
+        if (assoPersonFunction == null) {
+            throw new BusinessException("606", "无权限");
+        }
+        Integer totalNum = 5;
+        FunctionConfig functionConfig = JSON.parseObject(assoPersonFunction.getFunctionParameter(), FunctionConfig.class);
+        totalNum = functionConfig.getCanGetNum();
+
+        //查看关注的数量
+        LambdaQueryWrapper<AssoPersonProduct> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoPersonProduct::getPersonUuid, personnelVO.getUuid());
+        Long total = this.count(queryWrapper);
+
+        if (total >= totalNum) {
+            throw new BusinessException("606", "已超过可关注数量");
+        }
+
+
+    }
+
+    public Integer addAsso(AssoPersonProductDTO assoPersonProductDTO) {
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        if (ToolUtil.isNotEmpty(personnelVO)) {
+            AssoPersonProduct assoPersonProduct = new AssoPersonProduct();
+            BeanUtils.copyProperties(assoPersonProductDTO, assoPersonProduct);
+            assoPersonProduct.setPersonUuid(personnelVO.getUuid());
+            assoPersonProduct.insert();
+            return assoPersonProduct.getProductId();
+        }
+        return -1;
+    }
 }
 
 

+ 14 - 9
src/main/java/com/example/xiaoshiweixinback/service/ProductService.java

@@ -3,10 +3,13 @@ package com.example.xiaoshiweixinback.service;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.business.common.Response;
 import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.business.common.base.SystemFile;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
 import com.example.xiaoshiweixinback.business.utils.CacheUtil;
 import com.example.xiaoshiweixinback.business.utils.LoginUtils;
+import com.example.xiaoshiweixinback.domain.AssoPersonFunction;
 import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
 import com.example.xiaoshiweixinback.domain.AssoProductFile;
 import com.example.xiaoshiweixinback.domain.Product;
@@ -41,6 +44,8 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> {
     private final AssoProductFileService assoProductFileService;
     private final FileManagerService fileManagerService;
     private final AssoPersonProductService assoPersonProductService;
+    private final VipService vipService;
+
     /**
      * 查询爆款产品
      *
@@ -133,7 +138,7 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> {
 
             if (assoPersonProducts.size() != 0) {
                 AssoPersonProduct assoPersonProduct = assoPersonProducts.stream().filter(item -> item.getProductId().equals(productVO.getId())).findFirst().orElse(null);
-                if(assoPersonProduct!=null) {
+                if (assoPersonProduct != null) {
                     productVO.setConcernType(assoPersonProduct.getConcernType());
                 }
             }
@@ -144,12 +149,12 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> {
     public Integer addOrUpdateProduct(ProductAddDTO productAddDTO) {
         Product product = new Product();
         if (productAddDTO.getId() == null) {
+            assoPersonProductService.checkAdmin();
             product = this.addProduct(productAddDTO);
-            AssoPersonProductDTO assoPersonProductDTO =new AssoPersonProductDTO();
+            AssoPersonProductDTO assoPersonProductDTO = new AssoPersonProductDTO();
             assoPersonProductDTO.setProductId(product.getId());
             assoPersonProductDTO.setConcernType(productAddDTO.getConcernType());
-            assoPersonProductService.add(assoPersonProductDTO);
-
+            Integer flag = assoPersonProductService.addAsso(assoPersonProductDTO);
         } else {
             product = this.updateProduct(productAddDTO);
         }
@@ -205,11 +210,11 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> {
         getProductDTO.setSize(size);
         getProductDTO.setPersonUuid(personnelVO.getUuid());
         getProductDTO.setConcernTypes(productDTO.getConcernTypes());
-            List<ProductVO> productVOs = this.getBaseMapper().getConcernProduct(getProductDTO);
-            Long count = this.getBaseMapper().getConcernProductCount(getProductDTO);
-            this.loadProduct(productVOs);
-            records.setData(productVOs);
-            records.setTotal(count);
+        List<ProductVO> productVOs = this.getBaseMapper().getConcernProduct(getProductDTO);
+        Long count = this.getBaseMapper().getConcernProductCount(getProductDTO);
+        this.loadProduct(productVOs);
+        records.setData(productVOs);
+        records.setTotal(count);
         return records;
     }
 }

+ 2 - 2
src/main/java/com/example/xiaoshiweixinback/service/TicketFlowService.java

@@ -47,11 +47,11 @@ public class TicketFlowService extends ServiceImpl<TicketFlowMapper, TicketFlow>
      * @param description
      * @return
      */
-    public TicketFlow addTicketFlow(Ticket ticket, String description, Boolean ifResult,String remark) {
+    public TicketFlow addTicketFlow(Ticket ticket, String description, Boolean ifResult,String remark,Integer progress) {
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
         TicketFlow ticketFlow = new TicketFlow();
         ticketFlow.setTicketId(ticket.getId());
-        ticketFlow.setTicketProcess(ticket.getTicketProgress());
+        ticketFlow.setTicketProcess(progress);
         ticketFlow.setCreateId(personnelVO.getUuid());
         ticketFlow.setDescription(description);
         ticketFlow.setRemark(remark);

+ 40 - 12
src/main/java/com/example/xiaoshiweixinback/service/TicketService.java

@@ -18,11 +18,14 @@ import com.example.xiaoshiweixinback.entity.vo.ticket.TicketDetailVO;
 import com.example.xiaoshiweixinback.mapper.TicketMapper;
 import com.example.xiaoshiweixinback.service.common.FileManagerService;
 import lombok.RequiredArgsConstructor;
+import org.joda.time.DateTime;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -42,6 +45,7 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
     private final AssoTicketFileService assoTicketFileService;
     private final TicketFlowService ticketFlowService;
     private final FileManagerService fileManagerService;
+
     /**
      * 新增or更新工单
      *
@@ -110,7 +114,10 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
                 }
             }
 
+            //添加工单流程记录
+            ticketFlowService.addTicketFlow(ticket, "创建工单", false, null, 1);
         } else {
+            //TODO 未装载
             ticket = this.getById(ticket.getId());
             ticket.updateById();
         }
@@ -124,23 +131,33 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
         Integer process = ticketQueryDTO.getProcess();
         Integer pageNum = ticketQueryDTO.getCurrent();
         Integer pageSize = ticketQueryDTO.getSize();
-
+        String contactPerson = ticketQueryDTO.getContactPerson();
+        Date createTime = ticketQueryDTO.getCreateTime();
         Page<Ticket> page = new Page<>(pageNum, pageSize);
         QueryWrapper<Ticket> queryWrapper = new QueryWrapper<>();
         if (ticketType != null) {
             queryWrapper.lambda().eq(Ticket::getTicketType, ticketType);
         }
         if (num != null) {
-            queryWrapper.lambda().eq(Ticket::getNum, num);
+            queryWrapper.lambda().like(Ticket::getNum, num);
         }
         if (process != null) {
             queryWrapper.lambda().eq(Ticket::getTicketProgress, process);
         }
+        if (contactPerson != null) {
+            queryWrapper.lambda().like(Ticket::getContactPerson, contactPerson);
+        }
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
         Integer personType = personnelVO.getPersonType();
         if (personType != null && personType.equals(1)) {
             queryWrapper.lambda().eq(Ticket::getCreateId, personnelVO.getUuid());
         }
+        if (createTime != null) {
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+            String date = format.format(createTime);
+            queryWrapper.eq("DATE_FORMAT(create_time,'%Y-%m-%d')", date);
+
+        }
         queryWrapper.orderBy(true, false, "create_time");
         IPage<Ticket> ticketPage = this.page(page, queryWrapper);
         List<Ticket> tickets = ticketPage.getRecords();
@@ -169,11 +186,13 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
                 Integer ticketId = ticket.getId();
                 //附图
                 LambdaQueryWrapper<AssoTicketFile> queryWrapper = new LambdaQueryWrapper<>();
-                queryWrapper.eq(AssoTicketFile::getTicketId, ticketId);
+                queryWrapper.eq(AssoTicketFile::getTicketId, ticketId)
+                            .eq(AssoTicketFile::getType,0);
                 List<AssoTicketFile> assoTicketFiles = assoTicketFileService.list(queryWrapper);
                 if (assoTicketFiles != null && !assoTicketFiles.isEmpty()) {
                     List<String> fileGuids = assoTicketFiles.stream().map(AssoTicketFile::getFileGuid).collect(Collectors.toList());
-                    ticketVO.setFileGuids(fileGuids);
+                    List<SystemFile> systemFiles = fileManagerService.getSystemFileByGuids(fileGuids);
+                    ticketVO.setSystemFiles(systemFiles);
                 }
 
                 Integer ticketType = ticket.getTicketType();
@@ -260,6 +279,7 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
         Ticket ticket = this.getOne(queryWrapper, false);
         ticket.setTicketProgress(process);
         ticket.updateById();
+        ticketFlowService.addTicketFlow(ticket, "工单支付成功", false, null, 3);
         return ticket.getId();
     }
 
@@ -317,8 +337,14 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
 
         ticket.setPrice(price);
 
-        ticket.setTicketProgress(2);
+        if (ticket.getTicketProgress() == 2) {
+            ticketFlowService.addTicketFlow(ticket, "修改工单价格为" + price, false, null, 1);
+        } else {
+            ticket.setTicketProgress(2);
+            ticketFlowService.addTicketFlow(ticket, "受理工单并且修改价格为" + price, false, null, 1);
+        }
         ticket.updateById();
+
         return ticket.getId();
     }
 
@@ -345,10 +371,12 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
         }
 
         //添加工单流程
-        TicketFlow ticketFlow = ticketFlowService.addTicketFlow(ticket, description, true, "添加工单结果");
+        TicketFlow ticketFlow = ticketFlowService.addTicketFlow(ticket, description, true, "添加工单结果", 3);
 
         //添加结果
         assoTicketFileService.addTicketFile(fileGuids, 1, ticket, ticketFlow.getId());
+        ticket.setTicketProgress(6);
+        ticket.updateById();
         return ticket.getId();
     }
 
@@ -371,11 +399,12 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
         Integer ticketId = ticket.getId();
         //附图
         LambdaQueryWrapper<AssoTicketFile> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(AssoTicketFile::getTicketId, ticketId);
+        queryWrapper.eq(AssoTicketFile::getTicketId, ticketId)
+                .eq(AssoTicketFile::getType, 0);
         List<AssoTicketFile> assoTicketFiles = assoTicketFileService.list(queryWrapper);
         if (assoTicketFiles != null && !assoTicketFiles.isEmpty()) {
             List<String> fileGuids = assoTicketFiles.stream().map(AssoTicketFile::getFileGuid).collect(Collectors.toList());
-          List<SystemFile> systemFiles=  fileManagerService.getSystemFileByGuids(fileGuids);
+            List<SystemFile> systemFiles = fileManagerService.getSystemFileByGuids(fileGuids);
             ticketDetailVO.setSystemFiles(systemFiles);
         }
 
@@ -404,12 +433,11 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
                 break;
         }
         try {
-            TicketFlowVO ticketFlowVO =ticketFlowService.getTicketResult(ticketId);
+            TicketFlowVO ticketFlowVO = ticketFlowService.getTicketResult(ticketId);
             ticketDetailVO.setTicketResult(ticketFlowVO);
-        }
-  catch (Exception e){
+        } catch (Exception e) {
 
-  }
+        }
 
         return ticketDetailVO;
     }

+ 3 - 4
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsDenseVectorService.java

@@ -99,10 +99,9 @@ public class EsDenseVectorService {
         Long pageSize = dto.getPageSize();
         Boolean ifAddSearchRecord = dto.getIfAddSearchRecord();
 
-        AssoPersonFunction assoPersonFunction = vipService.getAssoPersonFunction("3");
-        if (assoPersonFunction == null) {
-
-        }
+//        AssoPersonFunction assoPersonFunction = vipService.getAssoPersonFunction("3");
+//        if (assoPersonFunction == null) {
+//        }
         SearchRequest.Builder builder = new SearchRequest.Builder();
         //设置查询索引
         builder.index("patent_vector");

+ 72 - 2
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsService.java

@@ -18,6 +18,7 @@ import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.operateNode
 import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.treeNode;
 import com.example.xiaoshiweixinback.domain.es.Patent;
 import com.example.xiaoshiweixinback.domain.es.PatentVector;
+import com.example.xiaoshiweixinback.entity.dto.PatentVectorWithId;
 import com.example.xiaoshiweixinback.entity.dto.patent.PatentDTO;
 import com.example.xiaoshiweixinback.entity.patent.MapRequest;
 import com.example.xiaoshiweixinback.entity.patent.QueryRequest;
@@ -65,7 +66,7 @@ public class EsService {
 
     public String addPatentVector(PatentVector patentVector) throws Exception {
         IndexResponse indexResponse = client.index(i -> i
-                .index("patent_vector_v3")
+                .index("patent_vector")
                 //传入user对象
                 .document(patentVector)
         );
@@ -352,7 +353,7 @@ public class EsService {
     public PatentVector getVectorByIndex(String patentNo,Integer index) throws Exception {
         SearchRequest.Builder builder = new SearchRequest.Builder();
         //设置查询索引
-        builder.index("patent_vector_v3");
+        builder.index("patent_vector");
         PatentVector patentVector = null;
         String id = null;
         Query q1 = QueryBuilders.term(t -> t.field("app_no").value(patentNo));
@@ -369,6 +370,75 @@ public class EsService {
         }
         return patentVector;
     }
+
+    //更新patent
+    public Integer updatePatentVector(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;
+        }
+    }
+
+
+    /**
+     * 根据专利号获取专利id
+     *
+     * @param patentNo
+     * @return
+     * @throws Exception
+     */
+    public PatentVectorWithId getVectorAndIdByIndex(String patentNo, Integer index) throws Exception {
+        PatentVectorWithId patentVectorWithId =null;
+        SearchRequest.Builder builder = new SearchRequest.Builder();
+        //设置查询索引
+        builder.index("patent_vector");
+        PatentVector patentVector = null;
+        String id = null;
+        Query q1 = QueryBuilders.term(t -> t.field("app_no").value(patentNo));
+        //公开号
+        Query q2 = QueryBuilders.term(t -> t.field("image_index").value(index));
+        //授权号
+        Query query = QueryBuilders.bool(i -> i.must(q1, q2));
+        builder.query(query);
+        SearchResponse<PatentVector> response = client.search(builder.build(), PatentVector.class);
+        List<Hit<PatentVector>> hits = response.hits().hits();
+        if (hits != null && hits.size() > 0) {
+            id = hits.get(0).id();
+            patentVector =hits.get(0).source();
+            patentVectorWithId=new PatentVectorWithId();
+            patentVectorWithId.setId(id);
+            patentVectorWithId.setPatentVector(patentVector);
+
+        }
+        return patentVectorWithId;
+    }
+
+
+    //更新patent
+    public Integer updatePatentVector(PatentVector patentVector, String id) {
+        UpdateRequest<PatentVector, PatentVector> req;
+
+        req = UpdateRequest.of(
+                b -> b.index("patent_vector").id(id)
+                        .doc(patentVector)
+        );
+
+        try {
+            client.update(req, PatentVector.class);
+            return 1;
+        } catch (IOException e) {
+            return -1;
+        }
+    }
 }
 
 

+ 40 - 22
src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetPatentFromExcelService.java

@@ -144,27 +144,7 @@ private GetPatentPictureFromExcelService getPatentPictureFromExcelService;
             }
         }
 
-        //装载权利要求
-        if (uploadParamsVO.getPatentRight() != null) {
-            List<Text> texts = new ArrayList<>();
-            if (uploadParamsVO.getPatentRight().getName() != null) {
-                Text text = new Text();
-                text.setTextContent(uploadParamsVO.getPatentRight().getName());
-                text.setIfOrigin(true);
-                text.setLanguage(contry);
-                texts.add(text);
-            }
-            if (uploadParamsVO.getPatentRight().getNameOut() != null) {
-                Text text = new Text();
-                text.setTextContent(uploadParamsVO.getPatentRight().getNameOut());
-                text.setIfOrigin(false);
-                text.setLanguage("CN");
-                texts.add(text);
-            }
-            if (texts.size() != 0) {
-                patent.setClaim(texts);
-            }
-        }
+
 
 
         List<String> applicantNames = uploadParamsVO.getPatentApplicantOriginalName();
@@ -181,8 +161,20 @@ private GetPatentPictureFromExcelService getPatentPictureFromExcelService;
             patent.setApplicant(patentPeople);
 
         }
+     //权利人
+        List<String> rightHoldNames =uploadParamsVO.getPatentApplicantCurrentName();
+        if (rightHoldNames != null && rightHoldNames.size() != 0) {
+            List<PatentPerson> patentPeople = new ArrayList<>();
+            for (int i = 0; i < rightHoldNames.size(); i++) {
+                PatentPerson patentPerson = new PatentPerson();
+                patentPerson.setOrder(i + 1);
+                patentPerson.setType("1");
+                patentPerson.setName(rightHoldNames.get(i));
+                patentPeople.add(patentPerson);
+            }
+            patent.setRightHolder(patentPeople);
 
-
+        }
         //装载LOC分类号
         List<String> locList = uploadParamsVO.getLocList();
         if (locList != null && locList.size() > 0) {
@@ -194,7 +186,33 @@ private GetPatentPictureFromExcelService getPatentPictureFromExcelService;
             }
             patent.setLoc(patentClassifies);
         }
+        List<String> ipcList = uploadParamsVO.getIpcList();
+
+        if (ipcList != null && ipcList.size() > 0) {
+            List<PatentClassify> patentClassifies = new ArrayList<>();
+            for (int i = 0; i < ipcList.size(); i++) {
+                PatentClassify patentClassify =new PatentClassify();
+                patentClassify.setLevel1(ipcList.get(i));
+                patentClassifies.add(patentClassify);
+            }
+            patent.setIpc(patentClassifies);
+        }
+
 
+        List<String> inventorNames = uploadParamsVO.getInventorName();
+        //申请人
+        if (inventorNames != null && inventorNames.size() != 0) {
+            List<PatentPerson> patentPeople = new ArrayList<>();
+            for (int i = 0; i < inventorNames.size(); i++) {
+                PatentPerson patentPerson = new PatentPerson();
+                patentPerson.setOrder(i + 1);
+                patentPerson.setType("1");
+                patentPerson.setName(inventorNames.get(i));
+                patentPeople.add(patentPerson);
+            }
+            patent.setInventor(patentPeople);
+
+        }
 
     }
 

+ 21 - 1
src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetPatentPictureFromExcelService.java

@@ -7,6 +7,7 @@ import com.example.xiaoshiweixinback.business.utils.FormatUtil;
 import com.example.xiaoshiweixinback.domain.es.Patent;
 import com.example.xiaoshiweixinback.domain.es.PatentClassify;
 import com.example.xiaoshiweixinback.domain.es.PatentVector;
+import com.example.xiaoshiweixinback.entity.dto.PatentVectorWithId;
 import com.example.xiaoshiweixinback.entity.dto.patent.UploadPatentWebDTO;
 import com.example.xiaoshiweixinback.service.common.FileManagerService;
 import com.example.xiaoshiweixinback.service.common.GetVectorService;
@@ -67,7 +68,7 @@ public class GetPatentPictureFromExcelService {
         patentVector.setAppDate(patent.getAppDate());
         patentVector.setAbstractStr(patent.getAbstractStr());
         patentVector.setAppCountry("US");
-        patentVector.setLoc(patent.getLoc());
+        patentVector.setLoc(patent.getIpc());
         patentVector.setImageIndex(i);
         patentVector.setGuid(guid);
         List<String> stringList = getVectorService.getVectorByFile(file);
@@ -83,4 +84,23 @@ public class GetPatentPictureFromExcelService {
 
 
     }
+
+
+    public void tem(Patent patent, Integer i) throws Exception {
+        String guid = FormatUtil.getPictureFormat(patent.getAppNo()) + i;
+        System.out.println(guid);
+        PatentVectorWithId patentVectorOrg = esService.getVectorAndIdByIndex(patent.getAppNo(), i);
+        if (patentVectorOrg != null) {
+            PatentVector patentVector = patentVectorOrg.getPatentVector();
+            patentVector.setRightHolder(patent.getApplicant());
+            patentVector.setLoc(patent.getIpc());
+            esService.updatePatentVector(patentVector, patentVectorOrg.getId());
+            return;
+        }
+
+
+
+
+
+    }
 }

+ 39 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/excel/GetPatentFromSzService.java

@@ -85,4 +85,43 @@ public class GetPatentFromSzService {
     }
 
 
+
+    public void test2(String pathStr) throws Exception {
+        String[] paths = pathStr.split(",");
+        for (int t=0;t<paths.length;t++) {
+            String path =paths[t];
+            File tempFile = new File(path);
+
+            Sheet sheet = ReadExcelUtils.readExcel(tempFile);
+            int total = sheet.getPhysicalNumberOfRows() - 1;
+            Row firstRow = sheet.getRow(0);
+            int columns = firstRow.getLastCellNum();
+
+            List<UploadSettingVO.Column> jsonData = excuteUploadSettingService.ExcuteUploadSetting(5 + "");
+
+            for (int r = 0; r < total; r++) {
+                Row needRow = sheet.getRow(r + 1);
+                Map<Object, Object> map = new HashMap<>();
+                for (int i = 0; i < columns; i++) {
+                    map.put(firstRow.getCell(i) + "", ExcelUtils.getValue(needRow.getCell(i)) + "");
+                }
+                UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(map, jsonData);
+                getPatentFromExcelService.loadPatent(uploadParamsVO);
+
+                List<PictureData> pictureDatas = ReadExcelUtils.getPictures((XSSFSheet) sheet, r + 1);
+
+                for (int i = 0; i < pictureDatas.size(); i++) {
+                    getPatentPictureFromExcelService.tem(uploadParamsVO.getPatent(), i);
+                }
+                UploadPatentWebDTO uploadPatentWebDTO = new UploadPatentWebDTO();
+                uploadPatentWebDTO.setPatent(uploadParamsVO.getPatent());
+                savePatentToEsService.saveOrUpdate(uploadPatentWebDTO);
+                System.out.println(r);
+            }
+            System.out.println("done"+t);
+
+            //获得总列数
+
+        }
+    }
 }

+ 3 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/excel/UploadParamsVO.java

@@ -90,6 +90,9 @@ public class UploadParamsVO {
     //申请人
     private List<String> patentApplicantOriginalName;
     private List<String> patentApplicantStandardOriginalName;
+
+    //权利人
+    private List<String> inventorName;
     //权利人地址
     private List<String> patentApplicantCurrentAddress;
     private List<String> patentApplicantCurrentCountry;

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/service/weixinpay/WeixinPayService.java

@@ -102,7 +102,7 @@ public class WeixinPayService {
         JsApiDTO.Amount amount = new JsApiDTO.Amount();
         amount.setCurrency("CNY");
         Integer price =0;
-        if(order.getTruePrice()==null){
+        if(order.getTruePrice()!=null){
             Double truePrice =order.getTruePrice()*100;
             price =truePrice.intValue();
         }

+ 8 - 16
src/main/resources/application-prodNetOut.yml

@@ -1,18 +1,6 @@
 spring:
-  redis:
-    host: 47.101.137.223
-    port: 6379
-    database: 3
-    password: Xx0GWxdWQJxx6Swe
-    lettuce:
-      pool:
-        max-active: 20
-        max-idle: 20
-        min-idle: 0
-        max-wait: -1ms
-    timeout: 2000ms
   datasource:
-    url: jdbc:mysql://47.101.137.223:3306/pas_prod2?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+    url: jdbc:mysql://47.101.137.223:3306/ecs?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
     username: root
     password: TU5x6IeBi7rl
     driver-class-name: com.mysql.cj.jdbc.Driver
@@ -30,8 +18,9 @@ PCSUrl: http://localhost:8871
 OPSUrl: http://139.224.24.90:5001
 PASUrl: http://localhost:8877
 RMSUrl: http://localhost:8872
-FMSUrl: http://localhost:8801
-FileSource: 3
+FMSUrl: http://localhost:8802
+VectorUrl: http://139.224.24.90:8000
+FileSource: 5
 
 ##################  短信 ####################
 SMS:
@@ -42,4 +31,7 @@ SMS:
 ##################  微信小程序  ####################
 WeChat:
   appId: wxaefb842bd0b93ff0
-  appSecret: 89fe0fb96472548d48f63b2f5c956537
+  appSecret: 89fe0fb96472548d48f63b2f5c956537
+
+Keypath: C:\Users\admin\Desktop\小程序证书\1673179188_20240408_cert\apiclient_key.pem
+queueName: emailProd.queue