diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueProcessInfoResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueProcessInfoResultDTO.java new file mode 100644 index 0000000000..5d9bbb0cf2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/IssueProcessInfoResultDTO.java @@ -0,0 +1,45 @@ +package com.epmet.dto.extract.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/9/16 1:27 下午 + */ +@Data +public class IssueProcessInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 104679947108492259L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 动作CODE + */ + private String actionCode; + + /** + * 用户ID + */ + private String userId; +} 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 30f1d9bc06..30f0ed324f 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 @@ -2,7 +2,12 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.service.evaluationindex.extract.IssueExtractService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import com.epmet.service.evaluationindex.extract.FactOriginTopicMainDailyService; import org.apache.commons.lang3.StringUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.epmet.service.evaluationindex.extract.FactOriginTopicMainDailyService; @@ -25,11 +30,19 @@ public class FactOriginController { @Autowired private FactOriginTopicMainDailyService factOriginTopicMainDailyService; - @PostMapping("issueextract") - public Result issueExtract(){ + @PostMapping("issueextractmain") + public Result issueExtractMain(){ + String customerId = "3ef7e4bb195eb9e622d68b52509aa940"; + String dateId = "20200811"; + issueExtractService.issueExtractMain(customerId,dateId); + return new Result(); + } + + @PostMapping("issueextractlog") + public Result issueExtractLog(){ String customerId = "3ef7e4bb195eb9e622d68b52509aa940"; String dateId = "20200811"; - issueExtractService.issueExtract(customerId,dateId); + issueExtractService.issueExtractLog(customerId,dateId); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java index eee5e51287..a98372928e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java @@ -42,4 +42,13 @@ public interface FactOriginIssueLogDailyDao extends BaseDao issueLogList); + /** + * @Description 删除旧的记录 + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/16 9:33 上午 + */ + void deleteOldLogRecord(@Param("customerId")String customerId,@Param("dateId")String dateId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java index ddfc9134e6..1866a593a5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueMainDailyDao.java @@ -49,5 +49,5 @@ public interface FactOriginIssueMainDailyDao extends BaseDao { */ List selectIssueProjectList(@Param("customerId") String customerId); + /** + * @Description 查询议题信息 + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/15 2:28 下午 + */ List selectIssueInfo(@Param("customerId")String customerId, @Param("dateId")String dateId); + + /** + * @Description 查询议题process信息 + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/16 1:48 下午 + */ + List selectIssueProcessInfo(@Param("customerId")String customerId, @Param("dateId")String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java index ea2d98a94b..9fe7edf6d9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java @@ -1,5 +1,6 @@ package com.epmet.service.Issue; +import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.dto.issue.IssueGridDTO; import com.epmet.dto.issue.IssueProjectDTO; @@ -119,4 +120,13 @@ public interface IssueService { * @date 2020/9/15 2:28 下午 */ List selectIssueInfo(String customerId,String dateId); + + /** + * @Description 查询议题process信息 + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/16 1:48 下午 + */ + List selectIssueProcessInfo(String customerId,String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java index 88e82eb9f2..aaa6c3844d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java @@ -3,6 +3,7 @@ package com.epmet.service.Issue.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.issue.StatsIssueDao; +import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.dto.issue.IssueGridDTO; import com.epmet.dto.issue.IssueProjectDTO; @@ -93,4 +94,16 @@ public class IssueServiceImpl implements IssueService { public List selectIssueInfo(String customerId,String dateId) { return statsIssueDao.selectIssueInfo(customerId, dateId); } + + /** + * @Description 查询议题process信息 + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/16 1:48 下午 + */ + @Override + public List selectIssueProcessInfo(String customerId, String dateId) { + return statsIssueDao.selectIssueProcessInfo(customerId, dateId); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java index 8731b47e9b..97373f53e2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/IssueExtractService.java @@ -7,12 +7,20 @@ package com.epmet.service.evaluationindex.extract; public interface IssueExtractService { /** - * @Description 议题抽取 + * @Description 议题抽取(main) * @param customerId * @param dateId * @author zxc * @date 2020/9/15 2:02 下午 */ - Boolean issueExtract(String customerId,String dateId); + Boolean issueExtractMain(String customerId, String dateId); + /** + * @Description 议题抽取(log) + * @param customerId + * @param dateId + * @author zxc + * @date 2020/9/16 9:41 上午 + */ + Boolean issueExtractLog(String customerId,String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java index 6e6ac11bd2..4cbef41109 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/IssueExtractServiceImpl.java @@ -1,15 +1,19 @@ package com.epmet.service.evaluationindex.extract.impl; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.dto.form.TimeListResultDTO; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.extract.FactOriginIssueLogDailyDao; import com.epmet.dao.evaluationindex.extract.FactOriginIssueMainDailyDao; import com.epmet.dao.stats.DimAgencyDao; -import com.epmet.dto.extract.FactOriginIssueMainDailyDTO; +import com.epmet.dto.extract.form.IssueLogDailyFormDTO; import com.epmet.dto.extract.form.IssueMainDailyFormDTO; import com.epmet.dto.extract.result.AgencyInfoResultDTO; import com.epmet.dto.extract.result.IssueInfoResultDTO; +import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; import com.epmet.dto.extract.result.TopicInfoResultDTO; import com.epmet.service.Issue.IssueService; import com.epmet.service.evaluationindex.extract.IssueExtractService; @@ -44,6 +48,8 @@ public class IssueExtractServiceImpl implements IssueExtractService { private TopicService topicService; @Autowired private DimAgencyDao dimAgencyDao; + @Autowired + private FactOriginIssueLogDailyDao issueLogDailyDao; /** * @Description 议题抽取 @@ -54,7 +60,7 @@ public class IssueExtractServiceImpl implements IssueExtractService { */ @Override @Transactional(rollbackFor = Exception.class) - public Boolean issueExtract(String customerId, String dateId) { + public Boolean issueExtractMain(String customerId, String dateId) { // 议题信息查询 List listResult = issueService.selectIssueInfo(customerId, dateId); @@ -125,9 +131,62 @@ public class IssueExtractServiceImpl implements IssueExtractService { } }); }); - issueMainDailyDao.deleteOldRecord(customerId, dateId); + issueMainDailyDao.deleteOldMainRecord(customerId, dateId); issueMainDailyDao.insertIssueMainList(result); return true; } + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean issueExtractLog(String customerId, String dateId) { + + // 查询议题process + List listResult = issueService.selectIssueProcessInfo(customerId, dateId); + if (CollectionUtils.isEmpty(listResult)){ + throw new RenException("查询查询议题process集合为空"); + } + List result = new ArrayList<>(); + listResult.forEach(issueProcess -> { + IssueLogDailyFormDTO issueLogDailyFormDTO = ConvertUtils.sourceToTarget(issueProcess, IssueLogDailyFormDTO.class); + issueLogDailyFormDTO.setOperationUserId(issueProcess.getUserId()); + result.add(issueLogDailyFormDTO); + }); + + // 动作操作人的身份标识是否是党员 + List userIds = listResult.stream().map(issue -> issue.getUserId()).distinct().collect(Collectors.toList()); + Map map = userService.selectUserIsParty(userIds); + if (null != map){ + result.forEach(r -> { + map.forEach((userId,isParty) -> { + if (r.getOperationUserId().equals(userId)){ + r.setIsParty(isParty); + } + }); + }); + } + + // 上级ID + List agencyIds = listResult.stream().map(process -> process.getAgencyId()).distinct().collect(Collectors.toList()); + List agencyInfoList = dimAgencyDao.selectAgencyInfo(agencyIds); + if (CollectionUtils.isEmpty(agencyInfoList)){ + throw new RenException("查询组织上级ID集合为空......"); + } + TimeListResultDTO timeList = DateUtils.getTimeList(dateId); + result.forEach(r -> { + r.setDateId(dateId); + r.setWeekId(timeList.getWeekId()); + r.setMonthId(timeList.getMonthId()); + r.setQuarterId(timeList.getQuarterId()); + r.setYearId(timeList.getYearId()); + agencyInfoList.forEach(agency -> { + if (r.getAgencyId().equals(agency.getAgencyId())){ + r.setPid(agency.getPid()); + } + }); + }); + issueLogDailyDao.deleteOldLogRecord(customerId, dateId); + issueLogDailyDao.insertIssueLogList(result); + return true; + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index 58e9202e70..610d323513 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -5,28 +5,44 @@ - INSERT INTO fact_origin_issue_log_daily ( ID, DATE_ID, WEEK_ID, MONTH_ID, QUARTER_ID, YEAR_ID, CUSTOMER_ID, USER_IDENTITY, USER_ID, CREATE_TOPIC_USER_ID, ISSUE_ID, TOPIC_ID, GRID_ID, - PID, AGENCY_ID, ISSUE_STATUS, TOPIC_USER_IDENTITY, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + INSERT INTO fact_origin_issue_log_daily ( + ID, + CUSTOMER_ID, + GRID_ID, + PID, + AGENCY_ID, + DATE_ID, + WEEK_ID, + MONTH_ID, + QUARTER_ID, + YEAR_ID, + ISSUE_ID, + OPERATION_USER_ID, + ACTION_CODE, + IS_PARTY, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) VALUES ( REPLACE ( UUID(), '-', '' ), + #{item.customerId}, + #{item.gridId}, + #{item.pid}, + #{item.agencyId}, #{item.dateId}, #{item.weekId}, #{item.monthId}, #{item.quarterId}, #{item.yearId}, - #{item.customerId}, - #{item.userIdentity}, - #{item.userId}, - #{item.createTopicUserId}, #{item.issueId}, - #{item.topicId}, - #{item.gridId}, - #{item.pid}, - #{item.agencyId}, - #{item.issueStatus}, - #{item.topicUserIdentity}, + #{item.operationUserId}, + #{item.actionCode}, + #{item.isParty}, #{item.delFlag}, #{item.revision}, #{item.createdBy}, @@ -36,4 +52,9 @@ ) + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml index 9b5420adde..992c189d52 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueMainDailyDao.xml @@ -58,12 +58,12 @@ - + DELETE FROM - fact_origin_issue_main_daily + fact_origin_issue_log_daily WHERE CUSTOMER_ID = #{customerId} - AND DATE_ID = #{dateId} + AND DATE_ID = #{dateId} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index 094da63178..1439aa721a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -199,4 +199,23 @@ AND DATE_FORMAT( CREATED_TIME, '%Y%m%d' ) = #{dateId} + + + \ No newline at end of file