zero 5 天之前
父节点
当前提交
b4223ce1ca

+ 1 - 1
src/main/java/com/cslg/ppa/service/GetWebArticle/GetCNIPAArticleService.java

@@ -96,7 +96,7 @@ public class GetCNIPAArticleService {
                 String dateStr = document.getElementsByTag("span").text().trim();
                 String yesterdayDateStr = DateUtil.getYesterdayDateStr();
                 if (!StringUtils.equals(dateStr, yesterdayDateStr)) {
-                    break;
+                    continue;
                 }
                 Date date = new Date();
                 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

+ 17 - 11
src/main/java/com/cslg/ppa/service/ReportService.java

@@ -60,7 +60,8 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     @Autowired
     private ArticleInfoMapper articleInfoMapper;
 
-    private static final List<String> SPECIAL_KEYWORDS = Arrays.asList("活动", "研讨", "座谈会", "举办", "举行", "培训", "课堂");
+    private static final List<String> SPECIAL_KEYWORDS = Arrays.asList("活动", "研讨", "座谈会", "举办", "举行", "培训",
+            "课堂", "论证会", "讨论", "调研", "会议", "召开","招聘","主题","讲座","大会","专利代理师","博览会","资助","参评","年会","参观","学习");
 
     public String selectReportList(SelectReportListDTO vo) {
         LambdaQueryWrapper<Report> wrapper = new LambdaQueryWrapper<>();
@@ -113,6 +114,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         if (!CollectionUtils.isEmpty(articleIds)) {
             for (Integer articleId : articleIds) {
                 Long count = assoReportArticleMapper.selectCount(new LambdaQueryWrapper<AssoReportArticle>()
+                        .eq(AssoReportArticle::getReportId,report.getId())
                         .eq(AssoReportArticle::getArticleId, articleId)
                         .eq(AssoReportArticle::getIfUse, 1));
                 if (count > 1) {
@@ -167,6 +169,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         if (!CollectionUtils.isEmpty(articleIds)) {
             for (Integer articleId : articleIds) {
                 Long count = assoReportArticleMapper.selectCount(new LambdaQueryWrapper<AssoReportArticle>()
+                        .eq(AssoReportArticle::getReportId,reportId)
                         .eq(AssoReportArticle::getArticleId, articleId)
                         .eq(AssoReportArticle::getIfUse, 1));
                 if (count > 1) {
@@ -261,6 +264,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         return fileGuid;
     }
 
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
     public String oneClickExport() {
         OneClickExportDTO vo = new OneClickExportDTO();
         vo.setBeginTime(DateUtil.getFirstDayOfMonthStr());
@@ -290,8 +294,8 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
                             String htmlLink = "<a href='" + reportArticleVO.getArticleUrl() + "'>" + reportArticleVO.getArticleUrl() + "</a>";
                             detailVO.setArticle_url(htmlLink);
                             detailVOS.add(detailVO);
-                            i++;
                             articleIds.add(reportArticleVO.getArticleId());
+                            i++;
                         }
                     }
                     reportVO.setDetailVOS(detailVOS);
@@ -300,6 +304,17 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             }
         }
 
+        String nowDateStr = DateUtil.getNowDateStr();
+        String year = nowDateStr.substring(0, 4);
+        String month = nowDateStr.substring(4, 6);
+        String reportName = nowDateStr + "-知识产权相关法律法规资讯整理(威世博" + year + "年第" + month + "月)-v1r00";
+        //添加报告
+        ReportDTO reportDTO = new ReportDTO();
+        reportDTO.setReportName(reportName);
+        reportDTO.setArticleIds(articleIds);
+        System.out.println(articleIds.size());
+        this.addReport(reportDTO);
+
         List<ExportReportDetailVO> list = new ArrayList<>();
         List<ExportReportDetailVO> list1 = new ArrayList<>();
         List<ExportReportDetailVO> list2 = new ArrayList<>();
@@ -330,20 +345,11 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         map.put("business_list", list4);
         ReportTemple reportTemplate = reportTempleService.getById(1);
         String templateFilePath = fileUtils.getPath(reportTemplate.getTemplatePath());
-        String nowDateStr = DateUtil.getNowDateStr();
-        String year = nowDateStr.substring(0, 4);
-        String month = nowDateStr.substring(4, 6);
-        String reportName = nowDateStr + "-知识产权相关法律法规资讯整理(威世博" + year + "年第" + month + "月)-v1r00";
         //生成文档
         String fileGuid = null;
         try {
             fileGuid = this.generateReportFile(map, templateFilePath, reportName);
             //todo 后续添加导出记录
-            //添加报告
-            ReportDTO reportDTO = new ReportDTO();
-            reportDTO.setReportName(reportName);
-            reportDTO.setArticleIds(articleIds);
-            this.addReport(reportDTO);
         } catch (Exception e) {
             throw new XiaoShiException(ExceptionEnum.BUSINESS_ERROR, "导出资讯报告失败");
         }

+ 13 - 10
src/test/java/com/cslg/ppa/PpaApplicationTests.java

@@ -115,11 +115,11 @@ class PpaApplicationTests {
 
 //        getCNIPAArticleService.getCNIPA();
 
-//        getLocalInformationService.getLocalInformation();
+        getLocalInformationService.getLocalInformation();
 
 //        getPCTArticleService.getPCTArticle();
 
-        getWeChatArticleService.getWeChatArticle();
+//        getWeChatArticleService.getWeChatArticle();
 
 //        final String digest = getCNIPAArticleService.getDigest("");
 //        final Date yesterdayDate = DateUtil.getYesterdayDate();
@@ -413,19 +413,22 @@ class PpaApplicationTests {
 
     @Test
     void test1() {
-//        final String firstDayOfMonthStr = DateUtil.getFirstDayOfMonthStr();
-//        final String lastDayOfMonthStr = DateUtil.getLastDayOfMonthStr();
-//
+        final String firstDayOfMonthStr = DateUtil.getFirstDayOfMonthStr();
+        final String lastDayOfMonthStr = DateUtil.getLastDayOfMonthStr();
+        System.out.println("---------");
 //        OneClickExportDTO vo = new OneClickExportDTO();
 //        vo.setBeginTime(DateUtil.getFirstDayOfMonthStr());
 //        vo.setEndTime(DateUtil.getLastDayOfMonthStr());
 //        List<OneClickExportVO> articleVOS = articleInfoMapper.selectArticleList(vo);
 //        System.out.println(articleVOS);
+//
+//        final String yesterdayDateStr = DateUtil.getYesterdayDateStr();
+//        String nowDateStr = DateUtil.getNowDateStr();
+//        String year = nowDateStr.substring(0, 4);
+//        String month = nowDateStr.substring(4, 6);
+//        String reportName = nowDateStr + "-知识产权相关法律法规资讯整理(威世博" + year + "年第" + month + "月)-v1r00";
+//        System.out.println(reportName);
+
 
-        String nowDateStr = DateUtil.getNowDateStr();
-        String year = nowDateStr.substring(0, 4);
-        String month = nowDateStr.substring(4, 6);
-        String reportName = nowDateStr + "-知识产权相关法律法规资讯整理(威世博" + year + "年第" + month + "月)-v1r00";
-        System.out.println(reportName);
     }
 }