|
@@ -180,16 +180,16 @@ func AddOrderWork(orderType, acceptance_no, nowTime, phone, company string, tx *
|
|
}
|
|
}
|
|
log.Println(personMap)
|
|
log.Println(personMap)
|
|
log.Println(GmailAuth, personMap, strings.Join(selectPersonMap.Product, ","), dkPerson, in.EntUserName, nowTime, work_order_no, phone, company)
|
|
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
|
|
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{}{}
|
|
person := map[string]interface{}{}
|
|
- personEntity := config.Person{}
|
|
|
|
|
|
+ personEntity := Person{}
|
|
personMap := make(map[string]map[string]interface{})
|
|
personMap := make(map[string]map[string]interface{})
|
|
phoneArr := make([]string, len(personArr))
|
|
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
|
|
// 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
|
|
SELECT a.name, a.mail, b.dept_id AS deptId, a.phone, c.name AS deptName
|
|
FROM entniche_user a
|
|
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
|
|
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
|
|
// Fetch position information
|
|
- positionArrMap := config.JianyuMysql.SelectBySql(fmt.Sprintf(`
|
|
|
|
|
|
+ positionArrMap := JyMysql.SelectBySql(fmt.Sprintf(`
|
|
SELECT a.phone, b.id
|
|
SELECT a.phone, b.id
|
|
FROM base_service.base_user a
|
|
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
|
|
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].Mail = gconv.String(info["mail"])
|
|
personArr[k].DeptId = gconv.Int64(info["deptId"])
|
|
personArr[k].DeptId = gconv.Int64(info["deptId"])
|
|
personArr[k].DeptName = gconv.String(info["deptName"])
|
|
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
|
|
// 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
|
|
SELECT * FROM order_work WHERE two_type = "%s" ORDER BY creator_time DESC LIMIT 1
|
|
`, orderType))
|
|
`, orderType))
|
|
|
|
|
|
@@ -276,7 +276,7 @@ func FindCandidate(personArr []config.Person, entId int64, orderType string) map
|
|
}
|
|
}
|
|
|
|
|
|
// Helper function to find the next person index
|
|
// 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)
|
|
n := len(personArr)
|
|
// 如果当前索引是最后一个,则从 0 开始
|
|
// 如果当前索引是最后一个,则从 0 开始
|
|
if startIndex >= n-1 {
|
|
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
|
|
// 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 {
|
|
for i, v := range personArr {
|
|
if v.Name == name {
|
|
if v.Name == name {
|
|
return i
|
|
return i
|
|
@@ -306,7 +306,7 @@ func findPersonIndexByName(personArr []config.Person, name string) int {
|
|
|
|
|
|
// Fetch department admin details
|
|
// Fetch department admin details
|
|
func fetchDeptAdmin(person map[string]interface{}, deptId int64) {
|
|
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
|
|
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_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)
|
|
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
|
|
// Fetch superior admin details
|
|
func fetchSuperiorAdmin(person map[string]interface{}, deptId int64) {
|
|
func fetchSuperiorAdmin(person map[string]interface{}, deptId int64) {
|
|
- superiorMap := config.JianyuMysql.SelectBySql(`SELECT c.*
|
|
|
|
|
|
+ superiorMap := JyMysql.SelectBySql(`SELECT c.*
|
|
FROM entniche_department d
|
|
FROM entniche_department d
|
|
INNER JOIN entniche_department_user a ON d.id = ? AND d.pid = a.dept_id
|
|
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 != ""
|
|
INNER JOIN entniche_user_role b ON a.user_id = b.user_id AND b.role_id != ""
|