licailing 4 жил өмнө
parent
commit
26e0dbe923

+ 8 - 1
src/main/java/com/izouma/uwip/domain/Patent.java

@@ -106,5 +106,12 @@ public class Patent extends BaseEntity {
     @Convert(converter = HandleListConverter.class)
     @Convert(converter = HandleListConverter.class)
     private List<Handle> handle;
     private List<Handle> handle;
 
 
-//    private CascadeType
+    /*
+    0-国内 1-国际 2-国家
+     */
+    private int category;
+
+    private String flow;
+
+    private LocalDate period;
 }
 }

+ 2 - 0
src/main/java/com/izouma/uwip/dto/CountryPatentDTO.java

@@ -161,6 +161,8 @@ public class CountryPatentDTO {
     @ApiModelProperty(value = "申请日")
     @ApiModelProperty(value = "申请日")
     private LocalDate applyDate;
     private LocalDate applyDate;
 
 
+    public LocalDate period;
+
     private List<Handle> handle = new ArrayList<>();
     private List<Handle> handle = new ArrayList<>();
 
 
     public List<AttachmentDTO> attachments;
     public List<AttachmentDTO> attachments;

+ 2 - 0
src/main/java/com/izouma/uwip/dto/DomesticPatentDTO.java

@@ -157,6 +157,8 @@ public class DomesticPatentDTO {
 
 
     public List<AttachmentDTO> attachments;
     public List<AttachmentDTO> attachments;
 
 
+    public LocalDate period;
+
     private List<Handle> handle = new ArrayList<>();
     private List<Handle> handle = new ArrayList<>();
 
 
     public DomesticPatentDTO(DomesticPatent dPatent, Patent patent){
     public DomesticPatentDTO(DomesticPatent dPatent, Patent patent){

+ 2 - 0
src/main/java/com/izouma/uwip/dto/InternationalPatentDTO.java

@@ -124,6 +124,8 @@ public class InternationalPatentDTO {
     @ApiModelProperty(value = "申请日")
     @ApiModelProperty(value = "申请日")
     private LocalDate applyDate;
     private LocalDate applyDate;
 
 
+    public LocalDate period;
+
     public List<AttachmentDTO> attachments;
     public List<AttachmentDTO> attachments;
 
 
     private List<Handle> handle = new ArrayList<>();
     private List<Handle> handle = new ArrayList<>();

+ 2 - 0
src/main/java/com/izouma/uwip/dto/PatentDTO.java

@@ -28,6 +28,8 @@ public class PatentDTO {
         this.name = patent.getName();
         this.name = patent.getName();
         this.uwNo = patent.getUwNo();
         this.uwNo = patent.getUwNo();
         this.applyStatus = patent.getApplyStatus();
         this.applyStatus = patent.getApplyStatus();
+        this.workflow = patent.getFlow();
+        this.date = patent.getPeriod();
     }
     }
 
 
     public PatentDTO(LogoPatent patent) {
     public PatentDTO(LogoPatent patent) {

+ 23 - 0
src/main/java/com/izouma/uwip/dto/TrendDTO.java

@@ -0,0 +1,23 @@
+package com.izouma.uwip.dto;
+
+import io.swagger.annotations.ApiModel;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@ApiModel("趋势")
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class TrendDTO {
+    private int dp;
+
+    private int ip;
+
+    private int cp;
+
+    private int lp;
+
+    private int day;
+
+}

+ 1 - 1
src/main/java/com/izouma/uwip/enums/CountryWorkflow.java

@@ -16,7 +16,7 @@ public enum CountryWorkflow {
     REPLY_NOTIFICATION("待上传答复通知", 2),
     REPLY_NOTIFICATION("待上传答复通知", 2),
     DETERMINED_REPLY("待确定答复意向", 1),
     DETERMINED_REPLY("待确定答复意向", 1),
     NO_REPLY("不答复终止", 1),
     NO_REPLY("不答复终止", 1),
-    REPLY_SUBMISSIONS("待上传答复意见书", 1),
+    REPLY_SUBMISSION("待上传答复意见书", 1),
     RESPONSE_RESULT("待确定答复结果", 2),
     RESPONSE_RESULT("待确定答复结果", 2),
     /*
     /*
     授权办登通知日
     授权办登通知日

+ 8 - 1
src/main/java/com/izouma/uwip/service/CountryPatentService.java

@@ -64,6 +64,12 @@ public class CountryPatentService {
             if (ObjectUtil.isNull(record.getApplyStatus()) || !ApplyStatus.COMPLETED.equals(record.getApplyStatus())) {
             if (ObjectUtil.isNull(record.getApplyStatus()) || !ApplyStatus.COMPLETED.equals(record.getApplyStatus())) {
                 orig1.setApplyStatus(this.getApplyStatus(record.getWorkflow()));
                 orig1.setApplyStatus(this.getApplyStatus(record.getWorkflow()));
             }
             }
+
+            // 流程--首页统计用
+            patent.setFlow(orig.getWorkflow().getDescription());
+            if (ObjectUtil.isNull(record.getPeriod())) {
+                patent.setPeriod(null);
+            }
             patentRepo.save(orig1);
             patentRepo.save(orig1);
 
 
             // 保存附件
             // 保存附件
@@ -76,6 +82,7 @@ public class CountryPatentService {
         Patent patent = new Patent();
         Patent patent = new Patent();
         BeanUtil.copyProperties(record, patent);
         BeanUtil.copyProperties(record, patent);
         patent.setSort(patentRepo.findMax());
         patent.setSort(patentRepo.findMax());
+        patent.setCategory(2);
 
 
         // 寰球案号
         // 寰球案号
         String type = patent.getType().name();
         String type = patent.getType().name();
@@ -109,7 +116,7 @@ public class CountryPatentService {
                 return ApplyStatus.APPLY_STAGE;//申请阶段
                 return ApplyStatus.APPLY_STAGE;//申请阶段
             case REPLY_NOTIFICATION://答复通知
             case REPLY_NOTIFICATION://答复通知
             case DETERMINED_REPLY://答复意向
             case DETERMINED_REPLY://答复意向
-            case REPLY_SUBMISSIONS://答复意见书
+            case REPLY_SUBMISSION://答复意见书
             case RESPONSE_RESULT://答复结果
             case RESPONSE_RESULT://答复结果
                 return ApplyStatus.SUBSTANTIVE_STAGE;//审查
                 return ApplyStatus.SUBSTANTIVE_STAGE;//审查
             case PENDING_REGISTER://办登通知日
             case PENDING_REGISTER://办登通知日

+ 7 - 0
src/main/java/com/izouma/uwip/service/DomesticPatentService.java

@@ -3,6 +3,7 @@ package com.izouma.uwip.service;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.izouma.uwip.domain.DomesticPatent;
 import com.izouma.uwip.domain.DomesticPatent;
+import com.izouma.uwip.domain.Fee;
 import com.izouma.uwip.domain.Handle;
 import com.izouma.uwip.domain.Handle;
 import com.izouma.uwip.domain.Patent;
 import com.izouma.uwip.domain.Patent;
 import com.izouma.uwip.dto.DomesticPatentDTO;
 import com.izouma.uwip.dto.DomesticPatentDTO;
@@ -59,6 +60,11 @@ public class DomesticPatentService {
             if (ObjectUtil.isNull(record.getApplyStatus()) || !ApplyStatus.COMPLETED.equals(record.getApplyStatus())) {
             if (ObjectUtil.isNull(record.getApplyStatus()) || !ApplyStatus.COMPLETED.equals(record.getApplyStatus())) {
                 orig1.setApplyStatus(this.getApplyStatus(record.getWorkflow()));
                 orig1.setApplyStatus(this.getApplyStatus(record.getWorkflow()));
             }
             }
+            // 流程--首页统计用
+            patent.setFlow(orig.getWorkflow().getDescription());
+            if (ObjectUtil.isNull(record.getPeriod())) {
+                patent.setPeriod(null);
+            }
             patentRepo.save(orig1);
             patentRepo.save(orig1);
 
 
             // 保存附件
             // 保存附件
@@ -72,6 +78,7 @@ public class DomesticPatentService {
         Patent patent = new Patent();
         Patent patent = new Patent();
         BeanUtil.copyProperties(record, patent);
         BeanUtil.copyProperties(record, patent);
         patent.setSort(patentRepo.findMax());
         patent.setSort(patentRepo.findMax());
+        patent.setCategory(0);
 
 
         //寰球案号
         //寰球案号
         PatentType type = patent.getType();
         PatentType type = patent.getType();

+ 7 - 0
src/main/java/com/izouma/uwip/service/InternationalPatentService.java

@@ -57,6 +57,12 @@ public class InternationalPatentService {
             if (ObjectUtil.isNull(record.getApplyStatus()) || !ApplyStatus.COMPLETED.equals(record.getApplyStatus())) {
             if (ObjectUtil.isNull(record.getApplyStatus()) || !ApplyStatus.COMPLETED.equals(record.getApplyStatus())) {
                 orig1.setApplyStatus(this.getApplyStatus(record.getWorkflow()));
                 orig1.setApplyStatus(this.getApplyStatus(record.getWorkflow()));
             }
             }
+
+            // 流程--首页统计用
+            patent.setFlow(orig.getWorkflow().getDescription());
+            if (ObjectUtil.isNull(record.getPeriod())) {
+                patent.setPeriod(null);
+            }
             patentRepo.save(orig1);
             patentRepo.save(orig1);
 
 
             // 保存附件
             // 保存附件
@@ -69,6 +75,7 @@ public class InternationalPatentService {
         Patent patent = new Patent();
         Patent patent = new Patent();
         BeanUtil.copyProperties(record, patent);
         BeanUtil.copyProperties(record, patent);
         patent.setSort(patentRepo.findMax());
         patent.setSort(patentRepo.findMax());
+        patent.setCategory(1);
 
 
         //寰球案号
         //寰球案号
         PatentType type = patent.getType();
         PatentType type = patent.getType();

+ 123 - 72
src/main/java/com/izouma/uwip/service/PatentService.java

@@ -8,8 +8,10 @@ import com.izouma.uwip.domain.LogoPatent;
 import com.izouma.uwip.domain.Patent;
 import com.izouma.uwip.domain.Patent;
 import com.izouma.uwip.dto.PageQuery;
 import com.izouma.uwip.dto.PageQuery;
 import com.izouma.uwip.dto.PatentDTO;
 import com.izouma.uwip.dto.PatentDTO;
+import com.izouma.uwip.dto.TrendDTO;
 import com.izouma.uwip.enums.ApplyStatus;
 import com.izouma.uwip.enums.ApplyStatus;
-import com.izouma.uwip.repo.*;
+import com.izouma.uwip.repo.LogoPatentRepo;
+import com.izouma.uwip.repo.PatentRepo;
 import com.izouma.uwip.utils.JpaUtils;
 import com.izouma.uwip.utils.JpaUtils;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Page;
@@ -28,11 +30,8 @@ import java.util.stream.Collectors;
 @AllArgsConstructor
 @AllArgsConstructor
 public class PatentService {
 public class PatentService {
 
 
-    private final PatentRepo              patentRepo;
-    private final LogoPatentRepo          logoPatentRepo;
-    private final DomesticPatentRepo      domesticPatentRepo;
-    private final InternationalPatentRepo internationalPatentRepo;
-    private final CountryPatentRepo       countryPatentRepo;
+    private final PatentRepo     patentRepo;
+    private final LogoPatentRepo logoPatentRepo;
 
 
     public Page<Patent> all(PageQuery pageQuery) {
     public Page<Patent> all(PageQuery pageQuery) {
         return patentRepo.findAll(JpaUtils.toSpecification(pageQuery, Patent.class), JpaUtils.toPageRequest(pageQuery));
         return patentRepo.findAll(JpaUtils.toSpecification(pageQuery, Patent.class), JpaUtils.toPageRequest(pageQuery));
@@ -84,17 +83,16 @@ public class PatentService {
         List<Patent> patents = patentRepo.findAll();
         List<Patent> patents = patentRepo.findAll();
         List<LogoPatent> logoPatents = logoPatentRepo.findAll();
         List<LogoPatent> logoPatents = logoPatentRepo.findAll();
 
 
+        Map<String, Integer> card = new HashMap<>();
         //总数
         //总数
         int total = patents.size() + logoPatents.size();
         int total = patents.size() + logoPatents.size();
-        map.put("total", total);
-
+        card.put("total", total);
         //今天
         //今天
         LocalDate now = LocalDate.now();
         LocalDate now = LocalDate.now();
         long pToday = patents.stream().filter(patent -> patent.getCreatedAt().toLocalDate().equals(now)).count();
         long pToday = patents.stream().filter(patent -> patent.getCreatedAt().toLocalDate().equals(now)).count();
         long lToday = logoPatents.stream().filter(patent -> patent.getCreatedAt().toLocalDate().equals(now)).count();
         long lToday = logoPatents.stream().filter(patent -> patent.getCreatedAt().toLocalDate().equals(now)).count();
         int today = (int) (pToday + lToday);
         int today = (int) (pToday + lToday);
-        map.put("today", today);
-
+        card.put("today", today);
         //进行中
         //进行中
         List<Patent> pInProgress = patents.stream()
         List<Patent> pInProgress = patents.stream()
                 .filter(patent -> !ApplyStatus.COMPLETED.equals(patent.getApplyStatus()))
                 .filter(patent -> !ApplyStatus.COMPLETED.equals(patent.getApplyStatus()))
@@ -103,80 +101,68 @@ public class PatentService {
                 .filter(patent -> !ApplyStatus.COMPLETED.equals(patent.getApplyStatus()))
                 .filter(patent -> !ApplyStatus.COMPLETED.equals(patent.getApplyStatus()))
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
         int inProgress = pInProgress.size() + lInProgress.size();
         int inProgress = pInProgress.size() + lInProgress.size();
-        map.put("inProgress", inProgress);
-
+        card.put("inProgress", inProgress);
         //已结束
         //已结束
         int end = total - inProgress;
         int end = total - inProgress;
-        map.put("end", end);
+        card.put("end", end);
 
 
-        //代办案件列表
-        List<PatentDTO> lAgent = lInProgress.stream().map(PatentDTO::new).collect(Collectors.toList());
-//        List<PatentDTO> pAgent = pInProgress.stream().map(PatentDTO::new).collect(Collectors.toList());
-
-        pInProgress.forEach(patent -> {
-            PatentDTO dto = new PatentDTO(patent);
-            List<Handle> handle = patent.getHandle();
-            int size = handle.size();
-            if (size > 0) {
-                String workflow = handle.get(size - 1).getWorkflow();
-
-                if ("TRANSLATION_DOCUMENTS".equals(workflow)) {
-                    //TRANSLATION_DOCUMENTS 待申请翻译文稿
-                } else if ("SUPPLIER_MATERIALS".equals(workflow)) {
-                    //SUPPLIER_MATERIALS 待添加供应商
-                    dto.setDate(patent.getSupplierSubmitPeriod());
-                } else if ("DETERMINED_REPLY".equals(workflow)) {
-                    //DETERMINED_REPLY 待上传答复通知
-                    dto.setDate(patent.getSubmitPeriod());
-                } else if("AUTHORIZE_REGISTER".equals(workflow)){
-                   //授权办登通知日
-                } else if("PENDING_REVIEW".equals(workflow)){
+        map.put("card", card);
 
 
-                }
 
 
+        //代办案件列表
+        List<PatentDTO> lAgent = lInProgress.stream()
+                .map(PatentDTO::new)
+                .filter(agent -> ObjectUtil.isNotNull(agent.getDate()))
+                .collect(Collectors.toList());
+        List<PatentDTO> pAgent = pInProgress.stream()
+                .map(PatentDTO::new)
+                .filter(agent -> ObjectUtil.isNotNull(agent.getDate()))
+                .collect(Collectors.toList());
+
+        lAgent.addAll(pAgent);
+        List<PatentDTO> agents = lAgent.stream()
+                .sorted(Comparator.comparing(PatentDTO::getDate))
+                .limit(5)
+                .collect(Collectors.toList());
+        map.put("agent", agents);
 
 
-            }
 
 
-        });
         //数据统计
         //数据统计
-        Map<ApplyStatus, List<Patent>> byPStatus = patents.stream()
-                .collect(Collectors.groupingBy(Patent::getApplyStatus));
+        Map<ApplyStatus, Long> byPStatus = patents.stream()
+                .collect(Collectors.groupingBy(Patent::getApplyStatus, Collectors.counting()));
 
 
-        Map<ApplyStatus, List<LogoPatent>> byLStatus = logoPatents.stream()
-                .collect(Collectors.groupingBy(LogoPatent::getApplyStatus));
-        List<LogoPatent> applyLPatent = byLStatus.get(ApplyStatus.APPLY_STAGE);
-        List<Patent> applyPatent = byPStatus.get(ApplyStatus.APPLY_STAGE);
-        int apply = CollUtil.isEmpty(applyLPatent) ? 0 : applyLPatent.size() +
-                ((CollUtil.isEmpty(applyPatent)) ? 0 : applyPatent.size());
+        Map<ApplyStatus, Long> byLStatus = logoPatents.stream()
+                .collect(Collectors.groupingBy(LogoPatent::getApplyStatus, Collectors.counting()));
 
 
-        List<LogoPatent> grantLPatent = byLStatus.get(ApplyStatus.GRANT_STAGE);
-        List<Patent> grantPatent = byPStatus.get(ApplyStatus.GRANT_STAGE);
-        int grant = CollUtil.isEmpty(grantLPatent) ? 0 : grantLPatent.size() +
-                ((CollUtil.isEmpty(grantPatent)) ? 0 : grantPatent.size());
+        long apply = ObjectUtil.isNull(byPStatus.get(ApplyStatus.APPLY_STAGE)) ? 0 : byPStatus.get(ApplyStatus.APPLY_STAGE) +
+                ((ObjectUtil.isNull(byLStatus.get(ApplyStatus.APPLY_STAGE))) ? 0 : byLStatus.get(ApplyStatus.APPLY_STAGE));
 
 
-        List<LogoPatent> reviewLPatent = byLStatus.get(ApplyStatus.REVIEW_STAGE);
-        List<Patent> reviewPatent = byPStatus.get(ApplyStatus.REVIEW_STAGE);
-        int review = CollUtil.isEmpty(reviewLPatent) ? 0 : reviewLPatent.size() +
-                ((CollUtil.isEmpty(reviewPatent)) ? 0 : reviewPatent.size());
+        long grant = ObjectUtil.isNull(byPStatus.get(ApplyStatus.GRANT_STAGE)) ? 0 : byPStatus.get(ApplyStatus.GRANT_STAGE) +
+                ((ObjectUtil.isNull(byLStatus.get(ApplyStatus.GRANT_STAGE))) ? 0 : byLStatus.get(ApplyStatus.GRANT_STAGE));
 
 
-        List<LogoPatent> substantiveLPatent = byLStatus.get(ApplyStatus.SUBSTANTIVE_STAGE);
-        List<Patent> substantivePatent = byPStatus.get(ApplyStatus.SUBSTANTIVE_STAGE);
-        int substantive = CollUtil.isEmpty(substantiveLPatent) ? 0 : substantiveLPatent.size() +
-                ((CollUtil.isEmpty(substantivePatent)) ? 0 : substantivePatent.size());
+        long review = ObjectUtil.isNull(byPStatus.get(ApplyStatus.REVIEW_STAGE)) ? 0 : byPStatus.get(ApplyStatus.REVIEW_STAGE) +
+                ((ObjectUtil.isNull(byLStatus.get(ApplyStatus.REVIEW_STAGE))) ? 0 : byLStatus.get(ApplyStatus.REVIEW_STAGE));
 
 
-        map.put("apply", apply);
-        map.put("grant", grant);
-        map.put("review", review);
-        map.put("substantive", substantive);
+        long substantive = ObjectUtil.isNull(byPStatus.get(ApplyStatus.SUBSTANTIVE_STAGE)) ? 0 : byPStatus.get(ApplyStatus.SUBSTANTIVE_STAGE) +
+                ((ObjectUtil.isNull(byLStatus.get(ApplyStatus.SUBSTANTIVE_STAGE))) ? 0 : byLStatus.get(ApplyStatus.SUBSTANTIVE_STAGE));
+
+        Map<String, Long> pie = new HashMap<>();
+        pie.put("apply", apply);
+        pie.put("grant", grant);
+        pie.put("review", review);
+        pie.put("substantive", substantive);
+
+        map.put("pie", pie);
 
 
 
 
         //本周数据对比
         //本周数据对比
-        int dayOfWeek = now.getDayOfWeek().getValue() % 7;
+        int dayOfWeek = now.getDayOfWeek().getValue();
         Map<LocalDate, Integer> weekMap = getData(patents, logoPatents, now, dayOfWeek);
         Map<LocalDate, Integer> weekMap = getData(patents, logoPatents, now, dayOfWeek);
         map.put("weekMap", weekMap);
         map.put("weekMap", weekMap);
 
 
+
         //本月数据对比
         //本月数据对比
-        int dayOfMonth = now.getDayOfMonth() - 1;
+        int dayOfMonth = now.getDayOfMonth();
         Map<LocalDate, Integer> monthMap = getData(patents, logoPatents, now, dayOfMonth);
         Map<LocalDate, Integer> monthMap = getData(patents, logoPatents, now, dayOfMonth);
         map.put("monthMap", monthMap);
         map.put("monthMap", monthMap);
 
 
@@ -189,23 +175,88 @@ public class PatentService {
     2 月
     2 月
     3 年
     3 年
      */
      */
-    public Map<Integer, Integer> getTrend(int type) {
-        Map<Integer, Integer> map = new HashMap<>();
-        switch (type) {
+    public List<TrendDTO> getTrend(int type) {
 
 
+        List<TrendDTO> dtos = new ArrayList<>();
+        LocalDate now = LocalDate.now();
+        List<Patent> patents = patentRepo.findAll();
+        List<LogoPatent> logoPatents = logoPatentRepo.findAll();
+        switch (type) {
+            case 1:
+                int dayOfWeek = now.getDayOfWeek().getValue();
+                getEveryDay(patents, logoPatents, dtos, now, dayOfWeek);
+                break;
+            case 2:
+                int dayOfMonth = now.getDayOfMonth();
+                getEveryDay(patents, logoPatents, dtos, now, dayOfMonth);
+                break;
             case 3:
             case 3:
+                int month = now.getMonthValue();
+                while (month > 0) {
+                    int dp = 0;
+                    int ip = 0;
+                    int cp = 0;
+                    int finalMonth = month;
+                    List<Patent> monthPatents = patents.stream()
+                            .filter(patent -> patent.getCreatedAt().getMonthValue() == finalMonth)
+                            .collect(Collectors.toList());
+                    for (Patent mp : monthPatents) {
+                        if (0 == mp.getCategory()) {
+                            dp++;
+                        } else if (1 == mp.getCategory()) {
+                            ip++;
+                        } else {
+                            cp++;
+                        }
+                    }
+                    int lp = (int) logoPatents.stream()
+                            .filter(patent -> patent.getCreatedAt().getMonthValue() == finalMonth)
+                            .count();
+
+                    dtos.add(new TrendDTO(dp, ip, cp, lp, month));
+                    month--;
+                }
+                break;
+            default:
+                break;
 
 
         }
         }
 
 
+        return dtos;
+    }
 
 
-        return map;
+    public void getEveryDay(List<Patent> patents, List<LogoPatent> lPatents, List<TrendDTO> dtos, LocalDate now, int day) {
+        while (day > 0) {
+            int dp = 0;
+            int ip = 0;
+            int cp = 0;
+            LocalDate weekStart = now.minusDays(day - 1);
+            List<Patent> monthPatents = patents.stream()
+                    .filter(patent -> patent.getCreatedAt().toLocalDate().equals(weekStart))
+                    .collect(Collectors.toList());
+            for (Patent mp : monthPatents) {
+                if (0 == mp.getCategory()) {
+                    dp++;
+                } else if (1 == mp.getCategory()) {
+                    ip++;
+                } else {
+                    cp++;
+                }
+            }
+            int lp = (int) lPatents.stream()
+                    .filter(patent -> patent.getCreatedAt().toLocalDate().equals(weekStart))
+                    .count();
+
+            dtos.add(new TrendDTO(dp, ip, cp, lp, day));
+            day--;
+        }
     }
     }
 
 
-    private Map<LocalDate, Integer> getData(List<Patent> patents, List<LogoPatent> logoPatents,
-                                            LocalDate now, int day) {
+    public Map<LocalDate, Integer> getData(List<Patent> patents, List<LogoPatent> logoPatents,
+                                           LocalDate now, int day) {
         Map<LocalDate, Integer> map = new HashMap<>();
         Map<LocalDate, Integer> map = new HashMap<>();
-        while (day >= 0) {
-            LocalDate weekStart = now.minusDays(day);
+        while (day > 0) {
+            LocalDate weekStart = now.minusDays(day - 1);
 
 
             long pWeek = patents.stream()
             long pWeek = patents.stream()
                     .filter(patent -> patent.getCreatedAt().toLocalDate().equals(weekStart))
                     .filter(patent -> patent.getCreatedAt().toLocalDate().equals(weekStart))

+ 34 - 1
src/main/java/com/izouma/uwip/web/PatentController.java

@@ -1,11 +1,14 @@
 package com.izouma.uwip.web;
 package com.izouma.uwip.web;
+
 import com.izouma.uwip.domain.Patent;
 import com.izouma.uwip.domain.Patent;
+import com.izouma.uwip.dto.TrendDTO;
 import com.izouma.uwip.service.PatentService;
 import com.izouma.uwip.service.PatentService;
 import com.izouma.uwip.dto.PageQuery;
 import com.izouma.uwip.dto.PageQuery;
 import com.izouma.uwip.exception.BusinessException;
 import com.izouma.uwip.exception.BusinessException;
 import com.izouma.uwip.repo.PatentRepo;
 import com.izouma.uwip.repo.PatentRepo;
 import com.izouma.uwip.utils.ObjUtils;
 import com.izouma.uwip.utils.ObjUtils;
 import com.izouma.uwip.utils.excel.ExcelUtils;
 import com.izouma.uwip.utils.excel.ExcelUtils;
+import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Page;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -14,13 +17,14 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.IOException;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 @RestController
 @RestController
 @RequestMapping("/patent")
 @RequestMapping("/patent")
 @AllArgsConstructor
 @AllArgsConstructor
 public class PatentController extends BaseController {
 public class PatentController extends BaseController {
     private final PatentService patentService;
     private final PatentService patentService;
-    private final PatentRepo patentRepo;
+    private final PatentRepo    patentRepo;
 
 
     //@PreAuthorize("hasRole('ADMIN')")
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
     @PostMapping("/save")
@@ -56,5 +60,34 @@ public class PatentController extends BaseController {
         List<Patent> data = all(pageQuery).getContent();
         List<Patent> data = all(pageQuery).getContent();
         ExcelUtils.export(response, data);
         ExcelUtils.export(response, data);
     }
     }
+
+    /**
+     * @return map
+     * card:卡片上
+     * ---->total:案件数量 today:今日新增 inProgress:进行中 end:已结束
+     * agent: 待办案件列表
+     * weekMap:本周新增数据对比(周一为一周的开始)
+     * monthMap:本月数据增长趋势
+     * pie:饼状图
+     * ---->apply:申请阶段 grant:授权阶段 review:复审阶段 substantive:实审阶段
+     */
+    @GetMapping("/statistic")
+    @ApiOperation("统计")
+    public Map<String, Object> statistic() {
+        return patentService.total();
+    }
+
+    /**
+     * 趋势列表
+     *
+     * @param type 1-周 2-月 3-年
+     * @return 趋势列表 为周时,周一为一周的开始
+     * dp-国内专利  ip-国际专利 cp-国家专利 lp-商标专利 day-(年)几月,(月)几号,(周)周几
+     */
+    @GetMapping("/trend")
+    @ApiOperation("增长趋势")
+    public List<TrendDTO> tread(int type) {
+        return patentService.getTrend(type);
+    }
 }
 }
 
 

+ 3 - 0
src/main/vue/src/components/countryPatent/Reply.vue

@@ -87,6 +87,9 @@ export default {
             info.officialPeriod = this.form.officialPeriod;
             info.officialPeriod = this.form.officialPeriod;
             info.submitPeriod = this.form.submitPeriod;
             info.submitPeriod = this.form.submitPeriod;
             info.workflow = 'REPLY_SUBMISSION';
             info.workflow = 'REPLY_SUBMISSION';
+            // 期限-用于首页统计用
+            info.period = this.form.submitPeriod;
+
             this.$emit('submit', info);
             this.$emit('submit', info);
             this.show = false;
             this.show = false;
         }
         }

+ 2 - 0
src/main/vue/src/components/domesticPatent/AddSupplierNo.vue

@@ -94,6 +94,8 @@ export default {
             info.supplierSubmitPeriod = this.form.supplierSubmitPeriod;
             info.supplierSubmitPeriod = this.form.supplierSubmitPeriod;
 
 
             info.workflow = 'SUPPLIER_MATERIALS';
             info.workflow = 'SUPPLIER_MATERIALS';
+            // 期限-用于首页统计用
+            info.period = this.form.supplierSubmitPeriod;
 
 
             this.$emit('submit', info);
             this.$emit('submit', info);
             this.show = false;
             this.show = false;

+ 2 - 0
src/main/vue/src/components/domesticPatent/Register.vue

@@ -92,6 +92,8 @@ export default {
             info.feeRemark = this.form.feeRemark;
             info.feeRemark = this.form.feeRemark;
             this.$emit('uploadAttement', this.form.attachment1);
             this.$emit('uploadAttement', this.form.attachment1);
             info.workflow = 'PAYMENT_REGISTER';
             info.workflow = 'PAYMENT_REGISTER';
+            // 期限-用于首页统计用
+            info.period = this.form.registerEndDate;
             this.$emit('submit', info);
             this.$emit('submit', info);
             this.show = false;
             this.show = false;
         }
         }

+ 2 - 0
src/main/vue/src/components/domesticPatent/Reply.vue

@@ -87,6 +87,8 @@ export default {
             info.officialPeriod = this.form.officialPeriod;
             info.officialPeriod = this.form.officialPeriod;
             info.submitPeriod = this.form.submitPeriod;
             info.submitPeriod = this.form.submitPeriod;
             info.workflow = 'PENDING_REVIEW';
             info.workflow = 'PENDING_REVIEW';
+            // 期限-用于首页统计用
+            info.period = this.form.submitPeriod;
             this.$emit('submit', info);
             this.$emit('submit', info);
             this.show = false;
             this.show = false;
         }
         }

+ 2 - 0
src/main/vue/src/components/internationalPatent/AddSupplierNo.vue

@@ -94,6 +94,8 @@ export default {
             info.supplierSubmitPeriod = this.form.supplierSubmitPeriod;
             info.supplierSubmitPeriod = this.form.supplierSubmitPeriod;
 
 
             info.workflow = 'SUPPLIER_MATERIALS';
             info.workflow = 'SUPPLIER_MATERIALS';
+            // 期限-用于首页统计用
+            info.period = this.form.supplierSubmitPeriod;
 
 
             this.$emit('submit', info);
             this.$emit('submit', info);
             this.show = false;
             this.show = false;

+ 3 - 0
src/main/vue/src/components/internationalPatent/Reply.vue

@@ -87,6 +87,9 @@ export default {
             info.officialPeriod = this.form.officialPeriod;
             info.officialPeriod = this.form.officialPeriod;
             info.submitPeriod = this.form.submitPeriod;
             info.submitPeriod = this.form.submitPeriod;
             info.workflow = 'REPLY_SUBMISSIONS';
             info.workflow = 'REPLY_SUBMISSIONS';
+            // 期限-用于首页统计用
+            info.period = this.form.submitPeriod;
+
             this.$emit('submit', info);
             this.$emit('submit', info);
             this.show = false;
             this.show = false;
         }
         }

+ 28 - 1
src/test/java/com/izouma/uwip/service/PatentServiceTest.java

@@ -1,16 +1,43 @@
 package com.izouma.uwip.service;
 package com.izouma.uwip.service;
 
 
 import com.izouma.uwip.ApplicationTests;
 import com.izouma.uwip.ApplicationTests;
+import com.izouma.uwip.dto.TrendDTO;
+import com.izouma.uwip.repo.LogoPatentRepo;
+import com.izouma.uwip.repo.PatentRepo;
 import org.junit.Test;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 
 
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+
 public class PatentServiceTest extends ApplicationTests {
 public class PatentServiceTest extends ApplicationTests {
 
 
     @Autowired
     @Autowired
-    private PatentService patentService;
+    private PatentService  patentService;
+    @Autowired
+    private PatentRepo     patentRepo;
+    @Autowired
+    private LogoPatentRepo logoPatentRepo;
 
 
     @Test
     @Test
     public void total() {
     public void total() {
         System.out.println(patentService.total());
         System.out.println(patentService.total());
+//        System.out.println(LocalDate.now().minusDays(24));
+    }
+
+    @Test
+    public void test1() {
+        System.out.println(patentService.getData(patentRepo.findAll(), logoPatentRepo.findAll(), LocalDate.now(), 7));
+        List<TrendDTO> dto = new ArrayList<>();
+        patentService.getEveryDay(patentRepo.findAll(), logoPatentRepo.findAll(), dto, LocalDate
+                .now(), 7);
+        dto.forEach(System.out::println);
+    }
+
+    @Test
+    public void test2() {
+        List<TrendDTO> trend = patentService.getTrend(3);
+        trend.forEach(System.out::println);
     }
     }
 }
 }