|
@@ -601,6 +601,11 @@ public class PayController {
|
|
//已存在用户信息 existCustomer
|
|
//已存在用户信息 existCustomer
|
|
CustomerManage existCustomer = payOrderService.isExistCustomer(customerManage);
|
|
CustomerManage existCustomer = payOrderService.isExistCustomer(customerManage);
|
|
logger.info("查询出客户是否存在数据 null 表示没有" + existCustomer);
|
|
logger.info("查询出客户是否存在数据 null 表示没有" + existCustomer);
|
|
|
|
+
|
|
|
|
+ //获取该油站的优惠方式
|
|
|
|
+ String discountPlanType = stationService.getStationDiscountWay(infoMap.get("stationId").toString());
|
|
|
|
+ logger.info("油站优惠方式:"+discountPlanType);
|
|
|
|
+
|
|
//判断该用户是否已存在
|
|
//判断该用户是否已存在
|
|
if(existCustomer != null){ //存在该用户时更新
|
|
if(existCustomer != null){ //存在该用户时更新
|
|
//此处if放null处理
|
|
//此处if放null处理
|
|
@@ -620,9 +625,6 @@ public class PayController {
|
|
}
|
|
}
|
|
logger.info("存在客户 更新时手机号参数: " + customerManage.getPhoneNumber());
|
|
logger.info("存在客户 更新时手机号参数: " + customerManage.getPhoneNumber());
|
|
|
|
|
|
- //获取该油站的优惠方式
|
|
|
|
- String discountPlanType = stationService.getStationDiscountWay(infoMap.get("stationId").toString());
|
|
|
|
- logger.info("油站优惠方式:"+discountPlanType);
|
|
|
|
if(discountPlanType !=null && discountPlanType.equals("1")){
|
|
if(discountPlanType !=null && discountPlanType.equals("1")){
|
|
//直降时存入等级名称和等级ID
|
|
//直降时存入等级名称和等级ID
|
|
List<Map> customerGradeInfo = customerGradeServices.getCustomerGradeList(infoMap); //直降
|
|
List<Map> customerGradeInfo = customerGradeServices.getCustomerGradeList(infoMap); //直降
|
|
@@ -640,7 +642,6 @@ public class PayController {
|
|
payOrderService.updateCustomer(customerManage);
|
|
payOrderService.updateCustomer(customerManage);
|
|
}else{
|
|
}else{
|
|
//该客户不存在时插入
|
|
//该客户不存在时插入
|
|
- String discountPlanType = stationService.getStationDiscountWay(infoMap.get("stationId").toString());
|
|
|
|
if(discountPlanType !=null && discountPlanType.equals("1")){
|
|
if(discountPlanType !=null && discountPlanType.equals("1")){
|
|
//直降时存入等级名称和等级ID
|
|
//直降时存入等级名称和等级ID
|
|
List<Map> customerGradeInfo = customerGradeServices.getCustomerGradeList(infoMap); //直降
|
|
List<Map> customerGradeInfo = customerGradeServices.getCustomerGradeList(infoMap); //直降
|
|
@@ -709,21 +710,40 @@ public class PayController {
|
|
BigDecimal realAmt = new BigDecimal(infoMap.get("amt").toString()); //本次消费实收金额
|
|
BigDecimal realAmt = new BigDecimal(infoMap.get("amt").toString()); //本次消费实收金额
|
|
for(IntegralRuleDetail integralRuleDetail : integralRuleDetailList){
|
|
for(IntegralRuleDetail integralRuleDetail : integralRuleDetailList){
|
|
if(realAmt.compareTo(integralRuleDetail.getRuleTerms()) ==1){
|
|
if(realAmt.compareTo(integralRuleDetail.getRuleTerms()) ==1){
|
|
- //计算积分并取整
|
|
|
|
- BigDecimal integral = realAmt.divide(integralRuleDetail.getSaleAmt(), 0).multiply(integralRuleDetail.getIntegral()).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
- //设置积分多倍时间时
|
|
|
|
- if(datePicker !=null){
|
|
|
|
- for(String str: datePicker){
|
|
|
|
- if (str.contains(currentTime) && rule.get(0).getIntegralProportion() != null){
|
|
|
|
- integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
|
|
|
|
- break;
|
|
|
|
|
|
+ //此处使用等级与不使用等级时参数存储获取逻辑写重原因:省去一次根据等级ID查询规则的数据库访问
|
|
|
|
+ if(discountPlanType == "1" && customerManage.getGrade().equals(integralRuleDetail.getGread())){
|
|
|
|
+ //计算积分并取整
|
|
|
|
+ BigDecimal integral = realAmt.divide(integralRuleDetail.getSaleAmt(), 0).multiply(integralRuleDetail.getIntegral()).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
+ //设置积分多倍时间时
|
|
|
|
+ if(datePicker !=null){
|
|
|
|
+ for(String str: datePicker){
|
|
|
|
+ if (str.contains(currentTime) && rule.get(0).getIntegralProportion() != null){
|
|
|
|
+ integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ customerPoints.setPoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPoints.setAccumulatePoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPointsRecord.setIntegral(Integer.valueOf(integral.toString()));
|
|
|
|
+ //break;
|
|
|
|
+ }else {
|
|
|
|
+ //计算积分并取整
|
|
|
|
+ BigDecimal integral = realAmt.divide(integralRuleDetail.getSaleAmt(), 0).multiply(integralRuleDetail.getIntegral()).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
+ //设置积分多倍时间时
|
|
|
|
+ if(datePicker !=null){
|
|
|
|
+ for(String str: datePicker){
|
|
|
|
+ if (str.contains(currentTime) && rule.get(0).getIntegralProportion() != null){
|
|
|
|
+ integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ customerPoints.setPoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPoints.setAccumulatePoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPointsRecord.setIntegral(Integer.valueOf(integral.toString()));
|
|
|
|
+ //break;
|
|
}
|
|
}
|
|
- customerPoints.setPoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
- customerPoints.setAccumulatePoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
- customerPointsRecord.setIntegral(Integer.valueOf(integral.toString()));
|
|
|
|
- break;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -732,21 +752,41 @@ public class PayController {
|
|
BigDecimal receivableAmt = new BigDecimal(infoMap.get("receivableAmt").toString()); //本次消费实收金额
|
|
BigDecimal receivableAmt = new BigDecimal(infoMap.get("receivableAmt").toString()); //本次消费实收金额
|
|
for(IntegralRuleDetail integralRuleDetail : integralRuleDetailList){
|
|
for(IntegralRuleDetail integralRuleDetail : integralRuleDetailList){
|
|
if(receivableAmt.compareTo(integralRuleDetail.getRuleTerms()) ==1){
|
|
if(receivableAmt.compareTo(integralRuleDetail.getRuleTerms()) ==1){
|
|
- //计算积分并取整
|
|
|
|
- BigDecimal integral = receivableAmt.divide(integralRuleDetail.getSaleAmt(), 0).multiply(integralRuleDetail.getIntegral()).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
- //设置积分多倍时间时
|
|
|
|
- if(datePicker !=null){
|
|
|
|
- for(String str: datePicker){
|
|
|
|
- if (str.contains(currentTime) && rule.get(0).getIntegralProportion() != null){
|
|
|
|
- integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
|
|
|
|
- break;
|
|
|
|
|
|
+ //此处使用等级与不使用等级时参数存储获取逻辑写重原因:省去一次数据库访问
|
|
|
|
+ if(discountPlanType == "1" && customerManage.getGrade().equals(integralRuleDetail.getGread())){
|
|
|
|
+ //计算积分并取整
|
|
|
|
+ BigDecimal integral = receivableAmt.divide(integralRuleDetail.getSaleAmt(), 0).multiply(integralRuleDetail.getIntegral()).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
+ //设置积分多倍时间时
|
|
|
|
+ if(datePicker !=null){
|
|
|
|
+ for(String str: datePicker){
|
|
|
|
+ if (str.contains(currentTime) && rule.get(0).getIntegralProportion() != null){
|
|
|
|
+ integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ customerPoints.setPoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPoints.setAccumulatePoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPointsRecord.setIntegral(Integer.valueOf(integral.toString()));
|
|
|
|
+ //break;
|
|
|
|
+ }else {
|
|
|
|
+ //计算积分并取整
|
|
|
|
+ BigDecimal integral = receivableAmt.divide(integralRuleDetail.getSaleAmt(), 0).multiply(integralRuleDetail.getIntegral()).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
+ //设置积分多倍时间时
|
|
|
|
+ if(datePicker !=null){
|
|
|
|
+ for(String str: datePicker){
|
|
|
|
+ if (str.contains(currentTime) && rule.get(0).getIntegralProportion() != null){
|
|
|
|
+ integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ customerPoints.setPoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPoints.setAccumulatePoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPointsRecord.setIntegral(Integer.valueOf(integral.toString()));
|
|
|
|
+ //break;
|
|
}
|
|
}
|
|
- customerPoints.setPoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
- customerPoints.setAccumulatePoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
- customerPointsRecord.setIntegral(Integer.valueOf(integral.toString()));
|
|
|
|
- break;
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -754,21 +794,40 @@ public class PayController {
|
|
BigDecimal orderLiters = new BigDecimal(infoMap.get("orderLiters").toString());
|
|
BigDecimal orderLiters = new BigDecimal(infoMap.get("orderLiters").toString());
|
|
for(IntegralRuleDetail integralRuleDetail : integralRuleDetailList){
|
|
for(IntegralRuleDetail integralRuleDetail : integralRuleDetailList){
|
|
if(orderLiters.compareTo(integralRuleDetail.getRuleTerms()) ==1){
|
|
if(orderLiters.compareTo(integralRuleDetail.getRuleTerms()) ==1){
|
|
- //计算积分并取整
|
|
|
|
- BigDecimal integral = orderLiters.divide(integralRuleDetail.getSaleAmt(), 0).multiply(integralRuleDetail.getIntegral()).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
- //设置积分多倍时间时
|
|
|
|
- if(datePicker !=null){
|
|
|
|
- for(String str: datePicker){
|
|
|
|
- if (str.contains(currentTime) && rule.get(0).getIntegralProportion() !=null ){
|
|
|
|
- integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
|
|
|
|
- break;
|
|
|
|
|
|
+ //此处使用等级与不使用等级时参数存储获取逻辑写重原因:省去一次数据库访问
|
|
|
|
+ if(discountPlanType == "1" && customerManage.getGrade().equals(integralRuleDetail.getGread())){
|
|
|
|
+ //计算积分并取整
|
|
|
|
+ BigDecimal integral = orderLiters.divide(integralRuleDetail.getSaleAmt(), 0).multiply(integralRuleDetail.getIntegral()).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
+ //设置积分多倍时间时
|
|
|
|
+ if(datePicker !=null){
|
|
|
|
+ for(String str: datePicker){
|
|
|
|
+ if (str.contains(currentTime) && rule.get(0).getIntegralProportion() !=null ){
|
|
|
|
+ integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ customerPoints.setPoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPoints.setAccumulatePoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPointsRecord.setIntegral(Integer.valueOf(integral.toString()));
|
|
|
|
+ //break;
|
|
|
|
+ }else {
|
|
|
|
+ //计算积分并取整
|
|
|
|
+ BigDecimal integral = orderLiters.divide(integralRuleDetail.getSaleAmt(), 0).multiply(integralRuleDetail.getIntegral()).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
+ //设置积分多倍时间时
|
|
|
|
+ if(datePicker !=null){
|
|
|
|
+ for(String str: datePicker){
|
|
|
|
+ if (str.contains(currentTime) && rule.get(0).getIntegralProportion() !=null ){
|
|
|
|
+ integral=integral.multiply(new BigDecimal(rule.get(0).getIntegralProportion()));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ customerPoints.setPoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPoints.setAccumulatePoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
+ customerPointsRecord.setIntegral(Integer.valueOf(integral.toString()));
|
|
|
|
+ //break;
|
|
}
|
|
}
|
|
- customerPoints.setPoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
- customerPoints.setAccumulatePoints(customerPointsInfo.getPoints() + Integer.valueOf(integral.toString()));
|
|
|
|
- customerPointsRecord.setIntegral(Integer.valueOf(integral.toString()));
|
|
|
|
- break;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|