Browse Source

Merge branch 'dev_v1.0.38.2_wh' of BaseService/biService into hotfix/v1.0.38.2

王浩 1 month ago
parent
commit
92013965a9
2 changed files with 25 additions and 22 deletions
  1. 14 11
      entity/entity.go
  2. 11 11
      service/acceptance.go

+ 14 - 11
entity/entity.go

@@ -1,22 +1,20 @@
 package entity
 
 import (
-	"bp.jydev.jianyu360.cn/BaseService/fileCenter/rpc/filecenter"
-	"log"
-	"strings"
-
+	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/mail"
-
+	"app.yhyue.com/moapp/jybase/redis"
+	"bp.jydev.jianyu360.cn/BaseService/fileCenter/rpc/filecenter"
 	"encoding/json"
+	"github.com/nsqio/go-nsq"
+	"github.com/zeromicro/go-zero/core/logx"
+	"strings"
 
-	util "app.yhyue.com/moapp/jybase/common"
 	elastic "app.yhyue.com/moapp/jybase/es"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
-	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jypkg/middleground"
-	"github.com/nsqio/go-nsq"
-	"github.com/zeromicro/go-zero/core/logx"
 	"sync"
 )
 
@@ -83,8 +81,13 @@ type ProductMap struct {
 	PersonArr   []Person
 }
 type Person struct {
-	Name  string
-	Phone string
+	Name       string
+	Phone      string
+	Mail       string `header:"mail,optional"`
+	DeptId     int64  `header:"deptId,optional"`
+	DeptName   string `header:"deptName,optional"`
+	PositionId int64  `header:"positionId,optional"`
+	IsResign   bool   `header:"isResign,optional"`
 }
 type SelectProductMap struct {
 	Product   []string

+ 11 - 11
service/acceptance.go

@@ -180,16 +180,16 @@ func AddOrderWork(orderType, acceptance_no, nowTime, phone, company string, tx *
 		}
 		log.Println(personMap)
 		log.Println(GmailAuth, personMap, strings.Join(selectPersonMap.Product, ","), dkPerson, in.EntUserName, nowTime, work_order_no, phone, company)
-		//WorkMail(GmailAuth, personMap, strings.Join(selectPersonMap.Product, ","), dkPerson, in.EntUserName, nowTime, work_order_no, phone, company)
+		WorkMail(GmailAuth, personMap, strings.Join(selectPersonMap.Product, ","), dkPerson, in.EntUserName, nowTime, work_order_no, phone, company)
 	}
 	return true
 
 }
 
 // 大客人员选择
-func FindCandidate(personArr []config.Person, entId int64, orderType string) map[string]interface{} {
+func FindCandidate(personArr []Person, entId int64, orderType string) map[string]interface{} {
 	person := map[string]interface{}{}
-	personEntity := config.Person{}
+	personEntity := Person{}
 	personMap := make(map[string]map[string]interface{})
 	phoneArr := make([]string, len(personArr))
 
@@ -203,7 +203,7 @@ func FindCandidate(personArr []config.Person, entId int64, orderType string) map
 	}
 
 	// Fetch personal email and department information
-	entUserArr := config.JianyuMysql.SelectBySql(fmt.Sprintf(`
+	entUserArr := JyMysql.SelectBySql(fmt.Sprintf(`
 		SELECT a.name, a.mail, b.dept_id AS deptId, a.phone, c.name AS deptName
 		FROM entniche_user a
 		INNER JOIN entniche_department_user b ON a.ent_id = %d AND a.phone IN %s AND a.id = b.user_id 
@@ -220,7 +220,7 @@ func FindCandidate(personArr []config.Person, entId int64, orderType string) map
 	}
 
 	// Fetch position information
-	positionArrMap := config.JianyuMysql.SelectBySql(fmt.Sprintf(`
+	positionArrMap := JyMysql.SelectBySql(fmt.Sprintf(`
 		SELECT a.phone, b.id
 		FROM base_service.base_user a
 		INNER JOIN base_service.base_position b ON b.ent_id = %d AND a.phone IN %s AND b.user_id = a.id AND b.type = 1
@@ -240,12 +240,12 @@ func FindCandidate(personArr []config.Person, entId int64, orderType string) map
 			personArr[k].Mail = gconv.String(info["mail"])
 			personArr[k].DeptId = gconv.Int64(info["deptId"])
 			personArr[k].DeptName = gconv.String(info["deptName"])
-			personArr[k].PositionId = gconv.String(info["positionId"])
+			personArr[k].PositionId = gconv.Int64(info["positionId"])
 		}
 	}
 
 	// Query the last person who created an order
-	orderWorkMap := config.OrderMysql.SelectBySql(fmt.Sprintf(`
+	orderWorkMap := WorkOrder.SelectBySql(fmt.Sprintf(`
 		SELECT * FROM order_work WHERE two_type = "%s" ORDER BY creator_time DESC LIMIT 1
 	`, orderType))
 
@@ -276,7 +276,7 @@ func FindCandidate(personArr []config.Person, entId int64, orderType string) map
 }
 
 // Helper function to find the next person index
-func findNextPersonIndex(personArr []config.Person, startIndex int) int {
+func findNextPersonIndex(personArr []Person, startIndex int) int {
 	n := len(personArr)
 	// 如果当前索引是最后一个,则从 0 开始
 	if startIndex >= n-1 {
@@ -295,7 +295,7 @@ func findNextPersonIndex(personArr []config.Person, startIndex int) int {
 }
 
 // Helper function to find a person's index by name
-func findPersonIndexByName(personArr []config.Person, name string) int {
+func findPersonIndexByName(personArr []Person, name string) int {
 	for i, v := range personArr {
 		if v.Name == name {
 			return i
@@ -306,7 +306,7 @@ func findPersonIndexByName(personArr []config.Person, name string) int {
 
 // Fetch department admin details
 func fetchDeptAdmin(person map[string]interface{}, deptId int64) {
-	deptMap := config.JianyuMysql.SelectBySql(`SELECT c.name AS name, c.mail AS mail
+	deptMap := JyMysql.SelectBySql(`SELECT c.name AS name, c.mail AS mail
 		FROM entniche_department_user a
 		INNER JOIN entniche_user_role b ON a.dept_id = ? AND a.user_id = b.user_id AND b.role_id != ""
 		INNER JOIN entniche_user c ON a.user_id = c.id`, deptId)
@@ -319,7 +319,7 @@ func fetchDeptAdmin(person map[string]interface{}, deptId int64) {
 
 // Fetch superior admin details
 func fetchSuperiorAdmin(person map[string]interface{}, deptId int64) {
-	superiorMap := config.JianyuMysql.SelectBySql(`SELECT c.*
+	superiorMap := JyMysql.SelectBySql(`SELECT c.*
 		FROM entniche_department d
 		INNER JOIN entniche_department_user a ON d.id = ? AND d.pid = a.dept_id
 		INNER JOIN entniche_user_role b ON a.user_id = b.user_id AND b.role_id != ""