|
@@ -4,237 +4,48 @@
|
|
|
package analysis
|
|
|
|
|
|
import (
|
|
|
+ "fmt"
|
|
|
"gadm-ods/apis"
|
|
|
"gadm-ods/common.in/clinit"
|
|
|
"gadm-ods/model"
|
|
|
- "fmt"
|
|
|
"github.com/tidwall/gjson"
|
|
|
"go.uber.org/zap"
|
|
|
"strings"
|
|
|
- "time"
|
|
|
)
|
|
|
|
|
|
-// spy VIN查询车型信息128-001
|
|
|
+// dybd 学位(DYXW = "104-001")
|
|
|
func ParasOds5(content string) (ret []map[string]string, err error) {
|
|
|
data := gjson.Parse(content)
|
|
|
requestParams := data.Get("request_params").String()
|
|
|
responseParams := data.Get("response_params").String()
|
|
|
- vin := gjson.Get(requestParams, "vin").String()
|
|
|
- if vin == "" {
|
|
|
+ degreeId := gjson.Get(requestParams, "xwzsbh").String()
|
|
|
+ name := gjson.Get(requestParams, "xm").String()
|
|
|
+
|
|
|
+ if degreeId == "" || name == ""{
|
|
|
return nil, fmt.Errorf("数据异常,车牌姓名不匹配")
|
|
|
}
|
|
|
|
|
|
- code := gjson.Get(responseParams, "respCode").String()
|
|
|
- if code != "0" {
|
|
|
+ code := gjson.Get(responseParams, "code").String()
|
|
|
+ if code != "200" {
|
|
|
return nil, fmt.Errorf("数据异常,没有数据")
|
|
|
}
|
|
|
-
|
|
|
- stateCode := gjson.Get(responseParams, "data.stateCode").String()
|
|
|
- if stateCode == "0" {
|
|
|
- return nil, fmt.Errorf("数据异常,没有数据")
|
|
|
+
|
|
|
+ arr := gjson.Get(responseParams, "data").Array()
|
|
|
+
|
|
|
+
|
|
|
+ for _, v := range arr {
|
|
|
+ dataMap := make(map[string]string)
|
|
|
+ dataMap["birth_date"] = v.Get("csrq").String() // 出生日期
|
|
|
+ dataMap["gender"] = v.Get("xb").String() // 性别
|
|
|
+ dataMap["major"] = v.Get("xkzy").String() // 学科专业
|
|
|
+ dataMap["degree_name"] = v.Get("xwlb").String() // 获学位名称
|
|
|
+ dataMap["award_name"] = v.Get( "xwsydw").String() // 学位授予单位
|
|
|
+ dataMap["name"] = v.Get( "xm").String() // 姓名
|
|
|
+ dataMap["award_date"] = v.Get( "hxwrq").String() // 获学位日期
|
|
|
+ dataMap["degree_id"] = degreeId
|
|
|
+ ret = append(ret, dataMap)
|
|
|
}
|
|
|
- respData := gjson.Get(responseParams, "data").String()
|
|
|
- if stateCode == "1" {
|
|
|
- arr := gjson.Get(respData, "vecStdVOS").Array()
|
|
|
- for _, v := range arr {
|
|
|
- dataMap := make(map[string]string)
|
|
|
- dataMap["vin"] = vin
|
|
|
- dataMap["approved_load"] = v.Get("approvedLoad").String()
|
|
|
- dataMap["release_date"] = time.Unix(v.Get("vinTime").Int()/1000, 0).Format("2006-01-02")
|
|
|
- dataMap["long"] = v.Get("wkc").String()
|
|
|
- dataMap["oil_wear"] = v.Get("yh").String()
|
|
|
- dataMap["engine_type"] = v.Get("fdjxh").String()
|
|
|
- dataMap["high"] = v.Get("wkg").String()
|
|
|
- dataMap["wide"] = v.Get("wkk").String()
|
|
|
- dataMap["vehicle_body_color_detail"] = v.Get("csys").String()
|
|
|
- dataMap["gross_mass"] = v.Get("zzl").String()
|
|
|
- dataMap["front_wheel_distance"] = v.Get("qlj").String()
|
|
|
- dataMap["axle_weight"] = v.Get("zh").String()
|
|
|
- dataMap["wheel_base"] = v.Get("zj").String()
|
|
|
- dataMap["model_no"] = v.Get("clxh").String()
|
|
|
- dataMap["axle_number"] = v.Get("zs").String()
|
|
|
- dataMap["approved_number"] = v.Get("edzk").String()
|
|
|
- plL := v.Get("plL").String()
|
|
|
- engineMod := v.Get("engineMod").String()
|
|
|
- plLMod := ""
|
|
|
- tmp := strings.Split(engineMod, " ")
|
|
|
- if len(tmp) > 0 {
|
|
|
- plLMod = tmp[0]
|
|
|
- }
|
|
|
- if plL != "" {
|
|
|
- tmp := strings.Replace(plL, "L", "", -1)
|
|
|
- tmp = strings.Replace(tmp, "T", "", -1)
|
|
|
- dataMap["displacement_l"] = tmp
|
|
|
- if strings.HasSuffix(plL, "L") {
|
|
|
- dataMap["air_intak_form"] = "L"
|
|
|
- } else if strings.HasSuffix(plL, "T") {
|
|
|
- dataMap["air_intak_form"] = "T"
|
|
|
- }
|
|
|
-
|
|
|
- } else if engineMod != "" {
|
|
|
- if plLMod != "" {
|
|
|
- pl := strings.Replace(plLMod, "L", "", -1)
|
|
|
- pl = strings.Replace(pl, "T", "", -1)
|
|
|
- dataMap["displacement_l"] = pl
|
|
|
- }
|
|
|
- }
|
|
|
- if dataMap["air_intak_form"] == "" {
|
|
|
- if plLMod != "" {
|
|
|
- if strings.HasSuffix(plLMod, "L") {
|
|
|
- dataMap["air_intak_form"] = "L"
|
|
|
- } else if strings.HasSuffix(plLMod, "T") {
|
|
|
- dataMap["air_intak_form"] = "T"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- dataMap["engine_no"] = v.Get("fdjh").String()
|
|
|
-
|
|
|
- // TODO 拆分为前后轮胎规格
|
|
|
- dataMap["tyre_size"] = v.Get("ltgg").String()
|
|
|
- //dataMap["front_wheel_specification"] = dataMap["tyre_size"]
|
|
|
- //dataMap["back_wheel_specification"] = dataMap["tyre_size"]
|
|
|
- dataMap["fuel_type_detail"] = v.Get("oilWay").String()
|
|
|
- dataMap["use_property_detail"] = v.Get("syxz").String()
|
|
|
- dataMap["unladen_mass"] = v.Get("zbzl").String()
|
|
|
- dataMap["rated_power"] = v.Get("gl").String()
|
|
|
- dataMap["back_wheel_distance"] = v.Get("hlj").String()
|
|
|
- dataMap["vehicle_type_detail"] = v.Get("vecModType").String()
|
|
|
- dataMap["tyre_number"] = v.Get("lts").String()
|
|
|
- dataMap["traction_mass"] = v.Get("quasiTraction").String()
|
|
|
- dataMap["emission_standard"] = v.Get("pfbz").String()
|
|
|
- dataMap["brand_name"] = v.Get("automarkerInfo").String()
|
|
|
-
|
|
|
- dataMap["price"] = v.Get("autoPrice").String()
|
|
|
- dataMap["vehicle_structure"] = v.Get("bodyStruct").String()
|
|
|
- dataMap["model_year"] = v.Get("modelYear").String()
|
|
|
- //dataMap["axle_number"] = v.Get("wheelSum").String()
|
|
|
- dataMap["drive_type"] = v.Get("driveWay").String()
|
|
|
- dataMap["chassis_model"] = v.Get("chassisModel").String()
|
|
|
- if v.Get("cxid").String() != ""{
|
|
|
- dataMap["third_style_id"] = v.Get("cxid").String()
|
|
|
- dataMap["source"] = "1"
|
|
|
- }else{
|
|
|
- qczjId := v.Get("qczjId").String()
|
|
|
- if qczjId != "" {
|
|
|
- dataMap["third_style_id"] = qczjId
|
|
|
- dataMap["source"] = "2"
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- dataMap["series_source"] = "1"
|
|
|
- /*if v.Get("catarcCode").Exists() {
|
|
|
- dataMap["third_style_id"] = v.Get("catarcCode").String()
|
|
|
- } else {
|
|
|
- dataMap["third_style_id"] = v.Get("cxid").String()
|
|
|
- }*/
|
|
|
-
|
|
|
- dataMap["third_series_id"] = v.Get("ccs5").String()
|
|
|
- dataMap["third_series_name"] = v.Get("vecMod").String()
|
|
|
- dataMap["third_style_name"] = v.Get("vecName").String()
|
|
|
- ret = append(ret, dataMap)
|
|
|
- }
|
|
|
- } else if stateCode == "2" {
|
|
|
- arr := gjson.Get(respData, "vinSycVO").Array()
|
|
|
- for _, v := range arr {
|
|
|
- dataMap := make(map[string]string)
|
|
|
- dataMap["vin"] = vin
|
|
|
- dataMap["approved_load"] = v.Get("ratedLoadMass").String()
|
|
|
- if v.Get("createTime").Int() != 0 {
|
|
|
- dataMap["release_date"] = time.Unix(v.Get("createTime").Int()/1000, 0).Format("2006-01-02")
|
|
|
- } else {
|
|
|
- dataMap["release_date"] = ""
|
|
|
- }
|
|
|
-
|
|
|
- dataMap["long"] = v.Get("length").String()
|
|
|
- dataMap["oil_wear"] = v.Get("oilLoss").String()
|
|
|
- dataMap["engine_type"] = v.Get("engineType").String()
|
|
|
- dataMap["high"] = v.Get("height").String()
|
|
|
- dataMap["wide"] = v.Get("wide").String()
|
|
|
- dataMap["gross_mass"] = v.Get("totalQuality").String()
|
|
|
- dataMap["front_wheel_distance"] = v.Get("frontGauge").String()
|
|
|
- dataMap["axle_weight"] = v.Get("axleLoad").String()
|
|
|
- dataMap["wheel_base"] = v.Get("wheelBase").String()
|
|
|
- dataMap["model_no"] = v.Get("vehicleNumber").String()
|
|
|
- dataMap["axle_number"] = v.Get("numberOfShaft").String()
|
|
|
- dataMap["approved_number"] = v.Get("ratedPassenger").String()
|
|
|
- dataMap["displacement"] = v.Get("displacement").String()
|
|
|
- dataMap["engine_no"] = v.Get("fdjh").String()
|
|
|
- dataMap["tyre_size"] = v.Get("tireSize").String()
|
|
|
- dataMap["fuel_type_detail"] = v.Get("fuelType").String()
|
|
|
- dataMap["unladen_mass"] = v.Get("curbWeight").String()
|
|
|
- dataMap["rated_power"] = v.Get("power").String()
|
|
|
- dataMap["back_wheel_distance"] = v.Get("trackRear").String()
|
|
|
- dataMap["vehicle_type_detail"] = v.Get("vehicleCategory").String() + v.Get("vehicleName").String()
|
|
|
- dataMap["tyre_number"] = v.Get("numberOfTires").String()
|
|
|
- dataMap["emission_standard"] = v.Get("emissionStandard").String()
|
|
|
- dataMap["brand_name"] = v.Get("brand").String()
|
|
|
- if v.Get("brand").String() == "" {
|
|
|
- dataMap["brand_name"] = v.Get("vehicleBrand").String()
|
|
|
- }
|
|
|
- dataMap["traction_mass"] = v.Get("totalMassOfQuasiTraction").String()
|
|
|
- dataMap["cargo_high"] = v.Get("cargoVanHeight").String()
|
|
|
- dataMap["cargo_long"] = v.Get("cargoVanLong").String()
|
|
|
- dataMap["cargo_wide"] = v.Get("cargoVanWide").String()
|
|
|
- dataMap["chassis_model"] = v.Get("chassisModel").String()
|
|
|
- //dataMap["drive_type"] = v.Get("drivingForm").String()
|
|
|
- //dataMap["vehicle_type_detail"] = v.Get("vehicleType").String()
|
|
|
- dataMap["number_of_leaf_springs"] = v.Get("numberOfLeafSprings").String()
|
|
|
- dataMap["number_of_passengers"] = v.Get("numberOfPassengers").String()
|
|
|
- ret = append(ret, dataMap)
|
|
|
- }
|
|
|
- } else if stateCode == "3" {
|
|
|
- arr := gjson.Get(respData, "vinMotoVO").Array()
|
|
|
- for _, v := range arr {
|
|
|
- dataMap := make(map[string]string)
|
|
|
- dataMap["vin"] = vin
|
|
|
- if v.Get("createTime").Int() != 0 {
|
|
|
- dataMap["release_date"] = time.Unix(v.Get("createTime").Int()/1000, 0).Format("2006-01-02")
|
|
|
- } else {
|
|
|
- dataMap["release_date"] = ""
|
|
|
- }
|
|
|
- dataMap["brand_name"] = v.Get("brand").String()
|
|
|
- if v.Get("brand").String() == "" {
|
|
|
- dataMap["brand_name"] = v.Get("vehicleBrand").String()
|
|
|
- }
|
|
|
- dataMap["front_wheel_distance"] = v.Get("frontGauge").String()
|
|
|
- dataMap["back_wheel_distance"] = v.Get("trackRear").String()
|
|
|
- dataMap["tyre_number"] = v.Get("numberOfTires").String()
|
|
|
- dataMap["tyre_size"] = v.Get("tireSize").String()
|
|
|
- dataMap["number_of_leaf_springs"] = v.Get("numberOfLeafSprings").String()
|
|
|
- dataMap["wheel_base"] = v.Get("wheelBase").String()
|
|
|
- dataMap["axle_weight"] = v.Get("axleLoad").String()
|
|
|
- dataMap["axle_number"] = v.Get("numberOfShaft").String()
|
|
|
- dataMap["long"] = v.Get("length").String()
|
|
|
- dataMap["wide"] = v.Get("wide").String()
|
|
|
- dataMap["high"] = v.Get("height").String()
|
|
|
- dataMap["cargo_long"] = v.Get("cargoVanLong").String()
|
|
|
- dataMap["cargo_wide"] = v.Get("cargoVanWide").String()
|
|
|
- dataMap["cargo_high"] = v.Get("cargoVanHeight").String()
|
|
|
- dataMap["gross_mass"] = v.Get("totalQuality").String()
|
|
|
- dataMap["approved_load"] = v.Get("ratedLoadMass").String()
|
|
|
- dataMap["unladen_mass"] = v.Get("curbWeight").String()
|
|
|
- dataMap["traction_mass"] = v.Get("totalMassOfQuasiTraction").String()
|
|
|
- dataMap["number_of_passengers"] = v.Get("numberOfPassengers").String()
|
|
|
- dataMap["approved_number"] = v.Get("ratedPassenger").String()
|
|
|
- dataMap["top_speed"] = v.Get("topSpeed").String()
|
|
|
- dataMap["model_no"] = v.Get("vehicleNumber").String()
|
|
|
- //vehicleCategory
|
|
|
- dataMap["vehicle_type_detail"] = v.Get("vehicleName").String()
|
|
|
- dataMap["emission_standard"] = v.Get("emissionStandard").String()
|
|
|
- dataMap["displacement"] = v.Get("displacement").String()
|
|
|
- dataMap["rated_power"] = v.Get("power").String()
|
|
|
- dataMap["engine_type"] = v.Get("engineType").String()
|
|
|
- dataMap["fuel_type_detail"] = v.Get("fuelType").String()
|
|
|
- // enterpriseName
|
|
|
- dataMap["engine_no"] = v.Get("fdjh").String()
|
|
|
- dataMap["vehicle_body_color_detail"] = v.Get("bodyColor").String()
|
|
|
- dataMap["steering_mode"] = v.Get("steeringMode").String()
|
|
|
- dataMap["is_moto"] = "1"
|
|
|
- ret = append(ret, dataMap)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
if len(ret) == 0 {
|
|
|
l.Error("func",
|
|
|
zap.String("call", "ParasOds5"),
|
|
@@ -260,14 +71,15 @@ func HandleOnlineOds5(msg *apis.OdsMessage) (dataMapList []map[string]string, er
|
|
|
|
|
|
// 入本地库
|
|
|
ods5 := &model.Ods5{}
|
|
|
- ods5.Vin = dataMapList[0]["vin"]
|
|
|
+ ods5.DegreeId = dataMapList[0]["degree_id"]
|
|
|
+ ods5.Name = dataMapList[0]["name"]
|
|
|
ods5.Content = msg.Content
|
|
|
err = ods5.Insert(clinit.DB())
|
|
|
if err != nil {
|
|
|
if !strings.Contains(err.Error(), "Duplicate") {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
- where := map[string]interface{}{"vin": ods5.Vin}
|
|
|
+ where := map[string]interface{}{"degree_id": ods5.DegreeId,"name":ods5.Name}
|
|
|
oldOds5 := &model.Ods5{}
|
|
|
err = oldOds5.Query(clinit.DB(), where)
|
|
|
if err == nil {
|
|
@@ -280,11 +92,5 @@ func HandleOnlineOds5(msg *apis.OdsMessage) (dataMapList []map[string]string, er
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*for _, dataMap := range dataMapList {
|
|
|
- dwsMsg := dutils.NewDwsMessage(msg)
|
|
|
- dwsMsg.Content = utils.MarshalJsonString(dataMap)
|
|
|
- ret = append(ret, dwsMsg)
|
|
|
- }*/
|
|
|
-
|
|
|
return dataMapList, nil
|
|
|
}
|