Browse Source

screen_public_parti_total_data公众参与各类总数v0.1

dev_shibei_match
yinzuomei 5 years ago
parent
commit
1bd155ffc1
  1. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java
  2. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java
  3. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserTotalDataDao.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPublicPartiTotalDataEntity.java
  5. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java
  6. 37
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java
  7. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PublicPartiTotalDataExtractService.java
  8. 68
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartiTotalDataExtractServiceImpl.java
  9. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPublicPartiTotalDataService.java
  10. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserTotalDataService.java
  11. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPublicPartiTotalDataServiceImpl.java
  12. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java
  13. 19
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml
  14. 47
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPublicPartiTotalDataDao.xml
  15. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java

@ -89,4 +89,16 @@ public interface FactOriginIssueLogDailyDao extends BaseDao<FactOriginIssueLogDa
@Param("communityId")String communityId,
@Param("agencyPath")String agencyPath,
@Param("isParty")String isParty);
/**
* @return int
* @param gridId 网格id
* @param pids 网格的pids
* @author yinzuomei
* @description 参与人数: 议题的表决行为的用户数去重的累计值
* @Date 2020/9/27 14:19
**/
int selectCountJoinUserTotal(@Param("customerId") String customerId,
@Param("gridId") String gridId,
@Param("pids")String pids);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java

@ -56,4 +56,13 @@ public interface ScreenPublicPartiTotalDataDao extends BaseDao<ScreenPublicParti
* @Date 10:52 2020-08-25
**/
void batchInsertPublicPartiTotalData(@Param("list") List<PublicPartiTotalDataFormDTO> list, @Param("customerId")String customerId);
/**
* @return void
* @param list
* @author yinzuomei
* @description 批量插入entity
* @Date 2020/9/27 14:00
**/
void insertBatchEntity(@Param("list") List<ScreenPublicPartiTotalDataEntity> list);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenUserTotalDataDao.java

@ -57,4 +57,13 @@ public interface ScreenUserTotalDataDao extends BaseDao<ScreenUserTotalDataEntit
void batchInsertUserTotalData(@Param("list") List<UserTotalDataFormDTO> list, @Param("customerId")String customerId);
void insertBatch(@Param("list") List<ScreenUserTotalDataEntity> list);
/**
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity>
* @param customerId
* @author yinzuomei
* @description 根据条件查询screen_user_total_data表
* @Date 2020/9/27 11:22
**/
List<ScreenUserTotalDataEntity> selectList(@Param("customerId") String customerId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPublicPartiTotalDataEntity.java

@ -86,7 +86,7 @@ public class ScreenPublicPartiTotalDataEntity extends BaseEpmetEntity {
private Integer regUserTotal;
/**
* 参与人数
* 参与人数参与人数: 议题的表决行为的用户数去重的累计值
*/
private Integer joinUserTotal;

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java

@ -40,4 +40,14 @@ public interface FactOriginIssueLogDailyService extends BaseService<FactOriginIs
* @Date 2020/9/26 17:57
**/
int calPartyPartiIssueTotal(String customerId, String gridId, String communityId, String agencyPath, String isParty);
/**
* @return int
* @param orgType 组织类别 agency组织网格grid部门department
* @param orgId 组织Id 可以为网格id
* @author yinzuomei
* @description 参与人数参与人数: 议题的表决行为的用户数去重的累计值
* @Date 2020/9/27 14:06
**/
int queryJoinUserTotal(String customerId,String orgType, String orgId);
}

37
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginIssueLogDailyServiceImpl.java

@ -19,10 +19,16 @@ package com.epmet.service.evaluationindex.extract.todata.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.extract.FactOriginIssueLogDailyDao;
import com.epmet.dto.stats.DimAgencyDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginIssueLogDailyEntity;
import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService;
import com.epmet.service.stats.DimAgencyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -31,10 +37,12 @@ import org.springframework.stereotype.Service;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-23
*/
@Slf4j
@DataSource(DataSourceConstant.STATS)
@Service
public class FactOriginIssueLogDailyServiceImpl extends BaseServiceImpl<FactOriginIssueLogDailyDao, FactOriginIssueLogDailyEntity> implements FactOriginIssueLogDailyService {
@Autowired
private DimAgencyService dimAgencyService;
/**
* @param customerId
@ -51,4 +59,31 @@ public class FactOriginIssueLogDailyServiceImpl extends BaseServiceImpl<FactOrig
public int calPartyPartiIssueTotal(String customerId, String gridId, String communityId, String agencyPath, String isParty) {
return baseDao.calPartyPartiIssueTotal(customerId,gridId,communityId,agencyPath,isParty);
}
/**
* @param orgType 组织类别 agency组织网格grid部门department
* @param orgId 组织Id 可以为网格id
* @return int
* @author yinzuomei
* @description 参与人数: 议题的表决行为的用户数去重的累计值
* @Date 2020/9/27 14:06
**/
@Override
public int queryJoinUserTotal(String customerId, String orgType, String orgId) {
if ("grid".equals(orgType)) {
return baseDao.selectCountJoinUserTotal(customerId, orgId, null);
} else {
//拼接pids,
DimAgencyDTO dimAgencyDTO = dimAgencyService.get(orgId);
if (null == dimAgencyDTO) {
log.error(String.format("根据agencyId=%s,查询dim_agency 返回null", orgId));
} else {
String pids = dimAgencyDTO.getPids().concat(StrConstant.COLON).concat(dimAgencyDTO.getId());
return baseDao.selectCountJoinUserTotal(customerId, null, pids);
}
}
return NumConstant.ZERO;
}
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PublicPartiTotalDataExtractService.java

@ -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);
}

