| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | |
| | | virtualCard.setClientId(clientId); |
| | | virtualCard.setOrderNumber(orderNumber); |
| | | virtualCard.setRechargeAmount(rechargeAmount); |
| | | BaseResponse result = virtualCardSv.insertVCRecharge(virtualCard); |
| | | if(!result.getCode().equals("0001")) { |
| | | |
| | | // -1:虚拟卡不存在,0:添加充值记录失败 |
| | | Long rechargeId = virtualCardSv.insertVCRecharge(virtualCard); |
| | | if(rechargeId.equals(-1)) { |
| | | return BaseResponseUtils.buildFail(WechatResultCode.NO_ACCOUNT.getMessage()); |
| | | } |
| | | if(rechargeId.equals(0)) { |
| | | return BaseResponseUtils.buildFail(WechatResultCode.RECHARGE_FAIL.getMessage()); |
| | | } |
| | | |
| | | // 生成充值操作记录,充值操作人为农户 |
| | | SeVcOperate seVcOperate = new SeVcOperate(); |
| | | seVcOperate.setVcId(virtualId); |
| | | seVcOperate.setClientId(clientId); |
| | | seVcOperate.setOperateType(LastOperateENUM.RECHARGE.getCode()); |
| | | seVcOperate.setRechargeId(rechargeId); |
| | | seVcOperate.setOperator(clientId); |
| | | seVcOperate.setOperateTime(new Date()); |
| | | Long vcOperateId = virtualCardSv.insertVcOperate(seVcOperate); |
| | | if(vcOperateId == null) { |
| | | return BaseResponseUtils.buildErrorMsg(WechatResultCode.RECHARGE_ADD_FAIL.getMessage()); |
| | | } |
| | | |
| | |
| | | job_body.put("mchid", mchid); |
| | | job_body.put("description", description); |
| | | job_body.put("out_trade_no", orderNumber); |
| | | job_body.put("attach", DataSourceContext.get()); |
| | | job_body.put("notify_url", notifyUrl); |
| | | |
| | | //订单金额 |
| | |
| | | JSONObject job_resource = JSONObject.parseObject(resource); |
| | | |
| | | // 解密后取出:商户订单号、微信支付订单号、交易状态、支付完成时间 |
| | | String attach = job_resource.getString("attach"); |
| | | DataSourceContext.set(attach); |
| | | String out_trade_no = job_resource.getString("out_trade_no"); |
| | | String transaction_id = job_resource.getString("transaction_id"); |
| | | String trade_state = job_resource.getString("trade_state"); |