From 5385badfb783cc7ecb0c94ebf60a8bdc5564a66f Mon Sep 17 00:00:00 2001 From: jiangyuying Date: Wed, 1 Jul 2020 09:57:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A3=E4=BC=A0=E8=83=BD=E5=8A=9B--=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=97=B6=E9=97=B4=E4=B8=BAt-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../publicity/impl/PublicityServiceImpl.java | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java index 990cc97916..902bfdee3f 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/impl/PublicityServiceImpl.java @@ -45,6 +45,8 @@ public class PublicityServiceImpl implements PublicityService { private PublicityDao publicityDao;//机关每日发文 @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + private Date dateFact = DateUtils.addDateDays( new Date(),-1); + /** * @param tokenDto @@ -66,16 +68,15 @@ public class PublicityServiceImpl implements PublicityService { @Override public List tagviewed(TokenDto tokenDto, Integer pageSize, String type) { String agencyId = this.getLoginUserDetails(tokenDto); - Date date = new Date(); - String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN); + String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD); String yearId = strDate.substring(0, 4); + String monthId = strDate.substring(0, 6); if (StringUtils.equals("month", type)) {//当月 - String monthId = strDate.substring(0, 4) + strDate.substring(5, 7); return publicityDao.getViewedMonthlyCountByTag(agencyId, monthId, pageSize); } else if (StringUtils.equals("quarter", type)) {//当季 - String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date); + String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact); return publicityDao.getViewedQuarterlyCountByTag(agencyId, quarterId, pageSize); } else if (StringUtils.equals("year", type)) {//当年 @@ -94,16 +95,15 @@ public class PublicityServiceImpl implements PublicityService { @Override public List tagused(TokenDto tokenDto, Integer pageSize, String type) { String agencyId = this.getLoginUserDetails(tokenDto); - Date date = new Date(); - String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN); + String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD); String yearId = strDate.substring(0, 4); + String monthId = strDate.substring(0, 6); if (StringUtils.equals("month", type)) {//当月 - String monthId = strDate.substring(0, 4) + strDate.substring(5, 7); return publicityDao.getUsedMonthlyCountByTag(agencyId, monthId, pageSize); } else if (StringUtils.equals("quarter", type)) {//当季 - String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date); + String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact); return publicityDao.getUsedQuarterlyCountByTag(agencyId, quarterId, pageSize); } else if (StringUtils.equals("year", type)) {//当年 @@ -122,8 +122,8 @@ public class PublicityServiceImpl implements PublicityService { @Override public List subagencyPublishedarticle(TokenDto tokenDto, String type) { String agencyId = this.getLoginUserDetails(tokenDto); - Date date = new Date(); - String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); +// Date date = new Date(); + String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD); String yearId = strDate.substring(0, 4); String monthId = strDate.substring(0, 6); @@ -131,7 +131,7 @@ public class PublicityServiceImpl implements PublicityService { return publicityDao.getSubAgencyPublishedMonth(agencyId, monthId); } else if (StringUtils.equals("quarter", type)) {//当季 - String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date); + String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact); return publicityDao.getSubAgencyPublishedQuarter(agencyId, quarterId); } else if (StringUtils.equals("year", type)) {//当年 @@ -150,8 +150,8 @@ public class PublicityServiceImpl implements PublicityService { @Override public List departmentPublishedarticle(TokenDto tokenDto, String type) { String agencyId = this.getLoginUserDetails(tokenDto); - Date date = new Date(); - String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); +// Date date = new Date(); + String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD); String yearId = strDate.substring(0, 4); String monthId = strDate.substring(0, 6); @@ -159,7 +159,7 @@ public class PublicityServiceImpl implements PublicityService { return publicityDao.getSubDepartPublishedMonth(agencyId, monthId); } else if (StringUtils.equals("quarter", type)) {//当季 - String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date); + String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact); return publicityDao.getSubDepartPublishedQuarter(agencyId, quarterId); } else if (StringUtils.equals("year", type)) {//当年 @@ -178,8 +178,8 @@ public class PublicityServiceImpl implements PublicityService { @Override public List subgridPublishedarticle(TokenDto tokenDto, String type) { String agencyId = this.getLoginUserDetails(tokenDto); - Date date = new Date(); - String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); +// Date date = new Date(); + String strDate = DateUtils.format(dateFact, DateUtils.DATE_PATTERN_YYYYMMDD); String yearId = strDate.substring(0, 4); String monthId = strDate.substring(0, 6); @@ -187,7 +187,7 @@ public class PublicityServiceImpl implements PublicityService { return publicityDao.getSubGridPublishedMonth(agencyId, monthId); } else if (StringUtils.equals("quarter", type)) {//当季 - String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date); + String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(dateFact); return publicityDao.getSubGridPublishedQuarter(agencyId, quarterId); } else if (StringUtils.equals("year", type)) {//当年