| | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.core.domain.entity.ServiceOrderAppVo; |
| | | import com.ruoyi.common.core.domain.entity.ServiceOrderAppResultVo; |
| | | import com.ruoyi.common.core.domain.entity.ServiceOrderDelResultVo; |
| | | import com.ruoyi.common.core.domain.entity.ServiceOrderDelVo; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import org.slf4j.Logger; |
| | |
| | | try { |
| | | Object value = field.get(model); |
| | | if (value != null) { |
| | | params.put(field.getName(),URLEncoder.encode(value.toString(), StandardCharsets.UTF_8.toString())); |
| | | |
| | | // 将字段名首字母大写 |
| | | String fieldName = field.getName(); |
| | | |
| | | String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); |
| | | if(fieldName.contains("method")) |
| | | { |
| | | capitalizedFieldName = fieldName; |
| | | } |
| | | |
| | | params.put(capitalizedFieldName,URLEncoder.encode(value.toString(), StandardCharsets.UTF_8.toString())); |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | // log.error("获取对象属性值时出错", e); |
| | |
| | | } |
| | | // 将字段名首字母大写 |
| | | String fieldName = field.getName(); |
| | | |
| | | String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); |
| | | |
| | | if(fieldName.contains("method")) |
| | | { |
| | | capitalizedFieldName = fieldName; |
| | | } |
| | | |
| | | formData.append(capitalizedFieldName) |
| | | .append("=") |
| | |
| | | * @param model 服务订单删除请求值对象 |
| | | * @return 服务订单删除接口调用结果 |
| | | */ |
| | | public static ServiceOrderAppResultVo CancelServiceOrder(ServiceOrderDelVo model,String appSecret) { |
| | | public static ServiceOrderDelResultVo CancelServiceOrder(ServiceOrderDelVo model,String appSecret) { |
| | | if (addServiceOrederAPI.isEmpty()) { |
| | | // log.info("AddServiceOrederAPI 未设置,请先设置接口地址。"); |
| | | return null; |
| | |
| | | try { |
| | | Object value = field.get(model); |
| | | if (value != null) { |
| | | params.put(field.getName(), value.toString()); |
| | | // 将字段名首字母大写 |
| | | String fieldName = field.getName(); |
| | | String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); |
| | | if(fieldName.contains("method")) |
| | | { |
| | | capitalizedFieldName = fieldName; |
| | | } |
| | | params.put(capitalizedFieldName,URLEncoder.encode(value.toString(), StandardCharsets.UTF_8.toString())); |
| | | } |
| | | } catch (IllegalAccessException e) { |
| | | // log.error("获取对象属性值时出错", e); |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | // 将字段名首字母大写 |
| | | String fieldName = field.getName(); |
| | | formData.append(fieldName) |
| | | .append("=") |
| | | .append(URLEncoder.encode(value.toString(), StandardCharsets.UTF_8.toString())); |
| | | String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); |
| | | if(fieldName.contains("method")) |
| | | { |
| | | capitalizedFieldName = fieldName; |
| | | } |
| | | formData.append(capitalizedFieldName) |
| | | .append("=") |
| | | .append(URLEncoder.encode(value.toString(), StandardCharsets.UTF_8.toString())); |
| | | } |
| | | } catch (Exception e) { |
| | | // log.error("拼接表单数据时出错", e); |
| | |
| | | if (responseData != null && !responseData.isEmpty()) { |
| | | // log.info("接口响应: " + responseData); |
| | | try { |
| | | return JSON.parseObject(responseData, ServiceOrderAppResultVo.class); |
| | | return JSON.parseObject(responseData, ServiceOrderDelResultVo.class); |
| | | } catch (Exception e) { |
| | | // log.info("解析接口响应数据失败: " + e.getMessage()); |
| | | } |