|
|
@ -1,11 +1,30 @@ |
|
|
package com.epmet.service.evaluationindex.extract.toscreen.impl; |
|
|
package com.epmet.service.evaluationindex.extract.toscreen.impl; |
|
|
|
|
|
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
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.OrgTypeConstant; |
|
|
|
|
|
import com.epmet.dto.extract.form.ExtractScreenFormDTO; |
|
|
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenUserJoinEntity; |
|
|
|
|
|
import com.epmet.entity.stats.DimAgencyEntity; |
|
|
|
|
|
import com.epmet.entity.stats.DimGridEntity; |
|
|
|
|
|
import com.epmet.entity.stats.FactIssueGridMonthlyEntity; |
|
|
import com.epmet.service.evaluationindex.extract.toscreen.PublicPartExtractService; |
|
|
import com.epmet.service.evaluationindex.extract.toscreen.PublicPartExtractService; |
|
|
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; |
|
|
import com.epmet.service.stats.DimAgencyService; |
|
|
import com.epmet.service.evaluationindex.screen.ScreenPublicPartiTotalDataService; |
|
|
import com.epmet.service.stats.DimGridService; |
|
|
|
|
|
import com.epmet.service.stats.FactIssueGridMonthlyService; |
|
|
|
|
|
import com.epmet.util.DimIdGenerator; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* desc:公众参与抽取到大屏的接口实现类 |
|
|
* desc:公众参与抽取到大屏的接口实现类 |
|
|
@ -14,33 +33,99 @@ import org.springframework.stereotype.Service; |
|
|
* @date: 2020/9/25 10:46 上午 |
|
|
* @date: 2020/9/25 10:46 上午 |
|
|
* @version: 1.0 |
|
|
* @version: 1.0 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
|
public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ScreenPublicPartiTotalDataService screenPublicPartiTotalDataService; |
|
|
private DimAgencyService dimAgencyService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private FactOriginProjectMainDailyService factOriginProjectMainDailyService; |
|
|
private DimGridService dimGridService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ScreenCustomerAgencyService agencyService; |
|
|
private FactIssueGridMonthlyService factIssueGridMonthlyService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* desc: 【月】抽取公众参与 人均议题 总次数和平均参与度 |
|
|
* desc: 【月】抽取公众参与 人均议题 总次数和平均参与度 |
|
|
* target:screen_user_join |
|
|
* target:screen_user_join |
|
|
|
|
|
* 总参与:统计周期内议题表决的人数 |
|
|
|
|
|
* 百人人均议题:统计周期内总的议题数/(用户数/100) |
|
|
|
|
|
* 百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 |
|
|
|
|
|
* 不考虑市北:人均议题:统计周期内议题总数/发过议题的人数 参与度:各个行为(表决)的总数/发生行为的人数 |
|
|
* |
|
|
* |
|
|
* @return java.lang.Boolean |
|
|
* @return java.lang.Boolean |
|
|
* @author LiuJanJun |
|
|
* @author LiuJanJun |
|
|
* @date 2020/9/25 10:24 上午 |
|
|
* @date 2020/9/25 10:24 上午 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public Boolean extractTotalDataMonthly() { |
|
|
public Boolean extractTotalDataMonthly(ExtractScreenFormDTO formDTO) { |
|
|
//agencyService.initAgencies();
|
|
|
if (StringUtils.isBlank(formDTO.getCustomerId()) || StringUtils.isBlank(formDTO.getMonthId())) { |
|
|
|
|
|
log.warn("extractTotalDataMonthly param is error,param:{}", JSON.toJSONString(formDTO)); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
extractGridUserJoin(formDTO); |
|
|
|
|
|
extractAgencyUserJoin(formDTO); |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void extractGridUserJoin(ExtractScreenFormDTO formDTO) { |
|
|
|
|
|
List<DimGridEntity> orgList = dimGridService.getGridListByCustomerId(formDTO.getCustomerId()); |
|
|
|
|
|
if (CollectionUtils.isEmpty(orgList)) { |
|
|
|
|
|
log.warn("抽取【公众参与-人均议题】,获取组织数据失败"); |
|
|
|
|
|
throw new RenException("抽取【公众参与-人均议题】,获取组织数据失败"); |
|
|
|
|
|
} |
|
|
|
|
|
//构建组织数据
|
|
|
|
|
|
Map<String, ScreenUserJoinEntity> insertMap = new HashMap<>(); |
|
|
|
|
|
orgList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void extractAgencyUserJoin(ExtractScreenFormDTO formDTO) { |
|
|
|
|
|
List<DimAgencyEntity> orgList = dimAgencyService.getAgencyListByCustomerId(formDTO.getCustomerId()); |
|
|
|
|
|
if (CollectionUtils.isEmpty(orgList)) { |
|
|
|
|
|
log.warn("抽取【公众参与-人均议题】,获取组织数据失败"); |
|
|
|
|
|
throw new RenException("抽取【公众参与-人均议题】,获取组织数据失败"); |
|
|
|
|
|
} |
|
|
|
|
|
//构建组织数据
|
|
|
|
|
|
Map<String, ScreenUserJoinEntity> insertMap = new HashMap<>(); |
|
|
|
|
|
orgList.forEach(org -> { |
|
|
|
|
|
buildUserJoinEntity(formDTO, org, insertMap); |
|
|
|
|
|
}); |
|
|
|
|
|
List<FactIssueGridMonthlyEntity> issueTotal = factIssueGridMonthlyService.getIssueCount(formDTO.getCustomerId(), formDTO.getMonthId()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void buildUserJoinEntity(ExtractScreenFormDTO formDTO, Object org, Map<String, ScreenUserJoinEntity> result) { |
|
|
|
|
|
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(DateUtils.stringToDate(formDTO.getMonthId(), DateUtils.DATE_PATTERN_YYYYMMDD)); |
|
|
|
|
|
ScreenUserJoinEntity entity = ConvertUtils.sourceToTarget(dimIdBean, ScreenUserJoinEntity.class); |
|
|
|
|
|
if (org instanceof DimGridEntity) { |
|
|
|
|
|
DimGridEntity grid = (DimGridEntity) org; |
|
|
|
|
|
entity.setCustomerId(grid.getCustomerId()); |
|
|
|
|
|
entity.setOrgType(OrgTypeConstant.GRID); |
|
|
|
|
|
entity.setOrgId(grid.getId()); |
|
|
|
|
|
entity.setParentId(grid.getAgencyId()); |
|
|
|
|
|
entity.setOrgName(grid.getGridName()); |
|
|
|
|
|
} else if (org instanceof DimAgencyEntity) { |
|
|
|
|
|
DimAgencyEntity agency = (DimAgencyEntity) org; |
|
|
|
|
|
entity.setCustomerId(agency.getCustomerId()); |
|
|
|
|
|
entity.setOrgType(agency.getLevel()); |
|
|
|
|
|
entity.setOrgId(agency.getId()); |
|
|
|
|
|
entity.setParentId(agency.getPid()); |
|
|
|
|
|
entity.setOrgName(agency.getAgencyName()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
entity.setJoinTotal(0); |
|
|
|
|
|
entity.setJoinTotalUpRate(new BigDecimal("0")); |
|
|
|
|
|
entity.setJoinTotalUpFlag(""); |
|
|
|
|
|
entity.setAvgIssue(0); |
|
|
|
|
|
entity.setAvgIssueUpRate(new BigDecimal("0")); |
|
|
|
|
|
entity.setAvgIssueUpFlag(""); |
|
|
|
|
|
entity.setAvgJoin(0); |
|
|
|
|
|
entity.setAgvgJoinUpRate(new BigDecimal("0")); |
|
|
|
|
|
entity.setAgvgJoinUpFlag(""); |
|
|
|
|
|
result.put(entity.getOrgId(), entity); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* desc: 【日】抽取公众参与 各类总数 |
|
|
* desc: 【日】抽取公众参与 各类总数 累计值 |
|
|
* target:screen_public_parti_total_data |
|
|
* target:screen_public_parti_total_data |
|
|
* |
|
|
* |
|
|
* @return java.lang.Boolean |
|
|
* @return java.lang.Boolean |
|
|
@ -48,7 +133,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
* @date 2020/9/25 10:24 上午 |
|
|
* @date 2020/9/25 10:24 上午 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public Boolean extractPerTotalDataDaily() { |
|
|
public Boolean extractPerTotalDataDaily(ExtractScreenFormDTO formDTO) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|