forked from rongchao/epmet-cloud-rizhao
Browse Source
# Conflicts: # epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java # epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java # epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java # epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xmldev
100 changed files with 2738 additions and 451 deletions
@ -0,0 +1,30 @@ |
|||
package com.epmet.evaluationindex.screen.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 评价指标字典表数据--接口返参 |
|||
* @Author sun |
|||
*/ |
|||
@Data |
|||
public class IndexDictResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 3860268744336541373L; |
|||
|
|||
/** |
|||
* 指标名 |
|||
*/ |
|||
private String indexName; |
|||
/** |
|||
* 指标code |
|||
*/ |
|||
private String indexCode; |
|||
/** |
|||
* 指标值类型 百分比:percent |
|||
*/ |
|||
private String valueType; |
|||
|
|||
} |
@ -0,0 +1,49 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.datareport.dao.fact; |
|||
|
|||
import com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 评价指标字典 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-09-02 |
|||
*/ |
|||
@Mapper |
|||
public interface IndexDictDao { |
|||
|
|||
/** |
|||
* @param |
|||
* @Description 查询指标字典表是百分比类型的数据 |
|||
* @author sun |
|||
*/ |
|||
List<IndexDictResultDTO> selectList(); |
|||
|
|||
/** |
|||
* @param |
|||
* @Description 根据indexCode查询指标字典表具体数据 |
|||
* @author sun |
|||
*/ |
|||
IndexDictResultDTO selectIndexDict(@Param("indexCode") String indexCode); |
|||
} |
@ -0,0 +1,31 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.datareport.dao.fact.IndexDictDao"> |
|||
|
|||
<select id="selectList" resultType="com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO"> |
|||
SELECT |
|||
index_name AS "indexName", |
|||
index_code AS "indexCode", |
|||
value_type AS "valueType" |
|||
FROM |
|||
index_dict |
|||
WHERE |
|||
del_flag = '0' |
|||
AND value_type != 'none' |
|||
</select> |
|||
|
|||
<select id="selectIndexDict" resultType="com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO"> |
|||
SELECT |
|||
index_name AS "indexName", |
|||
index_code AS "indexCode", |
|||
value_type AS "valueType" |
|||
FROM |
|||
index_dict |
|||
WHERE |
|||
del_flag = '0' |
|||
AND index_code = #{indexCode} |
|||
LIMIT 1 |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,30 @@ |
|||
package com.epmet.dto.extract.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc: 网格级别小组内的组成员数 |
|||
* |
|||
* @author LiuJanJun |
|||
* @date 2020/9/27 2:27 下午 |
|||
*/ |
|||
@Data |
|||
public class GridGroupUserCountResultDTO implements Serializable { |
|||
|
|||
|
|||
private static final long serialVersionUID = -4729061928990808187L; |
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
private String orgId; |
|||
|
|||
private Integer memberCount; |
|||
/** |
|||
* 网格的pids |
|||
*/ |
|||
private String pids; |
|||
} |
@ -0,0 +1,68 @@ |
|||
package com.epmet.dto.extract.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* desc: 议题投票统计结果DTO |
|||
* |
|||
* @author LiuJanJun |
|||
* @date 2020/9/27 11:22 上午 |
|||
*/ |
|||
@Data |
|||
public class IssueVoteStatisticalResultDTO implements Serializable { |
|||
|
|||
|
|||
private static final long serialVersionUID = 2631108929053690349L; |
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 议题ID |
|||
*/ |
|||
private String issueId; |
|||
|
|||
/** |
|||
* 统计日期 yyyy-MM-dd |
|||
*/ |
|||
private Date statisticalDate; |
|||
|
|||
/** |
|||
* 到该日的总赞成数 |
|||
*/ |
|||
private Integer supportCount; |
|||
|
|||
/** |
|||
* 到该日的总反对数 |
|||
*/ |
|||
private Integer oppositionCount; |
|||
|
|||
/** |
|||
* 到该日的总票数 |
|||
*/ |
|||
private Integer totalCount; |
|||
|
|||
/** |
|||
* 该日增量 |
|||
*/ |
|||
private Integer todayIncrement; |
|||
|
|||
/** |
|||
* 该日赞成增量 |
|||
*/ |
|||
private Integer supportIncrement; |
|||
|
|||
/** |
|||
* 该日反对增量 |
|||
*/ |
|||
private Integer oppositionIncrement; |
|||
|
|||
/** |
|||
* 到该日的应表决数 |
|||
*/ |
|||
private Integer votableCount; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.extract.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc: 议题投票人数 |
|||
* |
|||
* @author LiuJanJun |
|||
* @date 2020/9/27 2:27 下午 |
|||
*/ |
|||
@Data |
|||
public class IssueVoteUserCountResultDTO implements Serializable { |
|||
|
|||
|
|||
private static final long serialVersionUID = -4729061928990808187L; |
|||
private String orgId; |
|||
private Integer voteCount; |
|||
private Integer issueCount; |
|||
/** |
|||
* 网格的pids |
|||
*/ |
|||
private String pids; |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.service.evaluationindex.extract.toscreen; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/9/27 9:37 |
|||
*/ |
|||
public interface OrgRankExtractService { |
|||
/** |
|||
* 网格先进排行 |
|||
* |
|||
* @param customerId |
|||
* @param monthId |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2020/9/24 15:16 |
|||
*/ |
|||
void extractGridData(String customerId, String monthId); |
|||
|
|||
/** |
|||
* 社区先进排行 |
|||
* |
|||
* @param customerId |
|||
* @param monthId |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2020/9/24 15:17 |
|||
*/ |
|||
void extractCommunityData(String customerId, String monthId); |
|||
|
|||
/** |
|||
* 街道先进排行 |
|||
* |
|||
* @param customerId |
|||
* @param monthId |
|||
* @return void |
|||
* @author zhaoqifeng |
|||
* @date 2020/9/24 15:17 |
|||
*/ |
|||
void extractStreetData(String customerId, String monthId); |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.service.evaluationindex.extract.toscreen; |
|||
|
|||
/** |
|||
* screen_public_parti_total_data |
|||
* 公众参与-各类(话题|议题|项目|注册人数|参与人数)总数 按天统计 |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/9/27 11:09 |
|||
*/ |
|||
public interface PublicPartiTotalDataExtractService { |
|||
|
|||
/** |
|||
* 按天统计 |
|||
* |
|||
* @param customerId 客户id |
|||
* @param dateId yyyyMMdd 这一列存储到 screen_public_parti_total_data表中的数据更新至: yyyy|yyyyMM|yyyyMMdd |
|||
* @return |
|||
*/ |
|||
void extractPublicPartiTotalData(String customerId,String dateId); |
|||
} |
@ -0,0 +1,260 @@ |
|||
package com.epmet.service.evaluationindex.extract.toscreen.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.constant.OrgTypeConstant; |
|||
import com.epmet.dto.extract.result.OrgStatisticsResultDTO; |
|||
import com.epmet.dto.stats.user.FactRegUserAgencyMonthlyDTO; |
|||
import com.epmet.dto.stats.user.FactRegUserGridMonthlyDTO; |
|||
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; |
|||
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity; |
|||
import com.epmet.entity.evaluationindex.screen.ScreenOrgRankDataEntity; |
|||
import com.epmet.service.evaluationindex.extract.todata.*; |
|||
import com.epmet.service.evaluationindex.extract.toscreen.OrgRankExtractService; |
|||
import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyService; |
|||
import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; |
|||
import com.epmet.service.evaluationindex.screen.ScreenOrgRankDataService; |
|||
import com.epmet.service.stats.user.FactRegUserAgencyMonthlyService; |
|||
import com.epmet.service.stats.user.FactRegUserGridMonthlyService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.math.RoundingMode; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/9/27 9:37 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class OrgRankExtractServiceImpl implements OrgRankExtractService { |
|||
@Autowired |
|||
private ScreenOrgRankDataService screenOrgRankDataService; |
|||
@Autowired |
|||
private FactRegUserGridMonthlyService factRegUserGridMonthlyService; |
|||
@Autowired |
|||
private FactOriginGroupMainDailyService factOriginGroupMainDailyService; |
|||
@Autowired |
|||
private FactOriginTopicMainDailyService factOriginTopicMainDailyService; |
|||
@Autowired |
|||
private FactOriginIssueMainDailyService factOriginIssueMainDailyService; |
|||
@Autowired |
|||
private FactOriginProjectMainDailyService factOriginProjectMainDailyService; |
|||
@Autowired |
|||
private FactIndexGovrnAblityGridMonthlyService factIndexGovrnAblityGridMonthlyService; |
|||
@Autowired |
|||
private FactOriginProjectLogDailyService factOriginProjectLogDailyService; |
|||
@Autowired |
|||
private FactRegUserAgencyMonthlyService factRegUserAgencyMonthlyService; |
|||
@Autowired |
|||
private FactIndexGovrnAblityOrgMonthlyService factIndexGovrnAblityOrgMonthlyService; |
|||
|
|||
@Override |
|||
public void extractGridData(String customerId, String monthId) { |
|||
List<ScreenOrgRankDataEntity> list = screenOrgRankDataService.initList(customerId, OrgTypeConstant.GRID, null); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
return; |
|||
} |
|||
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|||
list.forEach(entity -> { |
|||
entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); |
|||
entity.setMonthId(monthId); |
|||
}); |
|||
//党员数
|
|||
List<FactRegUserGridMonthlyDTO> partyMemberList = factRegUserGridMonthlyService.getGridUserCountByCustomer(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(partyMemberList)) { |
|||
list.forEach(entity -> partyMemberList.stream().filter(item -> item.getGridId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setPartyTotal(dto.getPartymemberTotal()); |
|||
})); |
|||
} |
|||
//小组数
|
|||
List<OrgStatisticsResultDTO> groupList = factOriginGroupMainDailyService.getGridGroupCount(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(groupList)) { |
|||
list.forEach(entity -> groupList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setGroupTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//话题数
|
|||
List<OrgStatisticsResultDTO> topicList = factOriginTopicMainDailyService.getGridTopicCount(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(topicList)) { |
|||
list.forEach(entity -> topicList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setTopicTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//议题数
|
|||
List<OrgStatisticsResultDTO> issueList = factOriginIssueMainDailyService.getGridIssueCount(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(issueList)) { |
|||
list.forEach(entity -> issueList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setIssueTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//项目数
|
|||
List<OrgStatisticsResultDTO> projectList = factOriginProjectMainDailyService.getGridProjectCount(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(projectList)) { |
|||
list.forEach(entity -> projectList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setProjectTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//结案率 结案数/项目数
|
|||
List<FactIndexGovrnAblityGridMonthlyEntity> abilityList = factIndexGovrnAblityGridMonthlyService.getGridByCustomer(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(abilityList)) { |
|||
list.forEach(entity -> abilityList.stream().filter(item -> item.getGridId().equals(entity.getOrgId())).forEach(dto -> { |
|||
if (dto.getProjectTotal() != NumConstant.ZERO) { |
|||
BigDecimal total = new BigDecimal(dto.getProjectTotal()); |
|||
BigDecimal closed = new BigDecimal(dto.getResolveProjectCount()); |
|||
entity.setCloseProjectRatio(closed.multiply(hundred).divide(total, NumConstant.SIX, RoundingMode.HALF_UP)); |
|||
} |
|||
|
|||
})); |
|||
} |
|||
//满意率 满意和非常满意占比
|
|||
List<OrgStatisticsResultDTO> satisfactionList = factOriginProjectLogDailyService.getGridSatisfaction(customerId, monthId); |
|||
if (!CollectionUtils.isEmpty(satisfactionList)) { |
|||
list.forEach(entity -> satisfactionList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
if (dto.getSum() != NumConstant.ZERO) { |
|||
BigDecimal sum = new BigDecimal(dto.getSum()); |
|||
BigDecimal count = new BigDecimal(dto.getCount()); |
|||
entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); |
|||
} |
|||
})); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void extractCommunityData(String customerId, String monthId) { |
|||
List<ScreenOrgRankDataEntity> list = screenOrgRankDataService.initList(customerId, OrgTypeConstant.AGENCY, OrgTypeConstant.COMMUNITY); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
return; |
|||
} |
|||
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|||
list.forEach(entity -> { |
|||
entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); |
|||
entity.setMonthId(monthId); |
|||
}); |
|||
//党员数
|
|||
List<FactRegUserAgencyMonthlyDTO> partyMemberList = factRegUserAgencyMonthlyService.getOrgUserCountByCustomer(customerId, monthId, |
|||
OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(partyMemberList)) { |
|||
list.forEach(entity -> partyMemberList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setPartyTotal(dto.getPartymemberTotal()); |
|||
})); |
|||
} |
|||
//小组数
|
|||
List<OrgStatisticsResultDTO> groupList = factOriginGroupMainDailyService.getOrgGroupCount(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(groupList)) { |
|||
list.forEach(entity -> groupList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setGroupTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//话题数
|
|||
List<OrgStatisticsResultDTO> topicList = factOriginTopicMainDailyService.getOrgTopicCount(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(topicList)) { |
|||
list.forEach(entity -> topicList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setTopicTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//议题数
|
|||
List<OrgStatisticsResultDTO> issueList = factOriginIssueMainDailyService.getOrgIssueCount(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(issueList)) { |
|||
list.forEach(entity -> issueList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setIssueTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//项目数
|
|||
List<OrgStatisticsResultDTO> projectList = factOriginProjectMainDailyService.getOrgProjectCount(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(projectList)) { |
|||
list.forEach(entity -> projectList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setProjectTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//结案率 结案数/项目数
|
|||
List<FactIndexGovrnAblityOrgMonthlyEntity> abilityList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(abilityList)) { |
|||
list.forEach(entity -> abilityList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setCloseProjectRatio(dto.getClosedProjectRatio()); |
|||
})); |
|||
} |
|||
//满意率 满意和非常满意占比
|
|||
List<OrgStatisticsResultDTO> satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(satisfactionList)) { |
|||
list.forEach(entity -> satisfactionList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
if (dto.getSum() != NumConstant.ZERO) { |
|||
BigDecimal sum = new BigDecimal(dto.getSum()); |
|||
BigDecimal count = new BigDecimal(dto.getCount()); |
|||
entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); |
|||
} |
|||
})); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void extractStreetData(String customerId, String monthId) { |
|||
List<ScreenOrgRankDataEntity> list = screenOrgRankDataService.initList(customerId, OrgTypeConstant.AGENCY, OrgTypeConstant.STREET); |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
return; |
|||
} |
|||
BigDecimal hundred = new BigDecimal(NumConstant.ONE_HUNDRED); |
|||
list.forEach(entity -> { |
|||
entity.setYearId(monthId.substring(NumConstant.ZERO, NumConstant.FOUR)); |
|||
entity.setMonthId(monthId); |
|||
}); |
|||
//党员数
|
|||
List<FactRegUserAgencyMonthlyDTO> partyMemberList = factRegUserAgencyMonthlyService.getOrgUserCountByCustomer(customerId, monthId, |
|||
OrgTypeConstant.COMMUNITY); |
|||
if (!CollectionUtils.isEmpty(partyMemberList)) { |
|||
list.forEach(entity -> partyMemberList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setPartyTotal(dto.getPartymemberTotal()); |
|||
})); |
|||
} |
|||
//小组数
|
|||
List<OrgStatisticsResultDTO> groupList = factOriginGroupMainDailyService.getOrgGroupCount(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(groupList)) { |
|||
list.forEach(entity -> groupList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setGroupTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//话题数
|
|||
List<OrgStatisticsResultDTO> topicList = factOriginTopicMainDailyService.getOrgTopicCount(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(topicList)) { |
|||
list.forEach(entity -> topicList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setTopicTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//议题数
|
|||
List<OrgStatisticsResultDTO> issueList = factOriginIssueMainDailyService.getOrgIssueCount(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(issueList)) { |
|||
list.forEach(entity -> issueList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setIssueTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//项目数
|
|||
List<OrgStatisticsResultDTO> projectList = factOriginProjectMainDailyService.getOrgProjectCount(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(projectList)) { |
|||
list.forEach(entity -> projectList.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setProjectTotal(dto.getCount()); |
|||
})); |
|||
} |
|||
//结案率 结案数/项目数
|
|||
List<FactIndexGovrnAblityOrgMonthlyEntity> abilityList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(abilityList)) { |
|||
list.forEach(entity -> abilityList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
entity.setCloseProjectRatio(dto.getClosedProjectRatio()); |
|||
})); |
|||
} |
|||
//满意率 满意和非常满意占比
|
|||
List<OrgStatisticsResultDTO> satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.STREET); |
|||
if (!CollectionUtils.isEmpty(satisfactionList)) { |
|||
list.forEach(entity -> satisfactionList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto -> { |
|||
if (dto.getSum() != NumConstant.ZERO) { |
|||
BigDecimal sum = new BigDecimal(dto.getSum()); |
|||
BigDecimal count = new BigDecimal(dto.getCount()); |
|||
entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); |
|||
} |
|||
})); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
package com.epmet.service.evaluationindex.extract.toscreen.impl; |
|||
|
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.entity.evaluationindex.screen.ScreenPublicPartiTotalDataEntity; |
|||
import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity; |
|||
import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService; |
|||
import com.epmet.service.evaluationindex.extract.toscreen.PublicPartiTotalDataExtractService; |
|||
import com.epmet.service.evaluationindex.screen.ScreenPublicPartiTotalDataService; |
|||
import com.epmet.service.evaluationindex.screen.ScreenUserTotalDataService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* screen_public_parti_total_data |
|||
* 公众参与-各类(话题|议题|项目|注册人数|参与人数)总数 按天统计 |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/9/27 11:09 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class PublicPartiTotalDataExtractServiceImpl implements PublicPartiTotalDataExtractService { |
|||
@Autowired |
|||
private ScreenUserTotalDataService screenUserTotalDataService; |
|||
@Autowired |
|||
private ScreenPublicPartiTotalDataService screenPublicPartiTotalDataService; |
|||
@Autowired |
|||
private FactOriginIssueLogDailyService factOriginIssueLogDailyService; |
|||
|
|||
/** |
|||
* 按天统计 |
|||
* |
|||
* @param customerId 客户id |
|||
* @param dateId yyyyMMdd 这一列存储到 screen_public_parti_total_data表中的数据更新至: yyyy|yyyyMM|yyyyMMdd |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public void extractPublicPartiTotalData(String customerId, String dateId) { |
|||
List<ScreenUserTotalDataEntity> userTotalDataEntityList = screenUserTotalDataService.selectList(customerId); |
|||
if (CollectionUtils.isEmpty(userTotalDataEntityList)) { |
|||
log.warn("screen_user_total_data dosen't have any record customerId="+customerId); |
|||
return; |
|||
} |
|||
List<ScreenPublicPartiTotalDataEntity> list = new ArrayList<>(); |
|||
for (ScreenUserTotalDataEntity totalData : userTotalDataEntityList) { |
|||
ScreenPublicPartiTotalDataEntity entity = ConvertUtils.sourceToTarget(totalData,ScreenPublicPartiTotalDataEntity.class); |
|||
entity.setDataEndTime(dateId); |
|||
entity.setRegUserTotal(totalData.getUserTotal()); |
|||
//参与人数参与人数: 议题的表决行为的用户数去重的累计值
|
|||
int joinUserTotal=factOriginIssueLogDailyService.queryJoinUserTotal(customerId,totalData.getOrgType(),totalData.getOrgId()); |
|||
entity.setJoinUserTotal(joinUserTotal); |
|||
list.add(entity); |
|||
} |
|||
//先删除,后插入
|
|||
screenPublicPartiTotalDataService.delAndInsertBatch(customerId, list); |
|||
} |
|||
} |
Loading…
Reference in new issue