|
@@ -78,6 +78,8 @@ func AddAcceptance(in *biservice.AcceptanceReq, DkPersonMap []map[string]interfa
|
|
|
}
|
|
|
//判断是否创建工单
|
|
|
dkPerson := ""
|
|
|
+ dkdeptName := ""
|
|
|
+ dkdeptId := ""
|
|
|
dkProduct := []string{}
|
|
|
dkPositionId := int64(0)
|
|
|
personMap := map[string]interface{}{}
|
|
@@ -90,6 +92,8 @@ func AddAcceptance(in *biservice.AcceptanceReq, DkPersonMap []map[string]interfa
|
|
|
personMap = Findcandidate(DkPersonMap, entId)
|
|
|
dkPositionId = gconv.Int64(personMap["positionId"])
|
|
|
dkPerson = gconv.String(personMap["name"])
|
|
|
+ dkdeptId = gconv.String(personMap["deptId"])
|
|
|
+ dkdeptName = gconv.String(personMap["deptName"])
|
|
|
}
|
|
|
continue
|
|
|
default:
|
|
@@ -114,14 +118,28 @@ func AddAcceptance(in *biservice.AcceptanceReq, DkPersonMap []map[string]interfa
|
|
|
"creator_position_id": in.PositionId,
|
|
|
"creator_time": nowTime,
|
|
|
"two_type": "dk",
|
|
|
- "department_no": in.DeptId,
|
|
|
- "department_name": deptName,
|
|
|
+ "department_no": dkdeptId,
|
|
|
+ "department_name": dkdeptName,
|
|
|
}
|
|
|
ok3 := WorkOrder.InsertByTx(tx, "order_work", orderWorkMap)
|
|
|
if ok3 <= 0 {
|
|
|
return false
|
|
|
}
|
|
|
//发送邮件
|
|
|
+ //日志添加
|
|
|
+ approvalRecordMap := map[string]interface{}{
|
|
|
+ "work_order_no": work_order_no,
|
|
|
+ "status": 1,
|
|
|
+ "handle_name": dkPerson,
|
|
|
+ "handle_position_id": dkPositionId,
|
|
|
+ "handle_dept_id": dkdeptId,
|
|
|
+ "handle_dept_name": dkdeptName,
|
|
|
+ "creator_name": in.EntUserName,
|
|
|
+ "creator_position_id": in.PositionId,
|
|
|
+ "is_delete": 1,
|
|
|
+ "creator_time": nowTime,
|
|
|
+ }
|
|
|
+ WorkOrder.InsertByTx(tx, "approval_record", approvalRecordMap)
|
|
|
log.Println(personMap)
|
|
|
WorkMail(GmailAuth, personMap, strings.Join(dkProduct, ","), dkPerson, in.EntUserName, nowTime, work_order_no, phone, company)
|
|
|
}
|
|
@@ -158,17 +176,20 @@ func Findcandidate(DkPersonMap []map[string]interface{}, entId int64) map[string
|
|
|
}
|
|
|
//个人邮箱,部门信息获取
|
|
|
entUserArr := JyMysql.SelectBySql(fmt.Sprintf(`SELECT
|
|
|
- a.name as name,a.mail as mail,b.dept_id as deptId,a.phone
|
|
|
+ a.name as name,a.mail as 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`, entId, fmt.Sprintf("(%s)", strings.Join(phoneArr, ","))))
|
|
|
+ and a.id=b.user_id
|
|
|
+ inner join entniche_department c on b.dept_id=c.id
|
|
|
+`, entId, fmt.Sprintf("(%s)", strings.Join(phoneArr, ","))))
|
|
|
if entUserArr != nil && len(*entUserArr) > 0 {
|
|
|
for _, v := range *entUserArr {
|
|
|
phone := gconv.String(v["phone"])
|
|
|
personMap[phone]["mail"] = gconv.String(v["mail"])
|
|
|
personMap[phone]["deptId"] = gconv.String(v["deptId"])
|
|
|
+ personMap[phone]["deptName"] = gconv.String(v["deptName"])
|
|
|
}
|
|
|
}
|
|
|
//
|