This commit is contained in:
齐天大圣 2024-01-19 15:36:45 +08:00
parent 5c4922d656
commit 6a7af98bec

View File

@ -647,7 +647,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
Integer gasolineRule1 = jsonObject.getInteger("gasolineRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
@ -658,11 +658,10 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
BigDecimal multiply = divide.multiply(bigDecimal2);
paymentActiveVO.setMemberFavorableAmount(multiply);
}
}
}else {
String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
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){
@ -673,14 +672,13 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
}
}
}
}
if (oilTypebyId.equals("柴油")){
if (ljUserGrade.getGasolineDiscount().equals("无优惠")){
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
String gasolineRule = ljUserGrade.getDieselRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
Integer gasolineRule1 = jsonObject.getInteger("dieselRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
@ -691,11 +689,10 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
BigDecimal multiply = divide.multiply(bigDecimal2);
paymentActiveVO.setMemberFavorableAmount(multiply);
}
}
}else {
String gasolineRule = ljUserGrade.getDieselRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
Integer gasolineRule1 = jsonObject.getInteger("dieselRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
@ -705,7 +702,6 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
}
}
}
}
if (oilTypebyId.equals("天然气")){
@ -714,7 +710,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
String gasolineRule = ljUserGrade.getNaturalGasRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule3"))).get();
Integer gasolineRule1 = jsonObject.getInteger("naturalGas1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
@ -725,11 +721,10 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
BigDecimal multiply = divide.multiply(bigDecimal2);
paymentActiveVO.setMemberFavorableAmount(multiply);
}
}
}else {
String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
JSONObject jsonObject = jsonObjects.stream().max(Comparator.comparingDouble(o -> o.getDouble("gasolineRule2"))).get();
Integer gasolineRule1 = jsonObject.getInteger("naturalGas1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
@ -740,9 +735,6 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
}
}
}
}
}
}
return paymentActiveVO;