fuwencai 4 жил өмнө
parent
commit
847380fbae

+ 1 - 0
api/deduplication.api

@@ -31,6 +31,7 @@ type (
 		PersonId  string `form:"personId"`  //人员id
 		InfoId    string `form:"infoId"`    //信息id  逗号分隔
 		AccountId string `form:"accountId"` // 账户id
+		DataDesc  int64  `form:"dataDesc"`  // 字段包规格   1-高级字段包 2-标准字段包
 	}
 )
 

+ 1 - 0
api/internal/logic/dedupandsavelogic.go

@@ -29,6 +29,7 @@ func (l *DedupAndSaveLogic) DedupAndSave(req types.DedupByAccountReq) (*types.De
 		InfoId: req.InfoId,
 		PersonId: req.PersonId,
 		AccountId: req.AccountId,
+		DataDesc: req.DataDesc,
 	})
 	return &types.DedupResp{
 		Code: res.Code,

+ 1 - 0
api/internal/logic/dedupbyacountlogic.go

@@ -29,6 +29,7 @@ func (l *DedupByAcountLogic) DedupByAcount(req types.DedupByAccountReq) (*types.
 		InfoId: req.InfoId,
 		PersonId: req.PersonId,
 		AccountId: req.AccountId,
+		DataDesc: req.DataDesc,
 	})
 	return &types.DedupResp{
 		Code: res.Code,

+ 1 - 0
api/internal/types/types.go

@@ -25,6 +25,7 @@ type DedupByAccountReq struct {
 	PersonId  string `form:"personId"`  //人员id
 	InfoId    string `form:"infoId"`    //信息id  逗号分隔
 	AccountId string `form:"accountId"` // 账户id
+	DataDesc  int64  `form:"dataDesc"`  // 字段包规格   1-高级字段包 2-标准字段包
 }
 
 type EntCountReq struct {

+ 5 - 0
doc/dev1.0.1/变更.txt

@@ -0,0 +1,5 @@
+需要新增账户id字段,数据规格字段  创建索引
+使用程序修改执行sql修改表结构 qc,程序会替换TMPTABLENAME
+ALTER TABLE TMPTABLENAME ADD COLUMN account_id VARCHAR(50);
+ALTER TABLE TMPTABLENAME ADD COLUMN data_desc int(10) COMMENT "数据规格1-高级字段包 2-标准字段包";
+ALTER TABLE TMPTABLENAME ADD INDEX  account_id_desc(`account_id`,`data_desc`,`info_id`);

+ 1 - 0
entity/deduplication.go

@@ -5,4 +5,5 @@ type Deduplication struct {
 	PersonId  string `xorm:"person_id" form:"person_id" json:"person_id"`
 	EntId     string `xorm:"ent_id" form:"ent_id" json:"ent_id"`
 	AccountId string `xorm:"account_id" form:"account_id" json:"account_id"`
+	DataDesc  int64 `xorm:"data_desc" form:"data_desc" json:"data_desc"`
 }

+ 1 - 0
rpc/deduplication.proto

@@ -37,6 +37,7 @@ message ByAccountRequest {
   string personId = 1;     //人员id
   string  infoId = 2;      //信息id  逗号分隔
   string accountId = 3;    // 账户id
+  int64 DataDesc = 4;     // 数据规格 1 -高级字段包 2-标准字段包
 }
 
 service Deduplication {

+ 39 - 29
rpc/deduplication/deduplication.pb.go

@@ -361,6 +361,7 @@ type ByAccountRequest struct {
 	PersonId  string `protobuf:"bytes,1,opt,name=personId,proto3" json:"personId,omitempty"`   //人员id
 	InfoId    string `protobuf:"bytes,2,opt,name=infoId,proto3" json:"infoId,omitempty"`       //信息id  逗号分隔
 	AccountId string `protobuf:"bytes,3,opt,name=accountId,proto3" json:"accountId,omitempty"` // 账户id
+	DataDesc  int64  `protobuf:"varint,4,opt,name=DataDesc,proto3" json:"DataDesc,omitempty"`  // 数据规格 1 -高级字段包 2-标准字段包
 }
 
 func (x *ByAccountRequest) Reset() {
@@ -416,6 +417,13 @@ func (x *ByAccountRequest) GetAccountId() string {
 	return ""
 }
 
+func (x *ByAccountRequest) GetDataDesc() int64 {
+	if x != nil {
+		return x.DataDesc
+	}
+	return 0
+}
+
 var File_deduplication_proto protoreflect.FileDescriptor
 
 var file_deduplication_proto_rawDesc = []byte{
@@ -452,35 +460,37 @@ var file_deduplication_proto_rawDesc = []byte{
 	0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
 	0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
 	0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04,
-	0x64, 0x61, 0x74, 0x61, 0x22, 0x64, 0x0a, 0x10, 0x42, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
-	0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x72, 0x73,
-	0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x72, 0x73,
-	0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x18, 0x02,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09,
-	0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x32, 0xd5, 0x02, 0x0a, 0x0d, 0x44,
-	0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x44, 0x0a, 0x11,
-	0x64, 0x61, 0x74, 0x61, 0x44, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
-	0x6e, 0x12, 0x16, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
-	0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x65, 0x64, 0x75,
-	0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
-	0x73, 0x65, 0x12, 0x54, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e,
-	0x74, 0x12, 0x21, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
-	0x6e, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71,
-	0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61,
-	0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74,
-	0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x18, 0x64, 0x61, 0x74, 0x61,
-	0x44, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x79, 0x41, 0x63, 0x63,
-	0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1f, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61,
-	0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x42, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65,
-	0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63,
-	0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52,
-	0x0a, 0x16, 0x64, 0x61, 0x74, 0x61, 0x44, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74,
-	0x65, 0x41, 0x6e, 0x64, 0x53, 0x61, 0x76, 0x65, 0x12, 0x1f, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70,
-	0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x42, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75,
-	0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x65, 0x64, 0x75,
-	0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
-	0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x64, 0x61, 0x74, 0x61, 0x22, 0x80, 0x01, 0x0a, 0x10, 0x42, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75,
+	0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x72,
+	0x73, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x65, 0x72,
+	0x73, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x18,
+	0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x12, 0x1c, 0x0a,
+	0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x44,
+	0x61, 0x74, 0x61, 0x44, 0x65, 0x73, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x44,
+	0x61, 0x74, 0x61, 0x44, 0x65, 0x73, 0x63, 0x32, 0xd5, 0x02, 0x0a, 0x0d, 0x44, 0x65, 0x64, 0x75,
+	0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x44, 0x0a, 0x11, 0x64, 0x61, 0x74,
+	0x61, 0x44, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16,
+	0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52,
+	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69,
+	0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+	0x54, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21,
+	0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47,
+	0x65, 0x74, 0x45, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+	0x74, 0x1a, 0x22, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
+	0x6e, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73,
+	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x18, 0x64, 0x61, 0x74, 0x61, 0x44, 0x65, 0x64,
+	0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x42, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
+	0x74, 0x12, 0x1f, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
+	0x6e, 0x2e, 0x42, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
+	0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69,
+	0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x16, 0x64,
+	0x61, 0x74, 0x61, 0x44, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x65, 0x41, 0x6e,
+	0x64, 0x53, 0x61, 0x76, 0x65, 0x12, 0x1f, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69, 0x63,
+	0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x42, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52,
+	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x64, 0x65, 0x64, 0x75, 0x70, 0x6c, 0x69,
+	0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62,
+	0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (

+ 5 - 4
service/deduplication.go

@@ -167,7 +167,7 @@ func (service *DeduplicationService) DataDeduplicateByAccountId(data *deduplicat
 	var valueList []interface{}
 	var selectSql string
 	valueList = append(valueList, data.AccountId)
-
+	valueList = append(valueList, data.DataDesc)
 	for _, v := range strings.Split(data.InfoId, ",") {
 		if strings.TrimSpace(v)!=""{
 			tmpList = append(tmpList, "?")
@@ -176,7 +176,7 @@ func (service *DeduplicationService) DataDeduplicateByAccountId(data *deduplicat
 
 	}
 
-	selectSql = fmt.Sprintf("account_id=? and info_id in (%s)", strings.Join(tmpList, ","))
+	selectSql = fmt.Sprintf("account_id=? and data_desc=? and info_id in (%s)", strings.Join(tmpList, ","))
 	infoIdList := strings.Split(data.InfoId, ",")
 	totalInfoCount := len(infoIdList)
 	count, err := orm.Table(tableName).Where(selectSql, valueList...).Count(rs)
@@ -222,7 +222,7 @@ func (service *DeduplicationService) DataDeduplicateAndSave(data *deduplication.
 	var valueList []interface{}
 	var selectSql string
 	valueList = append(valueList, data.AccountId)
-
+	valueList = append(valueList, data.DataDesc)
 	for _, v := range strings.Split(data.InfoId, ",") {
 		if strings.TrimSpace(v)!=""{
 			tmpList = append(tmpList, "?")
@@ -231,7 +231,7 @@ func (service *DeduplicationService) DataDeduplicateAndSave(data *deduplication.
 
 	}
 
-	selectSql = fmt.Sprintf("account_id=? and info_id in (%s)", strings.Join(tmpList, ","))
+	selectSql = fmt.Sprintf("account_id=? and data_desc=? and info_id in (%s)", strings.Join(tmpList, ","))
 	infoIdList := strings.Split(data.InfoId, ",")
 	totalInfoCount := len(infoIdList)
 	err := orm.Table(tableName).Cols("info_id").Where(selectSql, valueList...).Find(&rs)
@@ -266,6 +266,7 @@ func (service *DeduplicationService) DataDeduplicateAndSave(data *deduplication.
 			EntId:    "0",
 			PersonId: data.PersonId,
 			AccountId: data.AccountId,
+			DataDesc: data.DataDesc,
 		}
 		insertList = append(insertList, temData)
 		if len(insertList) > 500 {