main^2
黄海 12 months ago
parent 6bf82e50e2
commit bdb7747b36

@ -798,8 +798,10 @@ public class CommonUtil {
return getRet(dictList, success, message); return getRet(dictList, success, message);
} }
public static Kv getRet(boolean success, String message) { public static Kv getRet(boolean success, String message) {
List<Record> dictList = new ArrayList<>(); Kv kv = Kv.by("code", 1000);
return getRet(dictList, success, message); kv.set("success", success);
kv.set("msg", message);
return kv;
} }
public static Kv getRet(List<Record> dictList, boolean success, String message) { public static Kv getRet(List<Record> dictList, boolean success, String message) {

@ -186,24 +186,23 @@ public class YltController extends Controller {
jo.put("elecMoney", elecMoney);//电费 jo.put("elecMoney", elecMoney);//电费
jo.put("seviceMoney", seviceMoney);//服务费 jo.put("seviceMoney", seviceMoney);//服务费
jo.put("totalMoney", totalMoney);//总费用 jo.put("totalMoney", totalMoney);//总费用
jo.put("freeType", freeType); jo.put("freeType", freeType);//减免类型
jo.put("freeMoney", freeMoney); jo.put("freeMoney", freeMoney);//减免金额
jo.put("freeTime", freeTime); jo.put("freeTime", freeTime);//减免时长
jo.put("version","v6.x");//请求头版本号
// 发送 POST 请求并获取响应 // 发送 POST 请求并获取响应
String result = HttpUtil.createPost(url) String result = HttpUtil.createPost(url)
.body(jo.toString()) // 将 JSON 对象转换为字符串作为请求正文 .body(jo.toString()) // 将 JSON 对象转换为字符串作为请求正文
//.header("accept-language","zh-CN")
//.header("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36")
//.header("version","1.0.0")
.header("Content-Type", "application/json") // 设置请求头,指明内容类型为 JSON .header("Content-Type", "application/json") // 设置请求头,指明内容类型为 JSON
.execute().body(); // 发送请求并获取响应体 .execute().body(); // 发送请求并获取响应体
// 打印结果 // 打印结果
System.out.println(result); System.out.println(result);
renderJson(CommonUtil.getRet(new Record(), true, renderJson(CommonUtil.getRet(true, "已经向科拓闸机平台发送了减免消息!"));
"已经向科拓闸机平台发送了减免消息!"));
return; return;
} }
renderJson(CommonUtil.getRet(false, "发现了一个未知的闸机厂商,请联系开发人员!"));
renderJson(CommonUtil.getRet(new Record(), false,
"发现了一个未知的闸机厂商,请联系开发人员!"));
} }
} }
Loading…
Cancel
Save