feat: 新增payInfo测试和部分优化appsecret
| | |
| | | model.setCondition(tbOrders.getRemark()); // 设置备注信息 |
| | | // model.setDoctor("医生" + (int) (Math.random() * 10)); // 随机设置患者医生 |
| | | // model.setDoctorPhone("13" + (int) (Math.random() * 900000000 + 100000000)); // 随机生成患者医生电话 |
| | | model.setOfferPrice(tbOrders.getBookingPrice().doubleValue()); // 随机生成报价 |
| | | model.setOfferPrice(tbOrders.getBookingPrice().doubleValue()); // 生成报价 |
| | | // model.setReferrals("推介人" + (int) (Math.random() * 10)); // 随机设置推介人信息 |
| | | // model.setUnitRemarks("商户随机备注信息"); // 随机设置商户备注 |
| | | // model.setPayQRcodeURL("https://example.com/qrcode/" + (int) (Math.random() * 100)); // 随机生成外部支付二维码链接 |
| | | model.setPayQRcodeURL(scApp.getPayUrl()); |
| | | |
| | | ServiceOrderAppResultVo result = ServiceOrderUtil.CreateServiceOrder(model); |
| | | ServiceOrderAppResultVo result = ServiceOrderUtil.CreateServiceOrder(model,scApp.getMinAppSecret()); |
| | | |
| | | if (result.getResult() == 1) { |
| | | tbOrders.setOrderID(tbOrders.getOrderID()); |
| | |
| | | return AjaxResult.error("订单状态已取消"); |
| | | } |
| | | |
| | | SysClientApp scApp = clientAppService.selectSysClientAppByAppId(1L); |
| | | SysClientApp scApp = clientAppService.selectSysClientAppByAppKey("appId1"); |
| | | |
| | | |
| | | ServiceOrderAppVo model = new ServiceOrderAppVo(); |
| | |
| | | model.setOfferPrice(tbOrders.getBookingPrice().doubleValue()); // 报价 |
| | | // model.setReferrals("推介人")); // 设置推介人信息--没有推介人信息 |
| | | // model.setUnitRemarks("商户备注信息"); // 设置商户备注--没有商户备注 |
| | | // model.setPayQRcodeURL("https://example.com/qrcode/")); // 外部支付二维码链接--用不到 |
| | | model.setPayQRcodeURL(scApp.getPayUrl()); |
| | | |
| | | ServiceOrderAppResultVo result = ServiceOrderUtil.CreateServiceOrder(model); |
| | | ServiceOrderAppResultVo result = ServiceOrderUtil.CreateServiceOrder(model,scApp.getMinAppSecret()); |
| | | |
| | | if (result.getResult() == 1) { |
| | | tbOrders.setOrderID(tbOrders.getOrderID()); |
| | |
| | | model.setServiceOrdID(cancelVo.getThirdOrderNo()); // 设置第三方订单号 |
| | | model.setDELRemarks(cancelVo.getReason()); // 设置取消原因 |
| | | |
| | | ServiceOrderAppResultVo result = ServiceOrderUtil.CancelServiceOrder(model); |
| | | ServiceOrderAppResultVo result = ServiceOrderUtil.CancelServiceOrder(model,scApp.getMinAppSecret()); |
| | | |
| | | if (result.getResult() == 1) { |
| | | // 更新本地订单状态 |
| | |
| | | private static final int BITS_TO_A_BYTE = 8; |
| | | private static final int BYTES_TO_A_WORD = 4; |
| | | private static final int BITS_TO_A_WORD = 32; |
| | | private static final String APP_SECRET = "JR6o8RQItoa2bzlneOCQ"; |
| | | |
| | | private static final long[] m_lOnBits = new long[31]; |
| | | private static final long[] m_l2Power = new long[31]; |
| | |
| | | * @param params 请求参数集合 |
| | | * @return 签名值 |
| | | */ |
| | | public static String generateSign(Map<String, String> params) { |
| | | public static String generateSign(Map<String, String> params,String APP_SECRET) { |
| | | // 1. 移除sign参数 |
| | | params.remove("sign"); |
| | | params.remove("Sign"); |
| | |
| | | * @return 验证结果 |
| | | */ |
| | | public static boolean verifySign(Map<String, String> params, String sign) { |
| | | String generatedSign = generateSign(params); |
| | | return generatedSign.equalsIgnoreCase(sign); |
| | | // String generatedSign = generateSign(params); |
| | | // return generatedSign.equalsIgnoreCase(sign); |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static void main(String[] args) { |
| | | // 测试用例 |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("method", "User_Login"); |
| | | params.put("LoginType", "0"); |
| | | params.put("UserID", "10"); |
| | | |
| | | String sign = generateSign(params); |
| | | System.out.println("生成的签名: " + sign); |
| | | // Map<String, String> params = new HashMap<>(); |
| | | // params.put("method", "User_Login"); |
| | | // params.put("LoginType", "0"); |
| | | // params.put("UserID", "10"); |
| | | // |
| | | // String sign = generateSign(params); |
| | | // System.out.println("生成的签名: " + sign); |
| | | // 应输出: 9a0a8659f005d6984697e2ca0a9cf3b7 |
| | | } |
| | | } |
| | |
| | | * @param model 服务单应用值对象 |
| | | * @return 服务单接口调用结果 |
| | | */ |
| | | public static ServiceOrderAppResultVo CreateServiceOrder(ServiceOrderAppVo model) { |
| | | public static ServiceOrderAppResultVo CreateServiceOrder(ServiceOrderAppVo model,String appSecret) { |
| | | if (AddServiceOrederAPI.isEmpty()) { |
| | | // log.info("AddServiceOrederAPI 未设置,请先设置接口地址。"); |
| | | return null; |
| | |
| | | } |
| | | } |
| | | |
| | | model.setSign(ServiceOrderSign.generateSign(params)); // 生成签名并设置到模型中 |
| | | model.setSign(ServiceOrderSign.generateSign(params,appSecret)); // 生成签名并设置到模型中 |
| | | |
| | | |
| | | // 替换为 |
| | |
| | | * @param model 服务订单删除请求值对象 |
| | | * @return 服务订单删除接口调用结果 |
| | | */ |
| | | public static ServiceOrderAppResultVo CancelServiceOrder(ServiceOrderDelVo model) { |
| | | public static ServiceOrderAppResultVo CancelServiceOrder(ServiceOrderDelVo model,String appSecret) { |
| | | if (AddServiceOrederAPI.isEmpty()) { |
| | | // log.info("AddServiceOrederAPI 未设置,请先设置接口地址。"); |
| | | return null; |
| | |
| | | } |
| | | } |
| | | |
| | | model.setSign(ServiceOrderSign.generateSign(params)); |
| | | model.setSign(ServiceOrderSign.generateSign(params,appSecret)); |
| | | |
| | | // 构建表单数据 |
| | | StringBuilder formData = new StringBuilder(); |
| | |
| | | model.setDELRemarks("测试"); |
| | | |
| | | // 调用 CancelServiceOrder 方法取消服务单 |
| | | ServiceOrderAppResultVo result = CancelServiceOrder(model); |
| | | System.out.println("1"); |
| | | // ServiceOrderAppResultVo result = CancelServiceOrder(model); |
| | | // System.out.println("1"); |
| | | } |
| | | |
| | | public static void test() |
| | |
| | | model.setPayQRcodeURL("https://example.com/qrcode/" + (int) (Math.random() * 100)); // 随机生成外部支付二维码链接 |
| | | |
| | | // 调用 CreateServiceOrder 方法创建服务单 |
| | | ServiceOrderAppResultVo result = CreateServiceOrder(model); |
| | | // ServiceOrderAppResultVo result = CreateServiceOrder(model); |
| | | } |
| | | |
| | | } |
| | |
| | | log.error("获取调度单异常:"+e.getMessage()); |
| | | } |
| | | |
| | | SysClientApp clientApp = sysClientAppService.selectSysClientAppByAppId(1L); |
| | | SysClientApp clientApp = sysClientAppService.selectSysClientAppByAppKey("appId1"); |
| | | if(clientApp==null){ |
| | | log.error("回调地址不存在"); |
| | | return; |
| | |
| | | @Excel(name = "min_app_id") |
| | | private String minAppId; |
| | | |
| | | /** min_app_secret */ |
| | | @Excel(name = "min_app_secret") |
| | | private String minAppSecret; |
| | | |
| | | |
| | | |
| | | /** 回调地址 */ |
| | | @Excel(name = "回调地址") |
| | | private String callbackUrl; |
| | | |
| | | |
| | | /** 支付地址 */ |
| | | @Excel(name = "支付地址") |
| | | private String payUrl; |
| | | |
| | | |
| | | public Long getAppId() { |
| | |
| | | this.callbackUrl = callbackUrl; |
| | | } |
| | | |
| | | public String getPayUrl() { |
| | | return payUrl; |
| | | } |
| | | |
| | | public void setPayUrl(String payUrl) { |
| | | this.payUrl = payUrl; |
| | | } |
| | | |
| | | public String getMinAppSecret() { |
| | | return minAppSecret; |
| | | } |
| | | |
| | | public void setMinAppSecret(String minAppSecret) { |
| | | this.minAppSecret = minAppSecret; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="minAppId" column="min_app_id" /> |
| | | <result property="minAppSecret" column="min_app_secret" /> |
| | | <result property="callbackUrl" column="callback_url" /> |
| | | <result property="payUrl" column="pay_url" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectSysClientAppVo"> |
| | | select app_id, client_name, app_key, security_key, valid_start_time, valid_end_time, status, del_flag, create_by, create_time, update_by, update_time, remark, min_app_id, callback_url from sys_client_app |
| | | select app_id, client_name, app_key, security_key, valid_start_time, valid_end_time, status, del_flag, create_by, create_time, update_by, update_time, remark, min_app_id, min_app_secret, callback_url, pay_url from sys_client_app |
| | | </sql> |
| | | |
| | | <select id="selectSysClientAppList" parameterType="SysClientApp" resultMap="SysClientAppResult"> |
| | |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="minAppId != null">min_app_id,</if> |
| | | <if test="minAppSecret != null">min_app_secret,</if> |
| | | <if test="callbackUrl != null">callback_url,</if> |
| | | <if test="payUrl != null">pay_url,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="clientName != null">#{clientName},</if> |
| | |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="minAppId != null">#{minAppId},</if> |
| | | <if test="minAppSecret != null">#{minAppSecret},</if> |
| | | <if test="callbackUrl != null">#{callbackUrl},</if> |
| | | <if test="payUrl != null">#{payUrl},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="minAppId != null">min_app_id = #{minAppId},</if> |
| | | <if test="minAppSecret != null">min_app_secret = #{minAppSecret},</if> |
| | | <if test="callbackUrl != null">callback_url = #{callbackUrl},</if> |
| | | <if test="payUrl != null">pay_url = #{payUrl},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | |
| | | component: () => import('@/views/system/gps/map'), |
| | | name: 'GpsMap', |
| | | meta: { title: '车辆轨迹', icon: 'map' ,anonymous: true} |
| | | }, |
| | | { |
| | | path: '/payInfoTest', |
| | | component: (resolve) => require(['@/views/system/payInfoTest/index'], resolve), |
| | | hidden: true, |
| | | meta: { title: '支付信息测试', anonymous: true } |
| | | } |
| | | ] |
| | | |
| | |
| | | <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="民航分公司Id" align="center" prop="minAppId" /> |
| | | <el-table-column label="民航合作公司Id" align="center" prop="minAppId" /> |
| | | <el-table-column label="民航合作公司密钥" align="center" prop="minAppSecret" /> |
| | | <el-table-column label="回调地址" align="center" prop="callbackUrl" /> |
| | | <el-table-column label="支付地址" align="center" prop="payUrl" /> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | |
| | | >{{dict.label}}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="民航分公司Id" prop="minAppId"> |
| | | <el-input v-model="form.minAppId" placeholder="请输入民航分公司Id" /> |
| | | <el-form-item label="民航合作公司Id" prop="minAppId"> |
| | | <el-input v-model="form.minAppId" placeholder="请输入民航合作公司Id" /> |
| | | </el-form-item> |
| | | <el-form-item label="民航合作公司密钥" prop="minAppSecret"> |
| | | <el-input v-model="form.minAppSecret" placeholder="请输入民航合作公司密钥" /> |
| | | </el-form-item> |
| | | <el-form-item label="回调地址" prop="callbackUrl"> |
| | | <el-input v-model="form.callbackUrl" placeholder="请输入回调地址" /> |
| | | </el-form-item> |
| | | <el-form-item label="支付地址" prop="payUrl"> |
| | | <el-input v-model="form.payUrl" placeholder="请输入支付地址" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> |
| | | </el-form-item> |
New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div v-if="!validated" class="loading-container"> |
| | | <el-alert |
| | | :title="errorMessage || '正在加载支付数据...'" |
| | | :type="errorMessage ? 'error' : 'info'" |
| | | :closable="false" |
| | | show-icon> |
| | | </el-alert> |
| | | </div> |
| | | <div v-else> |
| | | <el-card class="box-card"> |
| | | <div slot="header" class="clearfix"> |
| | | <span>支付信息详情</span> |
| | | </div> |
| | | <el-descriptions :column="1" border> |
| | | <el-descriptions-item label="支付金额"> |
| | | {{ payAmount }} 元 |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="订单号"> |
| | | {{ orderNo }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="交易流水号"> |
| | | {{ transactionNo }} |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'PayInfoTest', |
| | | data() { |
| | | return { |
| | | validated: false, |
| | | errorMessage: '', |
| | | payAmount: '', |
| | | orderNo: '', |
| | | transactionNo: '' |
| | | } |
| | | }, |
| | | created() { |
| | | this.initData(); |
| | | }, |
| | | methods: { |
| | | initData() { |
| | | // 从URL参数中获取数据 |
| | | const query = this.$route.query; |
| | | if (!query.payAmount || !query.orderNo || !query.transactionNo) { |
| | | this.errorMessage = '缺少必要的参数信息'; |
| | | return; |
| | | } |
| | | |
| | | // 设置数据 |
| | | this.payAmount = query.payAmount; |
| | | this.orderNo = query.orderNo; |
| | | this.transactionNo = query.transactionNo; |
| | | |
| | | // 模拟加载延迟 |
| | | setTimeout(() => { |
| | | this.validated = true; |
| | | }, 500); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .loading-container { |
| | | margin: 20px; |
| | | text-align: center; |
| | | } |
| | | .box-card { |
| | | margin: 20px; |
| | | } |
| | | </style> |