md
This commit is contained in:
parent
500c5373d0
commit
2e030c5bd1
@ -240,6 +240,23 @@ public class EmisSettleBillController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序支付
|
||||||
|
* @param emisSettleBill
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/genWxPayFromWxApp")
|
||||||
|
public AjaxResult genWxPayFromWxApp(EmisSettleBill emisSettleBill)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
String qrPicUrl=emisSettleBillPayLogService.genWxPayFromWxApp(emisSettleBill.getSettleBillNo(),emisSettleBill.getOpenId());
|
||||||
|
return AjaxResult.success("成功",qrPicUrl);
|
||||||
|
} catch (EmisBizError emisBizError) {
|
||||||
|
emisBizError.printStackTrace();
|
||||||
|
return AjaxResult.error(emisBizError.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(value = "/sumbitWxPay")
|
@PostMapping(value = "/sumbitWxPay")
|
||||||
public AjaxResult sumbitWxPay(@RequestBody EmisSettleBill emisSettleBill)
|
public AjaxResult sumbitWxPay(@RequestBody EmisSettleBill emisSettleBill)
|
||||||
|
|||||||
@ -59,11 +59,14 @@ public class EmisTmsCostProfitController extends BaseController
|
|||||||
public TableDataInfo list(EmisTmsCostProfit emisTmsCostProfit)
|
public TableDataInfo list(EmisTmsCostProfit emisTmsCostProfit)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
|
|
||||||
|
if(!StringUtils.isEmpty(emisTmsCostProfit.getBillCode())) {
|
||||||
emisTmsCostProfit.setBillCode(WaybillHelper.formatQueryValue(emisTmsCostProfit.getBillCode()));
|
emisTmsCostProfit.setBillCode(WaybillHelper.formatQueryValue(emisTmsCostProfit.getBillCode()));
|
||||||
String[] billCodeSortList = emisTmsCostProfit.getBillCode().split(",");
|
String[] billCodeSortList = emisTmsCostProfit.getBillCode().split(",");
|
||||||
if(billCodeSortList.length>1){
|
if (billCodeSortList.length > 1) {
|
||||||
emisTmsCostProfit.getParams().put("billCodeSortList", Arrays.asList(billCodeSortList));
|
emisTmsCostProfit.getParams().put("billCodeSortList", Arrays.asList(billCodeSortList));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<EmisTmsCostProfit> list = emisTmsCostProfitService.selectEmisTmsCostProfitList(emisTmsCostProfit);
|
List<EmisTmsCostProfit> list = emisTmsCostProfitService.selectEmisTmsCostProfitList(emisTmsCostProfit);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|||||||
@ -193,7 +193,8 @@ public class EmisSettleBill extends BaseEntity
|
|||||||
|
|
||||||
// 支付二维码图片
|
// 支付二维码图片
|
||||||
private String qrCodePayPicUrl;
|
private String qrCodePayPicUrl;
|
||||||
|
// 支付人openId
|
||||||
|
private String openId;
|
||||||
|
|
||||||
List<EmisSettleSubBill> subBillList;
|
List<EmisSettleSubBill> subBillList;
|
||||||
|
|
||||||
|
|||||||
@ -87,6 +87,16 @@ public interface IEmisSettleBillPayLogService
|
|||||||
public String genWxPayQR(String settleBillNo) throws EmisBizError;
|
public String genWxPayQR(String settleBillNo) throws EmisBizError;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公众号/小程序支付
|
||||||
|
* @param settleBillNo
|
||||||
|
* @param openId
|
||||||
|
* @return
|
||||||
|
* @throws EmisBizError
|
||||||
|
*/
|
||||||
|
public String genWxPayFromWxApp(String settleBillNo,String openId) throws EmisBizError;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查支付状态
|
* 检查支付状态
|
||||||
* @param orderNo
|
* @param orderNo
|
||||||
|
|||||||
@ -228,6 +228,84 @@ public class EmisSettleBillPayLogServiceImpl implements IEmisSettleBillPayLogSer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序支付
|
||||||
|
* @param settleBillNo
|
||||||
|
* @return
|
||||||
|
* @throws EmisBizError
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String genWxPayFromWxApp(String settleBillNo,String openId) throws EmisBizError {
|
||||||
|
|
||||||
|
EmisSettleBill emisSettleBill=emisSettleBillMapper.selectSettleBillBySettleBillNo(settleBillNo);
|
||||||
|
|
||||||
|
BigDecimal thisPayMoney=emisSettleBill.getRecMoney().subtract(emisSettleBill.getRecedMoney());
|
||||||
|
|
||||||
|
int amount= (int) (thisPayMoney.floatValue()*100.0f);
|
||||||
|
|
||||||
|
String merId="1";
|
||||||
|
float feeRate=0.0065f;
|
||||||
|
|
||||||
|
int fee= (int) (thisPayMoney.floatValue()*feeRate);
|
||||||
|
String authCode="";
|
||||||
|
|
||||||
|
String payId= WaybillHelper.genPayId();
|
||||||
|
// 产生支付订单
|
||||||
|
EmisSettleBillPayLog emisSettleBillPayLog = new EmisSettleBillPayLog();
|
||||||
|
emisSettleBillPayLog.setPayId(payId);
|
||||||
|
emisSettleBillPayLog.setSettleBillNo(settleBillNo);
|
||||||
|
emisSettleBillPayLog.setAmount(amount);
|
||||||
|
emisSettleBillPayLog.setPayType("wx");
|
||||||
|
emisSettleBillPayLog.setStatus(0);
|
||||||
|
emisSettleBillPayLog.setStatusDesc("初始");
|
||||||
|
emisSettleBillPayLog.setFee(fee);
|
||||||
|
emisSettleBillPayLog.setCurrency("CNY");
|
||||||
|
emisSettleBillPayLog.setSubject("账单支付");
|
||||||
|
emisSettleBillPayLog.setBody("账单支付");
|
||||||
|
emisSettleBillPayLog.setRemark("账单支付");
|
||||||
|
|
||||||
|
emisSettleBillPayLogMapper.insertEmisSettleBillPayLog(emisSettleBillPayLog);
|
||||||
|
|
||||||
|
// 公众号及小程序支付
|
||||||
|
String channel="wxpay_pub";
|
||||||
|
String appId="";
|
||||||
|
String notifyUrl= Config.ERP_API_PAY_NOTIFY_URL;
|
||||||
|
ApiRes res= null;
|
||||||
|
|
||||||
|
EmisSettleBillPayLog emisSettleBillPayLogUpd = new EmisSettleBillPayLog();
|
||||||
|
emisSettleBillPayLogUpd.setId(emisSettleBillPayLog.getId());
|
||||||
|
try {
|
||||||
|
res = VitePayOnlineSdk.onlinePay(channel,payId,merId,amount,fee,notifyUrl,appId,authCode,openId,"运费",emisSettleBill.getSettleBillName()+"-运费");
|
||||||
|
log.info("支付代码生成==>{}",JSONObject.toJSONString(res));
|
||||||
|
emisSettleBillPayLogUpd.setResponseExtra(JSON.toJSONString(res));
|
||||||
|
if(res.isSuccess()){
|
||||||
|
String payCode=((Map)res.getData().get("credential")).get("qr_image_url").toString();
|
||||||
|
emisSettleBillPayLogUpd.setCredential(JSON.toJSONString(res.getData().get("credential")));
|
||||||
|
|
||||||
|
emisSettleBillPayLogUpd.setStatus(10);
|
||||||
|
emisSettleBillPayLogUpd.setStatusDesc("支付中");
|
||||||
|
emisSettleBillPayLogMapper.updateEmisSettleBillPayLog(emisSettleBillPayLogUpd);
|
||||||
|
|
||||||
|
return payCode;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
emisSettleBillPayLogUpd.setStatus(40);
|
||||||
|
emisSettleBillPayLogUpd.setStatusDesc(res.getMessage());
|
||||||
|
emisSettleBillPayLogMapper.updateEmisSettleBillPayLog(emisSettleBillPayLogUpd);
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL,res.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
emisSettleBillPayLogUpd.setStatus(40);
|
||||||
|
emisSettleBillPayLogUpd.setStatusDesc("exception:"+e.getMessage());
|
||||||
|
emisSettleBillPayLogMapper.updateEmisSettleBillPayLog(emisSettleBillPayLogUpd);
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL,"支付异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查支付订单
|
* 检查支付订单
|
||||||
* @param payId
|
* @param payId
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user