|
@@ -4,68 +4,66 @@
|
|
package analysis
|
|
package analysis
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "fmt"
|
|
"gadm-ods/apis"
|
|
"gadm-ods/apis"
|
|
"gadm-ods/common.in/clinit"
|
|
"gadm-ods/common.in/clinit"
|
|
- "gadm-ods/consts"
|
|
|
|
"gadm-ods/model"
|
|
"gadm-ods/model"
|
|
- "fmt"
|
|
|
|
"github.com/tidwall/gjson"
|
|
"github.com/tidwall/gjson"
|
|
|
|
+ "go.uber.org/zap"
|
|
"strings"
|
|
"strings"
|
|
)
|
|
)
|
|
|
|
|
|
-// spy 过户车记录查询128-010
|
|
|
|
|
|
+// dybd 学历(DYXL = "104-003")
|
|
func ParasOds7(content string) (ret []map[string]string, err error) {
|
|
func ParasOds7(content string) (ret []map[string]string, err error) {
|
|
data := gjson.Parse(content)
|
|
data := gjson.Parse(content)
|
|
requestParams := data.Get("request_params").String()
|
|
requestParams := data.Get("request_params").String()
|
|
responseParams := data.Get("response_params").String()
|
|
responseParams := data.Get("response_params").String()
|
|
- vin := gjson.Get(requestParams, "vin").String()
|
|
|
|
|
|
+ idCard := gjson.Get(requestParams, "cardNo").String()
|
|
|
|
+ name := gjson.Get(requestParams, "name").String()
|
|
|
|
|
|
- if vin == "" {
|
|
|
|
- return nil, fmt.Errorf("数据异常,车牌姓名不匹配")
|
|
|
|
|
|
+ if idCard == "" || 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("数据异常,没有数据")
|
|
return nil, fmt.Errorf("数据异常,没有数据")
|
|
}
|
|
}
|
|
- lastTransTime := int64(0)
|
|
|
|
- lastPlate := ""
|
|
|
|
|
|
|
|
- respData := gjson.Get(responseParams, "data").Array()
|
|
|
|
- for _, v := range respData {
|
|
|
|
- dataMap := make(map[string]string)
|
|
|
|
- //record.TransferNumber = v.Get("transTime").Int()
|
|
|
|
- //record.TransferAge = v.Get("carYear").String()
|
|
|
|
- //record.NewPlateNo = v.Get("newCp").String()
|
|
|
|
- transTime := v.Get("transTime").Int()
|
|
|
|
- dataMap["vin"] = vin
|
|
|
|
- dataMap["plate_no"] = v.Get("oldCp").String()
|
|
|
|
- if transTime > lastTransTime {
|
|
|
|
- lastPlate = v.Get("newCp").String()
|
|
|
|
- lastTransTime = transTime
|
|
|
|
- }
|
|
|
|
- insuranceDate := v.Get("changeMonth").String()
|
|
|
|
- if len(insuranceDate) >= 6 {
|
|
|
|
- insuranceDate = insuranceDate[0:4] + "-" + insuranceDate[4:]
|
|
|
|
- }
|
|
|
|
|
|
+ arr := gjson.Get(responseParams, "data").Array()
|
|
|
|
|
|
- dataMap["insurance_date"] = insuranceDate
|
|
|
|
- dataMap["is_expire"] = consts.EXPIREDATA
|
|
|
|
|
|
|
|
- //record.TransferDate = v.Get("changeMonth").String()
|
|
|
|
- //record.TransferAgeMonth = v.Get("carMonth").String()
|
|
|
|
- ret = append(ret, dataMap)
|
|
|
|
|
|
+ for _, v := range arr {
|
|
|
|
+ respMap := make(map[string]string)
|
|
|
|
+ respMap["name"] = name
|
|
|
|
+ respMap["is_double_first_class_university"] = v.Get("isDoubleFirstClassUniversity").String() // 是否为双一流学校
|
|
|
|
+ respMap["is_two_one_one_university"] = v.Get("isTwoOneOneUniversity").String() // 是否为211学校
|
|
|
|
+ respMap["end_date"] = v.Get("endDate").String() // 毕业日期
|
|
|
|
+ respMap["type_name"] = v.Get("typeName").String() // 研究类型
|
|
|
|
+ respMap["edu_code"] = v.Get("eduCode").String() // 学校代码
|
|
|
|
+ respMap["qualification_code"] = v.Get( "qualificationCode").String() // 教育类别代码
|
|
|
|
+ respMap["major_category"] = v.Get( "majorCategory").String() // 专业名称
|
|
|
|
+ respMap["edu_name"] = v.Get( "eduName").String() // 学校名
|
|
|
|
+ respMap["qualification_name"] = v.Get( "qualificationName").String() // 教育类别
|
|
|
|
+ respMap["type_code"] = v.Get( "typeCode").String() // 研究类型代码
|
|
|
|
+ respMap["secondary_category"] = v.Get( "secondaryCategory").String() // 二级学科名称
|
|
|
|
+ respMap["begin_date"] = v.Get( "beginDate").String() // 注册日期
|
|
|
|
+ respMap["major_code"] = v.Get( "majorCode").String() // 专业代码
|
|
|
|
+ respMap["is_nine_eight_five_university"] = v.Get( "isNineEightFiveUniversity").String() // 是否为985学校
|
|
|
|
+ respMap["id_card"] = idCard
|
|
|
|
+ ret = append(ret, respMap)
|
|
}
|
|
}
|
|
|
|
|
|
- if lastPlate != "" {
|
|
|
|
- dataMap := make(map[string]string)
|
|
|
|
- dataMap["vin"] = vin
|
|
|
|
- dataMap["plate_no"] = lastPlate
|
|
|
|
- dataMap["is_expire"] = consts.NORMALDATA
|
|
|
|
- ret = append(ret, dataMap)
|
|
|
|
|
|
+ if len(ret) == 0 {
|
|
|
|
+ l.Error("func",
|
|
|
|
+ zap.String("call", "ParasOds7"),
|
|
|
|
+ zap.String("args", content),
|
|
|
|
+ zap.String("error", "数据异常,无法解析"))
|
|
|
|
+ return nil, fmt.Errorf("数据异常")
|
|
|
|
+ } else {
|
|
|
|
+ return ret, nil
|
|
}
|
|
}
|
|
|
|
|
|
- return ret, nil
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func HandleOnlineOds7(msg *apis.OdsMessage) (dataMapList []map[string]string, err error) {
|
|
func HandleOnlineOds7(msg *apis.OdsMessage) (dataMapList []map[string]string, err error) {
|
|
@@ -78,16 +76,18 @@ func HandleOnlineOds7(msg *apis.OdsMessage) (dataMapList []map[string]string, er
|
|
if len(dataMapList) == 0 {
|
|
if len(dataMapList) == 0 {
|
|
return nil, nil
|
|
return nil, nil
|
|
}
|
|
}
|
|
|
|
+
|
|
// 入本地库
|
|
// 入本地库
|
|
ods7 := &model.Ods7{}
|
|
ods7 := &model.Ods7{}
|
|
- ods7.Vin = dataMapList[0]["vin"]
|
|
|
|
|
|
+ ods7.IdCard = dataMapList[0]["id_card"]
|
|
|
|
+ ods7.Name = dataMapList[0]["name"]
|
|
ods7.Content = msg.Content
|
|
ods7.Content = msg.Content
|
|
err = ods7.Insert(clinit.DB())
|
|
err = ods7.Insert(clinit.DB())
|
|
if err != nil {
|
|
if err != nil {
|
|
if !strings.Contains(err.Error(), "Duplicate") {
|
|
if !strings.Contains(err.Error(), "Duplicate") {
|
|
return nil, err
|
|
return nil, err
|
|
} else {
|
|
} else {
|
|
- where := map[string]interface{}{"vin": ods7.Vin}
|
|
|
|
|
|
+ where := map[string]interface{}{"id_card": ods7.IdCard,"name":ods7.Name}
|
|
oldOds7 := &model.Ods7{}
|
|
oldOds7 := &model.Ods7{}
|
|
err = oldOds7.Query(clinit.DB(), where)
|
|
err = oldOds7.Query(clinit.DB(), where)
|
|
if err == nil {
|
|
if err == nil {
|
|
@@ -100,11 +100,5 @@ func HandleOnlineOds7(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
|
|
return dataMapList, nil
|
|
}
|
|
}
|