Xiaojh 4 年之前
父节点
当前提交
c92a5b2de7

+ 3 - 2
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PayFeeController.java

@@ -87,7 +87,8 @@ public class PayFeeController {
             @ApiParam(value = "欠费金额", required = false) @RequestParam(required = false)String debt,
             @ApiParam(value = "预存金额", required = false) @RequestParam(required = false)String remaining,
             @ApiParam(value = "购水量", required = false) @RequestParam(required = false)String amount,
-            @ApiParam(value = "购水金额", required = false) @RequestParam(required = false)String waterAmount,
+            /*@ApiParam(value = "购水金额", required = false) @RequestParam(required = false)String waterAmount,*/
+            @ApiParam(value = "单价", required = false) @RequestParam(required = false)String price,
             @ApiParam(value = "实收金额", required = true) @RequestParam(required = true)String transAmount,
             @ApiParam(value = "支付方式", required = true) @RequestParam(required = true)Integer payway,
             @ApiParam(value = "是否转预存,0否 1是", required = true) @RequestParam(required = true)Integer balancetype
@@ -95,7 +96,7 @@ public class PayFeeController {
     ){
         //暂时先默认柜台支付为现金支付,后期区分
      return new AjaxMessage<>(ResultStatus.OK, payFeeService.payFeeCounter(accountId,4,new BigDecimal(transAmount),balancetype,
-             new BigDecimal(debt),new BigDecimal(remaining),Integer.valueOf(amount),new BigDecimal(waterAmount)));
+             new BigDecimal(debt),new BigDecimal(remaining),Integer.valueOf(amount),new BigDecimal(price)));
     }
 
     @GetMapping("/findPayfeeAccountInfo")

+ 7 - 3
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayFeeServiceImp.java

@@ -64,7 +64,7 @@ public class PayFeeServiceImp implements PayFeeService {
      * @pram waterAmount 购水金额
      */
     public PayfeeResult payFeeCounter( String id,Integer payway,BigDecimal transAmount, Integer balancetype,BigDecimal debt,
-                                       BigDecimal ycremaining,Integer amount, BigDecimal waterAmount){
+                                       BigDecimal ycremaining,Integer amount,BigDecimal price){
         //实收金额不可为负数
         if(transAmount.compareTo(BigDecimal.ZERO)!=1){
             throw new ServiceException(ResultStatus.PAYFEE_TRANSAMOUNT_BELOW_ZERO);
@@ -82,9 +82,9 @@ public class PayFeeServiceImp implements PayFeeService {
             throw new ServiceException(ResultStatus.PAYFEE_REMAINING_BELOW_ZERO);
         }
         //购水金额不能为负数
-        if(waterAmount.compareTo(BigDecimal.ZERO) != 1){
+     /*   if(waterAmount.compareTo(BigDecimal.ZERO) != 1){
             throw new ServiceException(ResultStatus.PAYFEE_WATERAMOUNT_BELOW_ZERO);
-        }
+        }*/
         //String result="";   //执行结果描述
         String result="实收金额:"+String.format("%.2f",transAmount)+"元";
         BigDecimal fees=BigDecimal.ZERO;    //抵扣金额
@@ -104,6 +104,10 @@ public class PayFeeServiceImp implements PayFeeService {
         //查询欠费信息
         List<PayReceivable> payReceivableList =payFeeMapper.getReceivable(loginUser.getSiteId(),loginUser.getCustomerId(),payCustomRechargeDto.getAccountId(),null);
 
+
+        //购水金额 = 单价*水量
+        BigDecimal waterAmount = price.multiply(new BigDecimal(amount));
+
         if(payReceivableList.size() == 0 && debt.compareTo(BigDecimal.ZERO) ==0){ //没有应收信息走仅充值
             return rechargefeeCounter(id, transAmount, payway,balancetype,waterAmount);
         }else{

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayFeeService.java

@@ -42,7 +42,7 @@ public interface PayFeeService {
      * @pram waterAmount 购水金额
      */
     PayfeeResult payFeeCounter( String id,Integer payway,BigDecimal transAmount, Integer balancetype,BigDecimal debt,
-                               BigDecimal remaining,Integer amount, BigDecimal waterAmount);
+                               BigDecimal remaining,Integer amount,BigDecimal price);
 
     /**
      * 查询客户信息