Browse Source

部门名称添加

WH01243 1 year ago
parent
commit
0e0da5626f

+ 1 - 1
api/biService.api

@@ -131,7 +131,7 @@ type (
 		Over_time       string `json:"overTime,optional"`
 		Remark          string `json:"remark,optional"`
 		PositionId      int64  `header:"positionId,optional"`
-		DeptId          string `header:"deptId,optional"` //部门id
+		DeptId          string `header:"entDeptId,optional"` //部门id
 		EntUserName     string `header:"entUserName,optional"`
 		ParamData       string `json:"paramData,optional"`
 	}

+ 2 - 0
api/internal/logic/addacceptancelogic.go

@@ -3,6 +3,7 @@ package logic
 import (
 	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
 	"context"
+	"fmt"
 
 	"bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
 	"bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
@@ -26,6 +27,7 @@ func NewAddAcceptanceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Add
 
 func (l *AddAcceptanceLogic) AddAcceptance(req *types.AcceptanceReq) (resp *types.BiResp, err error) {
 	// todo: add your logic here and delete this line
+	fmt.Println(req)
 	res, err := l.svcCtx.BiServiceRpc.AddAcceptance(l.ctx, &biservice.AcceptanceReq{
 		PositionId:     req.PositionId,
 		ProposeType:    req.ProposeType,

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

@@ -151,7 +151,7 @@ type AcceptanceReq struct {
 	Over_time       string `json:"overTime,optional"`
 	Remark          string `json:"remark,optional"`
 	PositionId      int64  `header:"positionId,optional"`
-	DeptId          string `header:"deptId,optional"` //部门id
+	DeptId          string `header:"entDeptId,optional"` //部门id
 	EntUserName     string `header:"entUserName,optional"`
 	ParamData       string `json:"paramData,optional"`
 }

+ 15 - 3
service/acceptance.go

@@ -18,6 +18,16 @@ func AddAcceptance(in *biservice.AcceptanceReq, DkPersonMap []map[string]interfa
 	nowTime := time.Now().Format(date.Date_Full_Layout)
 	//编号处理
 	is_clue := 1
+	deptName := ""
+	if in.DeptId != "" {
+		//部门名称查询
+		deptData := JyMysql.FindOne("entniche_department", map[string]interface{}{
+			"id": in.DeptId,
+		}, "name", "")
+		if deptData != nil && len(*deptData) > 0 {
+			deptName = gconv.String((*deptData)["name"])
+		}
+	}
 	acceptance_no := fmt.Sprintf("SLD%s%s", time.Now().Format(date.Date_Short_Layout), FindNumber("sld"))
 	acceptanceMap := map[string]interface{}{
 		"acceptance_no":         acceptance_no,
@@ -34,6 +44,7 @@ func AddAcceptance(in *biservice.AcceptanceReq, DkPersonMap []map[string]interfa
 		"creator_name":          in.EntUserName,
 		"creator_position_id":   in.PositionId,
 		"creator_time":          nowTime,
+		"department_name":       deptName,
 	}
 	ok := int64(0)
 	WorkOrder.ExecTx("受理单处理", func(tx *sql.Tx) bool {
@@ -61,8 +72,8 @@ func AddAcceptance(in *biservice.AcceptanceReq, DkPersonMap []map[string]interfa
 			dkProduct := []string{}
 			dkPositionId := int64(0)
 			personMap := map[string]interface{}{}
-			if _, isOk := childMap["product"]; isOk {
-				for _, v := range strings.Split(gconv.String(childMap["product"]), ",") {
+			if _, isOk := childMap["咨询产品"]; isOk {
+				for _, v := range strings.Split(gconv.String(childMap["咨询产品"]), ",") {
 					switch productMap[v] {
 					case "dk":
 						dkProduct = append(dkProduct, v)
@@ -78,7 +89,7 @@ func AddAcceptance(in *biservice.AcceptanceReq, DkPersonMap []map[string]interfa
 				}
 			}
 			if dkPositionId != 0 {
-				work_order_no := fmt.Sprintf("SLD%s%s", time.Now().Format(date.Date_Short_Layout), FindNumber("gd"))
+				work_order_no := fmt.Sprintf("GD%s%s", time.Now().Format(date.Date_Short_Layout), FindNumber("gd"))
 				orderWorkMap := map[string]interface{}{
 					"work_order_no":         work_order_no,
 					"acceptance_no":         acceptance_no,
@@ -94,6 +105,7 @@ func AddAcceptance(in *biservice.AcceptanceReq, DkPersonMap []map[string]interfa
 					"creator_time":          nowTime,
 					"two_type":              "dk",
 					"department_no":         in.DeptId,
+					"department_name":       deptName,
 				}
 				ok3 := WorkOrder.InsertByTx(tx, "order_work", orderWorkMap)
 				if ok3 <= 0 {