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)) {//当年