Parcourir la source

各种处理...

zhengkun il y a 1 an
Parent
commit
417859d50d

+ 0 - 14
fieldproject_medical/data_service/src/bidding/bidding.go

@@ -102,20 +102,6 @@ func createBaseInfo(tmp map[string]interface{}, infoid string) bool {
 		insertIndustryTag(industry_code, infoid)
 	}
 
-	//临时处理
-	//isField, new_plist := createNewPurchasingInfo(p_list, infoid)
-	//if isField { //最终根据是否为领域数据灌入数据
-	//	//标的物基本信息~记录标签
-	//	insertBaseInfo(new_plist, infoid, bid_topsubtype_code)
-	//	//招标信息领域标签
-	//	insertFiledTag(infoid)
-	//	//招标信息行业标签
-	//	insertIndustryTag(industry_code, infoid)
-	//}
-
-	//阻止注释~报错
-	//if bid_topsubtype_code == "" || industry_code == "" || len(new_plist) == 0 {}
-
 	return isField
 }
 

+ 3 - 8
fieldproject_medical/data_service/src/main.go

@@ -2,24 +2,19 @@ package main
 
 import (
 	log "github.com/donnie4w/go-logger/logger"
-	"test"
+	"udp"
 	ul "util"
 )
 
 func init() {
-	//udp.InitUdpMsg()
-	ul.IsLocal = true
+	//ul.IsLocal = true
 	ul.InitClass()
+	udp.InitUdpMsg()
 	log.Debug("~~~~准备完毕~~~~")
 }
 
 func main() {
 	log.Debug("main ...")
-	Test()
 	lock := make(chan bool)
 	<-lock
 }
-
-func Test() {
-	test.StartDealWithProBrandInfo()
-}

+ 0 - 22
fieldproject_medical/data_service/src/service/service.go

@@ -1,22 +0,0 @@
-package service
-
-import (
-	"bidding"
-	"encoding/json"
-	"net/http"
-	"sync"
-)
-
-var datalock sync.Mutex
-
-func InitService() {
-
-	http.HandleFunc("/getbid/fieldtags", func(w http.ResponseWriter, r *http.Request) {
-		gtid := r.FormValue("gtid")
-		lteid := r.FormValue("lteid")
-		bidding.RunPurchasingInfo(gtid, lteid, true)
-		res, _ := json.Marshal("ok")
-		w.Write(res)
-	})
-
-}

+ 25 - 9
fieldproject_medical/data_service/src/udp/udp.go

@@ -21,7 +21,6 @@ func InitUdpMsg() {
 	udpclient.Listen(processUdpMsg)
 	log.Debug("监听~", port)
 }
-
 func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 	switch act {
 	case mu.OP_TYPE_DATA:
@@ -31,6 +30,13 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 			udpclient.WriteUdp([]byte("err:"+err.Error()), mu.OP_NOOP, ra)
 		} else if mapInfo != nil {
 			sid, eid := qu.ObjToString(mapInfo["gtid"]), qu.ObjToString(mapInfo["lteid"])
+			stype := qu.ObjToString(mapInfo["stype"])
+			if stype == "monitor" {
+				log.Debug("收到监测......")
+				key := qu.ObjToString(mapInfo["key"])
+				udpclient.WriteUdp([]byte(key), mu.OP_NOOP, ra)
+				return
+			}
 			if sid == "" || eid == "" {
 				log.Debug("异常~", sid, "~", eid)
 			} else {
@@ -44,22 +50,32 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 			}
 		}
 	case mu.OP_NOOP: //下个节点回应
