/**
* 获取两个号段之间的差值集合
*
* @param newNumber 新号段
* @param oldNumber 老号段
* @return 差值号段集合
*/
private List<CardNumberDistributionDTO> getMoreNumber(CardNumberDistributionEditDTO newNumber, CardNumberDistribution oldNumber) {
List<CardNumberDistributionDTO> resultList = Lists.newArrayList();
BigDecimal newCardNumberStart = new BigDecimal(newNumber.getCardNumberStart());
BigDecimal newCardNumberEnd = new BigDecimal(newNumber.getCardNumberEnd());
BigDecimal oldCardNumberStart = new BigDecimal(oldNumber.getCardNumberStart());
BigDecimal oldCardNumberEnd = new BigDecimal(oldNumber.getCardNumberEnd());
if (newCardNumberStart.compareTo(oldCardNumberStart) < 0) {
CardNumberDistributionDTO cardNumberDistributionDTO = new CardNumberDistributionDTO();
cardNumberDistributionDTO.setCardNumberStart(String.valueOf(newCardNumberStart));
cardNumberDistributionDTO.setCardNumberEnd(String.valueOf(oldCardNumberStart.subtract(new BigDecimal("1"))));
resultList.add(cardNumberDistributionDTO);
}
if (newCardNumberEnd.compareTo(oldCardNumberEnd) > 0) {
CardNumberDistributionDTO cardNumberDistributionDTO = new CardNumberDistributionDTO();
cardNumberDistributionDTO.setCardNumberStart(String.valueOf(oldCardNumberEnd.add(new BigDecimal("1"))));
cardNumberDistributionDTO.setCardNumberEnd(String.valueOf(newCardNumberEnd));
resultList.add(cardNumberDistributionDTO);
}
return resultList;
}
获取两个号段之间的差值集合
最新推荐文章于 2022-03-21 20:01:25 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)