From 5457bdfaa716602deaf664ab402b0d1d380ac599 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 16 一月 2026 20:05:51 +0800
Subject: [PATCH] 上传交通部
---
/dev/null | 1
MinistryOfTransport/src/main/resources/logback-spring.xml | 221 +++++++++
MinistryOfTransport/src/main/resources/application.properties | 3
MinistryOfTransport/src/main/java/com/sinata/ministryoftransport/controller/FTPController.java | 19
MinistryOfTransport/src/main/java/com/sinata/ministryoftransport/util/MinistryOfTransport.java | 1111 +++++++++++++++++++++++-------------------------
5 files changed, 765 insertions(+), 590 deletions(-)
diff --git a/MinistryOfTransport/src/main/java/com/sinata/ministryoftransport/controller/FTPController.java b/MinistryOfTransport/src/main/java/com/sinata/ministryoftransport/controller/FTPController.java
index 9ddffdc..6532325 100644
--- a/MinistryOfTransport/src/main/java/com/sinata/ministryoftransport/controller/FTPController.java
+++ b/MinistryOfTransport/src/main/java/com/sinata/ministryoftransport/controller/FTPController.java
@@ -32,15 +32,16 @@
public String uploadAndMoveFile(String path, String fileName, String url, String newFilePath){
try {
//上传文件
- boolean b = ftpUtil.uploadFile(path, fileName, url);
- if(b){
- //移动文件
- boolean b1 = ftpUtil.moveFile(path + "/" + fileName, newFilePath);
- if(b1){
- System.out.println("移动文件成功");
- return "上传文件成功";
- }
- }
+// boolean b = ftpUtil.uploadFile(path, fileName, url);
+// if(b){
+// //移动文件
+// boolean b1 = ftpUtil.moveFile(path + "/" + fileName, newFilePath);
+// if(b1){
+// System.out.println("移动文件成功");
+// return "上传文件成功";
+// }
+// }
+ return "上传文件成功";
}catch (Exception e){
e.printStackTrace();
}
diff --git a/MinistryOfTransport/src/main/java/com/sinata/ministryoftransport/util/MinistryOfTransport.java b/MinistryOfTransport/src/main/java/com/sinata/ministryoftransport/util/MinistryOfTransport.java
index 85bf65b..ae0b472 100644
--- a/MinistryOfTransport/src/main/java/com/sinata/ministryoftransport/util/MinistryOfTransport.java
+++ b/MinistryOfTransport/src/main/java/com/sinata/ministryoftransport/util/MinistryOfTransport.java
@@ -1,16 +1,23 @@
package com.sinata.ministryoftransport.util;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
import com.sinata.ministryoftransport.model.*;
import com.sinata.ministryoftransport.util.httpClinet.HttpClientUtil;
import com.sinata.ministryoftransport.util.httpClinet.HttpResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -20,18 +27,16 @@
@Component
public class MinistryOfTransport {
+ Logger logger = LoggerFactory.getLogger(MinistryOfTransport.class);
+
private final String CompanyId = "5301XFKJ9386";//公司标识
private final String Source = "0";//消息来源标识
private final String url = "https://wycup.ggjtfw.com:8085";
- @Autowired
- private HttpClientUtil httpClientUtil;
-
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
- private SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
private SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd");
@@ -40,11 +45,10 @@
* 上传企业基础信息
*/
public String baseInfoCompany(BaseInfoCompany baseInfoCompany) throws Exception{
- System.err.println("公司信息"+baseInfoCompany);
String IPCType = "baseInfoCompany";
String path = url + "/baseinfo/company";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("CompanyName", baseInfoCompany.getCompanyName());//公司名称
jsonObject.put("Identifier", baseInfoCompany.getIdentifier());//统一社会信用代码
@@ -57,7 +61,7 @@
jsonObject.put("LegalID", baseInfoCompany.getLegalID());//法人代表身份证号
jsonObject.put("LegalPhone", baseInfoCompany.getLegalPhone());//法人代表电话
jsonObject.put("LegalPhoto", baseInfoCompany.getLegalPhoto());//法人代表身份证扫描件文件编号(.jpg)
- jsonObject.put("State", baseInfoCompany.getState());//状态(0:有效,1:失效)
+ jsonObject.put("State", 0);//状态(0:有效,1:失效)
jsonObject.put("Flag", baseInfoCompany.getFlag());//操作标识(1:新增,2:更新,3:删除)
jsonObject.put("UpdateTime", baseInfoCompany.getUpdateTime());
@@ -66,17 +70,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/company\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【企业基础信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【企业基础信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -85,12 +90,10 @@
* 网约车平台公司营运规模信息接口
*/
public String baseInfoCompanyStat(BaseInfoCompanyStat baseInfoCompanyStat) throws Exception{
- System.err.println("网约车平台公司营运规模信息接口"+baseInfoCompanyStat);
-
String IPCType = "baseInfoCompanyStat";
String path = url + "/baseinfo/companystat";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("VehicleNum", baseInfoCompanyStat.getVehicleNum());//平台注册网约车辆数
jsonObject.put("DriverNum", baseInfoCompanyStat.getDriverNum());//平台注册驾驶员数
@@ -102,17 +105,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/companystat\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【网约车平台公司营运规模信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【网约车平台公司营运规模信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -121,11 +125,10 @@
* 网约车平台公司支付信息
*/
public String baseInfoCompanyPay(BaseInfoCompanyPay baseInfoCompanyPay) throws Exception{
- System.err.println("网约车平台公司支付信息"+baseInfoCompanyPay);
String IPCType = "baseInfoCompanyPay";
String path = url + "/baseinfo/companypay";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("PayName", baseInfoCompanyPay.getPayName());//银行或者非银行支付机构名称
jsonObject.put("PayId", baseInfoCompanyPay.getPayId());//非银行支付机构支付业务许可证编号
@@ -133,7 +136,7 @@
jsonObject.put("PayScope", baseInfoCompanyPay.getPayScope());//业务覆盖范围
jsonObject.put("PrepareBank", baseInfoCompanyPay.getPrepareBank());//备付金存管银行
jsonObject.put("CountDate", baseInfoCompanyPay.getCountDate());//结算周期
- jsonObject.put("State", baseInfoCompanyPay.getState());//状态(0:有效,1:失效)
+ jsonObject.put("State", 0);//状态(0:有效,1:失效)
jsonObject.put("Flag", baseInfoCompanyPay.getFlag());//操作标识(1:新增,2:更新,3:删除)
jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoCompanyPay.getUpdateTime())));
@@ -142,18 +145,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/companypay\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【网约车平台公司支付信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【网约车平台公司支付信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -162,11 +165,10 @@
* 网约车平台公司服务机构
*/
public String baseInfoCompanyService(BaseInfoCompanyService baseInfoCompanyService) throws Exception{
- System.err.println("网约车平台公司服务机构"+baseInfoCompanyService);
String IPCType = "baseInfoCompanyService";
String path = url + "/baseinfo/companyservice";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", baseInfoCompanyService.getAddress());//行政区划代码
jsonObject.put("ServiceName", baseInfoCompanyService.getServiceName());//服务机构名称
@@ -179,7 +181,7 @@
jsonObject.put("ContactPhone", baseInfoCompanyService.getContactPhone());//服务机构紧急联系电话
jsonObject.put("MailAddress", baseInfoCompanyService.getMailAddress());//行政文书送达邮寄地址
jsonObject.put("CreateDate", Long.valueOf(sdf.format(baseInfoCompanyService.getCreateDate())));//服务机构设立日期
- jsonObject.put("State", baseInfoCompanyService.getState());//状态(0:有效,1:失效)
+ jsonObject.put("State", 0);//状态(0:有效,1:失效)
jsonObject.put("Flag", baseInfoCompanyService.getFlag());//操作标识(1:新增,2:更新,3:删除)
jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoCompanyService.getUpdateTime())));
@@ -188,18 +190,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/companyservice\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【网约车平台公司服务机构】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【网约车平台公司服务机构】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -208,12 +210,10 @@
* 网约车平台公司经营许可
*/
public String baseInfoCompanyPermit(BaseInfoCompanyPermit baseInfoCompanyPermit) throws Exception{
- System.err.println("网约车平台公司经营许可"+baseInfoCompanyPermit);
-
String IPCType = "baseInfoCompanyPermit";
String path = url + "/baseinfo/companypermit";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", baseInfoCompanyPermit.getAddress());//许可地行政区划代码
jsonObject.put("Certificate", baseInfoCompanyPermit.getCertificate());//网络预约出租车经营许可证号
@@ -223,7 +223,7 @@
jsonObject.put("StartDate", Long.valueOf(sdf2.format(baseInfoCompanyPermit.getStartDate())));//有效期起YYYYMMDD
jsonObject.put("StopDate", Long.valueOf(sdf2.format(baseInfoCompanyPermit.getStopDate())));//有效期止YYYYMMDD
jsonObject.put("CertifyDate", Long.valueOf(sdf2.format(baseInfoCompanyPermit.getCertifyDate())));//初次发证日期YYYYMMDD
- jsonObject.put("State", baseInfoCompanyPermit.getState());//状态(0:有效,1:失效)
+ jsonObject.put("State", 0);//状态(0:有效,1:失效)
jsonObject.put("Flag", baseInfoCompanyPermit.getFlag());//操作标识(1:新增,2:更新,3:删除)
jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoCompanyPermit.getUpdateTime())));
@@ -232,18 +232,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/companypermit\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【网约车平台公司经营许可】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【网约车平台公司经营许可】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -252,12 +252,10 @@
* 网约车平台公司运价信息
*/
public String baseInfoCompanyFare(BaseInfoCompanyFare baseInfoCompanyFare) throws Exception{
- System.err.println("网约车平台公司运价信息"+baseInfoCompanyFare);
-
String IPCType = "baseInfoCompanyFare";
String path = url + "/baseinfo/companyfare";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", baseInfoCompanyFare.getAddress());//运价适用地行政区划代码
jsonObject.put("FareType", baseInfoCompanyFare.getFareType());//运价类型编码(由网约车平台公司统一编码,应确保唯一性)
@@ -283,7 +281,7 @@
jsonObject.put("NightPricePerMinute", baseInfoCompanyFare.getNightPricePerMinute().intValue());//夜间费(按分钟 元)
jsonObject.put("OtherPrice", baseInfoCompanyFare.getOtherPrice().intValue());//其它加价金额(元)
- jsonObject.put("State", baseInfoCompanyFare.getState());//状态(0:有效,1:失效)
+ jsonObject.put("State", 0);//状态(0:有效,1:失效)
jsonObject.put("Flag", baseInfoCompanyFare.getFlag());//操作标识(1:新增,2:更新,3:删除)
jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoCompanyFare.getUpdateTime())));
@@ -292,18 +290,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/companyfare\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【网约车平台公司运价信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【网约车平台公司运价信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -312,12 +310,10 @@
* 车辆基本信息
*/
public String baseInfoVehicle(BaseInfoVehicle baseInfoVehicle) throws Exception{
- System.err.println("车辆基本信息"+baseInfoVehicle);
-
String IPCType = "baseInfoVehicle";
String path = url + "/baseinfo/vehicle";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", baseInfoVehicle.getAddress());//车辆所在城市行政区划代码
jsonObject.put("VehicleNo", baseInfoVehicle.getVehicleNo());//车辆号牌
@@ -352,7 +348,7 @@
jsonObject.put("CommercialType", baseInfoVehicle.getCommercialType());//服务类型(1:网络预约出租车,2:巡游出租汽车,3:私人小客车合乘)
jsonObject.put("FareType", baseInfoVehicle.getFareType());//运价类型编码(与云间信息中一一对应)
- jsonObject.put("State", baseInfoVehicle.getSeats());//状态(0:有效,1:失效)
+ jsonObject.put("State", 0);//状态(0:有效,1:失效)
jsonObject.put("Flag", baseInfoVehicle.getFlag());//操作标识(1:新增,2:更新,3:删除)
jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoVehicle.getUpdateTime())));//YYYYMMDDhhmmss
@@ -361,18 +357,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/vehicle\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【车辆基本信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【车辆基本信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -381,12 +377,10 @@
* 车辆保险信息
*/
public String baseInfoVehicleInsurance(BaseInfoVehicleInsurance baseInfoVehicleInsurance) throws Exception{
- System.err.println("车辆保险信息"+baseInfoVehicleInsurance);
-
String IPCType = "baseInfoVehicleInsurance";
String path = url + "/baseinfo/vehicleinsurance";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("VehicleNo", baseInfoVehicleInsurance.getVehicleNo());//车辆号牌
jsonObject.put("InsurCom", baseInfoVehicleInsurance.getInsurCom());//保险公司名称
@@ -404,18 +398,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/vehicleinsurance\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【车辆保险信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【车辆保险信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -424,12 +418,10 @@
* 网约车车辆里程信息
*/
public String baseInfoVehicleTotalMile(BaseInfoVehicleTotalMile baseInfoVehicleTotalMile) throws Exception{
- System.err.println("网约车车辆里程信息"+baseInfoVehicleTotalMile);
-
String IPCType = "baseInfoVehicleTotalMile";
String path = url + "/baseinfo/vehicletotalmile";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", baseInfoVehicleTotalMile.getAddress());//注册地行政区划代码
jsonObject.put("VehicleNo", baseInfoVehicleTotalMile.getVehicleNo());//车辆号牌
@@ -443,18 +435,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/vehicletotalmile\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【网约车车辆里程信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【网约车车辆里程信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -463,12 +455,10 @@
* 驾驶员基本信息
*/
public String baseInfoDriver(BaseInfoDriver baseInfoDriver) throws Exception{
- System.err.println("驾驶员基本信息"+baseInfoDriver);
-
String IPCType = "baseInfoDriver";
String path = url + "/baseinfo/driver";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", baseInfoDriver.getAddress());//注册地行政区划代码
jsonObject.put("DriverName", baseInfoDriver.getDriverName());//机动车驾驶员姓名
@@ -507,23 +497,26 @@
jsonObject.put("EmergencyContact", baseInfoDriver.getEmergencyContact());//紧急情况联系人
jsonObject.put("EmergencyContactPhone", baseInfoDriver.getEmergencyContactPhone());//紧急情况联系人电话
jsonObject.put("EmergencyContactAddress", baseInfoDriver.getEmergencyContactAddress());//紧急情况联系人通信地址
- jsonObject.put("State", baseInfoDriver.getState());//状态(0:有效,1:失效)
+ jsonObject.put("State", 0);//状态(0:有效,1:失效)
jsonObject.put("Flag", baseInfoDriver.getFlag());//操作标识(1:新增,2:更新,3:删除)
jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoDriver.getUpdateTime())));
data.put("CompanyId", CompanyId);
data.put("Source", Source);
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/driver\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【驾驶员基本信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【驾驶员基本信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -532,12 +525,10 @@
* 网约车驾驶员培训信息
*/
public String baseInfoDriverEducate(BaseInfoDriverEducate baseInfoDriverEducate) throws Exception{
- System.err.println("网约车驾驶员培训信息"+baseInfoDriverEducate);
-
String IPCType = "baseInfoDriverEducate";
String path = url + "/baseinfo/drivereducate";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", baseInfoDriverEducate.getAddress());//注册地行政区划代码
jsonObject.put("LicenseId", null != baseInfoDriverEducate.getLicenseId() ? baseInfoDriverEducate.getLicenseId() : "");//机动车驾驶证号
@@ -555,18 +546,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/drivereducate\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【网约车驾驶员培训信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【网约车驾驶员培训信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -575,12 +566,10 @@
* 驾驶员移动终端信息
*/
public String baseInfoDriverApp(BaseInfoDriverApp baseInfoDriverApp) throws Exception{
- System.err.println("驾驶员移动终端信息"+baseInfoDriverApp);
-
String IPCType = "baseInfoDriverApp";
String path = url + "/baseinfo/driverapp";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", baseInfoDriverApp.getAddress());//注册地行政区划代码
jsonObject.put("LicenseId", null != baseInfoDriverApp.getLicenseId() ? baseInfoDriverApp.getLicenseId() : "");//机动车驾驶证号
@@ -589,7 +578,7 @@
jsonObject.put("AppVersion", baseInfoDriverApp.getAppVersion());//使用APP版本号
jsonObject.put("MapType", baseInfoDriverApp.getMapType());//使用地图类型(1:百度地图,2:高德地图,3:其他)
- jsonObject.put("State", baseInfoDriverApp.getState());//状态(0:有效,1:失效)
+ jsonObject.put("State", 0);//状态(0:有效,1:失效)
jsonObject.put("Flag", baseInfoDriverApp.getFlag());//操作标识(1:新增,2:更新,3:删除)
jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoDriverApp.getUpdateTime())));
@@ -598,18 +587,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/driverapp\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【驾驶员移动终端信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【驾驶员移动终端信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -618,12 +607,10 @@
* 驾驶员统计信息
*/
public String baseInfoDriverStat(BaseInfoDriverStat baseInfoDriverStat) throws Exception{
- System.err.println("驾驶员统计信息"+baseInfoDriverStat);
-
String IPCType = "baseInfoDriverStat";
String path = url + "/baseinfo/driverstat";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", baseInfoDriverStat.getAddress());//注册地行政区划代码
jsonObject.put("LicenseId", null != baseInfoDriverStat.getLicenseId() ? baseInfoDriverStat.getLicenseId() : "");//机动车驾驶证号
@@ -640,18 +627,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/driverstat\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【驾驶员统计信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【驾驶员统计信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -660,19 +647,17 @@
* 乘客基本信息
*/
public String baseInfoPassenger(BaseInfoPassenger baseInfoPassenger) throws Exception{
- System.err.println("乘客基本信息"+baseInfoPassenger);
-
String IPCType = "baseInfoPassenger";
String path = url + "/baseinfo/passenger";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("RegisterDate", Long.valueOf(sdf2.format(baseInfoPassenger.getRegisterDate())));//注册日期YYYYMMDD
jsonObject.put("PassengerPhone", null != baseInfoPassenger.getPassengerPhone() ? baseInfoPassenger.getPassengerPhone() : "");//乘客手机号
jsonObject.put("PassengerName", null != baseInfoPassenger.getPassengerName() ? baseInfoPassenger.getPassengerName() : "");//乘客称谓
jsonObject.put("PassengerGender", null != baseInfoPassenger.getPassengerGender() ? baseInfoPassenger.getPassengerGender() : "");//乘客性别
- jsonObject.put("State", baseInfoPassenger.getState());//状态(0:有效,1:失效)
+ jsonObject.put("State", 0);//状态(0:有效,1:失效)
jsonObject.put("Flag", baseInfoPassenger.getFlag());//操作标识(1:新增,2:更新,3:删除)
jsonObject.put("UpdateTime", Long.valueOf(sdf.format(baseInfoPassenger.getUpdateTime())));
@@ -681,18 +666,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/baseinfo/passenger\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【乘客基本信息1】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【乘客基本信息1】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -701,12 +686,10 @@
* 订单发起接口
*/
public String orderCreate(OrderCreate orderCreate) throws Exception{
- System.err.println("订单发起接口"+orderCreate);
-
String IPCType = "orderCreate";
String path = url + "/order/create";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", orderCreate.getAddress());//发起第行政区划代码
jsonObject.put("OrderId", orderCreate.getOrderId());//订单编号
@@ -727,18 +710,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/order/create\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【订单发起1】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【订单发起1】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -747,12 +730,10 @@
* 订单成功接口
*/
public String orderMatch(OrderMatch orderMatch) throws Exception{
- System.err.println("订单成功接口"+orderMatch);
-
String IPCType = "orderMatch";
String path = url + "/order/match";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", orderMatch.getAddress());//发起地行政区划代码
jsonObject.put("OrderId", orderMatch.getOrderId());//订单编号
@@ -769,18 +750,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/order/match\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【订单成功】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【订单成功】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -789,12 +770,10 @@
* 订单撤销接口
*/
public String orderCancel(OrderCancel orderCancel) throws Exception{
- System.err.println("订单撤销接口"+orderCancel);
-
String IPCType = "orderCancel";
String path = url + "/order/cancel";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", orderCancel.getAddress());//上车地点行政区划代码
jsonObject.put("OrderId", orderCancel.getOrderId());//订单编号
@@ -809,18 +788,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/order/cancel\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【订单撤销】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【订单撤销】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -829,12 +808,10 @@
* 车辆经营上线接口
*/
public String operateLogin(OperateLogin operateLogin) throws Exception{
- System.err.println("车辆经营上线接口"+operateLogin);
-
String IPCType = "operateLogin";
String path = url + "/operate/login";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("LicenseId", null != operateLogin.getLicenseId() ? operateLogin.getLicenseId() : "");//机动车驾驶证号
jsonObject.put("VehicleNo", operateLogin.getVehicleNo());//车辆号牌
@@ -848,18 +825,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/operate/login\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【车辆经营上线】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【车辆经营上线】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -868,12 +845,10 @@
* 车辆经营下线接口
*/
public String operateLogout(OperateLogout operateLogout) throws Exception{
- System.err.println("车辆经营下线接口"+operateLogout);
-
String IPCType = "operateLogout";
String path = url + "/operate/logout";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("LicenseId", null != operateLogout.getLicenseId() ? operateLogout.getLicenseId() : "");//机动车驾驶证号
jsonObject.put("VehicleNo", operateLogout.getVehicleNo());//车辆号牌
@@ -887,18 +862,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/operate/logout\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【车辆经营下线】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【车辆经营下线】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -907,12 +882,10 @@
* 经营出发接口
*/
public String operateDepart(OperateDepart operateDepart) throws Exception{
- System.err.println("经营出发接口"+operateDepart);
-
String IPCType = "operateDepart";
String path = url + "/operate/depart";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("OrderId", operateDepart.getOrderId());//订单号
jsonObject.put("LicenseId", null != operateDepart.getLicenseId() ? operateDepart.getLicenseId() : "");//机动车驾驶证号
@@ -930,18 +903,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/operate/depart\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【 经营出发】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【经营出发】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -950,12 +923,10 @@
* 经营到达接口
*/
public String operateArrive(OperateArrive operateArrive) throws Exception{
- System.err.println("经营到达接口"+operateArrive);
-
String IPCType = "operateArrive";
String path = url + "/operate/arrive";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("OrderId", operateArrive.getOrderId());//订单号
jsonObject.put("DestLongitude", Double.valueOf(operateArrive.getDestLongitude() * 1000000).intValue());//车辆到达经度
@@ -970,18 +941,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/operate/arrive\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【经营到达】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【经营到达】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -990,12 +961,10 @@
* 经营支付接口
*/
public String operatePay(OperatePay operatePay) throws Exception{
- System.err.println("经营支付接口"+operatePay);
-
String IPCType = "operatePay";
String path = url + "/operate/pay";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("OrderId", operatePay.getOrderId());//订单号
jsonObject.put("OnArea", operatePay.getOnArea());//上车位置行政区划代码
@@ -1042,18 +1011,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/operate/pay\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【经营支付接口】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【经营支付接口】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -1062,12 +1031,10 @@
* 驾驶员定位信息
*/
public String positionDriver(PositionDriver positionDriver) throws Exception{
- System.err.println("驾驶员定位信息"+positionDriver);
-
String IPCType = "positionDriver";
String path = url + "/position/driver";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("LicenseId", null != positionDriver.getLicenseId() ? positionDriver.getLicenseId() : "");//机动车驾驶证号
jsonObject.put("DriverRegionCode", positionDriver.getDriverRegionCode());//行政区划代码
@@ -1087,18 +1054,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
- System.err.println("响应结果"+httpResult.getData());
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/position/driver\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【驾驶员定位信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【驾驶员定位信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -1107,12 +1074,10 @@
* 车辆定位信息
*/
public String positionVehicle(PositionVehicle positionVehicle) throws Exception{
- System.err.println("车辆定位信息"+positionVehicle);
-
String IPCType = "positionVehicle";
String path = url + "/position/vehicle";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("VehicleNo", positionVehicle.getVehicleNo());//车辆号牌
jsonObject.put("VehicleRegionCode", positionVehicle.getVehicleRegionCode());//行政区划代码
@@ -1134,18 +1099,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/position/vehicle\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【车辆定位信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【车辆定位信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -1154,12 +1119,10 @@
* 乘客评价信息
*/
public String ratedPassenger(RatedPassenger ratedPassenger) throws Exception{
- System.err.println("乘客评价信息"+ratedPassenger);
-
String IPCType = "ratedPassenger";
String path = url + "/rated/passenger";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("OrderId", ratedPassenger.getOrderId());//订单号
jsonObject.put("EvaluateTime", Long.valueOf(sdf.format(ratedPassenger.getEvaluateTime())));//评价时间YYYYMMDDhhmms
@@ -1173,18 +1136,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/rated/passenger\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【乘客评价信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【乘客评价信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -1193,12 +1156,10 @@
* 乘客投诉信息
*/
public String ratedPassengerComplaint(RatedPassengerComplaint ratedPassengerComplaint) throws Exception{
- System.err.println("乘客投诉信息"+ratedPassengerComplaint);
-
String IPCType = "ratedPassengerComplaint";
String path = url + "/rated/passengercomplaint";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("OrderId", ratedPassengerComplaint.getOrderId());//订单号
jsonObject.put("ComplaintTime", Long.valueOf(sdf.format(ratedPassengerComplaint.getComplaintTime())));//投诉时间YYYYMMDDhhmms
@@ -1210,18 +1171,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/rated/passengercomplaint\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【乘客投诉信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【乘客投诉信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -1229,12 +1190,10 @@
* 驾驶员处罚信息
*/
public String ratedDriverPunish(RatedDriverPunish ratedDriverPunish) throws Exception{
- System.err.println("驾驶员处罚信息"+ratedDriverPunish);
-
String IPCType = "ratedDriverPunish";
String path = url + "/rated/driverpunish";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("LicenseId", null != ratedDriverPunish.getLicenseId() ? ratedDriverPunish.getLicenseId() : "");//机动车驾驶证编号
jsonObject.put("PunishTime", Long.valueOf(sdf.format(ratedDriverPunish.getPunishTime())));//处罚时间YYYYMMDDhhmms
@@ -1246,18 +1205,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/rated/driverpunish\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【驾驶员处罚信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【驾驶员处罚信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -1266,12 +1225,10 @@
* 驾驶员信誉信息
*/
public String ratedDriver(RatedDriver ratedDriver) throws Exception{
- System.err.println("驾驶员信誉信息"+ratedDriver);
-
String IPCType = "ratedDriver";
String path = url + "/rated/driver";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("LicenseId", null != ratedDriver.getLicenseId() ? ratedDriver.getLicenseId() : "");//机动车驾驶证编号
jsonObject.put("Level", ratedDriver.getLevel());//服务质量信誉等级(五分制)
@@ -1283,18 +1240,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/rated/driver\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【驾驶员信誉信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【驾驶员信誉信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -1303,12 +1260,10 @@
* 私人小客车合乘信息服务平台基本信息
*/
public String shareCompany(ShareCompany shareCompany) throws Exception{
- System.err.println("私人小客车合乘信息服务平台基本信息"+shareCompany);
-
String IPCType = "shareCompany";
String path = url + "/share/company";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("CompanyName", shareCompany.getCompanyName());//公司名称
jsonObject.put("Identifier", shareCompany.getIdentifier());//统一社会信用代码
@@ -1317,7 +1272,7 @@
jsonObject.put("EconomicType", shareCompany.getEconomicType());//经营业户经济类型
jsonObject.put("LegalName", shareCompany.getLegalName());//法人代表姓名(按照营业执照填写)
jsonObject.put("LegalPhone", shareCompany.getLegalPhone());//法人代表电话
- jsonObject.put("State", shareCompany.getState());//状态(0:有效,1:失效)
+ jsonObject.put("State", 0);//状态(0:有效,1:失效)
jsonObject.put("Flag", shareCompany.getFlag());//操作标识(1:新增,2:更新,3:删除)
jsonObject.put("UpdateTime", Long.valueOf(sdf.format(shareCompany.getUpdateTime())));//更新时间YYYYMMDDhhmmss
@@ -1326,18 +1281,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/share/company\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【私人小客车合乘信息服务平台基本信息】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【私人小客车合乘信息服务平台基本信息】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -1345,12 +1300,10 @@
* 私人小客车合乘驾驶员行程发布接口
*/
public String shareRoute(ShareRoute shareRoute) throws Exception{
- System.err.println("私人小客车合乘驾驶员行程发布接口"+shareRoute);
-
String IPCType = "shareRoute";
String path = url + "/share/route";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", shareRoute.getAddress());//行政区划代码
jsonObject.put("RouteId", shareRoute.getRouteId());//驾驶员发起行程编号
@@ -1374,18 +1327,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/share/route\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【私人小客车合乘驾驶员行程发布】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【私人小客车合乘驾驶员行程发布】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -1394,12 +1347,10 @@
* 私人小客车合乘订单接口
*/
public String shareOrder(ShareOrder shareOrder) throws Exception{
- System.err.println("私人小客车合乘订单接口"+shareOrder);
-
String IPCType = "shareOrder";
String path = url + "/share/order";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", shareOrder.getAddress());//行政区划代码
jsonObject.put("RouteId", shareOrder.getRouteId());//驾驶员发起行程编号
@@ -1421,18 +1372,18 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/share/order\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【私人小客车合乘订单】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【私人小客车合乘订单】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
@@ -1441,12 +1392,10 @@
* 私人小客车合乘订单支付接口
*/
public String sharePay(SharePay sharePay) throws Exception{
- System.err.println("私人小客车合乘订单支付接口"+sharePay);
-
String IPCType = "sharePay";
String path = url + "/share/pay";
- Map<String, Object> data = new HashMap<>();
- JSONObject jsonObject = new JSONObject();
+ JSONObject data = new JSONObject(true);
+ JSONObject jsonObject = new JSONObject(true);
jsonObject.put("CompanyId", CompanyId);
jsonObject.put("Address", sharePay.getAddress());//行政区划代码
jsonObject.put("RouteId", sharePay.getRouteId());//驾驶员发起行程编号
@@ -1487,88 +1436,92 @@
data.put("IPCType", IPCType);
data.put(IPCType, jsonObject);
- Map<String, String> header = new HashMap<>();
- header.put("connection", "keep-alive");
- header.put("content-type", "application/json; charset=UTF-8");
- header.put("accept", "application/json");
- header.put("accept-encoding", "gzip");
- header.put("accept-charset", "utf-8");
- HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", path, data, header, "json");
-
- if(httpResult.getCode() == 200){
- analysisResult(httpResult.getData());
- }
+ logger.info("\n业务接口代码(IPCType):" + IPCType + "\nURL:/share/pay\nHTTP 方法:POST\nConnection头域:keep-alive\nContent—Type头域:application/json\nAccept—Encoding头域:gzip\nAccept—Charset头域:utf-8");
+ logger.info(sdf.format(new Date()) + "【私人小客车合乘订单支付】请求:\n" +
+ path + "\n" +
+ "JSON串:\n" + JSON.toJSONString(data, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue));
+ Map<String, Object> map = sendPost_JSON(path, data);
+ Integer code = Integer.valueOf(map.get("code").toString());
+ String msg = map.get("msg").toString();
+ logger.info("【私人小客车合乘订单支付】响应:\n【"+ code + "】" + msg);
+ analysisResult(code);
+ HttpResult httpResult = new HttpResult();
+ httpResult.setCode(code);
+ httpResult.setData(msg);
return JSON.toJSONString(httpResult);
}
/**
* 处理返回结果
- * @param result
*/
- private void analysisResult(String result){
- JSONObject jsonObject = JSON.parseObject(result);
-// if(null == jsonObject){
-// System.err.println("请求接口出错!");
-// return;
-// }
- System.err.println("(成功)服务器已成功处理了请求");
-
-// int code = (Integer)jsonObject.get("status");
-// if(code == 200){
-// System.err.println("(成功)服务器已成功处理了请求");
-// }
-// if(code == 201){
-// System.err.println("请求已经完成并一个新的返回资源被创建");
-// }
-// if(code == 400){
-// System.err.println("(错误请求)服务器不理解请求的语法");
-// System.err.println(jsonObject.getString("error"));
-// }
-// if(code == 401){
-// System.err.println("(未授权)请求要求身份验证");
-// System.err.println(jsonObject.getString("error"));
-// }
-// if(code == 403){
-// System.err.println("(禁止)服务器拒绝请求");
-// System.err.println(jsonObject.getString("error"));
-// }
-// if(code == 404){
-// System.err.println("(未找到)服务器找不到请求的网页");
-// System.err.println(jsonObject.getString("error"));
-// }
-// if(code == 500){
-// System.err.println("服务器遭遇异常阻止了当前请求的执行");
-// System.err.println(jsonObject.getString("error"));
-// }
-// if(code == 502){
-// System.err.println("(错误网关)服务器作为网关或代理,从上游服务器收到无效响应");
-// System.err.println(jsonObject.getString("error"));
-// }
-// if(code == 702){
-// System.err.println("请求文件不存在");
-// System.err.println(jsonObject.getString("error"));
-// }
-// if(code == 948){
-// System.err.println("请求文件名格式不正确");
-// System.err.println(jsonObject.getString("error"));
-// }
-// if(code == 949){
-// System.err.println("文件解压失败");
-// System.err.println(jsonObject.getString("error"));
-// }
-// if(code == 952){
-// System.err.println("格式校验失败");
-// System.err.println(jsonObject.getString("error"));
-// }
-// if(code == 1000){
-// System.err.println("请求异常");
-// System.err.println(jsonObject.getString("error"));
-// }
+ private void analysisResult(Integer code){
+ if(code == 0){
+ logger.info("接口请求失败!");
+ }
+ if(code == 200){
+ logger.info("(成功)服务器已成功处理了请求");
+ }
+ if(code == 201){
+ logger.info("请求已经完成并一个新的返回资源被创建");
+ }
+ if(code == 400){
+ logger.info("(错误请求)服务器不理解请求的语法");
+ }
+ if(code == 401){
+ logger.info("(未授权)请求要求身份验证");
+ }
+ if(code == 403){
+ logger.info("(禁止)服务器拒绝请求");
+ }
+ if(code == 404){
+ logger.info("(未找到)服务器找不到请求的网页");
+ }
+ if(code == 500){
+ logger.info("服务器遭遇异常阻止了当前请求的执行");
+ }
+ if(code == 502){
+ logger.info("(错误网关)服务器作为网关或代理,从上游服务器收到无效响应");
+ }
+ if(code == 702){
+ logger.info("请求文件不存在");
+ }
+ if(code == 948){
+ logger.info("请求文件名格式不正确");
+ }
+ if(code == 949){
+ logger.info("文件解压失败");
+ }
+ if(code == 952){
+ logger.info("格式校验失败");
+ }
+ if(code == 1000){
+ logger.info("请求异常");
+ }
}
-
+ public Map<String, Object> sendPost_JSON(String url, JSONObject obj) {
+ Map<String, Object> map = new HashMap<>();
+ HttpRequest post = HttpUtil.createPost(url);
+ post.header("Connection", "keep-alive");
+ post.header("Content-Type", "application/json");
+ post.header("Accept-Encoding", "gzip");
+ post.header("Accept-Charset", "utf-8");
+ post.body(obj.toJSONString());
+ try {
+ HttpResponse execute = post.execute();
+ int status = execute.getStatus();
+ map.put("code", status);
+ map.put("msg", execute.body());
+ return map;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ map.put("code", 0);
+ map.put("msg", "");
+ return map;
+ }
}
diff --git a/MinistryOfTransport/src/main/resources/application-prod.properties b/MinistryOfTransport/src/main/resources/application-prod.properties
deleted file mode 100644
index 1163883..0000000
--- a/MinistryOfTransport/src/main/resources/application-prod.properties
+++ /dev/null
@@ -1 +0,0 @@
-server.port=8868
\ No newline at end of file
diff --git a/MinistryOfTransport/src/main/resources/application.properties b/MinistryOfTransport/src/main/resources/application.properties
index 1163883..6b13d22 100644
--- a/MinistryOfTransport/src/main/resources/application.properties
+++ b/MinistryOfTransport/src/main/resources/application.properties
@@ -1 +1,2 @@
-server.port=8868
\ No newline at end of file
+server.port=8868
+spring.profiles.active=prod
\ No newline at end of file
diff --git a/MinistryOfTransport/src/main/resources/logback-spring.xml b/MinistryOfTransport/src/main/resources/logback-spring.xml
new file mode 100644
index 0000000..7f784ca
--- /dev/null
+++ b/MinistryOfTransport/src/main/resources/logback-spring.xml
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,比如: 如果设置为WARN,则低于WARN的信息都不会输出 -->
+<!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true -->
+<!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
+<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
+<configuration scan="true" scanPeriod="10 seconds">
+ <contextName>logback</contextName>
+
+ <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 -->
+ <property name="log.path" value="/usr/local/server/app/log/ministryoftransport"/>
+
+ <!--0. 日志格式和颜色渲染 -->
+ <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
+ <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
+ <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
+ <!-- 彩色日志格式 -->
+ <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
+
+ <!--1. 输出到控制台-->
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+ <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>debug</level>
+ </filter>
+ <encoder>
+ <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
+ <!-- 设置字符集 -->
+ <charset>UTF-8</charset>
+ </encoder>
+ </appender>
+
+ <!--2. 输出到文档-->
+ <!-- 2.1 level为 DEBUG 日志,时间滚动输出 -->
+ <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <!-- 正在记录的日志文档的路径及文档名 -->
+ <file>${log.path}/debug.log</file>
+ <!--日志文档输出格式-->
+ <encoder>
+ <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+ <charset>UTF-8</charset> <!-- 设置字符集 -->
+ </encoder>
+ <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!-- 日志归档 -->
+ <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ <maxFileSize>100MB</maxFileSize>
+ </timeBasedFileNamingAndTriggeringPolicy>
+ <!--日志文档保留天数-->
+ <maxHistory>15</maxHistory>
+ </rollingPolicy>
+ <!-- 此日志文档只记录debug级别的 -->
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>debug</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ </appender>
+
+ <!-- 2.2 level为 INFO 日志,时间滚动输出 -->
+ <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <!-- 正在记录的日志文档的路径及文档名 -->
+ <file>${log.path}/info.log</file>
+ <!--日志文档输出格式-->
+ <encoder>
+ <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+ <charset>UTF-8</charset>
+ </encoder>
+ <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!-- 每天日志归档路径以及格式 -->
+ <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ <maxFileSize>100MB</maxFileSize>
+ </timeBasedFileNamingAndTriggeringPolicy>
+ <!--日志文档保留天数-->
+ <maxHistory>15</maxHistory>
+ </rollingPolicy>
+ <!-- 此日志文档只记录info级别的 -->
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>info</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ </appender>
+
+ <!-- 2.3 level为 WARN 日志,时间滚动输出 -->
+ <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <!-- 正在记录的日志文档的路径及文档名 -->
+ <file>${log.path}/warn.log</file>
+ <!--日志文档输出格式-->
+ <encoder>
+ <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+ <charset>UTF-8</charset> <!-- 此处设置字符集 -->
+ </encoder>
+ <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ <maxFileSize>100MB</maxFileSize>
+ </timeBasedFileNamingAndTriggeringPolicy>
+ <!--日志文档保留天数-->
+ <maxHistory>15</maxHistory>
+ </rollingPolicy>
+ <!-- 此日志文档只记录warn级别的 -->
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>warn</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ </appender>
+
+ <!-- 2.4 level为 ERROR 日志,时间滚动输出 -->
+ <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <!-- 正在记录的日志文档的路径及文档名 -->
+ <file>${log.path}/error.log</file>
+ <!--日志文档输出格式-->
+ <encoder>
+ <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+ <charset>UTF-8</charset> <!-- 此处设置字符集 -->
+ </encoder>
+ <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ <maxFileSize>100MB</maxFileSize>
+ </timeBasedFileNamingAndTriggeringPolicy>
+ <!--日志文档保留天数-->
+ <maxHistory>15</maxHistory>
+ </rollingPolicy>
+ <!-- 此日志文档只记录ERROR级别的 -->
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>ERROR</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ </appender>
+
+ <!-- 2.5 所有 除了DEBUG级别的其它高于DEBUG的 日志,记录到一个文件 -->
+ <appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <!-- 正在记录的日志文档的路径及文档名 -->
+ <file>${log.path}/all.log</file>
+ <!--日志文档输出格式-->
+ <encoder>
+ <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+ <charset>UTF-8</charset> <!-- 此处设置字符集 -->
+ </encoder>
+ <!-- 日志记录器的滚动策略,按日期,按大小记录 -->
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ <maxFileSize>100MB</maxFileSize>
+ </timeBasedFileNamingAndTriggeringPolicy>
+ <!--日志文档保留天数-->
+ <maxHistory>15</maxHistory>
+ </rollingPolicy>
+ <!-- 此日志文档记录除了DEBUG级别的其它高于DEBUG的 -->
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>DEBUG</level>
+ <onMatch>DENY</onMatch>
+ <onMismatch>ACCEPT</onMismatch>
+ </filter>
+ </appender>
+
+ <!--
+ <logger>用来设置某一个包或者具体的某一个类的日志打印级别、
+ 以及指定<appender>。<logger>仅有一个name属性,
+ 一个可选的level和一个可选的addtivity属性。
+ name:用来指定受此logger约束的某一个包或者具体的某一个类。
+ level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
+ 还有一个特殊值INHERITED或者同义词NULL,代表强制执行上级的级别。
+ 如果未设置此属性,那么当前logger将会继承上级的级别。
+ addtivity:是否向上级logger传递打印信息。默认是true。
+ <logger name="org.springframework.web" level="info"/>
+ <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>
+ -->
+
+ <!--
+ root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性
+ level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
+ 不能设置为INHERITED或者同义词NULL。默认是DEBUG
+ 可以包含零个或多个元素,标识这个appender将会添加到这个logger。
+ -->
+
+ <!-- 4 最终的策略:
+ 基本策略(root级) + 根据profile在启动时, logger标签中定制化package日志级别(优先级高于上面的root级)-->
+ <springProfile name="dev">
+ <root level="info">
+ <appender-ref ref="CONSOLE" />
+ <appender-ref ref="DEBUG_FILE" />
+ <appender-ref ref="INFO_FILE" />
+ <appender-ref ref="WARN_FILE" />
+ <appender-ref ref="ERROR_FILE" />
+ <appender-ref ref="ALL_FILE" />
+ </root>
+ <logger name="com.stylefeng.guns.modular.system.dao" level="debug"/>
+ </springProfile>
+
+ <springProfile name="test">
+ <root level="info">
+ <appender-ref ref="CONSOLE" />
+ <appender-ref ref="DEBUG_FILE" />
+ <appender-ref ref="INFO_FILE" />
+ <appender-ref ref="WARN_FILE" />
+ <appender-ref ref="ERROR_FILE" />
+ <appender-ref ref="ALL_FILE" />
+ </root>
+ </springProfile>
+
+ <springProfile name="prod">
+ <root level="info">
+ <!-- 生产环境最好不配置console写文件 -->
+ <appender-ref ref="DEBUG_FILE" />
+ <appender-ref ref="INFO_FILE" />
+ <appender-ref ref="WARN_FILE" />
+ <appender-ref ref="ERROR_FILE" />
+ <appender-ref ref="ALL_FILE" />
+ </root>
+ </springProfile>
+
+</configuration>
\ No newline at end of file
--
Gitblit v1.7.1