-		ok := string(data)
-		if ok != "" {
-			log.Debug("接收~", ok)
-		}
+		log.Debug("接收~", string(data))
 	}
 }
 
 func processNextNode(sid string, eid string, key string) {
+
+	nextNode := []map[string]interface{}{}
+	//医疗标讯数据合并
+	nextNode = append(nextNode, map[string]interface{}{"ip": "172.17.4.202", "port": 1582})
+	//经销商标讯信息产品-增量
+	nextNode = append(nextNode, map[string]interface{}{"ip": "172.17.4.189", "port": 1583})
+	//es标记处理
+	nextNode = append(nextNode, map[string]interface{}{"ip": "172.17.4.189", "port": 1585})
+
 	by, _ := json.Marshal(map[string]interface{}{
 		"gtid":  sid,
 		"lteid": eid,
 		"key":   key,
 	})
-	addr := &net.UDPAddr{
-		IP:   net.ParseIP("172.17.4.189"),
-		Port: 1582,
+	for _, v := range nextNode {
+		ip := qu.ObjToString(v["ip"])
+		port := qu.IntAll(v["port"])
+		addr := &net.UDPAddr{
+			IP:   net.ParseIP(ip),
+			Port: port,
+		}
+		udpclient.WriteUdp(by, mu.OP_TYPE_DATA, addr)
 	}
-	udpclient.WriteUdp(by, mu.OP_TYPE_DATA, addr)
 }

+ 4 - 4
fieldproject_medical/data_service/src/util/initcfg.go

@@ -48,7 +48,7 @@ func InitClass() {
 	initVCode()
 }
 
-//初始化mgo
+// 初始化mgo
 func initMgo() {
 	if IsLocal {
 		Mgo = &MongodbSim{
@@ -61,7 +61,7 @@ func initMgo() {
 		Mgo.InitPool()
 	} else {
 		Mgo = &MongodbSim{
-			MongodbAddr: "172.17.145.163:27083,172.17.4.187:27082",
+			MongodbAddr: "172.17.189.140:27080,172.17.189.141:27081",
 			DbName:      "qfw",
 			Size:        10,
 			UserName:    "zhengkun",
@@ -105,7 +105,7 @@ func initMysql() {
 
 }
 
-//加载代码表~
+// 加载代码表~
 func initVCode() {
 	initBidInfoClass()     //招标信息分类
 	initBidIndustryClass() //行业分类
@@ -114,7 +114,7 @@ func initVCode() {
 	initMedicalProduct()    //分类产品
 }
 
-//插入数据
+// 插入数据
 func InsertMedicalMysqlData(name string, data map[string]interface{}, mark string) int64 {
 	inb := MysqlMedicalTool.Insert(name, data)
 	if inb == -1 {

+ 8 - 31
fieldproject_medical/data_subject/src/main.go

@@ -3,50 +3,27 @@ package main
 import (
 	"database/sql"
 	"fmt"
-	"log"
+	log "github.com/donnie4w/go-logger/logger"
 	qu "qfw/util"
 	"subject"
+	"subject_udp"
 	su "subject_util"
 )
 
 func init() {
 	//su.IsLocal = true
+	//su.IsDev = true
 	su.InitClass()
-	//subject_udp.InitUdpMsg()
+	subject_udp.InitUdpMsg()
+	log.Debug("~~~~准备完毕~~~~")
 }
 
 func main() {
-	//全量数据准备
-	//subject.RunSubjectFullDataInfo("5a4af64340d2d9bbe8b0859d")
-	//subject_heal.HealSubjectInfoData()
-	//subject_sql.ExportSqlInfoData()
-	//修复数据
-	//subject_repair.RunRepairFullDataInfo("632892000000000000000000")
-	//增量~更新数据
-	//subject.RunSubjectAddDataInfo("632892000000000000000000", "63346f800000000000000000")
-
-	//修复全量业主单位数据
-	//subject_repair.RunRepairFullOwnerContactInfo("63e06e5b779467cff153ad3b")
-
+	log.Debug("main ...")
 	lock := make(chan bool)
 	<-lock
 }
 
-//以下调试方法~~~
-func test() {
-	aaa := qu.IntAll(subject.Str2DEC("0100"))
-	log.Println(aaa)
-
-	bbb := subject.ConvertToBin(9)
-	log.Println(bbb)
-
-	ccc := subject.SupplementIdentityType(bbb)
-	log.Println(ccc)
-
-	eee := subject.CalculateIdentityType("0010", "1000")
-	log.Println(eee)
-
-}
 func exportdata() {
 	dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s", "root", "=PDT49#80Z!RVv52_z", "192.168.3.217", 4000, "global_common_data")
 	if !su.IsLocal {
@@ -84,7 +61,7 @@ func exportdata() {
 							"company_id": new_c_id,
 						})
 						if isup%100 == 0 {
-							log.Println(id, "~", new_c_id)
+							log.Debug(id, "~", new_c_id)
 						}
 					}
 				} else {
@@ -99,7 +76,7 @@ func exportdata() {
 			break
 		}
 		if num%10000 == 0 { //加载5000W
-			log.Println("cur index ~ ", num, "~", isok, "~", isup)
+			log.Debug("cur index ~ ", num, "~", isok, "~", isup)
 		}
 	}
 	db.Close()

+ 52 - 7
fieldproject_medical/data_subject/src/subject/method.go

@@ -2,14 +2,22 @@ package subject
 
 import (
 	"fmt"
+	"math/rand"
 	"runtime"
 	"strconv"
 	"strings"
 	su "subject_util"
+	"sync"
+	"time"
 	"unicode/utf8"
 )
 
-//转二进制
+// 刷存量使用
+var SeoSId = "1000000000"
+var SeoUnique = map[string]string{}
+var SeoLock sync.Mutex
+
+// 转二进制
 func Str2DEC(s string) (num int) {
 	l := len(s)
 	for i := l - 1; i >= 0; i-- {
@@ -18,7 +26,6 @@ func Str2DEC(s string) (num int) {
 	return
 }
 
-//
 func ConvertToBin(num int) string {
 	s := ""
 	if num == 0 {
@@ -31,7 +38,7 @@ func ConvertToBin(num int) string {
 	return s
 }
 
-//补充身份类型字符串~
+// 补充身份类型字符串~
 func SupplementIdentityType(identity string) string {
 	new_str := identity
 	l := utf8.RuneCountInString(identity)
@@ -44,7 +51,7 @@ func SupplementIdentityType(identity string) string {
 	return new_str
 }
 
-//计算身份类型
+// 计算身份类型
 func CalculateIdentityType(identity string, new_identity string) string {
 	a := identity[:1]
 	b := identity[1:2]
@@ -64,7 +71,7 @@ func CalculateIdentityType(identity string, new_identity string) string {
 	return a + b + c + d
 }
 
-//计算身份类型
+// 计算身份类型
 func CreateIdentityBool(buyer bool, agency bool, winner bool) string {
 	new_identity := ""
 	if agency {
@@ -85,7 +92,7 @@ func CreateIdentityBool(buyer bool, agency bool, winner bool) string {
 	return new_identity
 }
 
-//处理地域代码
+// 处理地域代码
 func CalculateRegionCode(area string, city string, district string) (area_code string, city_code string, district_code string) {
 	area_code, city_code, district_code = "000000", "", ""
 	if district != "" {
@@ -118,7 +125,7 @@ func CalculateRegionCode(area string, city string, district string) (area_code s
 	return
 }
 
-//单位分割~去重
+// 单位分割~去重
 func SegmentationEntName(name_1 string, name_2 string) ([]string, []bool) {
 	new_arr := []string{}
 	new_bool := []bool{}
@@ -177,3 +184,41 @@ func traceMemStats() {
 	}
 	fmt.Printf("\n")
 }
+
+// 获取 随机自然数 sting
+func GetRandomSeoId(isAdd bool) string {
+	SeoLock.Lock()
+	s := ""
+	for {
+		num := rand.Int63n(100000)
+		if num > 0 {
+			s = FillBeforeSting(num, 6)
+			if isAdd {
+				time.Now().Unix()
+				s = fmt.Sprintf("%d", time.Now().Unix()) + s
+			} else {
+				s = SeoSId + s
+			}
+			if SeoUnique[s] == "" {
+				SeoUnique[s] = s
+				break
+			}
+
+		}
+	}
+	SeoLock.Unlock()
+	return s
+}
+
+// 前置补0
+func FillBeforeSting(n int64, l int) string {
+	s := fmt.Sprintf("%d", n)
+	if len(s) < l {
+		fill := ""
+		for i := 0; i < l-len(s); i++ {
+			fill = fill + "0"
+		}
+		s = fill + s
+	}
+	return s
+}

+ 53 - 31
fieldproject_medical/data_subject/src/subject/subject_add.go

@@ -16,9 +16,10 @@ var (
 	updateLock sync.Mutex
 )
 
-//正产增量主体数据服务
+// 正产增量主体数据服务
 func RunSubjectAddDataInfo(gtid string, lteid string) {
 	log.Debug("增量~~~")
+	SeoUnique = map[string]string{}
 	sess := su.SourceMgo.GetMgoConn()
 	defer su.SourceMgo.DestoryMongoConn(sess)
 	q := map[string]interface{}{
@@ -96,7 +97,6 @@ func dealWithAddSubjectInfo(tmp map[string]interface{}) {
 	if buyer != "" && utf8.RuneCountInString(buyer) < 30 {
 		dealWithUpdateContact(buyer, buyerclass, &Contact{b_per, b_tel, true, false, false, false, publishtime}, "0001", tmpid)
 	}
-
 	//中标单位
 	for k, v := range winner_arr {
 		b := winner_bool[k]
@@ -123,6 +123,10 @@ func dealWithUpdateContact(name string, buyerclass string, contact *Contact, ide
 	info := su.MysqlGlobalTool.FindOne(su.G_Units_Baseinfo, map[string]interface{}{"name": name}, "", "-id")
 	isNewEnt := false
 	isNewEntInfo := map[string]interface{}{}
+	isLast := false //是否需要更新lastime
+	if identity == "0010" || identity == "0001" {
+		isLast = true
+	}
 	if info == nil {
 	} else { //判断企业库最新的company_id是否与当前保持一致
 		qyxy_info := CreateQyxyInfo(name)
@@ -149,6 +153,9 @@ func dealWithUpdateContact(name string, buyerclass string, contact *Contact, ide
 		base_info["name_id"] = name_id
 		base_info["identity_type"] = qu.IntAll(Str2DEC(identity))
 		base_info["createtime"] = time.Unix(time.Now().Unix(), 0).Format(ul.TimeLayout)
+		if isLast && contact.Publishtime > 0 {
+			base_info["latest_time"] = time.Unix(contact.Publishtime, 0).Format(ul.TimeLayout)
+		}
 		//创建通讯录信息 调整仅有联系电话即可
 		if contact.Tel != "" {
 			date := ""
@@ -181,6 +188,7 @@ func dealWithUpdateContact(name string, buyerclass string, contact *Contact, ide
 			}
 		}
 		base_info["area_code"], base_info["city_code"], base_info["district_code"] = CalculateRegionCode(area, city, district)
+		base_info["seo_id"] = GetRandomSeoId(true)
 		//新增主体信息表
 		b := su.InsertMysqlData(su.G_Units_Baseinfo, base_info, tmpid)
 		if b > 0 { //存通讯录
@@ -225,14 +233,25 @@ func dealWithUpdateContact(name string, buyerclass string, contact *Contact, ide
 	update_info := map[string]interface{}{}
 	info_identity := ConvertToBin(Str2DEC(qu.ObjToString((*info)["identity_type"])))
 	info_identity = SupplementIdentityType(info_identity)
+	p_l_time := int64(0)
+	p_l_time_str := qu.ObjToString((*info)["latest_time"])
+	if p_l_time_str != "" {
+		t, _ := time.ParseInLocation(su.TimeLayout, p_l_time_str, time.Local)
+		p_l_time = t.Unix()
+	}
 	if info_identity != identity {
 		new_identity := CalculateIdentityType(info_identity, identity)
 		if new_identity != info_identity {
 			update_info["identity_type"] = qu.IntAll(Str2DEC(new_identity))
-			update_info["updatetime"] = time.Unix(time.Now().Unix(), 0).Format(ul.TimeLayout)
-			su.MysqlGlobalTool.Update(su.G_Units_Baseinfo, map[string]interface{}{"name_id": name_id}, update_info)
 		}
 	}
+	if isLast && contact.Publishtime > p_l_time {
+		update_info["latest_time"] = time.Unix(contact.Publishtime, 0).Format(ul.TimeLayout)
+	}
+	if len(update_info) > 0 {
+		update_info["updatetime"] = time.Unix(time.Now().Unix(), 0).Format(ul.TimeLayout)
+		su.MysqlGlobalTool.Update(su.G_Units_Baseinfo, map[string]interface{}{"name_id": name_id}, update_info)
+	}
 	//更新~主体标签记录表
 	if buyerclass != "" && contact.Buyer {
 		info_tag := su.MysqlGlobalTool.FindOne(su.G_Units_Tags, map[string]interface{}{"name_id": name_id}, "", "")
@@ -253,35 +272,38 @@ func dealWithUpdateContact(name string, buyerclass string, contact *Contact, ide
 	if contact.Tel != "" {
 		contact_datas := su.MysqlGlobalTool.Find(su.G_Units_Contact, map[string]interface{}{"name_id": name_id}, "", "", -1, -1)
 		isExists := false
-		for _, v := range *contact_datas {
-			update_id := qu.IntAll(v["id"])
-			person := qu.ObjToString(v["contact_name"])
-			tel := qu.ObjToString(v["contact_tel"])
-			pt_str := qu.ObjToString(v["publishtime"])
-			pt := int64(0)
-			if pt_str != "" {
-				t, _ := time.ParseInLocation(su.TimeLayout, pt_str, time.Local)
-				pt = t.Unix()
-			}
-			if person+"~"+tel == contact.Per+"~"+contact.Tel {
-				isExists = true
-				old_contact_identity := ConvertToBin(Str2DEC(qu.ObjToString(v["identity_type"])))
-				old_contact_identity = SupplementIdentityType(old_contact_identity)
-				if old_contact_identity != identity || qu.IntAll(v["source_type"]) == 2 || (contact.Publishtime > pt && contact.Publishtime > 0) {
-					new_identity := CalculateIdentityType(old_contact_identity, identity)
-					update_contact := map[string]interface{}{}
-					update_contact["source_type"] = 1
-					update_contact["identity_type"] = qu.IntAll(Str2DEC(new_identity))
-					update_contact["updatetime"] = time.Unix(time.Now().Unix(), 0).Format(ul.TimeLayout)
-					if contact.Publishtime > pt {
-						update_contact["publishtime"] = time.Unix(contact.Publishtime, 0).Format(ul.TimeLayout)
+		if contact_datas != nil {
+			for _, v := range *contact_datas {
+				update_id := qu.IntAll(v["id"])
+				person := qu.ObjToString(v["contact_name"])
+				tel := qu.ObjToString(v["contact_tel"])
+				pt_str := qu.ObjToString(v["publishtime"])
+				pt := int64(0)
+				if pt_str != "" {
+					t, _ := time.ParseInLocation(su.TimeLayout, pt_str, time.Local)
+					pt = t.Unix()
+				}
+				if person+"~"+tel == contact.Per+"~"+contact.Tel {
+					isExists = true
+					old_contact_identity := ConvertToBin(Str2DEC(qu.ObjToString(v["identity_type"])))
+					old_contact_identity = SupplementIdentityType(old_contact_identity)
+					if old_contact_identity != identity || qu.IntAll(v["source_type"]) == 2 || (contact.Publishtime > pt && contact.Publishtime > 0) {
+						new_identity := CalculateIdentityType(old_contact_identity, identity)
+						update_contact := map[string]interface{}{}
+						update_contact["source_type"] = 1
+						update_contact["identity_type"] = qu.IntAll(Str2DEC(new_identity))
+						update_contact["updatetime"] = time.Unix(time.Now().Unix(), 0).Format(ul.TimeLayout)
+						if contact.Publishtime > pt {
+							update_contact["publishtime"] = time.Unix(contact.Publishtime, 0).Format(ul.TimeLayout)
+						}
+						//更新通讯录
+						su.MysqlGlobalTool.Update(su.G_Units_Contact, map[string]interface{}{"id": update_id}, update_contact)
 					}
-					//更新通讯录
-					su.MysqlGlobalTool.Update(su.G_Units_Contact, map[string]interface{}{"id": update_id}, update_contact)
+					break
 				}
-				break
 			}
 		}
+
 		if !isExists {
 			add_contact := map[string]interface{}{}
 			add_contact["name_id"] = name_id
@@ -301,7 +323,7 @@ func dealWithUpdateContact(name string, buyerclass string, contact *Contact, ide
 
 }
 
-//创建年报字段~与现有的通讯录
+// 创建年报字段~与现有的通讯录
 func CreateAnnualInfo(company_id string, legal_person string, contact_arr *[]map[string]interface{}) {
 	keys := map[string]string{}
 	for _, v := range *contact_arr {
@@ -335,7 +357,7 @@ func CreateAnnualInfo(company_id string, legal_person string, contact_arr *[]map
 	}
 }
 
-//创建企业信息
+// 创建企业信息
 func CreateQyxyInfo(name string) map[string]interface{} {
 	//查询企业库
 	qyxy_info := map[string]interface{}{}

+ 44 - 0
fieldproject_medical/data_subject/src/subject_test/test.go

@@ -0,0 +1,44 @@
+package subject_test
+
+import (
+	"fmt"
+	log "github.com/donnie4w/go-logger/logger"
+	qu "qfw/util"
+	"subject"
+	su "subject_util"
+)
+
+func TestSeoIdFullInfo() {
+	log.Debug("存量随机数...")
+	index, total := 0, 0
+L:
+	for {
+		dataArr := su.MysqlGlobalTool.Find("dws_f_ent_baseinfo", nil, "id", "id", index*10000, 10000)
+		if dataArr != nil {
+			if len(*dataArr) == 0 {
+				break
+			}
+			for _, v := range *dataArr {
+				id := qu.IntAll(v["id"])
+				if id >= 8998661 {
+					break L
+				}
+				seoid := subject.GetRandomSeoId(false)
+				if seoid != "" && id > 0 {
+					//更新id
+					su.MysqlGlobalTool.Update("dws_f_ent_baseinfo", map[string]interface{}{"id": id}, map[string]interface{}{"seo_id": seoid})
+				}
+			}
+		} else {
+			break L
+		}
+		index++
+		total += len(*dataArr)
+		subject.SeoUnique = map[string]string{}
+		subject.SeoSId = fmt.Sprintf("%d", qu.IntAll(subject.SeoSId)+135790)
+		if total%10000 == 0 {
+			log.Debug("cur index ", index, "~", total)
+		}
+	}
+	log.Debug("is over ", total)
+}

+ 29 - 3
fieldproject_medical/data_subject/src/subject_udp/udp.go

@@ -31,6 +31,13 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 			udpclient.WriteUdp([]byte("err:"+err.Error()), mu.OP_NOOP, ra)
 		} else if mapInfo != nil {
 			sid, eid := qu.ObjToString(mapInfo["gtid"]), qu.ObjToString(mapInfo["lteid"])
+			stype := qu.ObjToString(mapInfo["stype"])
+			if stype == "monitor" {
+				log.Debug("收到监测......")
+				key := qu.ObjToString(mapInfo["key"])
+				udpclient.WriteUdp([]byte(key), mu.OP_NOOP, ra)
+				return
+			}
 			if sid == "" || eid == "" {
 				log.Debug("异常~", sid, "~", eid)
 			} else {
@@ -39,12 +46,31 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 				udpLock.Lock()
 				subject.RunSubjectAddDataInfo(sid, eid)
 				udpLock.Unlock()
+				//下一节点发消息
+				processNextNode(sid, eid, key)
 			}
 		}
 	case mu.OP_NOOP: //下个节点回应
-		ok := string(data)
-		if ok != "" {
-			log.Debug("接收~", ok)
+		log.Debug("接收~", string(data))
+	}
+}
+
+func processNextNode(sid string, eid string, key string) {
+	nextNode := []map[string]interface{}{}
+	//领域标签
+	nextNode = append(nextNode, map[string]interface{}{"ip": "172.17.4.189", "port": 1581})
+	by, _ := json.Marshal(map[string]interface{}{
+		"gtid":  sid,
+		"lteid": eid,
+		"key":   key,
+	})
+	for _, v := range nextNode {
+		ip := qu.ObjToString(v["ip"])
+		port := qu.IntAll(v["port"])
+		addr := &net.UDPAddr{
+			IP:   net.ParseIP(ip),
+			Port: port,
 		}
+		udpclient.WriteUdp(by, mu.OP_TYPE_DATA, addr)
 	}
 }

+ 15 - 13
fieldproject_medical/data_subject/src/subject_util/initcfg.go

@@ -11,7 +11,7 @@ var (
 	MysqlGlobalTool            *Mysql
 	BuyerClassData             = map[string]string{}
 	RegionCodeData             = map[string]string{}
-	IsLocal                    bool
+	IsLocal, IsDev             bool
 )
 
 const (
@@ -29,11 +29,11 @@ func InitClass() {
 	initVCode()
 }
 
-//初始化mgo
+// 初始化mgo
 func initMgo() {
 	if IsLocal {
 		SourceMgo = &MongodbSim{
-			MongodbAddr: "192.168.3.207:27092",
+			MongodbAddr: "127.0.0.1:27017",
 			DbName:      "zhengkun",
 			Size:        10,
 			UserName:    "",
@@ -42,7 +42,7 @@ func initMgo() {
 		SourceMgo.InitPool()
 
 		QyxyMgo = &MongodbSim{
-			MongodbAddr: "192.168.3.207:27092",
+			MongodbAddr: "127.0.0.1:27017",
 			DbName:      "zhengkun",
 			Size:        10,
 			UserName:    "",
@@ -51,7 +51,7 @@ func initMgo() {
 		QyxyMgo.InitPool()
 
 		SpiMgo = &MongodbSim{
-			MongodbAddr: "192.168.3.207:27092",
+			MongodbAddr: "127.0.0.1:27017",
 			DbName:      "zhengkun",
 			Size:        10,
 			UserName:    "",
@@ -60,7 +60,7 @@ func initMgo() {
 		SpiMgo.InitPool()
 	} else {
 		SourceMgo = &MongodbSim{
-			MongodbAddr: "172.17.145.163:27083,172.17.4.187:27082",
+			MongodbAddr: "172.17.189.140:27080,172.17.189.141:27081",
 			DbName:      "qfw",
 			Size:        10,
 			UserName:    "zhengkun",
@@ -69,7 +69,7 @@ func initMgo() {
 		SourceMgo.InitPool()
 
 		QyxyMgo = &MongodbSim{
-			MongodbAddr: "172.17.145.163:27083,172.17.4.187:27082",
+			MongodbAddr: "172.17.189.140:27080,172.17.189.141:27081",
 			DbName:      "mixdata",
 			Size:        10,
 			UserName:    "zhengkun",
@@ -89,13 +89,15 @@ func initMgo() {
 }
 
 func initMysql() {
-	username, password := "root", "=PDT49#80Z!RVv52_z"
-	address := "192.168.3.217:4000"
+	username, password := "zhengkun", "Zk#20220824"
+	address := "127.0.0.1:15001"
 	if !IsLocal {
-		username = "zhengkun"
-		password = "Zk#20220824"
 		address = "172.17.4.242:4000"
 	}
+	if IsDev {
+		username, password = "root", "=PDT49#80Z!RVv52_z"
+		address = "192.168.3.217:4000"
+	}
 	MysqlGlobalTool = &Mysql{
 		Address:  address,
 		UserName: username,
@@ -105,7 +107,7 @@ func initMysql() {
 	MysqlGlobalTool.Init()
 }
 
-//加载代码表
+// 加载代码表
 func initVCode() {
 	data_types := MysqlGlobalTool.Find("code_buyerclass", nil, "", "", -1, -1)
 	//先构建所有一级数据
@@ -130,7 +132,7 @@ func initVCode() {
 	log.Debug("地域信息数量~", len(RegionCodeData))
 }
 
-//插入数据
+// 插入数据
 func InsertMysqlData(name string, data map[string]interface{}, mark string) int64 {
 	inb := MysqlGlobalTool.Insert(name, data)
 	if inb == -1 {