| | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.security.annotation.AnonymousAccess; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.PayParam; |
| | | import com.sandu.ximon.admin.pay.alipay.UsrAlipayConfigService; |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | @AnonymousAccess |
| | | @PostMapping("/advancePay") |
| | | public ResponseVO<Object> advancePayOrder(@RequestBody PayParam param) throws WxErrorException { |
| | | if (param.getWxCode().isEmpty()) { |
| | | if (param.getOpenId().isEmpty()) { |
| | | throw new BusinessException("微信code不能为空"); |
| | | } |
| | | if (param.getPoleId() == null || param.getSubscribeChargingCapacity() == null) { |
| | |
| | | double totalAmount = TotalAmount.doubleValue(); |
| | | //生成订单 |
| | | C3mOrder c3mOrderEntity = c3mOrderService.advancePayOrder(param.getPoleId(), c3m, "wxpay" |
| | | , totalAmount, param.getSubscribeChargingCapacity(), param.getWxCode()); |
| | | , totalAmount, param.getSubscribeChargingCapacity(), param.getOpenId()); |
| | | if (null == c3mOrderEntity) { |
| | | throw new BusinessException("该充电桩正被使用!"); |
| | | } |
| | |
| | | param.setTotalAmount(c3mOrderEntity.getTotalAmount()); |
| | | String s = WxFastPayService.parseWxAmount(param.getTotalAmount().toString()); |
| | | //生成微信预付订单 |
| | | SortedMap<Object, Object> result = wxPayService.miniAppPay("扫码充电支付(C3充电桩)", param.getOutTradeNo(), Integer.valueOf(s), param.getPoleId(), param.getWxCode()); |
| | | SortedMap<Object, Object> result = wxPayService.miniAppPay("扫码充电支付(C3充电桩)", param.getOutTradeNo(), Integer.valueOf(s), param.getPoleId(), param.getOpenId()); |
| | | return ResponseUtil.success(result); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 获取wx的openid |
| | | */ |
| | | @AnonymousAccess |
| | | @PostMapping("/getWxOpenId") |
| | | public ResponseVO<Object> getWxOpenId(@RequestBody PayParam param) throws WxErrorException { |
| | | if (param.getWxCode() == null || param.getPoleId() == null || param.getWxCode().isEmpty()) { |