68
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartiTotalDataExtractServiceImpl.java

@ -0,0 +1,68 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl;
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 ");
return;
}
List<ScreenPublicPartiTotalDataEntity> list = new ArrayList<>();
for (ScreenUserTotalDataEntity totalData : userTotalDataEntityList) {
ScreenPublicPartiTotalDataEntity entity = new ScreenPublicPartiTotalDataEntity();
entity.setCustomerId(customerId);
entity.setOrgType(totalData.getOrgType());
entity.setOrgId(totalData.getOrgId());
entity.setParentId(totalData.getParentId());
entity.setOrgName(totalData.getOrgName());
entity.setDataEndTime(dateId);
entity.setTopicTotal(totalData.getTopicTotal());
entity.setIssueTotal(totalData.getIssueTotal());
entity.setProjectTotal(totalData.getProjectTotal());
entity.setRegUserTotal(totalData.getUserTotal());
//参与人数参与人数: 议题的表决行为的用户数去重的累计值
int joinUserTotal=factOriginIssueLogDailyService.queryJoinUserTotal(customerId,totalData.getOrgType(),totalData.getOrgId());
entity.setJoinUserTotal(joinUserTotal);
list.add(entity);
}
//先删除,后插入
screenPublicPartiTotalDataService.delAndInsertBatch(customerId, list);
}
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPublicPartiTotalDataService.java

@ -21,6 +21,8 @@ package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.screen.ScreenPublicPartiTotalDataEntity;
import java.util.List;
/**
* 公众参与-各类(话题|议题|项目|注册人数|参与人数)总数
*
@ -28,4 +30,13 @@ import com.epmet.entity.evaluationindex.screen.ScreenPublicPartiTotalDataEntity;
* @since v1.0.0 2020-09-22
*/
public interface ScreenPublicPartiTotalDataService extends BaseService<ScreenPublicPartiTotalDataEntity> {
/**
* @return void
* @param customerId
* @param list screen_public_parti_total_data 记录
* @author yinzuomei
* @description 先删除后插入
* @Date 2020/9/27 13:51
**/
void delAndInsertBatch(String customerId, List<ScreenPublicPartiTotalDataEntity> list);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenUserTotalDataService.java

@ -40,4 +40,13 @@ public interface ScreenUserTotalDataService extends BaseService<ScreenUserTotalD
* @date 2020.09.24 17:59
**/
void dataClean(List<ScreenUserTotalDataEntity> list,String customerId);
/**
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity>
* @param customerId
* @author yinzuomei
* @description 根据条件查询screen_user_total_data表
* @Date 2020/9/27 11:18
**/
List<ScreenUserTotalDataEntity> selectList(String customerId);
}

31
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPublicPartiTotalDataServiceImpl.java

