|
|
|
@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
@@ -225,6 +226,19 @@ public class WxBillController extends BaseController { |
|
|
|
return new ResultData(result); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("获取支付渠道") |
|
|
|
@GetMapping("payChannel") |
|
|
|
public ResultData payChannel() { |
|
|
|
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(this.getTenantInfo()); |
|
|
|
if (null == wxPayAccountBill || null == wxPayAccountBill.getPayChannel()) { |
|
|
|
return new ResultData(Result.ERROR,"账单支付配置错误,请联系管理员"); |
|
|
|
} |
|
|
|
Map retMap = new HashMap(); |
|
|
|
retMap.put("payChannel", wxPayAccountBill.getPayChannel()); |
|
|
|
retMap.put("payChannelName", EnumBillPayChannel.getEnum(wxPayAccountBill.getPayChannel()).getMessage()); |
|
|
|
return new ResultData(retMap); |
|
|
|
} |
|
|
|
|
|
|
|
//必要的参数是这三个,其他根据每个支付方式来传参数 |
|
|
|
@ApiOperation(value = "支付", notes = "{\"billTypeValue\":\"string\",\"billId\":\"string\",\"payMoney\":\"string\"}") |
|
|
|
@PostMapping("payBill") |
|
|
|
@@ -254,6 +268,10 @@ public class WxBillController extends BaseController { |
|
|
|
if (null == billdetail) { |
|
|
|
return new ResultData(Result.ERROR,"账单支付未查询到"); |
|
|
|
} |
|
|
|
BigDecimal owe = new BigDecimal(billdetail.getOwe()); |
|
|
|
if (owe.compareTo(new BigDecimal(payMoney)) < 0) { |
|
|
|
return new ResultData(Result.ERROR,"支付金额大于欠费金额,请刷新账单后再支付"); |
|
|
|
} |
|
|
|
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxMerchant); |
|
|
|
if (null == wxPayAccountBill || null == wxPayAccountBill.getPayChannel()) { |
|
|
|
return new ResultData(Result.ERROR,"账单支付配置错误,请联系管理员"); |
|
|
|
@@ -264,11 +282,7 @@ public class WxBillController extends BaseController { |
|
|
|
if (null == result) { |
|
|
|
return new ResultData(Result.ERROR,"账单支付错误,请联系管理员"); |
|
|
|
} |
|
|
|
Map retMap = new HashMap(); |
|
|
|
retMap.put("payChannel", wxPayAccountBill.getPayChannel()); |
|
|
|
retMap.put("payChannelName", EnumBillPayChannel.getEnum(wxPayAccountBill.getPayChannel()).getMessage()); |
|
|
|
retMap.put("result", result); |
|
|
|
return new ResultData(retMap); |
|
|
|
return new ResultData(result); |
|
|
|
}catch(Exception e) { |
|
|
|
logger.error("payBill error.",e); |
|
|
|
return new ResultData(Result.ERROR,"账单支付错误:"+e.getMessage()); |
|
|
|
|