|
|
@ -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; |
|
|
@ -407,7 +408,8 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
entity.setAvgJoin(realJoinCount.divide(avgFz, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
} |
|
|
|
screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.GRID); |
|
|
|
ArrayList<ScreenUserJoinEntity> dispose = dispose(formDTO, insertMap, OrgTypeConstant.GRID); |
|
|
|
screenUserJoinService.deleteAndInsertBatch(formDTO, dispose,OrgTypeConstant.GRID); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -492,7 +494,84 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
screenUserJoinService.deleteAndInsertBatch(formDTO, new ArrayList<>(insertMap.values()),OrgTypeConstant.AGENCY); |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|