@ -19,10 +19,17 @@ package com.epmet.service.evaluationindex.screen.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.evaluationindex.screen.ScreenPublicPartiTotalDataDao;
import com.epmet.entity.evaluationindex.screen.ScreenPublicPartiTotalDataEntity;
import com.epmet.service.evaluationindex.screen.ScreenPublicPartiTotalDataService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 公众参与-各类(话题|议题|项目|注册人数|参与人数)总数
@ -34,4 +41,28 @@ import org.springframework.stereotype.Service;
public class ScreenPublicPartiTotalDataServiceImpl extends BaseServiceImpl<ScreenPublicPartiTotalDataDao, ScreenPublicPartiTotalDataEntity> implements ScreenPublicPartiTotalDataService {
/**
* @param customerId
* @param entityList screen_public_parti_total_data 记录
* @return void
* @author yinzuomei
* @description 先删除后插入
* @Date 2020/9/27 13:51
**/
@Transactional(rollbackFor = Exception.class)
@Override
public void delAndInsertBatch(String customerId, List<ScreenPublicPartiTotalDataEntity> entityList) {
if(CollectionUtils.isEmpty(entityList)){
return;
}
int deleteNum=0;
do{
//沿用原来项目采集的删除方法,一次删除1000
deleteNum=baseDao.deletePublicPartiTotalData(customerId);
}while (deleteNum!= NumConstant.ZERO);
List<List<ScreenPublicPartiTotalDataEntity>> partionList= ListUtils.partition(entityList, IndexCalConstant.INSERT_SIZE);
partionList.forEach(list->{
baseDao.insertBatchEntity(list);
});
}
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java

@ -23,7 +23,6 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.dao.evaluationindex.screen.ScreenUserTotalDataDao;
import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity;
import com.epmet.service.evaluationindex.screen.ScreenUserTotalDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -56,4 +55,16 @@ public class ScreenUserTotalDataServiceImpl extends BaseServiceImpl<ScreenUserTo
baseDao.insertBatch(list);
}
}
/**
* @param customerId
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity>
* @author yinzuomei
* @description 根据条件查询screen_user_total_data表
* @Date 2020/9/27 11:18
**/
@Override
public List<ScreenUserTotalDataEntity> selectList(String customerId) {
return baseDao.selectList(customerId);
}
}

19
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml

@ -119,4 +119,23 @@
and M.IS_PARTY=#{isParty}
</if>
</select>
<!-- 参与人数: 议题的表决行为的用户数去重的累计值 -->
<select id="selectCountJoinUserTotal" parameterType="map" resultType="int">
SELECT
count( DISTINCT m.OPERATION_USER_ID ) as total
FROM
fact_origin_issue_log_daily m
WHERE
m.DEL_FLAG = '0'
and m.ACTION_CODE like'vote_%'
and m.CUSTOMER_ID=#{customerId}
<if test='null != gridId and "" != gridId'>
and m.GRID_ID=#{gridId}
</if>
<if test='null != pids and "" != pids'>
and m.PIDS LIKE CONCAT(#{pids},'%')
</if>
</select>
</mapper>

47
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPublicPartiTotalDataDao.xml

@ -77,5 +77,50 @@
</foreach>
</insert>
<!-- 批量插入entity -->
<insert id="insertBatchEntity" parameterType="map">
insert into screen_public_parti_total_data
(
ID,
CUSTOMER_ID,
ORG_TYPE,
ORG_ID,
PARENT_ID,
ORG_NAME,
DATA_END_TIME,
TOPIC_TOTAL,
ISSUE_TOTAL,
PROJECT_TOTAL,
REG_USER_TOTAL,
JOIN_USER_TOTAL,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME
) values
<foreach collection="list" item="item" index="index" separator=",">
(
(SELECT REPLACE(UUID(), '-', '') AS id),
#{item.customerId},
#{item.orgType},
#{item.orgId},
#{item.parentId},
#{item.orgName},
#{item.dataEndTime},
#{item.topicTotal},
#{item.issueTotal},
#{item.projectTotal},
#{item.regUserTotal},
#{item.joinUserTotal},
0,
0,
'APP_USER',
now(),
'APP_USER',
now()
)
</foreach>
</insert>
</mapper>

8
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenUserTotalDataDao.xml

@ -105,4 +105,12 @@
</foreach>
</insert>
<!-- 根据条件查询screen_user_total_data表 -->
<select id="selectList" parameterType="map" resultType="com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity">
select * from screen_user_total_data m
where m.DEL_FLAG='0'
<if test='null!=customerId and ""!=customerId'>
and m.CUSTOMER_ID=#{customerId}
</if>
</select>
</mapper>

Loading…
Cancel
Save