|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.constant.GovernConstant; |
|
|
|
import com.epmet.constant.OrgTypeConstant; |
|
|
|
import com.epmet.constant.ProjectConstant; |
|
|
|
import com.epmet.dto.extract.form.ExtractScreenFormDTO; |
|
|
@ -76,6 +77,14 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
* <p> |
|
|
|
* 不考虑市北:人均议题:统计周期内议题总数/发过议题的人数 参与度:各个行为(表决)的总数/发生行为的人数 |
|
|
|
* |
|
|
|
* |
|
|
|
* ================================================================================================================ |
|
|
|
* ================================================================================================================ |
|
|
|
* 2021-07-09 新注释 |
|
|
|
* 公众参与里的指标含义说明: |
|
|
|
* 总参与:议题参与的次数(比如 表决 等行为,产品只有表决行为,其他三个街道 包含评论数、点赞数、点踩数) |
|
|
|
* 人均议题:议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重) |
|
|
|
* 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:组织内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) |
|
|
|
* @return java.lang.Boolean |
|
|
|
* @author LiuJanJun |
|
|
|
* @date 2020/9/25 10:24 上午 |
|
|
@ -86,9 +95,9 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
log.warn("extractTotalDataMonthly param is error,param:{}", JSON.toJSONString(formDTO)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
extractGridUserJoin(formDTO); |
|
|
|
extractAgencyUserJoin(formDTO); |
|
|
|
return null; |
|
|
|
gridUserJoinCal(formDTO); |
|
|
|
agencyUserJoinCal(formDTO); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
private void extractGridUserJoin(ExtractScreenFormDTO formDTO) { |
|
|
@ -178,7 +187,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
entity.setAvgJoin(bigDecimal.divide(votedByIssueCount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(NumConstant.ONE_HUNDRED))); |
|
|
|
} |
|
|
|
} |
|
|
|
screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); |
|
|
|
screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); |
|
|
|
} |
|
|
|
|
|
|
|
private void extractAgencyUserJoin(ExtractScreenFormDTO formDTO) { |
|
|
@ -219,7 +228,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
List<IssueVoteUserCountResultDTO> voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.AGENCY_ID); |
|
|
|
Map<String, Integer> orgMemberCount = new HashMap<>(); |
|
|
|
if (!CollectionUtils.isEmpty(issueTotal)) { |
|
|
|
//获取每个网格的应表决人数
|
|
|
|
//获取每个网格的应表决人数 (组成员数去重)
|
|
|
|
List<GridGroupUserCountResultDTO> memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); |
|
|
|
if (CollectionUtils.isEmpty(memberCountList)) { |
|
|
|
log.warn("抽取【公众参与-人均议题】,获取应表决人数为空,customerId:{}", formDTO.getCustomerId()); |
|
|
@ -253,12 +262,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values())); |
|
|
|
} |
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
BigDecimal bigDecimal = new BigDecimal(0); |
|
|
|
bigDecimal = bigDecimal.add(new BigDecimal(0 / (1 * 1.0))); |
|
|
|
screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); |
|
|
|
} |
|
|
|
|
|
|
|
private void buildUserJoinEntity(ExtractScreenFormDTO formDTO, Object org, Map<String, ScreenUserJoinEntity> result) { |
|
|
@ -274,7 +278,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
} else if (org instanceof DimAgencyEntity) { |
|
|
|
DimAgencyEntity agency = (DimAgencyEntity) org; |
|
|
|
entity.setCustomerId(agency.getCustomerId()); |
|
|
|
entity.setOrgType(agency.getLevel()); |
|
|
|
entity.setOrgType(OrgTypeConstant.AGENCY); |
|
|
|
entity.setOrgId(agency.getId()); |
|
|
|
entity.setParentId(agency.getPid()); |
|
|
|
entity.setOrgName(agency.getAgencyName()); |
|
|
@ -289,6 +293,10 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
entity.setAvgJoin(new BigDecimal(0)); |
|
|
|
entity.setAgvgJoinUpRate(new BigDecimal("0")); |
|
|
|
entity.setAgvgJoinUpFlag(""); |
|
|
|
entity.setAvgIssueFz(NumConstant.ZERO); |
|
|
|
entity.setAvgIssueFm(NumConstant.ZERO); |
|
|
|
entity.setAvgJoinFz(NumConstant.ZERO); |
|
|
|
entity.setAvgJoinFm(NumConstant.ZERO); |
|
|
|
result.put(entity.getOrgId(), entity); |
|
|
|
} |
|
|
|
|
|
|
@ -304,4 +312,266 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
public Boolean extractPerTotalDataDaily(ExtractScreenFormDTO formDTO) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 基层治理-公众参与【网格-月】 |
|
|
|
* @Param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2021/7/9 9:20 上午 |
|
|
|
*/ |
|
|
|
public void gridUserJoinCal(ExtractScreenFormDTO formDTO){ |
|
|
|
// 查询客户下所有网格
|
|
|
|
List<DimGridEntity> orgList = dimGridService.getGridListByCustomerId(formDTO.getCustomerId()); |
|
|
|
if (CollectionUtils.isEmpty(orgList)) { |
|
|
|
log.warn("抽取【公众参与-人均议题】,获取组织数据失败,customerId:{}", formDTO.getCustomerId()); |
|
|
|
return; |
|
|
|
} |
|
|
|
//构建组织数据
|
|
|
|
Map<String, ScreenUserJoinEntity> insertMap = new HashMap<>(16); |
|
|
|
orgList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); |
|
|
|
//获取议题月份增量
|
|
|
|
List<FactIssueGridMonthlyEntity> issueTotal = factIssueGridMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); |
|
|
|
if (CollectionUtils.isEmpty(issueTotal)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
// 查询 注册居民本月增量 党员认证本月增量 截止本月底居民总数
|
|
|
|
List<GridUserCountResultDTO> userCountList = factRegUserGridMonthlyService.selectGridUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); |
|
|
|
if (CollectionUtils.isEmpty(userCountList)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
// list 转 map 以orgId为key
|
|
|
|
Map<String, GridUserCountResultDTO> userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); |
|
|
|
for (FactIssueGridMonthlyEntity issue : issueTotal) { |
|
|
|
String gridId = issue.getGridId(); |
|
|
|
ScreenUserJoinEntity entity = insertMap.get(gridId); |
|
|
|
if (entity == null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
// 议题本月增长
|
|
|
|
entity.setJoinTotal(issue.getIssueIncr()); |
|
|
|
// 网格下 注册居民本月增量,党员认证本月增量,截止本月底居民总数
|
|
|
|
GridUserCountResultDTO user = userCountMap.get(gridId); |
|
|
|
if (user == null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
// 议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重)
|
|
|
|
log.debug("issue:{}", JSON.toJSONString(issue)); |
|
|
|
log.debug("user:{}", JSON.toJSONString(user)); |
|
|
|
if (!user.getRegTotal().equals(0)) { |
|
|
|
BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()),NumConstant.FOUR, BigDecimal.ROUND_HALF_UP); |
|
|
|
entity.setAvgIssueFz(issue.getIssueIncr()); |
|
|
|
entity.setAvgIssueFm(user.getRegTotal()); |
|
|
|
// 人均议题
|
|
|
|
entity.setAvgIssue(avgIssueCount); |
|
|
|
} |
|
|
|
} |
|
|
|
//获取该月 表决的人数
|
|
|
|
List<IssueVoteUserCountResultDTO> voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.GRID_ID); |
|
|
|
Map<String, Integer> gridMemberCount = new HashMap<>(16); |
|
|
|
// 议题月份增量不为空
|
|
|
|
if (!CollectionUtils.isEmpty(issueTotal)) { |
|
|
|
//获取每个网格的应表决人数
|
|
|
|
List<GridGroupUserCountResultDTO> memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.GRID_ID); |
|
|
|
if (CollectionUtils.isEmpty(memberCountList)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
// 网格下的组员
|
|
|
|
gridMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:网格内的人数不去重;产品:组织内的小组成员数去重)* 议题个数) |
|
|
|
*/ |
|
|
|
// 根据网格ID分组
|
|
|
|
Map<String, List<IssueVoteUserCountResultDTO>> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getOrgId)); |
|
|
|
//遍历实际参与人数
|
|
|
|
for (Map.Entry<String, List<IssueVoteUserCountResultDTO>> entry : voteMap.entrySet()) { |
|
|
|
String gridId = entry.getKey(); |
|
|
|
ScreenUserJoinEntity entity = insertMap.get(gridId); |
|
|
|
if (entity == null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
List<IssueVoteUserCountResultDTO> issueList = entry.getValue(); |
|
|
|
BigDecimal realJoinCount = new BigDecimal(0); |
|
|
|
// 网格下 议题个数
|
|
|
|
BigDecimal votedByIssueCount = new BigDecimal(issueList.get(0).getIssueCount()); |
|
|
|
// 网格下 组员人数
|
|
|
|
Integer memberCount = gridMemberCount.get(gridId); |
|
|
|
for (IssueVoteUserCountResultDTO vote : issueList) { |
|
|
|
// 每个议题参与人数求和
|
|
|
|
realJoinCount = realJoinCount.add(new BigDecimal(vote.getVoteCount())); |
|
|
|
} |
|
|
|
if (votedByIssueCount.intValue() != NumConstant.ZERO) { |
|
|
|
// 平均参与度 = 议题参与的总人数 / (应参与人数 * 议题个数)
|
|
|
|
BigDecimal avgFz = votedByIssueCount.multiply(new BigDecimal(memberCount)); |
|
|
|
entity.setAvgJoinFz(Integer.valueOf(avgFz.toString())); |
|
|
|
entity.setAvgJoinFm(Integer.valueOf(realJoinCount.toString())); |
|
|
|
entity.setAvgJoin(realJoinCount.divide(avgFz, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
} |
|
|
|
ArrayList<ScreenUserJoinEntity> dispose = dispose(formDTO, insertMap, OrgTypeConstant.GRID); |
|
|
|
screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.GRID); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 基层治理-公众参与【组织-月】 |
|
|
|
* @Param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2021/7/9 9:20 上午 |
|
|
|
*/ |
|
|
|
public void agencyUserJoinCal(ExtractScreenFormDTO formDTO){ |
|
|
|
// 查询客户下的所有组织
|
|
|
|
List<DimAgencyEntity> agencyList = dimAgencyService.getAgencyListByCustomerId(formDTO.getCustomerId()); |
|
|
|
if (CollectionUtils.isEmpty(agencyList)) { |
|
|
|
log.warn("抽取【公众参与-人均议题】,获取组织数据失败,customerId:{}", formDTO.getCustomerId()); |
|
|
|
return; |
|
|
|
} |
|
|
|
//构建组织数据
|
|
|
|
Map<String, ScreenUserJoinEntity> insertMap = new HashMap<>(16); |
|
|
|
agencyList.forEach(org -> buildUserJoinEntity(formDTO, org, insertMap)); |
|
|
|
// 查询组织下 议题月增长,截止本月议题总数
|
|
|
|
List<FactIssueAgencyMonthlyEntity> issueTotal = factIssueAgencyMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); |
|
|
|
// 查询 注册居民本月增量 党员认证本月增量 截止本月底居民总数
|
|
|
|
List<GridUserCountResultDTO> userCountList = factRegUserAgencyMonthlyService.selectAgencyUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); |
|
|
|
// 以agencyId为key
|
|
|
|
Map<String, GridUserCountResultDTO> userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); |
|
|
|
Set<String> agencyIdSet = new HashSet<>(); |
|
|
|
if (!CollectionUtils.isEmpty(issueTotal)) { |
|
|
|
issueTotal.forEach(issue -> { |
|
|
|
String agencyId = issue.getAgencyId(); |
|
|
|
agencyIdSet.add(agencyId); |
|
|
|
ScreenUserJoinEntity entity = insertMap.get(agencyId); |
|
|
|
if (entity == null){ |
|
|
|
return; |
|
|
|
} |
|
|
|
entity.setJoinTotal(issue.getIssueIncr()); |
|
|
|
GridUserCountResultDTO user = userCountMap.get(agencyId); |
|
|
|
// 人均议题:议题总数/组织内的总人数(项目:绑定网格的总用户数,产品:组织内的小组成员数去重)
|
|
|
|
if (!user.getRegTotal().equals(NumConstant.ZERO)) { |
|
|
|
BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getRegTotal()), NumConstant.FOUR, BigDecimal.ROUND_HALF_UP); |
|
|
|
entity.setAvgIssueFz(issue.getIssueIncr()); |
|
|
|
entity.setAvgIssueFm(user.getRegTotal()); |
|
|
|
entity.setAvgIssue(avgIssueCount); |
|
|
|
} |
|
|
|
}); |
|
|
|
List<List<String>> partition = ListUtils.partition(new ArrayList<>(agencyIdSet), NumConstant.THIRTY); |
|
|
|
partition.forEach(list -> { |
|
|
|
//获取该月 表决的人数
|
|
|
|
List<IssueVoteUserCountResultDTO> voteCountList = factOriginIssueLogDailyService.getVoteCount(formDTO.getCustomerId(), formDTO.getMonthId(), ProjectConstant.AGENCY_ID); |
|
|
|
Map<String, Integer> orgMemberCount = new HashMap<>(16); |
|
|
|
if (!CollectionUtils.isEmpty(issueTotal)) { |
|
|
|
//获取每个组织的应表决人数
|
|
|
|
List<GridGroupUserCountResultDTO> memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); |
|
|
|
if (CollectionUtils.isEmpty(memberCountList)) { |
|
|
|
log.warn("抽取【公众参与-人均议题】,获取应表决人数为空,customerId:{}", formDTO.getCustomerId()); |
|
|
|
return; |
|
|
|
} |
|
|
|
// (k,v) = (agencyId,组织下的人)
|
|
|
|
orgMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); |
|
|
|
} |
|
|
|
// 平均参与度:议题参与的总人数(每个议题参与人数的和)/(应参与人数(项目:组织内的人数不去重;产品:组织内的小组成员数去重)* 议题个数)
|
|
|
|
// 根据组织ID分组
|
|
|
|
Map<String, List<IssueVoteUserCountResultDTO>> voteMap = voteCountList.stream().collect(Collectors.groupingBy(IssueVoteUserCountResultDTO::getOrgId)); |
|
|
|
for (Map.Entry<String, List<IssueVoteUserCountResultDTO>> entry : voteMap.entrySet()) { |
|
|
|
String orgId = entry.getKey(); |
|
|
|
ScreenUserJoinEntity entity = insertMap.get(orgId); |
|
|
|
List<IssueVoteUserCountResultDTO> issueList = entry.getValue(); |
|
|
|
// 实际参与人数
|
|
|
|
BigDecimal realJoinCount = new BigDecimal(NumConstant.ZERO); |
|
|
|
// 组织下 的议题数
|
|
|
|
BigDecimal votedByIssueCount = new BigDecimal(issueList.get(NumConstant.ZERO).getIssueCount()); |
|
|
|
// 组织下应参与人数
|
|
|
|
Integer memberCount = orgMemberCount.get(orgId); |
|
|
|
for (IssueVoteUserCountResultDTO vote : issueList) { |
|
|
|
realJoinCount = realJoinCount.add(new BigDecimal(vote.getVoteCount())); |
|
|
|
} |
|
|
|
if (votedByIssueCount.intValue() != 0) { |
|
|
|
// 平均参与度 = 议题参与的总人数 / (应参与人数 * 议题个数)
|
|
|
|
BigDecimal avgFz = votedByIssueCount.multiply(new BigDecimal(memberCount)); |
|
|
|
entity.setAvgJoin(realJoinCount.divide(votedByIssueCount, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); |
|
|
|
entity.setAvgJoinFz(Integer.valueOf(realJoinCount.toString())); |
|
|
|
entity.setAvgJoinFm(Integer.valueOf(avgFz.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
ArrayList<ScreenUserJoinEntity> dispose = dispose(formDTO, insertMap, OrgTypeConstant.AGENCY); |
|
|
|
screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.AGENCY); |
|
|
|
} |
|
|
|
|
|
|
|
public ArrayList<ScreenUserJoinEntity> dispose(ExtractScreenFormDTO formDTO,Map<String, ScreenUserJoinEntity> insertMap,String flag) { |
|
|
|
String beforeNMonthByMonth = DateUtils.getBeforeNMonthByMonth(NumConstant.ONE, formDTO.getMonthId()); |
|
|
|
List<ScreenUserJoinEntity> screenUserJoinEntities = screenUserJoinService.selectScreenUserJoin(formDTO.getCustomerId(), beforeNMonthByMonth, flag); |
|
|
|
ArrayList<ScreenUserJoinEntity> insertList = new ArrayList<>(insertMap.values()); |
|
|
|
if (CollectionUtils.isEmpty(screenUserJoinEntities)) { |
|
|
|
insertList.forEach(l -> { |
|
|
|
// 总的参与次数较上月增长率
|
|
|
|
if (l.getJoinTotal().equals(NumConstant.ZERO)) { |
|
|
|
l.setJoinTotalUpFlag(GovernConstant.EQ); |
|
|
|
l.setJoinTotalUpRate(NumConstant.ZERO_DECIMAL); |
|
|
|
} else if (l.getJoinTotal() > NumConstant.ZERO) { |
|
|
|
l.setJoinTotalUpFlag(GovernConstant.INCR); |
|
|
|
l.setJoinTotalUpRate(NumConstant.ONE_HUNDRED_DECIMAL); |
|
|
|
} |
|
|
|
// 人均议题较上月增长率
|
|
|
|
if (l.getAvgIssue().equals(NumConstant.ZERO_DECIMAL)) { |
|
|
|
l.setAvgIssueUpFlag(GovernConstant.EQ); |
|
|
|
l.setAvgIssueUpRate(NumConstant.ZERO_DECIMAL); |
|
|
|
} else { |
|
|
|
l.setAvgIssueUpFlag(GovernConstant.INCR); |
|
|
|
l.setAvgIssueUpRate(NumConstant.ONE_HUNDRED_DECIMAL); |
|
|
|
} |
|
|
|
// 平均参与度较上月增长率
|
|
|
|
if (l.getAvgJoin().equals(NumConstant.ZERO_DECIMAL)) { |
|
|
|
l.setAgvgJoinUpFlag(GovernConstant.EQ); |
|
|
|
l.setAgvgJoinUpRate(NumConstant.ZERO_DECIMAL); |
|
|
|
} else { |
|
|
|
l.setAgvgJoinUpFlag(GovernConstant.INCR); |
|
|
|
l.setAgvgJoinUpRate(NumConstant.ONE_HUNDRED_DECIMAL); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
insertList.forEach(l -> { |
|
|
|
screenUserJoinEntities.forEach(s -> { |
|
|
|
if (l.getOrgId().equals(s.getOrgId())) { |
|
|
|
// 总的参与次数较上月增长率
|
|
|
|
if (l.getJoinTotal() > s.getJoinTotal()) { |
|
|
|
l.setJoinTotalUpFlag(GovernConstant.INCR); |
|
|
|
l.setJoinTotalUpRate(new BigDecimal(((l.getJoinTotal() - s.getJoinTotal()) / s.getJoinTotal()) * NumConstant.ONE_HUNDRED).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} else if (l.getJoinTotal() < s.getJoinTotal()) { |
|
|
|
l.setJoinTotalUpFlag(GovernConstant.DECR); |
|
|
|
l.setJoinTotalUpRate(new BigDecimal(((l.getJoinTotal() - s.getJoinTotal()) / s.getJoinTotal()) * NumConstant.ONE_HUNDRED).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} else { |
|
|
|
l.setJoinTotalUpFlag(GovernConstant.EQ); |
|
|
|
l.setJoinTotalUpRate(NumConstant.ZERO_DECIMAL); |
|
|
|
} |
|
|
|
// 人均议题较上月增长率
|
|
|
|
Integer re = l.getAvgIssue().compareTo(s.getAvgIssue()); |
|
|
|
if (re.equals(NumConstant.ONE)) { |
|
|
|
l.setAvgIssueUpFlag(GovernConstant.INCR); |
|
|
|
l.setAvgIssueUpRate(l.getAvgIssue().subtract(s.getAvgIssue()).divide(s.getAvgIssue()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} else if (re.equals(NumConstant.ONE_NEG)) { |
|
|
|
l.setAvgIssueUpFlag(GovernConstant.DECR); |
|
|
|
l.setAvgIssueUpRate(l.getAvgIssue().subtract(s.getAvgIssue()).divide(s.getAvgIssue()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} else { |
|
|
|
l.setAvgIssueUpFlag(GovernConstant.EQ); |
|
|
|
l.setAvgIssueUpRate(NumConstant.ZERO_DECIMAL); |
|
|
|
} |
|
|
|
// 平均参与度较上月增长率
|
|
|
|
Integer avgJoinRe = l.getAvgJoin().compareTo(s.getAvgJoin()); |
|
|
|
if (avgJoinRe.equals(NumConstant.ONE)) { |
|
|
|
l.setAgvgJoinUpFlag(GovernConstant.INCR); |
|
|
|
l.setAgvgJoinUpRate(l.getAvgJoin().subtract(s.getAvgJoin()).divide(s.getAvgJoin()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} else if (avgJoinRe.equals(NumConstant.ONE_NEG)) { |
|
|
|
l.setAvgIssueUpFlag(GovernConstant.DECR); |
|
|
|
l.setAgvgJoinUpRate(l.getAvgJoin().subtract(s.getAvgJoin()).divide(s.getAvgJoin()).multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} else { |
|
|
|
l.setAvgIssueUpFlag(GovernConstant.EQ); |
|
|
|
l.setAgvgJoinUpRate(NumConstant.ZERO_DECIMAL); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
return insertList; |
|
|
|
} |
|
|
|
} |
|
|
|