diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicHotdiscussAgencyDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicHotdiscussAgencyDailyDTO.java new file mode 100644 index 0000000000..c5c5eeaa21 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicHotdiscussAgencyDailyDTO.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 热议中话题机关日统计表【热议中指的没有被关闭、屏蔽、转议题的话题】 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-17 + */ +@Data +public class FactTopicHotdiscussAgencyDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 机构ID 关联机关dm表 + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计日期 关联日期dm表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 话题总数 + */ + private Integer topicTotal; + + /** + * 话题状态【热议中:hot_discuss】 + */ + private String status; + + /** + * 状态话题数量 + */ + private Integer topicCount; + + /** + * 删除标识 + */ + private String 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-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicHotdiscussGridDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicHotdiscussGridDailyDTO.java new file mode 100644 index 0000000000..340f07dc49 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/FactTopicHotdiscussGridDailyDTO.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.stats.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 热议中话题网格日统计表【热议中指的没有被关闭、屏蔽、转议题的话题】 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-17 + */ +@Data +public class FactTopicHotdiscussGridDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 网格ID 关联网格dm表 + */ + private String gridId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 话题总数 + */ + private Integer topicTotal; + + /** + * 话题状态【热议中:hot_discuss】 + */ + private String status; + + /** + * 状态话题数量 + */ + private Integer topicCount; + + /** + * 删除标识 + */ + private String 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-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/form/TopicStatusFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/form/TopicStatusFormDTO.java new file mode 100644 index 0000000000..4fd7830330 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/form/TopicStatusFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.stats.topic.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * 热议中话题-网格、机关日统计-接口入参 + */ +@Data +public class TopicStatusFormDTO implements Serializable { + + private static final long serialVersionUID = -4527492073390715391L; + + /** + * 客户Id + */ + private String customerId = ""; + /** + * 需要执行的日期(格式:yyyyMMdd) + */ + private String dateId = ""; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/TopicListResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/TopicListResultDTO.java new file mode 100644 index 0000000000..01c5f60075 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/topic/result/TopicListResultDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto.stats.topic.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * 热议中话题-网格、机关日统计-接口返参 + */ +@Data +public class TopicListResultDTO implements Serializable { + private static final long serialVersionUID = -7427128491727512781L; + + /** + * 客户Id + */ + private String customerId; + /** + * 话题Id + */ + private String topicId; + /** + * 网格id + */ + private String gridId; + /** + * 小组Id + */ + private String groupId; + /** + * 话题状态(讨论中 - discussing、 已屏蔽 - hidden、 已关闭 - closed) + */ + private String status; + /** + * 是否转为议题,0:false,1:true + * */ + private Boolean shiftIssue; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsTopicController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsTopicController.java index e76badc8a3..6fffd887bc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsTopicController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsTopicController.java @@ -2,6 +2,8 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.group.form.GroupTotalFormDTO; +import com.epmet.dto.stats.topic.form.TopicStatusFormDTO; import com.epmet.service.StatsTopicService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -27,4 +29,25 @@ public class StatsTopicController { statsTopicService.partition(formDTO); return new Result(); } + + /** + * @Author sun + * @Description 热议中话题-网格日统计 + **/ + @PostMapping("gridtopicstatus") + public Result gridTopicStatus(@RequestBody(required = false) TopicStatusFormDTO formDTO) { + statsTopicService.gridTopicStatus(formDTO); + return new Result(); + } + + /** + * @Author sun + * @Description 热议中话题-机关日统计 + **/ + @PostMapping("agencytopicstatus") + public Result agencyTopicStatus(@RequestBody(required = false) TopicStatusFormDTO formDTO) { + statsTopicService.agencyTopicStatus(formDTO); + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTopicHotdiscussAgencyDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTopicHotdiscussAgencyDailyDao.java new file mode 100644 index 0000000000..a0ea409d91 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTopicHotdiscussAgencyDailyDao.java @@ -0,0 +1,38 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactTopicHotdiscussAgencyDailyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 热议中话题机关日统计表【热议中指的没有被关闭、屏蔽、转议题的话题】 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-17 + */ +@Mapper +public interface FactTopicHotdiscussAgencyDailyDao extends BaseDao { + + /** + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + void delTopicAgency(FactTopicHotdiscussAgencyDailyEntity delEntity); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTopicHotdiscussGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTopicHotdiscussGridDailyDao.java new file mode 100644 index 0000000000..6a2237cee6 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactTopicHotdiscussGridDailyDao.java @@ -0,0 +1,38 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.stats.FactTopicHotdiscussGridDailyEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 热议中话题网格日统计表【热议中指的没有被关闭、屏蔽、转议题的话题】 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-17 + */ +@Mapper +public interface FactTopicHotdiscussGridDailyDao extends BaseDao { + + /** + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + void delTopicGrid(FactTopicHotdiscussGridDailyEntity delEntity); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/topic/TopicDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/topic/TopicDao.java index d9b11ddc6a..4f37200359 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/topic/TopicDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/topic/TopicDao.java @@ -11,6 +11,7 @@ import com.epmet.dto.group.result.TopicContentResultDTO; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.ScreenProjectImgDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; +import com.epmet.dto.stats.topic.result.TopicListResultDTO; import com.epmet.dto.topic.ResiTopicDTO; import com.epmet.dto.extract.result.TopicInfoResultDTO; import com.epmet.dto.topic.TopicOriginInfoDTO; @@ -142,4 +143,10 @@ public interface TopicDao { List initNewScreenProjectImgData(@Param("customerId") String customerId, @Param("list") List list); ResiTopicAndImgResultDTO getTopicAndImgs(@Param("topicId") String topicId); + + /** + * @Author sun + * @Description 根据客户Id和截止日期查询话题业务数据 + **/ + List selectTopicList(@Param("customerId") String customerId, @Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactTopicHotdiscussAgencyDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactTopicHotdiscussAgencyDailyEntity.java new file mode 100644 index 0000000000..4590334147 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactTopicHotdiscussAgencyDailyEntity.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 热议中话题机关日统计表【热议中指的没有被关闭、屏蔽、转议题的话题】 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_topic_hotdiscuss_agency_daily") +public class FactTopicHotdiscussAgencyDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 机构ID 关联机关dm表 + */ + private String agencyId; + + /** + * 父级机关ID + */ + private String pid; + + /** + * 统计日期 关联日期dm表 + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 话题总数 + */ + private Integer topicTotal; + + /** + * 话题状态【热议中:hot_discuss】 + */ + private String status; + + /** + * 状态话题数量 + */ + private Integer topicCount; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactTopicHotdiscussGridDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactTopicHotdiscussGridDailyEntity.java new file mode 100644 index 0000000000..9b1fde9b74 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactTopicHotdiscussGridDailyEntity.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.stats; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 热议中话题网格日统计表【热议中指的没有被关闭、屏蔽、转议题的话题】 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_topic_hotdiscuss_grid_daily") +public class FactTopicHotdiscussGridDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 网格ID 关联网格dm表 + */ + private String gridId; + + /** + * 日期ID + */ + private String dateId; + + /** + * 周ID + */ + private String weekId; + + /** + * 月ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年ID + */ + private String yearId; + + /** + * 话题总数 + */ + private Integer topicTotal; + + /** + * 话题状态【热议中:hot_discuss】 + */ + private String status; + + /** + * 状态话题数量 + */ + private Integer topicCount; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java index 0c17e21420..8a6464c255 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsTopicService.java @@ -1,6 +1,7 @@ package com.epmet.service; import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.stats.topic.form.TopicStatusFormDTO; /** * @Description 话题统计Service接口 @@ -18,4 +19,16 @@ public interface StatsTopicService { * @date 2020.06.28 14:38 **/ void partition(StatsFormDTO formDTO); + + /** + * @Author sun + * @Description 热议中话题-网格日统计 + **/ + void gridTopicStatus(TopicStatusFormDTO formDTO); + + /** + * @Author sun + * @Description 热议中话题-机关日统计 + **/ + void agencyTopicStatus(TopicStatusFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java index 62a4950f7b..2ec8212d21 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java @@ -7,7 +7,9 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.group.form.GroupTotalFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; +import com.epmet.dto.stats.topic.form.TopicStatusFormDTO; import com.epmet.service.StatsGroupService; +import com.epmet.service.StatsTopicService; import com.epmet.service.evaluationindex.extract.todata.*; import com.epmet.service.stats.DimCustomerPartymemberService; import com.epmet.service.stats.DimCustomerService; @@ -54,6 +56,8 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { private FactGroupActDailyService factGroupActDailyService; @Autowired private StatsGroupService statsGroupService; + @Autowired + private StatsTopicService statsTopicService; @Override @@ -263,6 +267,36 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { } }); + //热议中话题网格、机关日统计 + threadPool.submit(() -> { + TopicStatusFormDTO formDTO = new TopicStatusFormDTO(); + formDTO.setCustomerId(param.getCustomerId()); + if (!isRange) { + formDTO.setDateId(param.getDateId()); + try { + statsTopicService.gridTopicStatus(formDTO); + } catch (Exception e) { + log.error("热议中话题-网格日统计计算错误,参数:" + JSON.toJSONString(formDTO), e); + } + try { + statsTopicService.agencyTopicStatus(formDTO); + } catch (Exception e) { + log.error("热议中话题-机关日统计计算错误,参数:" + JSON.toJSONString(formDTO), e); + } + } else { + try { + statsTopicService.gridTopicStatus(formDTO); + } catch (Exception e) { + log.error("热议中话题-网格日统计计算错误,参数:" + JSON.toJSONString(formDTO), e); + } + try { + statsTopicService.agencyTopicStatus(formDTO); + } catch (Exception e) { + log.error("热议中话题-机关日统计计算错误,参数:" + JSON.toJSONString(formDTO), e); + } + } + }); + submitProjectRelationData(param, finalDaysBetween); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java index f222a9ee8e..50382aa75e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java @@ -583,11 +583,11 @@ public class StatsGroupServiceImpl implements StatsGroupService { FactGroupTotalAgencyDailyEntity delEntity = new FactGroupTotalAgencyDailyEntity(); delEntity.setCustomerId(customerId); delEntity.setDateId(dimId.getDateId()); - log.info("StatsGroupServiceImpl.agencyGroupStats-根据客户Id、日维度Id批量删除小组总数网格日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); + log.info("StatsGroupServiceImpl.agencyGroupStats-根据客户Id、日维度Id批量删除小组总数机关日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); factGroupTotalAgencyDailyService.delDateGroupTotal(delEntity); - //5.2:批量保存网格日统计数据 - log.info("StatsGroupServiceImpl.agencyGroupStats-批量新增小组总数网格日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); + //5.2:批量保存机关日统计数据 + log.info("StatsGroupServiceImpl.agencyGroupStats-批量新增小组总数机关日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); factGroupTotalAgencyDailyService.insertBatch(list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java index 423c47174e..74e0c8615b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsTopicServiceImpl.java @@ -6,12 +6,15 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.ProjectConstant; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.StatsFormDTO; +import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.dto.stats.DimTopicStatusDTO; +import com.epmet.dto.stats.topic.form.TopicStatusFormDTO; +import com.epmet.dto.stats.topic.result.TopicListResultDTO; import com.epmet.dto.stats.topic.result.TopicStatisticalData; +import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; +import com.epmet.entity.stats.*; import com.epmet.service.StatsTopicService; -import com.epmet.service.stats.DimAgencyService; -import com.epmet.service.stats.DimCustomerService; -import com.epmet.service.stats.DimTopicStatusService; +import com.epmet.service.stats.*; import com.epmet.service.stats.topic.TopicStatisticalService; import com.epmet.service.topic.TopicService; import com.epmet.util.DimIdGenerator; @@ -23,7 +26,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.text.SimpleDateFormat; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; /** * @Description 话题统计Service @@ -35,21 +40,22 @@ import java.util.*; public class StatsTopicServiceImpl implements StatsTopicService { protected static final Logger log = LoggerFactory.getLogger(StatsTopicServiceImpl.class); - @Autowired private DimCustomerService dimCustomerService; - @Autowired private DimAgencyService dimAgencyService; - @Autowired private DimTopicStatusService dimTopicStatusService; - @Autowired private TopicService topicService; - @Autowired private TopicStatisticalService topicStatisticalService; + @Autowired + private DimGridService dimGridService; + @Autowired + private FactTopicHotdiscussGridDailyService factTopicHotdiscussGridDailyService; + @Autowired + private FactTopicHotdiscussAgencyDailyService factTopicHotdiscussAgencyDailyService; /** * @param formDTO 如果目标日期为空,则自动计算为T-1天 @@ -122,4 +128,232 @@ public class StatsTopicServiceImpl implements StatsTopicService { } } + + /** + * @Author sun + * @Description 热议中话题-网格日统计 + **/ + @Override + public void gridTopicStatus(TopicStatusFormDTO formDTO) { + //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 + if (StringUtils.isBlank(formDTO.getDateId())) { + Date yesterday = DateUtils.addDateDays(new Date(), -1); + SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); + formDTO.setDateId(format.format(yesterday)); + } + //入参有客户Id的则按客户Id执行,没有的则全部客户都执行 + if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) { + log.info("热议中话题网格日统计数据,当前统计的客户Id:" + formDTO.getCustomerId()); + gridTopic(formDTO.getCustomerId(), formDTO.getDateId()); + } else { + int pageNo = 1; + int pageSize = 100; + List customerIdList = null; + do { + //获取有效客户列表 + customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); + if (!CollectionUtils.isEmpty(customerIdList)) { + for (String customerId : customerIdList) { + try { + log.info("for循环统计热议中话题网格日统计数据,当前统计的客户Id:" + customerId); + //遍历统计每一个客户数据 + gridTopic(customerId, formDTO.getDateId()); + } catch (Exception e) { + log.error("热议中话题-网格日统计-程序错误,对应客户Id:" + customerId, e); + log.error("Error creating model JSON", e); + } + } + } + } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); + } + + } + + /** + * @Author sun + * @Description 热议中话题-网格日统计 + **/ + private void gridTopic(String customerId, String dateId) { + //1:查询各维度表Id,方便使用 + Date date = DateUtils.parseDate(dateId,DateUtils.DATE_PATTERN_YYYYMMDD); + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); + + //2:根据客户Id查询网格维度表数据 + log.info("StatsGroupServiceImpl.customerGridStats-根据客户Id查询网格维度数据,对应客户Id:" + customerId); + List dimGridList = dimGridService.getGridListByCustomerId(customerId); + + //3.根据客户Id查询客户下有效的话题数据,查询dateId之前的数据 + List list = topicService.getTopicList(customerId, dateId); + + //4.遍历封装数据 + List saveList = new ArrayList<>(); + dimGridList.forEach(grid->{ + FactTopicHotdiscussGridDailyEntity entity = new FactTopicHotdiscussGridDailyEntity(); + AtomicInteger total = new AtomicInteger(0); + AtomicInteger num = new AtomicInteger(0); + list.forEach(l->{ + if(grid.getId().equals(l.getGridId()) ){ + total.addAndGet(1); + if(l.getStatus().equals("discussing") && !l.getShiftIssue()){ + num.addAndGet(1); + } + } + }); + entity.setCustomerId(customerId); + entity.setAgencyId(grid.getAgencyId()); + entity.setGridId(grid.getId()); + entity.setDateId(dimId.getDateId()); + entity.setWeekId(dimId.getWeekId()); + entity.setMonthId(dimId.getMonthId()); + entity.setQuarterId(dimId.getQuarterId()); + entity.setYearId(dimId.getYearId()); + entity.setTopicTotal(total.get()); + entity.setStatus("hot_discuss"); + entity.setTopicCount(num.get()); + saveList.add(entity); + }); + + //5.批量插入数据库,先删后增的逻辑 + if (!CollectionUtils.isEmpty(saveList)) { + //5.1:根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + FactTopicHotdiscussGridDailyEntity delEntity = new FactTopicHotdiscussGridDailyEntity(); + delEntity.setCustomerId(customerId); + delEntity.setDateId(dimId.getDateId()); + factTopicHotdiscussGridDailyService.delTopicGrid(delEntity); + + //5.2:批量保存网格日统计数据 + log.info("StatsTopicServiceImpl.gridTopic-批量新增热议中话题网格日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); + factTopicHotdiscussGridDailyService.insertBatch(saveList); + } + + } + + /** + * @Author sun + * @Description 热议中话题-机关日统计 + **/ + @Override + public void agencyTopicStatus(TopicStatusFormDTO formDTO) { + //入参有日期的则按具体时间执行,没有的则按当前时间前一天执行 + if (StringUtils.isBlank(formDTO.getDateId())) { + Date yesterday = DateUtils.addDateDays(new Date(), -1); + SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); + formDTO.setDateId(format.format(yesterday)); + } + //入参有客户Id的则按客户Id执行,没有的则全部客户都执行 + if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) { + log.info("单独统计客户组织下热议中话题日统计数据,当前统计的客户Id:" + formDTO.getCustomerId()); + agencyTopic(formDTO.getCustomerId(), formDTO.getDateId()); + } else { + int pageNo = 1; + int pageSize = 100; + List customerIdList = null; + do { + customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); + if (!CollectionUtils.isEmpty(customerIdList)) { + for (String customerId : customerIdList) { + try { + log.info("for循环统计机关热议中话题日统计数据,当前统计的客户Id:" + customerId); + //遍历统计每一个客户数据 + agencyTopic(customerId, formDTO.getDateId()); + } catch (Exception e) { + log.error("热议中话题机关日统计程序错误,对应客户Id:" + customerId, e); + log.error("Error creating model JSON", e); + } + } + } + } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); + } + + } + + /** + * @Author sun + * @Description 热议中话题-机关日统计数据 + **/ + private void agencyTopic(String customerId, String dateId) { + //1:查询各维度表Id,方便使用 + Date date = DateUtils.parseDate(dateId,DateUtils.DATE_PATTERN_YYYYMMDD); + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); + + //2:根据客户Id查询机关维度表数据 + log.info("StatsTopicServiceImpl.agencyTopic-根据客户Id查询机关维度数据,对应客户Id:" + customerId); + DimAgencyDTO dimAgencyDTO = new DimAgencyDTO(); + dimAgencyDTO.setCustomerId(customerId); + List agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); + + //3.根据客户Id查询网格维度表数据 + List gridList = dimGridService.getGridListByCustomerId(customerId); + + //4..根据客户Id查询客户下有效的话题数据,查询dateId之前的数据 + List groupList = topicService.getTopicList(customerId, dateId); + + List list = new ArrayList<>(); + //5.遍历组织维度数据分别计算每个组织下话题数据 + DimIdGenerator.DimIdBean finalDimId = dimId; + agencyList.forEach(agency->{ + FactTopicHotdiscussAgencyDailyEntity entity = new FactTopicHotdiscussAgencyDailyEntity(); + //5-1.汇总组织及所有下级组织列表 + Map map = new HashMap<>(); + map.put(agency.getId(), agency.getId()); + String subPids = ((null == agency.getPids() || "".equals(agency.getPids())) ? agency.getId() : agency.getPids() + ":" + agency.getId()); + agencyList.forEach(sub -> { + if (sub.getPids().contains(subPids)) { + map.put(sub.getId(), sub.getId()); + } + }); + + //5-2.汇总组织及下级所有的网格列表 + List agencyGridList = new ArrayList<>(); + gridList.forEach(grid->{ + if (map.containsKey(grid.getAgencyId())) { + agencyGridList.add(grid.getId()); + } + }); + + AtomicInteger total = new AtomicInteger(0); + AtomicInteger num = new AtomicInteger(0); + //5-3.根据汇总的网格列表统计对应的群组数据 + agencyGridList.forEach(gridId -> { + groupList.forEach(l -> { + if (gridId.equals(l.getGridId())) { + total.addAndGet(1); + if(l.getStatus().equals("discussing") && !l.getShiftIssue()){ + num.addAndGet(1); + } + } + }); + }); + //封装数据 + entity.setCustomerId(agency.getCustomerId()); + entity.setAgencyId(agency.getId()); + entity.setPid(agency.getPid()); + entity.setDateId(finalDimId.getDateId()); + entity.setWeekId(finalDimId.getWeekId()); + entity.setMonthId(finalDimId.getMonthId()); + entity.setQuarterId(finalDimId.getQuarterId()); + entity.setYearId(finalDimId.getYearId()); + entity.setTopicTotal(total.get()); + entity.setStatus("hot_discuss"); + entity.setTopicCount(num.get()); + list.add(entity); + }); + + //6.批量插入数据库,先删后增的逻辑 + if (!CollectionUtils.isEmpty(list)) { + //5.1:根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + FactTopicHotdiscussAgencyDailyEntity delEntity = new FactTopicHotdiscussAgencyDailyEntity(); + delEntity.setCustomerId(customerId); + delEntity.setDateId(dimId.getDateId()); + log.info("StatsTopicServiceImpl.agencyTopic-根据客户Id、日维度Id批量删除热议中话题机关日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); + factTopicHotdiscussAgencyDailyService.delTopicAgency(delEntity); + + //5.2:批量保存机关日统计数据 + log.info("StatsTopicServiceImpl.agencyTopic-批量新增小组总数网格日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId()); + factTopicHotdiscussAgencyDailyService.insertBatch(list); + } + + } + + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTopicHotdiscussAgencyDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTopicHotdiscussAgencyDailyService.java new file mode 100644 index 0000000000..7e60409a73 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTopicHotdiscussAgencyDailyService.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicHotdiscussAgencyDailyDTO; +import com.epmet.entity.stats.FactTopicHotdiscussAgencyDailyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 热议中话题机关日统计表【热议中指的没有被关闭、屏蔽、转议题的话题】 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-17 + */ +public interface FactTopicHotdiscussAgencyDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-05-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-05-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicHotdiscussAgencyDailyDTO + * @author generator + * @date 2021-05-17 + */ + FactTopicHotdiscussAgencyDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-05-17 + */ + void save(FactTopicHotdiscussAgencyDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-05-17 + */ + void update(FactTopicHotdiscussAgencyDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-05-17 + */ + void delete(String[] ids); + + /** + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + void delTopicAgency(FactTopicHotdiscussAgencyDailyEntity delEntity); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTopicHotdiscussGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTopicHotdiscussGridDailyService.java new file mode 100644 index 0000000000..e7a3fbfe0a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactTopicHotdiscussGridDailyService.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.stats.topic.FactTopicHotdiscussGridDailyDTO; +import com.epmet.entity.stats.FactTopicHotdiscussGridDailyEntity; + +import java.util.List; +import java.util.Map; + +/** + * 热议中话题网格日统计表【热议中指的没有被关闭、屏蔽、转议题的话题】 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-17 + */ +public interface FactTopicHotdiscussGridDailyService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-05-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-05-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FactTopicHotdiscussGridDailyDTO + * @author generator + * @date 2021-05-17 + */ + FactTopicHotdiscussGridDailyDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-05-17 + */ + void save(FactTopicHotdiscussGridDailyDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-05-17 + */ + void update(FactTopicHotdiscussGridDailyDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-05-17 + */ + void delete(String[] ids); + + /** + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + void delTopicGrid(FactTopicHotdiscussGridDailyEntity delEntity); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTopicHotdiscussAgencyDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTopicHotdiscussAgencyDailyServiceImpl.java new file mode 100644 index 0000000000..af5f866943 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTopicHotdiscussAgencyDailyServiceImpl.java @@ -0,0 +1,109 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.stats.FactTopicHotdiscussAgencyDailyDao; +import com.epmet.dto.stats.topic.FactTopicHotdiscussAgencyDailyDTO; +import com.epmet.entity.stats.FactTopicHotdiscussAgencyDailyEntity; +import com.epmet.service.stats.FactTopicHotdiscussAgencyDailyService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 热议中话题机关日统计表【热议中指的没有被关闭、屏蔽、转议题的话题】 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-17 + */ +@Service +public class FactTopicHotdiscussAgencyDailyServiceImpl extends BaseServiceImpl implements FactTopicHotdiscussAgencyDailyService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicHotdiscussAgencyDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicHotdiscussAgencyDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicHotdiscussAgencyDailyDTO get(String id) { + FactTopicHotdiscussAgencyDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicHotdiscussAgencyDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicHotdiscussAgencyDailyDTO dto) { + FactTopicHotdiscussAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicHotdiscussAgencyDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicHotdiscussAgencyDailyDTO dto) { + FactTopicHotdiscussAgencyDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicHotdiscussAgencyDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + @Override + public void delTopicAgency(FactTopicHotdiscussAgencyDailyEntity delEntity) { + baseDao.delTopicAgency(delEntity); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTopicHotdiscussGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTopicHotdiscussGridDailyServiceImpl.java new file mode 100644 index 0000000000..697143bfd2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactTopicHotdiscussGridDailyServiceImpl.java @@ -0,0 +1,109 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.stats.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.stats.FactTopicHotdiscussGridDailyDao; +import com.epmet.dto.stats.topic.FactTopicHotdiscussGridDailyDTO; +import com.epmet.entity.stats.FactTopicHotdiscussGridDailyEntity; +import com.epmet.service.stats.FactTopicHotdiscussGridDailyService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 热议中话题网格日统计表【热议中指的没有被关闭、屏蔽、转议题的话题】 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-05-17 + */ +@Service +public class FactTopicHotdiscussGridDailyServiceImpl extends BaseServiceImpl implements FactTopicHotdiscussGridDailyService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FactTopicHotdiscussGridDailyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FactTopicHotdiscussGridDailyDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FactTopicHotdiscussGridDailyDTO get(String id) { + FactTopicHotdiscussGridDailyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FactTopicHotdiscussGridDailyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FactTopicHotdiscussGridDailyDTO dto) { + FactTopicHotdiscussGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicHotdiscussGridDailyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FactTopicHotdiscussGridDailyDTO dto) { + FactTopicHotdiscussGridDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactTopicHotdiscussGridDailyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @Author sun + * @Description 根据客户Id、日维度Id批量物理删除一下可能存在的历史数据 + **/ + @Override + public void delTopicGrid(FactTopicHotdiscussGridDailyEntity delEntity) { + baseDao.delTopicGrid(delEntity); + } + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java index 475fb886c7..78a823b155 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java @@ -6,6 +6,7 @@ import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.ScreenProjectImgDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.stats.DimTopicStatusDTO; +import com.epmet.dto.stats.topic.result.TopicListResultDTO; import com.epmet.dto.stats.topic.result.TopicStatisticalData; import com.epmet.dto.topic.ResiTopicDTO; import com.epmet.dto.topic.TopicOriginInfoDTO; @@ -116,4 +117,10 @@ public interface TopicService { * @date 2021/4/13 5:39 下午 */ ResiTopicAndImgResultDTO getTopicAndImgs(String topicId,String attachmentType); + + /** + * @Author sun + * @Description 根据客户Id和截止日期查询话题业务数据 + **/ + List getTopicList(String customerId, String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java index 0b74adba49..a47baa85bd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -14,6 +14,7 @@ import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.stats.DimTopicStatusDTO; import com.epmet.dto.stats.topic.*; import com.epmet.dto.stats.topic.result.GroupTopicData; +import com.epmet.dto.stats.topic.result.TopicListResultDTO; import com.epmet.dto.stats.topic.result.TopicStatisticalData; import com.epmet.dto.topic.ResiTopicDTO; import com.epmet.dto.topic.TopicOriginInfoDTO; @@ -1413,4 +1414,14 @@ public class TopicServiceImpl implements TopicService { public List queryTopicOriginInfoList(String customerId, String dateId) { return topicDao.selectListTopicOriginInfo(customerId, dateId); } + + /** + * @Author sun + * @Description 根据客户Id和截止日期查询话题业务数据 + **/ + @Override + public List getTopicList(String customerId, String dateId) { + return topicDao.selectTopicList(customerId, dateId); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTopicHotdiscussAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTopicHotdiscussAgencyDailyDao.xml new file mode 100644 index 0000000000..27d63b02e0 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTopicHotdiscussAgencyDailyDao.xml @@ -0,0 +1,15 @@ + + + + + + + DELETE + FROM + fact_topic_hotdiscuss_agency_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTopicHotdiscussGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTopicHotdiscussGridDailyDao.xml new file mode 100644 index 0000000000..f82d421f42 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactTopicHotdiscussGridDailyDao.xml @@ -0,0 +1,15 @@ + + + + + + + DELETE + FROM + fact_topic_hotdiscuss_grid_daily + WHERE + customer_id = #{customerId} + AND date_id = #{dateId} + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml index 8dfb2aae2e..ae18ea2b7c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml @@ -307,4 +307,23 @@ AND ATTACHMENT_TYPE = 'image' and TOPIC_ID = #{topicId} + + +