diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java new file mode 100644 index 0000000000..894e6e3d7d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.org; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 网格基本信息 + * + * @author yinzuomei@elink-cn.com + * @date 2020/9/16 14:00 + */ +@Data +public class GridInfoDTO implements Serializable { + private static final long serialVersionUID = -5328705277000477630L; + /** + * 话题所属的网格ID + */ + private String gridId; + + /** + * 所属机关ID 发布单位所属机关ID + */ + private String agencyId; + + /** + * agencyId的上一级组织id + */ + private String pid; + + /** + * 客户id + */ + private String customerId; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/TopicOriginInfoDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/TopicOriginInfoDTO.java index 932cdb4284..6ba7b323da 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/TopicOriginInfoDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/topic/TopicOriginInfoDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.topic; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** * 原始话题相关信息 @@ -14,6 +15,68 @@ import java.io.Serializable; public class TopicOriginInfoDTO implements Serializable { private static final long serialVersionUID = -182136873047614269L; + /** + * 话题id + */ + private String topicId; + + /** + * 操作类型(发布 - discussing 、 屏蔽 - hidden、 取消屏蔽 - hidden_cancelled、 关闭话题 - closed) + * 补充 转议题:shift_issue 、评论话题:comment + */ + private String actionCode; + + /** + * 本条记录的操作人 resi_topic_operation.CREATED_BY + */ + private String operateUserId; + + /** + * 用户操作时间 resi_topic_operation.CREATED_TIME 对应的yyyyMMdd + */ + private String dateId; + + /** + * 用户操作时间 resi_topic_operation.CREATED_TIME 对应的yyyyMM + */ + private String monthId; + + /** + * 用户操作时间 resi_topic_operation.CREATED_TIME 对应的yyyy + */ + private String yearId; + + /** + * 用户操作时间 resi_topic_operation.CREATED_TIME + */ + private Date originalBusinessTime; + + /** + * 话题状态(讨论中 - discussing、 已屏蔽 - hidden、 已关闭 - closed) + */ + private String groupId; + + /** + * 话题的状态 + */ + private String topicStatus; + + /** + * 话题关闭时的状态:已解决 resolved,未解决 unresolved + */ + private String closedStatus; + + /** + * 网格id ( 其实就是小组所属的网格id) + */ + private String gridId; + + /** + * 客户id + */ + private String customerId; + + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectActionConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectActionConstant.java new file mode 100644 index 0000000000..660cbf4e4b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectActionConstant.java @@ -0,0 +1,14 @@ +package com.epmet.constant; + +/** + * 对象行为动作维度表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/9/16 10:13 + */ +public interface DimObjectActionConstant { + /** + * 发布话题 + */ + String TOPIC_PUBLISH="disscussing"; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectStatusConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectStatusConstant.java new file mode 100644 index 0000000000..5ceae84d44 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/DimObjectStatusConstant.java @@ -0,0 +1,10 @@ +package com.epmet.constant; + +/** + * 对象行为状态维度表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/9/16 10:14 + */ +public interface DimObjectStatusConstant { +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginController.java index 1d98f65935..30fb66b1a9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginController.java @@ -49,7 +49,6 @@ public class FactOriginController { public Result topicDataCleaning(String customerId, String dateId) { if (StringUtils.isNotBlank(customerId) && StringUtils.isNotBlank(dateId)) { factOriginTopicMainDailyService.topicCleaning(customerId,dateId); - factOriginTopicMainDailyService.topicCommentCleaning(customerId,dateId); } return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java index 60f1ddb2a3..ef66cc0c73 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicLogDailyDao.java @@ -20,6 +20,9 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.evaluationindex.extract.FactOriginTopicLogDailyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 话题明细_日统计 @@ -29,5 +32,24 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactOriginTopicLogDailyDao extends BaseDao { - + /** + * @return int + * @param customerId + * @param dateId + * @param deleteSize + * @author yinzuomei + * @description 批量删除 + * @Date 2020/9/16 12:54 + **/ + int deleteByDateIdAndCustomerId(@Param("customerId") String customerId, + @Param("dateId") String dateId, + @Param("deleteSize") Integer deleteSize); + /** + * @return int + * @param list + * @author yinzuomei + * @description 批量插入 + * @Date 2020/9/16 12:54 + **/ + int insertBatchEntity(@Param("list") List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java index 980560c32e..26738dc2b3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginTopicMainDailyDao.java @@ -20,6 +20,9 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.evaluationindex.extract.FactOriginTopicMainDailyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 话题主表_日统计 @@ -29,5 +32,26 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface FactOriginTopicMainDailyDao extends BaseDao { - + + /** + * @param customerId + * @param dateId + * @param deleteSize + * @return int + * @author yinzuomei + * @description 批量删除 + * @Date 2020/9/16 11:16 + **/ + int deleteByDateIdAndCustomerId(@Param("customerId") String customerId, + @Param("dateId") String dateId, + @Param("deleteSize") Integer deleteSize); + + /** + * @return int + * @param list + * @author yinzuomei + * @description 批量插入 + * @Date 2020/9/16 12:48 + **/ + int insertBatchEntity(@Param("list") List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java index 9f26b8b98d..b8d9093631 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -67,4 +68,13 @@ public interface CustomerGridDao extends BaseDao { * @return */ List listUpdatedGridsByUpdateTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 查询客户下的网格的agencyId, 还有pid + * @Date 2020/9/16 14:03 + **/ + List selectListGridInfo(String customerId); } \ 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 42e9f83233..b317ee0d7c 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 @@ -72,8 +72,9 @@ public interface TopicDao { * @param customerId * @param dateId yyyyMMdd * @author yinzuomei - * @description 根据日期查询resi_topic_operation,返回所有对话体的操作记录 + * @description 根据日期查询resi_topic_operation,返回当前日期这一天内所有话题相关的操作记录 * @Date 2020/9/15 18:14 **/ - List selectTopicOriginInfo(@Param("customerId")String customerId, @Param("dateId")String dateId); + List selectListTopicOriginInfo(@Param("customerId")String customerId, @Param("dateId")String dateId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicLogDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicLogDailyEntity.java index 9e67eeec59..a1da41988a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicLogDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicLogDailyEntity.java @@ -93,11 +93,6 @@ public class FactOriginTopicLogDailyEntity extends BaseEpmetEntity { */ private String groupId; - /** - * 话题状态 来自dim_object_status表 - */ - private String topicStatus; - /** * 行为code 来自dim_object_action表 */ @@ -111,7 +106,7 @@ public class FactOriginTopicLogDailyEntity extends BaseEpmetEntity { /** * 本条数据操作用户是否是党员, 1是0不是 */ - private String operateUserIsParty; + private Boolean operateUserIsParty; /** * 原始业务发生时间 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicMainDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicMainDailyEntity.java index 92b03d933e..39e5304527 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicMainDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginTopicMainDailyEntity.java @@ -101,6 +101,6 @@ public class FactOriginTopicMainDailyEntity extends BaseEpmetEntity { /** * 话题发布人是否是党员:1是党员0不是。 默认0 */ - private Integer createTopicUserIsParty; + private Boolean createTopicUserIsParty; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicMainDailyService.java index 1fef99bf21..cb68dadf3c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginTopicMainDailyService.java @@ -42,14 +42,5 @@ public interface FactOriginTopicMainDailyService extends BaseService implements FactOriginTopicMainDailyService { @Autowired private TopicService topicService; - + @Autowired + private CustomerGridService customerGridService; + @Autowired + private FactOriginTopicLogDailyDao factOriginTopicLogDailyDao; /** * @param customerId 客户id @@ -55,28 +71,142 @@ public class FactOriginTopicMainDailyServiceImpl extends BaseServiceImpl topicOriginInfoList = topicService.queryTopicOriginInfoList(customerId, dateId); if (CollectionUtils.isEmpty(topicOriginInfoList)) { log.info(String.format("customerId%s,dateId%s,doesn't have any topic operation record",customerId,dateId)); return true; } - + Map gridMap=getGridInfoMap(customerId); + Map map=this.constructFactOriginData(topicOriginInfoList,gridMap); + List mainDailyEntityList= (List) map.get("main"); + List logDailyEntityList= (List) map.get("log"); + //删除之前统计的数据 + deleteFactOriginData(customerId,dateId); + //批量保存主表 + saveFactOriginTopicMainDailyEntity(mainDailyEntityList); + //批量保存明细表 + saveFactOriginTopicLogDailyEntity(logDailyEntityList); return true; } + private Map getGridInfoMap(String customerId) { + Map map=new HashMap<>(); + List list=customerGridService.queryGridInfoList(customerId); + if(!CollectionUtils.isEmpty(list)){ + return list.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, gridInfoDTO -> gridInfoDTO)); + } + return map; + } + + /** - * @param customerId 客户id - * @param dateId yyyyMMdd - * @return java.lang.Boolean + * @return void + * @param mainDailyEntityList * @author yinzuomei - * @description 数据采集:话题的评论 - * @Date 2020/9/15 17:56 + * @description 批量插入 fact_origin_topic_main_daily + * @Date 2020/9/16 11:21 **/ - @Override - public Boolean topicCommentCleaning(String customerId, String dateId) { - //TODO - return true; + private void saveFactOriginTopicMainDailyEntity(List mainDailyEntityList) { + //批量插入 + List> partition = ListUtils.partition(mainDailyEntityList, IndexCalConstant.INSERT_SIZE); + partition.forEach(list -> { + baseDao.insertBatchEntity(list); + }); } + /** + * @return void + * @param logDailyEntityList + * @author yinzuomei + * @description 批量插入fact_origin_topic_log_daily + * @Date 2020/9/16 12:53 + **/ + private void saveFactOriginTopicLogDailyEntity(List logDailyEntityList) { + //批量插入 + List> partition = ListUtils.partition(logDailyEntityList, IndexCalConstant.INSERT_SIZE); + partition.forEach(list -> { + factOriginTopicLogDailyDao.insertBatchEntity(list); + }); + } + + /** + * @return java.util.Map + * @param topicOriginInfoList + * @author yinzuomei + * @description 构造好要插入的数据 + * @Date 2020/9/16 11:21 + **/ + private Map constructFactOriginData(List topicOriginInfoList,Map gridMap) { + Map map=new HashMap<>(); + List mainDailyEntityList=new ArrayList<>(); + List logDailyEntityList=new ArrayList<>(); + for(TopicOriginInfoDTO topicOriginInfoDTO:topicOriginInfoList){ + GridInfoDTO gridInfoDTO=gridMap.get(topicOriginInfoDTO.getGridId()); + if(null==gridInfoDTO){ + log.error("没有找到 gridId="+topicOriginInfoDTO.getGridId()+" 的基本信息"); + continue; + } + // 一年的第几周 + String weekId = DateUtils.format(topicOriginInfoDTO.getOriginalBusinessTime(), DateUtils.DATE_PATTERN_YYYY).concat("W").concat(String.valueOf(DateUtils.getWeekOfYear(topicOriginInfoDTO.getOriginalBusinessTime()))); + String quarterId=DateUtils.getQuarterId(topicOriginInfoDTO.getMonthId()); + if(DimObjectActionConstant.TOPIC_PUBLISH.equals(topicOriginInfoDTO.getActionCode())){ + //如果是新发布的话题需要插入主表 + FactOriginTopicMainDailyEntity mainDailyEntity=ConvertUtils.sourceToTarget(topicOriginInfoDTO, FactOriginTopicMainDailyEntity.class); + mainDailyEntity.setId(topicOriginInfoDTO.getTopicId()); + mainDailyEntity.setWeekId(weekId); + mainDailyEntity.setQuarterId(quarterId); + mainDailyEntity.setCreateTopicUserId(topicOriginInfoDTO.getOperateUserId()); + //网格所属的组织id + mainDailyEntity.setAgencyId(gridInfoDTO.getAgencyId()); + //网格的上上级组织id=街道id + mainDailyEntity.setPid(gridInfoDTO.getPid()); + //TODO + //话题发布人是否是党员:1是党员0不是。 默认0 + mainDailyEntity.setCreateTopicUserIsParty(false); + + mainDailyEntityList.add(mainDailyEntity); + } + FactOriginTopicLogDailyEntity logDailyEntity= ConvertUtils.sourceToTarget(topicOriginInfoDTO, FactOriginTopicLogDailyEntity.class); + logDailyEntity.setCustomerId(topicOriginInfoDTO.getCustomerId()); + logDailyEntity.setGridId(topicOriginInfoDTO.getGridId()); + logDailyEntity.setWeekId(weekId); + logDailyEntity.setQuarterId(quarterId); + logDailyEntity.setAgencyId(gridInfoDTO.getAgencyId()); + logDailyEntity.setPid(gridInfoDTO.getPid()); + //TODO + logDailyEntity.setOperateUserIsParty(false); + logDailyEntityList.add(logDailyEntity); + } + map.put("main",mainDailyEntityList); + map.put("log",logDailyEntityList); + return map; + } + + /** + * @return void + * @param customerId + * @param dateId + * @author yinzuomei + * @description 删除之前统计过的数据 + * @Date 2020/9/16 11:21 + **/ + private void deleteFactOriginData(String customerId, String dateId) { + int mainDeleteNum; + do { + //一次删除50条 + mainDeleteNum = baseDao.deleteByDateIdAndCustomerId(customerId, + dateId, + IndexCalConstant.DELETE_SIZE); + } while (mainDeleteNum > NumConstant.ZERO); + int logDeleteNum; + do { + //一次删除50条 + logDeleteNum = factOriginTopicLogDailyDao.deleteByDateIdAndCustomerId(customerId, + dateId, + IndexCalConstant.DELETE_SIZE); + } while (logDeleteNum > NumConstant.ZERO); + } + + + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java index b2b7a5b129..2cdee8ccad 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java @@ -3,6 +3,7 @@ package com.epmet.service.org; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import java.util.Date; @@ -40,4 +41,13 @@ public interface CustomerGridService { * @return */ List listUpdatedGridsByUpdateTime(Date lastInitTime, Date now); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 查询客户下的网格的agencyId, 还有pid + * @Date 2020/9/16 14:02 + **/ + List queryGridInfoList(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index 5bab5596a7..fa8018e1e1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -6,6 +6,7 @@ import com.epmet.dao.org.CustomerGridDao; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridTotalCountResultDTO; import com.epmet.dto.group.result.GridIdListByCustomerResultDTO; +import com.epmet.dto.org.GridInfoDTO; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.service.org.CustomerGridService; import org.springframework.beans.factory.annotation.Autowired; @@ -51,4 +52,16 @@ public class CustomerGridServiceImpl implements CustomerGridService { public List listUpdatedGridsByUpdateTime(Date lastInitTime, Date now) { return customerGridDao.listUpdatedGridsByUpdateTime(lastInitTime, now); } + + /** + * @param customerId + * @return java.util.List + * @author yinzuomei + * @description 查询客户下的网格的agencyId, 还有pid + * @Date 2020/9/16 14:02 + **/ + @Override + public List queryGridInfoList(String customerId) { + return customerGridDao.selectListGridInfo(customerId); + } } 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 c32d3180ae..6c80ecd8cf 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 @@ -108,6 +108,8 @@ public class TopicServiceImpl implements TopicService { return topicDao.selectTopicInfo(topicIds); } + + /** * @Description 初始化机关-所有下级网格Map * @param pid - 固定一个机关Id @@ -1276,12 +1278,12 @@ public class TopicServiceImpl implements TopicService { * @param dateId * @return java.util.List * @author yinzuomei - * @description 根据日期查询resi_topic_operation,返回所有对话体的操作记录 + * @description 根据日期查询resi_topic_operation,返回所有对话题操作记录 * @Date 2020/9/15 18:13 **/ @DataSource(DataSourceConstant.RESI_GROUP) @Override public List queryTopicOriginInfoList(String customerId, String dateId) { - return topicDao.selectTopicOriginInfo(customerId, dateId); + return topicDao.selectListTopicOriginInfo(customerId, dateId); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml index 3c92cd5651..3efebcd69f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicLogDailyDao.xml @@ -2,6 +2,67 @@ + + DELETE + FROM + fact_origin_topic_log_daily + WHERE + CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + LIMIT #{deleteSize} + - + + insert into fact_origin_topic_log_daily + ( + ID, + CUSTOMER_ID, + GRID_ID, + AGENCY_ID, + PID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + TOPIC_ID, + GROUP_ID, + ACTION_CODE, + OPERATE_USER_ID, + OPERATE_USER_IS_PARTY, + ORIGINAL_BUSINESS_TIME, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + #{item.id}, + #{item.customerId}, + #{item.gridId}, + #{item.agencyId}, + #{item.pid}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.topicId}, + #{item.groupId}, + #{item.actionCode}, + #{item.operateUserId}, + #{item.operateUserIsParty}, + #{item.originalBusinessTime}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml index 29e2e075f2..377f09bd45 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginTopicMainDailyDao.xml @@ -3,6 +3,63 @@ + + DELETE + FROM + fact_origin_topic_main_daily + WHERE + CUSTOMER_ID = #{customerId} + AND DATE_ID = #{dateId} + LIMIT #{deleteSize} + - + + insert into fact_origin_topic_main_daily + ( + ID, + CUSTOMER_ID, + GRID_ID, + AGENCY_ID, + PID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + GROUP_ID, + TOPIC_STATUS, + CREATE_TOPIC_USER_ID, + CREATE_TOPIC_USER_IS_PARTY, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + #{item.id}, + #{item.customerId}, + #{item.gridId}, + #{item.agencyId}, + #{item.pid}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.groupId}, + #{item.topicStatus}, + #{item.createTopicUserId}, + #{item.createTopicUserIsParty}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index 48c5176a78..c12feef84b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -68,4 +68,18 @@ WHERE UPDATED_TIME >= #{startTime} AND UPDATED_TIME #{endTime} + + \ 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 91724d7a97..3a0cc38e8b 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 @@ -146,11 +146,11 @@ ) - - SELECT rto.TOPIC_ID, - rto.OPERATION_TYPE, + rto.OPERATION_TYPE as ACTION_CODE, rto.CREATED_BY as OPERATE_USER_ID, DATE_FORMAT(rto.CREATED_TIME,'%Y%m%d') as DATE_ID, DATE_FORMAT(rto.CREATED_TIME,'%Y%m') as MONTH_ID, @@ -169,5 +169,28 @@ rto.DEL_FLAG = '0' AND DATE_FORMAT(rto.CREATED_TIME,'%Y%m%d')=#{dateId} AND RG.CUSTOMER_ID=#{customerId} + union all + SELECT + rtc.TOPIC_ID, + 'comment' as ACTION_CODE, + rtc.CREATED_BY as OPERATE_USER_ID, + DATE_FORMAT(rtc.CREATED_TIME,'%Y%m%d') as DATE_ID, + DATE_FORMAT(rtc.CREATED_TIME,'%Y%m') as MONTH_ID, + DATE_FORMAT(rtc.CREATED_TIME,'%Y') as YEAR_ID, + rtc.CREATED_TIME AS ORIGINAL_BUSINESS_TIME, + rt.GROUP_ID , + rt.STATUS as TOPIC_STATUS, + RT.CLOSED_STATUS, + rg.GRID_ID, + rg.CUSTOMER_ID + FROM + resi_topic_comment rtc + LEFT JOIN resi_topic rt ON ( rtc.TOPIC_ID = rt.id AND rt.DEL_FLAG = '0' ) + LEFT JOIN resi_group rg ON ( rt.GROUP_ID = rg.id AND rg.DEL_FLAG = '0' ) + WHERE + rtc.DEL_FLAG = '0' + AND DATE_FORMAT( rtc.CREATED_TIME, '%Y%m%d' )=#{dateId} + AND RG.CUSTOMER_ID =#{customerId} + \ No newline at end of file