浏览代码

批量操作配置项回显

WH01243 1 年之前
父节点
当前提交
5537cb40ca
共有 4 个文件被更改,包括 28 次插入16 次删除
  1. 7 1
      api/application.api
  2. 3 3
      api/internal/logic/employinfologic.go
  3. 11 12
      api/internal/service/employService.go
  4. 7 0
      api/internal/types/types.go

+ 7 - 1
api/application.api

@@ -6,6 +6,12 @@ type (
 		Error_msg  string      `json:"error_msg"`
 		Data       interface{} `json:"data"`
 	}
+	InfoReply {
+		Error_code  int64       `json:"error_code"`
+		Error_msg   string      `json:"error_msg"`
+		Data        interface{} `json:"data"`
+		BatchEmploy int64       `json:"batchEmploy"`
+	}
 
 	ClueAddReq {
 		AppId        string  `header:"appId,default=10000"`
@@ -207,7 +213,7 @@ service crmApplication {
 	post /crmApplication/ignore/operate (IgnoreOperateReq) returns (Reply)
 	@doc "收录情况"
 	@handler employInfo
-	post /crmApplication/employ/info (InfoEmployinfoReq) returns (Reply)
+	post /crmApplication/employ/info (InfoEmployinfoReq) returns (InfoReply)
 	@doc "创建客户"
 	@handler customAdd
 	post /crmApplication/custom/add (CustomAddReq) returns (Reply)

+ 3 - 3
api/internal/logic/employinfologic.go

@@ -24,10 +24,10 @@ func NewEmployInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Employ
 	}
 }
 
-func (l *EmployInfoLogic) EmployInfo(req *types.InfoEmployinfoReq) (resp *types.Reply, err error) {
+func (l *EmployInfoLogic) EmployInfo(req *types.InfoEmployinfoReq) (resp *types.InfoReply, err error) {
 	// todo: add your logic here and delete this line
-	resp = &types.Reply{}
+	resp = &types.InfoReply{}
 	employService := &service.EmPloyService{}
-	resp.Data = employService.InfoEmployinfo(req)
+	resp.Data, resp.BatchEmploy = employService.InfoEmployinfo(req)
 	return
 }

+ 11 - 12
api/internal/service/employService.go

@@ -32,24 +32,25 @@ type PersonSmmary struct {
 }
 
 // InfoEmployinfo 收录情况查询
-func (e *EmPloyService) InfoEmployinfo(in *types.InfoEmployinfoReq) []map[string]interface{} {
+func (e *EmPloyService) InfoEmployinfo(in *types.InfoEmployinfoReq) ([]map[string]interface{}, int64) {
 	var data []map[string]interface{}
 	depIDArr := ""
+	batchEmploy := int64(0)
 	if in.EntNicheDis > 0 {
 		//查询所有部门标识
 		deptArr := MC.MainMysql.SelectBySql("select GROUP_CONCAT(DISTINCT b.id)  as depIDArr from entniche_department_parent a"+
 			"     INNER JOIN entniche_department b "+
 			"on (b.ent_id=? and (b.id=? or (a.pid=? and a.id=b.id)))", in.EntId, in.EntDeptId, in.EntDeptId)
 		if len(*deptArr) == 0 {
-			return data
+			return data, batchEmploy
 		}
 		depIDArr = common.InterfaceToStr((*deptArr)[0]["depIDArr"])
 		if depIDArr == "" {
-			return data
+			return data, batchEmploy
 		}
 	}
 	//是否可以批量收录配置回显
-	batchEmploy := 0
+
 	accountId := int64(0)
 	if in.PositionType == 0 {
 		accountId = in.AccountId
@@ -60,7 +61,7 @@ func (e *EmPloyService) InfoEmployinfo(in *types.InfoEmployinfoReq) []map[string
 		"account_id": accountId,
 	}, "batch_employ", "")
 	if configData != nil {
-		batchEmploy = gconv.Int((*configData)["batch_employ"])
+		batchEmploy = gconv.Int64((*configData)["batch_employ"])
 	}
 	for _, v := range strings.Split(in.IdArr, ",") {
 		id := ""
@@ -71,12 +72,12 @@ func (e *EmPloyService) InfoEmployinfo(in *types.InfoEmployinfoReq) []map[string
 			continue
 		}
 		if in.EntNicheDis > 0 {
-			data = append(data, employInfoEnt(v, table, id, employKey, findKey, depIDArr, source, in, projectId, isNiJian, batchEmploy))
+			data = append(data, employInfoEnt(v, table, id, employKey, findKey, depIDArr, source, in, projectId, isNiJian))
 		} else {
-			data = append(data, employInfoPerson(v, table, id, employKey, findKey, source, in, projectId, isNiJian, batchEmploy))
+			data = append(data, employInfoPerson(v, table, id, employKey, findKey, source, in, projectId, isNiJian))
 		}
 	}
-	return data
+	return data, batchEmploy
 }
 
 // EmployOperate 收录操作
@@ -569,7 +570,7 @@ func niJianHandle(infoId string, data map[string]interface{}, v1, pushTime strin
 }
 
 // 个人收录情况查询
-func employInfoPerson(v, table, id, employKey, findKey string, source int64, in *types.InfoEmployinfoReq, projectId string, isNiJian bool, batchEmploy int) map[string]interface{} {
+func employInfoPerson(v, table, id, employKey, findKey string, source int64, in *types.InfoEmployinfoReq, projectId string, isNiJian bool) map[string]interface{} {
 	valueMap := map[string]interface{}{
 		"id": v,
 	}
@@ -634,12 +635,11 @@ func employInfoPerson(v, table, id, employKey, findKey string, source int64, in
 		valueMap["isIgnore"] = false
 		valueMap["customCount"] = 0
 	}
-	valueMap["batchEmploy"] = batchEmploy
 	return valueMap
 }
 
 // 企业收录情况查询
-func employInfoEnt(v, table, id, employKey, findKey, depIDArr string, source int64, in *types.InfoEmployinfoReq, projectId string, isNiJian bool, batchEmploy int) map[string]interface{} {
+func employInfoEnt(v, table, id, employKey, findKey, depIDArr string, source int64, in *types.InfoEmployinfoReq, projectId string, isNiJian bool) map[string]interface{} {
 	valueMap := map[string]interface{}{
 		"id":          v,
 		"isIgnore":    false,
@@ -695,6 +695,5 @@ func employInfoEnt(v, table, id, employKey, findKey, depIDArr string, source int
 		valueMap["clueCount"] = 0
 		valueMap["customCount"] = 0
 	}
-	valueMap["batchEmploy"] = batchEmploy
 	return valueMap
 }

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

@@ -7,6 +7,13 @@ type Reply struct {
 	Data       interface{} `json:"data"`
 }
 
+type InfoReply struct {
+	Error_code  int64       `json:"error_code"`
+	Error_msg   string      `json:"error_msg"`
+	Data        interface{} `json:"data"`
+	BatchEmploy int64       `json:"batchEmploy"`
+}
+
 type ClueAddReq struct {
 	AppId        string  `header:"appId,default=10000"`
 	BaseUserId   int64   `header:"newUserId"`