This commit is contained in:
齐天大圣 2024-01-19 16:02:17 +08:00
parent 6a7af98bec
commit 974264984f

View File

@ -648,23 +648,20 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
Integer gasolineRule1 = jsonObject.getInteger("gasolineRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
BigDecimal bigDecimal = jsonObject.getBigDecimal("gasolineRule1");
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
Integer gasolineRule3 = jsonObject.getInteger("gasolineRule3");
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
BigDecimal multiply = divide.multiply(bigDecimal2);
BigDecimal gasolineRule3 = jsonObject.getBigDecimal("gasolineRule3");
BigDecimal multiply = divide.multiply(gasolineRule3);
paymentActiveVO.setMemberFavorableAmount(multiply);
}
}else {
String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
Integer gasolineRule1 = jsonObject.getInteger("gasolineRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
BigDecimal gasolineRule1 = jsonObject.getBigDecimal("gasolineRule1");
if (paymentActiveDTO.getAmount().compareTo(gasolineRule1)>=0){
//升数
Integer gasolineRule3 = jsonObject.getInteger("gasolineRule2");
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
@ -679,13 +676,11 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
String gasolineRule = ljUserGrade.getDieselRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
Integer gasolineRule1 = jsonObject.getInteger("dieselRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
BigDecimal bigDecimal =jsonObject.getBigDecimal("dieselRule1");
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
Integer gasolineRule3 = jsonObject.getInteger("dieselRule3");
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
BigDecimal bigDecimal2 = jsonObject.getBigDecimal("dieselRule3");
BigDecimal multiply = divide.multiply(bigDecimal2);
paymentActiveVO.setMemberFavorableAmount(multiply);
}
@ -693,8 +688,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
String gasolineRule = ljUserGrade.getDieselRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
Integer gasolineRule1 = jsonObject.getInteger("dieselRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
BigDecimal bigDecimal = jsonObject.getBigDecimal("dieselRule1");
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
Integer gasolineRule3 = jsonObject.getInteger("dieselRule2");
@ -711,13 +705,11 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
String gasolineRule = ljUserGrade.getNaturalGasRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
Integer gasolineRule1 = jsonObject.getInteger("naturalGas1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
BigDecimal bigDecimal = jsonObject.getBigDecimal("naturalGas1");
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
Integer gasolineRule3 = jsonObject.getInteger("naturalGas3");
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
BigDecimal bigDecimal2 = jsonObject.getBigDecimal("naturalGas3");
BigDecimal multiply = divide.multiply(bigDecimal2);
paymentActiveVO.setMemberFavorableAmount(multiply);
}
@ -725,8 +717,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
Integer gasolineRule1 = jsonObject.getInteger("naturalGas1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
BigDecimal bigDecimal = jsonObject.getBigDecimal("naturalGas1");
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
Integer gasolineRule3 = jsonObject.getInteger("naturalGas2");