diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginGroupMainDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginGroupMainDailyDTO.java index 7fbeb1ca84..8292361039 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginGroupMainDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginGroupMainDailyDTO.java @@ -18,7 +18,11 @@ package com.epmet.dto.extract; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; +import java.util.List; + +import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import lombok.Data; @@ -146,4 +150,6 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审 */ private Date updatedTime; + + private List members = new ArrayList(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridHeartedFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridHeartedFormDTO.java new file mode 100644 index 0000000000..f570700d01 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/GridHeartedFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.extract.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @ClassName GridHeartedFormDTO + * @Auth wangc + * @Date 2020-09-20 12:42 + */ +@Data +public class GridHeartedFormDTO implements Serializable { + private static final long serialVersionUID = 9069263069122734316L; + + private String userId; + + private String gridId; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/ExtractGroupMemberActionRecordResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/ExtractGroupMemberActionRecordResultDTO.java new file mode 100644 index 0000000000..47aa8e8783 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/result/ExtractGroupMemberActionRecordResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description + * @ClassName ExtractGroupMemberActionRecordResultDTO + * @Auth wangc + * @Date 2020-09-18 21:18 + */ +@Data +public class ExtractGroupMemberActionRecordResultDTO implements Serializable { + private static final long serialVersionUID = -74883228267461785L; + private String customerId; + + private String groupId; + + private String memberId; + + private String leaderFlag; + + private String dateId; + + private String weekId; + + private String monthId; + + private String quarterId; + + private String yearId; + + private Date joinDate; + + /** + * 目前只有join leader也是join + * */ + private String actionCode; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/ProjectOrgPeriodResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/ProjectOrgPeriodResultDTO.java index caa7034481..b3e101295d 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/ProjectOrgPeriodResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/ProjectOrgPeriodResultDTO.java @@ -86,4 +86,10 @@ public class ProjectOrgPeriodResultDTO implements Serializable { * */ private Date periodTillReplyFirstly; + private String customerId; + + private String staffId; + + private String isResolved; + } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/GridAttributesResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/GridAttributesResultDTO.java new file mode 100644 index 0000000000..17fd652a8c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/result/GridAttributesResultDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.stats.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @ClassName GridAttributesResultDTO + * @Auth wangc + * @Date 2020-09-20 12:50 + */ +@Data +public class GridAttributesResultDTO implements Serializable { + private static final long serialVersionUID = 466974582608407121L; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格所属机关ID + */ + private String agencyId; + + /** + * 机关的上级ID + */ + private String parentId; + + /** + * 所有上级Id + * */ + private String pids; +} 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 870485ffd3..b90bdcdc28 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 @@ -4,10 +4,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.extract.form.ExtractFormDTO; -import com.epmet.service.evaluationindex.extract.FactOriginExtractService; -import com.epmet.service.evaluationindex.extract.FactOriginTopicMainDailyService; -import com.epmet.service.evaluationindex.extract.IssueExtractService; -import com.epmet.service.evaluationindex.extract.ProjectExtractService; +import com.epmet.service.evaluationindex.extract.*; import com.epmet.util.DimIdGenerator; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -36,6 +33,8 @@ public class FactOriginController { private FactOriginTopicMainDailyService factOriginTopicMainDailyService; @Autowired private ProjectExtractService projectExtractService; + @Autowired + private GroupExtractService groupExtractService; /** * desc: @@ -107,4 +106,30 @@ public class FactOriginController { projectExtractService.saveOriginProjectDaily(extractFormDTO); return new Result(); } + + /** + * @Description 项目节点历时数据清洗 + * @param param + * @return + * @author wangc + * @date 2020.09.20 16:11 + **/ + @PostMapping("projectorgperiodcleanning") + public Result projectOrgPeriodCleaning(@RequestBody ExtractFormDTO param){ + projectExtractService.extractProjectPeriodData(param); + return new Result(); + } + + /** + * @Description 小组数据清洗 + * @param + * @return + * @author wangc + * @date 2020.09.20 16:11 + **/ + @PostMapping("groupdatacleaning") + public Result groupDataCleaning(@RequestBody ExtractFormDTO param){ + groupExtractService.extractGroupData(param); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java index ff1c16d1ec..c2100cee16 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java @@ -19,6 +19,9 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; +import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; +import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -43,4 +46,76 @@ public interface FactOriginGroupMainDailyDao extends BaseDao selectPartyCreateGroupCount(@Param("customerId") String customerId,@Param("monthId") String monthId); + + /** + * @Description 查询是否存在该客户下的数据 + * @param customerId + * @return + * @author wangc + * @date 2020.09.18 23:30 + **/ + int selectIfExist(@Param("customerId")String customerId); + + /** + * @Description 按照客户Id清除组数据 + * @param customerId + * @return + * @author wangc + * @date 2020.09.20 09:58 + **/ + void deleteBatchByCustomerId(@Param("customerId")String customerId); + + /** + * @Description 按照客户Id清除组员数据 + * @param customerId + * @return + * @author wangc + * @date 2020.09.20 09:58 + **/ + void deleteBatchMemberByCustomerId(@Param("customerId")String customerId); + + /** + * @Description 按照组Id清除组和组员数据 + * @param list + * @return + * @author wangc + * @date 2020.09.20 12:16 + **/ + void deleteBatchByGroupId(@Param("list") List list); + + /** + * @Description 更新群主的党员信息 + * @param list + * @return + * @author wangc + * @date 2020.09.20 12:44 + **/ + int updatePartyFlag(@Param("list") List list); + + /** + * @Description 更新群主的热心居民信息 + * @param list + * @return + * @author wangc + * @date 2020.09.20 12:44 + **/ + int updateHeartedFlag(@Param("list") List list); + + /** + * @Description 批量插入组主表 + * @param list + * @return + * @author wangc + * @date 2020.09.20 15:37 + **/ + int insertBatchMain(@Param("list") List list); + + /** + * @Description 批量插入组员表 + * @param list + * @return + * @author wangc + * @date 2020.09.20 15:37 + **/ + int insertBatchMembers(List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java index db1bc08318..32059b58b3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java @@ -1,5 +1,6 @@ package com.epmet.dao.group; +import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.group.form.GridGroupPeopleFormDTO; import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO; import com.epmet.dto.group.form.GridGroupTotalFormDTO; @@ -80,4 +81,13 @@ public interface GroupDataDao { * @author zxc */ List getAgencyGrid(@Param("gridIds")List gridIds); + + /** + * @Description 抽取小组数据 + * @param customerId + * @return + * @author wangc + * @date 2020.09.18 22:45 + **/ + List groupExtracting(@Param("customerId")String customerId,@Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java index dd2338bb69..3087abdd21 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridInfoResultDTO; import com.epmet.dto.group.result.SubAgencyIdResultDTO; +import com.epmet.dto.stats.result.GridAttributesResultDTO; import com.epmet.dto.stats.result.GridBelongAgencyResultDTO; import com.epmet.entity.stats.DimGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -69,4 +70,13 @@ public interface DimGridDao extends BaseDao { * @date 2020/9/17 2:34 下午 */ List selectGridBelongAgencyInfo(@Param("gridIds") List gridIds); + + /** + * @Description 查询网格的所有所属上级属性 + * @param gridIds + * @return + * @author wangc + * @date 2020.09.20 13:01 + **/ + List selectGridAttributes(@Param("gridIds") List gridIds); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java index 9e50c2d7d4..22372cbed4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java @@ -1,5 +1,6 @@ package com.epmet.dao.user; +import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; import org.apache.ibatis.annotations.Mapper; @@ -105,5 +106,9 @@ public interface UserDao { * @author zxc * @date 2020/9/15 4:23 下午 */ - List selectUserIsParty(@Param("userIds") List userIds);; + List selectUserIsParty(@Param("userIds") List userIds); + + List selectPartymembersByCustomerId(@Param("customerId")String customerId); + + List selectWarmHeartedByCustomerId(@Param("customerId")String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectOrgPeriodDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectOrgPeriodDailyEntity.java index c6dc080aea..b5f0d2d53b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectOrgPeriodDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectOrgPeriodDailyEntity.java @@ -83,7 +83,7 @@ public class FactOriginProjectOrgPeriodDailyEntity extends BaseEpmetEntity { /** * 截至第一次响应时长,从流转到第一次处理(响应、结案、流转)耗时,大于等于上一项值 */ - private Integer periodTillReplyFirstly; + private Date periodTillReplyFirstly; /** * resloved 、 unresolved diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/GroupExtractService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/GroupExtractService.java index e775660b9e..c43a4d01c7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/GroupExtractService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/GroupExtractService.java @@ -4,6 +4,8 @@ import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; import java.util.List; +import com.epmet.dto.extract.form.ExtractFormDTO; + /** * @Desc 业务数据抽取 - 组相关 * @Author wangc @@ -20,4 +22,13 @@ public interface GroupExtractService { */ List selectPartyCreateGroupCount(String customerId,String monthId); + + /** + * @Description 业务抽取 - 小组祥光 + * @param param + * @return + * @author wangc + * @date 2020.09.18 21:07 + **/ + void extractGroupData(ExtractFormDTO param); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/GroupExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/GroupExtractServiceImpl.java index 56a3b46245..9d3c89eca8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/GroupExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/GroupExtractServiceImpl.java @@ -2,10 +2,34 @@ package com.epmet.service.evaluationindex.extract.impl; import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao; import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao; +import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; +import com.epmet.dto.extract.form.ExtractFormDTO; +import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; +import com.epmet.dto.stats.result.GridAttributesResultDTO; import com.epmet.service.evaluationindex.extract.GroupExtractService; +import com.epmet.service.group.GroupDataService; +import com.epmet.service.stats.DimAgencyService; +import com.epmet.service.stats.DimGridService; +import com.epmet.service.user.UserService; +import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; import java.util.List; @@ -33,4 +57,96 @@ public class GroupExtractServiceImpl implements GroupExtractService { public List selectPartyCreateGroupCount(String customerId, String monthId) { return groupMainDailyDao.selectPartyCreateGroupCount(customerId, monthId); } + @Autowired + private GroupDataService groupDataService; + @Autowired + private FactOriginGroupMainDailyDao factOriginGroupMainDailyDao; + @Autowired + private UserService userService; + @Autowired + private DimGridService dimGridService; + + /** + * @Description 业务抽取 - 小组祥光 + * @param param + * @return + * @author wangc + * @date 2020.09.18 21:07 + **/ + @Override + public void extractGroupData(ExtractFormDTO param) { + int count = factOriginGroupMainDailyDao.selectIfExist(param.getCustomerId()); + + if(StringUtils.isBlank(param.getDateId())){ + Date yesterday = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24); + SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); + param.setDateId(format.format(yesterday)); + } + //原生数据,如果是首次,则为全部组,如果非首次,则只有新创建以及新进人的组 + //但是每个组每天都要更新一次组长的身份信息 + List originGroupData = groupDataService.extractGroupData( + count <= NumConstant.ZERO ? true : false, + param.getCustomerId(), param.getDateId()); + + List memberList = new LinkedList<>(); + if (!CollectionUtils.isEmpty(originGroupData)) { + List gridList = dimGridService.getGridAttributes(originGroupData.stream().map(FactOriginGroupMainDailyDTO::getGridId).distinct().collect(Collectors.toList())); + + if (!CollectionUtils.isEmpty(gridList)) { + Map gridMap = + gridList.stream().collect(Collectors.toMap(GridAttributesResultDTO::getGridId, Function.identity(), (key1, key2) -> key2)); + if (!CollectionUtils.isEmpty(originGroupData)) { + originGroupData.forEach(group -> { + if (!CollectionUtils.isEmpty(group.getMembers())) { + group.setMemberTotal(group.getMembers().size()); + group.getMembers().forEach(member -> { + DimIdGenerator.DimIdBean dateInfo = DimIdGenerator.getDimIdBean(member.getJoinDate()); + member.setDateId(dateInfo.getDateId()); + member.setWeekId(dateInfo.getWeekId()); + member.setMonthId(dateInfo.getMonthId()); + member.setQuarterId(dateInfo.getQuarterId()); + member.setYearId(dateInfo.getYearId()); + + memberList.add(member); + }); + } + GridAttributesResultDTO attr = gridMap.get(group.getGridId()); + if (null != attr) { + group.setAgencyId(attr.getAgencyId()); + group.setParentId(attr.getParentId()); + group.setPids(attr.getPids()); + } + if(null != group.getCreatedTime()){ + DimIdGenerator.DimIdBean dateInfo = DimIdGenerator.getDimIdBean(group.getCreatedTime()); + group.setDateId(dateInfo.getDateId()); + group.setWeekId(dateInfo.getWeekId()); + group.setMonthId(dateInfo.getMonthId()); + group.setQuarterId(dateInfo.getQuarterId()); + group.setYearId(dateInfo.getYearId()); + } + }); + } + + + if (count <= NumConstant.ZERO) { + //isFirst + factOriginGroupMainDailyDao.deleteBatchByCustomerId(param.getCustomerId()); + factOriginGroupMainDailyDao.deleteBatchMemberByCustomerId(param.getCustomerId()); + factOriginGroupMainDailyDao.insertBatchMain(originGroupData); + factOriginGroupMainDailyDao.insertBatchMembers(memberList); + } else { + factOriginGroupMainDailyDao.deleteBatchByGroupId(originGroupData.stream().map(FactOriginGroupMainDailyDTO :: getId).distinct().collect(Collectors.toList())); + factOriginGroupMainDailyDao.insertBatchMembers(memberList); + } + + } + + + List partyIds = userService.getPartymembersByCustomerId(param.getCustomerId()); + List heartedIds = userService.getWarmHeartedByCustomerId(param.getCustomerId()); + + factOriginGroupMainDailyDao.updatePartyFlag(partyIds); + factOriginGroupMainDailyDao.updateHeartedFlag(heartedIds); + } + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/ProjectPeriodExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/ProjectPeriodExtractServiceImpl.java index 20c3e99e29..37f6237c88 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/ProjectPeriodExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/ProjectPeriodExtractServiceImpl.java @@ -6,7 +6,6 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; import com.epmet.dto.extract.form.ExtractFormDTO; import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO; -import com.epmet.dto.project.result.ProjectOrgRelationWhenResponseResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; import com.epmet.service.evaluationindex.extract.ProjectPeriodExtractService; import com.epmet.service.project.ProjectProcessService; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java index 82588801a7..38e291d420 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java @@ -1,5 +1,6 @@ package com.epmet.service.group; +import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.group.result.*; import com.epmet.util.DimIdGenerator; import org.apache.ibatis.annotations.Param; @@ -55,4 +56,14 @@ public interface GroupDataService { */ List getAgencyGrid(@Param("gridIds") List gridIds); + /** + * @Description 业务抽取 - 小组数据 + * @param isFirst + * @param customerId + * @return + * @author wangc + * @date 2020.09.18 22:52 + **/ + List extractGroupData(Boolean isFirst,String customerId,String dateId); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java index 2b37f81ed6..b7875982d5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java @@ -4,6 +4,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.group.GroupDataDao; +import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.group.form.GridGroupPeopleFormDTO; import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO; import com.epmet.dto.group.form.GridGroupTotalFormDTO; @@ -12,9 +13,12 @@ import com.epmet.dto.group.result.*; import com.epmet.entity.stats.DimGridEntity; import com.epmet.service.group.GroupDataService; import com.epmet.util.DimIdGenerator; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.util.StringUtil; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import java.util.*; import java.util.stream.Collectors; @@ -193,4 +197,18 @@ public class GroupDataServiceImpl implements GroupDataService { } + /** + * @Description 业务抽取 - 小组数据 + * * @param isFirst + * @param customerId + * @return + * @author wangc + * @date 2020.09.18 22:52 + **/ + @Override + public List extractGroupData(Boolean isFirst ,String customerId,String dateId) { + return groupDataDao.groupExtracting(customerId,isFirst?null:dateId); + } + + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java index a78dec1da7..fdf84a48e5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java @@ -143,19 +143,16 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl processSingleList = dest.get(staffResponseTraceUnit.get(index).getProcessId()); if(!CollectionUtils.isEmpty(processSingleList)){ - ProjectOrgPeriodResultDTO element = processSingleList.get(NumConstant.ZERO); + //ProjectOrgPeriodResultDTO element = processSingleList.get(NumConstant.ZERO); + ProjectOrgPeriodResultDTO element = processSingleList.stream().filter(node -> + StringUtils.equals(node.getStaffId(),staffResponseTraceUnit.get(index).getStaffId())).findFirst().get(); if(!ifResponsed && null == element.getHandledDate()){ log.warn("com.epmet.service.project.impl.ProjectProcessServiceImpl.skipLevelGrouping::已流出节点没有办结日期,节点ID{}",element.getProcessId() ); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java index 399781d3d3..aed58b369b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java @@ -23,6 +23,7 @@ import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridInfoResultDTO; import com.epmet.dto.group.result.SubAgencyIdResultDTO; import com.epmet.dto.stats.DimGridDTO; +import com.epmet.dto.stats.result.GridAttributesResultDTO; import com.epmet.dto.stats.result.GridBelongAgencyResultDTO; import com.epmet.entity.stats.DimGridEntity; import com.epmet.entity.stats.LastExecRecordEntity; @@ -138,4 +139,13 @@ public interface DimGridService extends BaseService { * @date 2020/9/17 2:34 下午 */ List selectGridBelongAgencyInfo(List gridIds); + + /** + * @Description 查询网格的所有所属上级属性 + * @param gridIds + * @return + * @author wangc + * @date 2020.09.20 13:01 + **/ + List getGridAttributes(List gridIds); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java index f7cec14b13..6a6a5ff323 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java @@ -34,6 +34,7 @@ import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.result.AgencyGridInfoResultDTO; import com.epmet.dto.group.result.SubAgencyIdResultDTO; import com.epmet.dto.stats.DimGridDTO; +import com.epmet.dto.stats.result.GridAttributesResultDTO; import com.epmet.dto.stats.result.GridBelongAgencyResultDTO; import com.epmet.entity.stats.DimGridEntity; import com.epmet.service.stats.DimGridService; @@ -41,11 +42,9 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 客户网格维度 @@ -177,4 +176,17 @@ public class DimGridServiceImpl extends BaseServiceImpl selectGridBelongAgencyInfo(List gridIds) { return baseDao.selectGridBelongAgencyInfo(gridIds); } + + /** + * @Description 查询网格的所有所属上级属性 + * @param gridIds + * @return + * @author wangc + * @date 2020.09.20 13:01 + **/ + @Override + public List getGridAttributes(List gridIds) { + if(CollectionUtils.isEmpty(gridIds)) return Collections.EMPTY_LIST; + return baseDao.selectGridAttributes(gridIds); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index 60934ed2c1..0203780cc8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -1,8 +1,10 @@ package com.epmet.service.user; import com.epmet.dto.AgencySubTreeDto; +import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.util.DimIdGenerator; +import org.apache.ibatis.annotations.Param; import java.util.Date; import java.util.List; @@ -35,4 +37,22 @@ public interface UserService { * @date 2020/9/15 4:23 下午 */ Map selectUserIsParty(List userIds); + + /** + * @Description 查询客户下的党员userId + * @param customerId + * @return + * @author wangc + * @date 2020.09.20 15:01 + **/ + List getPartymembersByCustomerId(String customerId); + + /** + * @Description 查询客户下的热心居民Id以及所在网格Id + * @param customerId + * @return + * @author wangc + * @date 2020.09.20 15:01 + **/ + List getWarmHeartedByCustomerId(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index 3d230f476b..5a8aa7b3f2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -6,6 +6,7 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.constant.ExtractConstant; import com.epmet.dao.user.UserDao; import com.epmet.dto.AgencySubTreeDto; +import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.stats.user.*; import com.epmet.dto.stats.user.result.UserStatisticalData; @@ -152,6 +153,30 @@ public class UserServiceImpl implements UserService { return result; } + /** + * @Description 查询客户下的党员userId + * @param customerId + * @return + * @author wangc + * @date 2020.09.20 15:01 + **/ + @Override + public List getPartymembersByCustomerId(String customerId) { + return userDao.selectPartymembersByCustomerId(customerId); + } + + /** + * @Description 查询客户下的热心居民Id以及所在网格Id + * @param customerId + * @return + * @author wangc + * @date 2020.09.20 15:01 + **/ + @Override + public List getWarmHeartedByCustomerId(String customerId) { + return userDao.selectWarmHeartedByCustomerId(customerId); + } + /** * @Description 初始化机关-所有下级网格Map diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index fd90cd5a18..305b618772 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -18,4 +18,182 @@ + + + + DELETE FROM + fact_origin_group_main_daily + WHERE + CUSTOMER_ID = #{customerId} + + + + + + DELETE FROM + fact_origin_group_member_daily + WHERE + CUSTOMER_ID = #{customerId} + + + + DELETE FROM + fact_origin_group_main_daily + + + ID = #{groupId} + + + + + + UPDATE fact_origin_group_main_daily + SET IS_OWNER_PARTY = 1 + + DEL_FLAG = '0' + AND + + GROUP_OWNER_ID = #{ownerId} + + + + + + UPDATE fact_origin_group_main_daily + SET IS_OWNER_HEARTED = 1 + + DEL_FLAG = '0' + AND + + (GROUP_OWNER_ID = #{item.userId} AND GRID_ID = #{item.gridId}) + + + + + + INSERT INTO fact_origin_group_main_daily + ( + + id, + customer_id, + group_state, + grid_id, + agency_id, + parent_id, + pids, + date_id, + week_id, + month_id, + quarter_id, + year_id, + resi_member_count, + member_total, + group_owner_id, + is_owner_hearted, + is_owner_party, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + )VALUES + + ( + #{item.id}, + #{item.customerId}, + #{item.groupState}, + #{item.gridId}, + #{item.agencyId}, + #{item.parentId}, + #{item.pids}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + 0, + #{item.memberTotal}, + #{item.groupOwnerId}, + + + 0, + + + #{item.isOwnerHearted}, + + + + + + 0, + + + #{item.isOwnerParty}, + + + + '0', + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now() + + ) + + + + + + INSERT INTO fact_origin_group_member_daily + ( + id, + group_id, + member_id, + customer_id, + leader_flag, + date_id, + week_id, + month_id, + quarter_id, + year_id, + action_code, + revision, + del_flag, + created_by, + created_time, + updated_by, + updated_time + )VALUES + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.groupId}, + #{item.memberId}, + #{item.customerId}, + #{item.leaderFlag}, + #{item.dateId}, + #{item.weekId}, + #{item.monthId}, + #{item.quarterId}, + #{item.yearId}, + #{item.actionCode}, + '0', + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now() + ) + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml index c047ea0541..a642ff1f56 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml @@ -29,7 +29,7 @@ @@ -90,24 +90,27 @@ ( (SELECT REPLACE(UUID(), '-', '') AS id), - #{customerId}, - #{projectId}, - #{orgId}, - #{orgType}, - #{pid}, - #{pids}, - #{informedDate}, - #{handledDate}, - #{totalPeriod}, - #{periodTillReplyFirstly}, - #{isResolved}, - #{operation}, + #{item.customerId}, + #{item.projectId}, + #{item.orgId}, + #{item.orgType}, + + 0, + #{item.pid}, + + #{item.pids}, + #{item.informedDate}, + #{item.handledDate}, + #{item.totalPeriod}, + #{item.periodTillReplyFirstly}, + #{item.isResolved}, + #{item.operation}, '0', 0, - 'CRAWLER_ROBOT', now(), 'CRAWLER_ROBOT', - now() + now(), + 'CRAWLER_ROBOT' ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml index 0ed8f428fe..61e4057e22 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml @@ -155,5 +155,61 @@ rgm.resi_group_id - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml index fae85f5561..be19516363 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml @@ -90,11 +90,14 @@ staff.ORG_ID, staff.DEPARTMENT_ID, staff.GRID_ID, + staff.CREATED_BY AS staffId, staff.ORG_ID_PATH, IF(staff.IS_HANDLE='handle',timestampdiff(MINUTE , staff.CREATED_TIME , staff.UPDATED_TIME),0) AS TOTAL_PERIOD, + staff.CREATED_TIME AS informedDate, - -- 转入时间 - IF(staff.IS_HANDLE='handle',staff.UPDATED_TIME,null) AS handledDate + IF(staff.IS_HANDLE='handle','resolved','unresolved') AS isResolved, + IF(staff.IS_HANDLE='handle',staff.UPDATED_TIME,null) AS handledDate, + IF(staff.IS_HANDLE='handle',staff.UPDATED_TIME,null) AS periodTillReplyFirstly FROM PROJECT_STAFF staff LEFT JOIN PROJECT project ON staff.PROJECT_ID = project.ID AND project.DEL_FLAG = '0' @@ -102,7 +105,7 @@ LEFT JOIN PROJECT_PROCESS selfAction ON staff.PROJECT_ID = selfAction.PROJECT_ID AND selfAction.DEL_FLAG = '0' AND staff.UPDATED_TIME = selfAction.CREATED_TIME AND staff.STAFF_ID = selfAction.STAFF_ID WHERE staff.DEL_FLAG = '0' AND project.CUSTOMER_ID = #{customerId} - + AND project.STATUS = #{projectStatus} @@ -114,7 +117,7 @@ ) AND process.OPERATION ]]> 'response' - ORDER BY process.PROJECT_ID,staff.CREATED_TIME ASC -- 按照立项-流转的顺序 + ORDER BY process.PROJECT_ID,staff.CREATED_TIME ASC diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml index d3f6c044a3..09aa1bee36 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml @@ -89,4 +89,23 @@ ) + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index 67e2ab9442..22061e3e70 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -424,4 +424,37 @@ ) + + + +