diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedAgencyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedAgencyDTO.java index 6d1144a2c8..9357d45f2d 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedAgencyDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedAgencyDTO.java @@ -33,21 +33,29 @@ public class FactPublishedAgencyDTO implements Serializable { private static final long serialVersionUID = 1L; + /** + * 机关名称 + */ + private String name; + /** + * 发文数量 + */ + private Integer value; /** - * 累计发文总数 + * 固定值:文章数量 */ - private Integer publishedTotal; + private String type="文章数量"; /** - * 发布中的文章总数 + * 机关Id */ - private Integer publishingTotal; + private String agencyId; /** - * 数据截止日期 + * 上级机关Id */ - private String dateName; + private String pid; } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedAgencyDailyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedAgencyDailyDTO.java index 50f07bcb8f..02eb3446a7 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedAgencyDailyDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedAgencyDailyDTO.java @@ -17,13 +17,13 @@ package com.epmet.publicity.dto.result; -import java.io.Serializable; -import java.util.Date; import lombok.Data; +import java.io.Serializable; + /** - * 文章发布数量【机关】日统计表 + * 文章发表数量—下级机关统计 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-06-19 @@ -33,89 +33,21 @@ public class FactPublishedAgencyDailyDTO implements Serializable { private static final long serialVersionUID = 1L; - /** - * ID ID - */ - private String id; - - /** - * 客户ID 客户ID - */ - private String customerId; - - /** - * 上级机关ID 上级机关ID - */ - private String pid; - - /** - * 机关ID - */ - private String agencyId; - - /** - * 文章累计发文数量 文章数量 - */ - private Integer articleTotalCount; /** - * 当前发文数量 当前未下线的文章数量 + * 累计发文总数 */ - private Integer articlePublishedCount; + private Integer publishedTotal; /** - * 日期ID 日期ID + * 发布中的文章总数 */ - private String dateId; + private Integer publishingTotal; /** - * 周ID 周ID eg:2020W01 = 2020年第一周 + * 数据截止日期 */ - private String weekId; + private String dateName; - /** - * 月份ID 月份ID eg:202006 = 2020年6月、2020-07 = 2020年7月 - */ - private String monthId; - - /** - * 季度ID 季度ID eg:2020Q1 = 2020年第一季度、2020Q2 = 2020年第二季度、2020Q3 = 2020年第三季度、2020Q4 = 2020年第四季度 - */ - private String quarterId; - - /** - * 年度ID 年度ID eg:2020 = 2020年、2021 = 2021年 - */ - private String yearId; - - /** - * 删除状态 - */ - private Integer delFlag; - - /** - * 乐观锁 - */ - private Integer revision; - - /** - * 创建人 - */ - private String createdBy; - - /** - * 创建时间 - */ - private Date createdTime; - - /** - * 更新人 - */ - private String updatedBy; - - /** - * 更新时间 - */ - private Date updatedTime; } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedDepartmentDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedDepartmentDTO.java index bc26c9fb50..11aa1e2cea 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedDepartmentDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedDepartmentDTO.java @@ -34,7 +34,7 @@ public class FactPublishedDepartmentDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 机关名称 + * 部门名称 */ private String name; diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedGridDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedGridDTO.java index ad8a3e6c9e..909deb2ba4 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedGridDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/publicity/dto/result/FactPublishedGridDTO.java @@ -34,7 +34,7 @@ public class FactPublishedGridDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 机关名称 + * 网格名称 */ private String name; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/publicity/PublicityController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/publicity/PublicityController.java index 9f64bec3e4..56d31b9d17 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/publicity/PublicityController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/publicity/PublicityController.java @@ -23,11 +23,13 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.publicity.dto.form.TagFormDTO; -import com.epmet.publicity.dto.result.FactPublishedAgencyDailyDTO; -import com.epmet.publicity.dto.result.FactTagAgencyDTO; +import com.epmet.publicity.dto.result.*; import com.epmet.service.publicity.PublicityService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -91,4 +93,40 @@ public class PublicityController { return new Result>().ok(publicityService.tagused(tokenDto, pageSize, type)); } + /** + * @param tokenDto 登录者token + * @Description 获取下级机关发文数 + * @author jyy + */ + @PostMapping("subagency/publishedarticle") + public Result> subagencyPublishedarticle(@LoginUser TokenDto tokenDto, @RequestBody TagFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, TagFormDTO.GroupJava.class); + String type = formDTO.getType(); + return new Result>().ok(publicityService.subagencyPublishedarticle(tokenDto, type)); + } + + /** + * @param tokenDto 登录者token + * @Description 获取直属部门发文数 + * @author jyy + */ + @PostMapping("department/publishedarticle") + public Result> departmentPublishedarticle(@LoginUser TokenDto tokenDto, @RequestBody TagFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, TagFormDTO.GroupJava.class); + String type = formDTO.getType(); + return new Result>().ok(publicityService.departmentPublishedarticle(tokenDto, type)); + } + + /** + * @param tokenDto 登录者token + * @Description 获取指数网格发文数 + * @author jyy + */ + @PostMapping("subgrid/publishedarticle") + public Result> subgridPublishedarticle(@LoginUser TokenDto tokenDto, @RequestBody TagFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, TagFormDTO.GroupJava.class); + String type = formDTO.getType(); + return new Result>().ok(publicityService.subgridPublishedarticle(tokenDto, type)); + } + } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/publicity/PublicityDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/publicity/PublicityDao.java index aa2475e2c5..33801156b9 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/publicity/PublicityDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/dao/publicity/PublicityDao.java @@ -17,8 +17,7 @@ package com.epmet.dao.publicity; -import com.epmet.publicity.dto.result.FactPublishedAgencyDailyDTO; -import com.epmet.publicity.dto.result.FactTagAgencyDTO; +import com.epmet.publicity.dto.result.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -81,5 +80,66 @@ public interface PublicityDao { * @author zxc */ List getUsedYearlyCountByTag(@Param("agencyId") String agencyId, @Param("yearId") String yearId, @Param("pageSize") Integer pageSize); + + /** + * @Description 当月———下级机发文数 + * @param agencyId,monthId 机关id,月 + * @author zxc + */ + List getSubAgencyPublishedMonth(@Param("agencyId") String agencyId, @Param("monthId") String monthId); + + /** + * @Description 当季———下级机发文数 + * @param agencyId,quarterId 机关id,季度 + * @author zxc + */ + List getSubAgencyPublishedQuarter(@Param("agencyId") String agencyId, @Param("quarterId") String quarterId); + /** + * @Description 当年———下级机发文数 + * @param agencyId,yearId 机关id,年 + * @author zxc + */ + List getSubAgencyPublishedYear(@Param("agencyId") String agencyId, @Param("yearId") String yearId); + + /** + * @Description 当月———下级部门文数 + * @param agencyId,monthId 机关id,月 + * @author zxc + */ + List getSubDepartPublishedMonth(@Param("agencyId") String agencyId, @Param("monthId") String monthId); + + /** + * @Description 当季———下级部门文数 + * @param agencyId,quarterId 机关id,季度 + * @author zxc + */ + List getSubDepartPublishedQuarter(@Param("agencyId") String agencyId, @Param("quarterId") String quarterId); + /** + * @Description 当年———下级部门文数 + * @param agencyId,yearId 机关id,年 + * @author zxc + */ + List getSubDepartPublishedYear(@Param("agencyId") String agencyId, @Param("yearId") String yearId); + + /** + * @Description 当月———下级网格文数 + * @param agencyId,monthId 机关id,月 + * @author zxc + */ + List getSubGridPublishedMonth(@Param("agencyId") String agencyId, @Param("monthId") String monthId); + + /** + * @Description 当季———下级网格文数 + * @param agencyId,quarterId 机关id,季度 + * @author zxc + */ + List getSubGridPublishedQuarter(@Param("agencyId") String agencyId, @Param("quarterId") String quarterId); + /** + * @Description 当年———下级网格文数 + * @param agencyId,yearId 机关id,年 + * @author zxc + */ + List getSubGridPublishedYear(@Param("agencyId") String agencyId, @Param("yearId") String yearId); + } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/PublicityService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/PublicityService.java index e79ed8c1d5..9eccb5b29f 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/PublicityService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/service/publicity/PublicityService.java @@ -18,9 +18,12 @@ package com.epmet.service.publicity; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.publicity.dto.result.FactPublishedAgencyDailyDTO; -import com.epmet.publicity.dto.result.FactTagAgencyDTO; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.publicity.dto.result.*; +import org.apache.commons.lang3.StringUtils; +import java.util.Date; import java.util.List; /** @@ -52,5 +55,24 @@ public interface PublicityService { */ public List tagused(TokenDto tokenDto, Integer pageSize, String type) ; + /** + * @param tokenDto type + * @Description 获取下级机关发文数 + * @author jyy + */ + public List subagencyPublishedarticle(TokenDto tokenDto, String type) ; + /** + * @param tokenDto type + * @Description 获取直属部门发文数 + * @author jyy + */ + public List departmentPublishedarticle(TokenDto tokenDto, String type); + + /** + * @param tokenDto type + * @Description 获取指数网格发文数 + * @author jyy + */ + public List subgridPublishedarticle(TokenDto tokenDto, String type); } \ No newline at end of file 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 e65b569d23..10f19b3ea0 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 @@ -19,15 +19,11 @@ package com.epmet.service.publicity.impl; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.dao.publicity.PublicityDao; import com.epmet.dto.form.LoginUserDetailsFormDTO; import com.epmet.dto.result.LoginUserDetailsResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; - - -import com.epmet.dao.publicity.PublicityDao; -import com.epmet.publicity.dto.result.FactPublishedAgencyDailyDTO; - -import com.epmet.publicity.dto.result.FactTagAgencyDTO; +import com.epmet.publicity.dto.result.*; import com.epmet.service.publicity.PublicityService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; @@ -65,7 +61,7 @@ public class PublicityServiceImpl implements PublicityService { /** * @param tokenDto,formDTO - * @Description 宣传能力—工作端—宣传能力-获取阅读最多的分类数据 + * @Description 宣传能力—工作端-获取阅读最多的分类数据 * @author jyy */ @Override @@ -81,23 +77,20 @@ public class PublicityServiceImpl implements PublicityService { return publicityDao.getViewedMonthlyCountByTag(agencyId, monthId, pageSize); } else if (StringUtils.equals("quarter", type)) {//当季 - String quarterId = strDate + "Q" + DateUtils.getQuarterIndex(date); + String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date); return publicityDao.getViewedQuarterlyCountByTag(agencyId, quarterId, pageSize); } else if (StringUtils.equals("year", type)) {//当年 - return publicityDao.getViewedYearlyCountByTag(agencyId, yearId, pageSize); } else { return null; } - - } /** * @param tokenDto pageSize type - * @Description 宣传能力—工作端—宣传能力-获取发表最多的分类数据 + * @Description 宣传能力—工作端-获取发表最多的分类数据 * @author jyy */ @Override @@ -113,18 +106,102 @@ public class PublicityServiceImpl implements PublicityService { return publicityDao.getUsedMonthlyCountByTag(agencyId, monthId, pageSize); } else if (StringUtils.equals("quarter", type)) {//当季 - String quarterId = strDate + "Q" + DateUtils.getQuarterIndex(date); + String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date); return publicityDao.getUsedQuarterlyCountByTag(agencyId, quarterId, pageSize); } else if (StringUtils.equals("year", type)) {//当年 - return publicityDao.getUsedYearlyCountByTag(agencyId, yearId, pageSize); } else { return null; } + } + + /** + * @param tokenDto type + * @Description 获取下级机关发文数 + * @author jyy + */ + @Override + public List subagencyPublishedarticle(TokenDto tokenDto, String type) { +// String agencyId = this.getLoginUserDetails(tokenDto); + String agencyId = "1041fe5e8499dbd8add314291d2f6da4"; + Date date = new Date(); + String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); + String yearId = strDate.substring(0, 4); + String monthId = strDate.substring(0, 6); + + if (StringUtils.equals("month", type)) {//当月 + return publicityDao.getSubAgencyPublishedMonth(agencyId, monthId); + + } else if (StringUtils.equals("quarter", type)) {//当季 + String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date); + return publicityDao.getSubAgencyPublishedQuarter(agencyId, quarterId); + + } else if (StringUtils.equals("year", type)) {//当年 + return publicityDao.getSubAgencyPublishedYear(agencyId, yearId); + + } else { + return null; + } + } + + /** + * @param tokenDto type + * @Description 获取直属部门发文数 + * @author jyy + */ + @Override + public List departmentPublishedarticle(TokenDto tokenDto, String type) { +// String agencyId = this.getLoginUserDetails(tokenDto); + String agencyId = "0d2ffe9fce682b602b9d451226d08fae"; + Date date = new Date(); + String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); + String yearId = strDate.substring(0, 4); + String monthId = strDate.substring(0, 6); + + if (StringUtils.equals("month", type)) {//当月 + return publicityDao.getSubDepartPublishedMonth(agencyId, monthId); + + } else if (StringUtils.equals("quarter", type)) {//当季 + String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date); + return publicityDao.getSubDepartPublishedQuarter(agencyId, quarterId); + + } else if (StringUtils.equals("year", type)) {//当年 + return publicityDao.getSubDepartPublishedYear(agencyId, yearId); + + } else { + return null; + } + } + /** + * @param tokenDto type + * @Description 获取指数网格发文数 + * @author jyy + */ + @Override + public List subgridPublishedarticle(TokenDto tokenDto, String type) { +// String agencyId = this.getLoginUserDetails(tokenDto); + String agencyId = "0d2ffe9fce682b602b9d451226d08fae"; + Date date = new Date(); + String strDate = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMMDD); + String yearId = strDate.substring(0, 4); + String monthId = strDate.substring(0, 6); + + if (StringUtils.equals("month", type)) {//当月 + return publicityDao.getSubGridPublishedMonth(agencyId, monthId); + + } else if (StringUtils.equals("quarter", type)) {//当季 + String quarterId = yearId + "Q" + DateUtils.getQuarterIndex(date); + return publicityDao.getSubGridPublishedQuarter(agencyId, quarterId); + + } else if (StringUtils.equals("year", type)) {//当年 + return publicityDao.getSubGridPublishedYear(agencyId, yearId); + } else { + return null; + } } /** diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/publicity/PublicityDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/publicity/PublicityDao.xml index 73ec0850fb..ccd4fb657e 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/publicity/PublicityDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/publicity/PublicityDao.xml @@ -8,7 +8,7 @@ SELECT article_total_count AS publishedTotal, article_published_count AS publishingTotal, - DATE_FORMAT( date_id, '%Y-%m-%d' ) AS dateName + DATE_FORMAT( date_id, '%Y.%m.%d' ) AS dateName FROM fact_article_published_agency_daily where agency_id = #{agencyId} @@ -74,8 +74,7 @@ - SELECT tag_name AS name, agency_id AS agencyId, @@ -90,8 +89,7 @@ - SELECT tag_name AS name, agency_id AS agencyId, @@ -104,4 +102,161 @@ ORDER BY value DESC LIMIT #{pageSize} + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file