Sfoglia il codice sorgente

feature(管理员转移):管理员转移客户、项目、渠道

ZZH-wl 2 anni fa
parent
commit
204b9f82ae

+ 22 - 8
opms_parent/app/handler/base/distributor.go

@@ -18,7 +18,7 @@ type DistributorHandler struct{}
 
 // GetList 获取列表
 // Swagger:Distributor 经销商代理商 查询
-func (p *DistributorHandler) GetList(ctx context.Context, req *model.BaseDistributorSearchReq, rsp *comm_def.CommonMsg) error {
+func (c *DistributorHandler) GetList(ctx context.Context, req *model.BaseDistributorSearchReq, rsp *comm_def.CommonMsg) error {
 	distributorServer, err := server.NewDistributorService(ctx)
 	if err != nil {
 
@@ -34,7 +34,7 @@ func (p *DistributorHandler) GetList(ctx context.Context, req *model.BaseDistrib
 }
 
 // Swagger:Distributor 经销商代理商 新增
-func (p *DistributorHandler) Create(ctx context.Context, req *model.AddDistributor, rsp *comm_def.CommonMsg) error {
+func (c *DistributorHandler) Create(ctx context.Context, req *model.AddDistributor, rsp *comm_def.CommonMsg) error {
 	distributorServer, err := server.NewDistributorService(ctx)
 	if err != nil {
 		return err
@@ -47,7 +47,7 @@ func (p *DistributorHandler) Create(ctx context.Context, req *model.AddDistribut
 }
 
 // GetEntityById 详情
-func (p *DistributorHandler) GetEntityById(ctx context.Context, req *comm_def.IdReq, rsp *comm_def.CommonMsg) error {
+func (c *DistributorHandler) GetEntityById(ctx context.Context, req *comm_def.IdReq, rsp *comm_def.CommonMsg) error {
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
 		return err
 	}
@@ -64,7 +64,7 @@ func (p *DistributorHandler) GetEntityById(ctx context.Context, req *comm_def.Id
 }
 
 // Swagger:Distributor 经销商代理商 修改
-func (p *DistributorHandler) UpdateById(ctx context.Context, req *model.UpdateDistributorReq, rsp *comm_def.CommonMsg) error {
+func (c *DistributorHandler) UpdateById(ctx context.Context, req *model.UpdateDistributorReq, rsp *comm_def.CommonMsg) error {
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
 		return err
 	}
@@ -80,7 +80,7 @@ func (p *DistributorHandler) UpdateById(ctx context.Context, req *model.UpdateDi
 }
 
 // Swagger:Distributor 经销商代理商 转为代理商
-func (p *DistributorHandler) ToProxy(ctx context.Context, req *model.DistributorToProxyReq, rsp *comm_def.CommonMsg) error {
+func (c *DistributorHandler) ToProxy(ctx context.Context, req *model.DistributorToProxyReq, rsp *comm_def.CommonMsg) error {
 	g.Log().Infof("DistributorHandler.ToProxy request %#v ", *req)
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
 		return err
@@ -97,7 +97,7 @@ func (p *DistributorHandler) ToProxy(ctx context.Context, req *model.Distributor
 }
 
 // Swagger:Distributor 经销商代理商 续签
-func (p *DistributorHandler) Renew(ctx context.Context, req *model.DistributorRenewReq, rsp *comm_def.CommonMsg) error {
+func (c *DistributorHandler) Renew(ctx context.Context, req *model.DistributorRenewReq, rsp *comm_def.CommonMsg) error {
 	g.Log().Infof("DistributorHandler.Renew request %#v ", *req)
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
 		return err
@@ -114,7 +114,7 @@ func (p *DistributorHandler) Renew(ctx context.Context, req *model.DistributorRe
 }
 
 // Swagger:Distributor 经销商代理商 转为经销商
-func (p *DistributorHandler) ToDist(ctx context.Context, req *model.DistributorToDistReq, rsp *comm_def.CommonMsg) error {
+func (c *DistributorHandler) ToDist(ctx context.Context, req *model.DistributorToDistReq, rsp *comm_def.CommonMsg) error {
 	g.Log().Infof("DistributorHandler.ToDist request %#v ", *req)
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
 		return err
@@ -149,7 +149,7 @@ func (c *DistributorHandler) TransRecord(ctx context.Context, req *model.Distrib
 }
 
 // DeleteByIds 删掉
-func (p *DistributorHandler) DeleteByIds(ctx context.Context, req *model.DeleteDistributorReq, rsp *comm_def.CommonMsg) error {
+func (c *DistributorHandler) DeleteByIds(ctx context.Context, req *model.DeleteDistributorReq, rsp *comm_def.CommonMsg) error {
 	distributorServer, err := server.NewDistributorService(ctx)
 	if err != nil {
 
@@ -214,3 +214,17 @@ func (c *DistributorHandler) DynamicsList(ctx context.Context, req *model.Distri
 	rsp.Data = g.Map{"list": ent, "total": total}
 	return nil
 }
+
+// Swagger:Distributor 经销商代理商 系统管理员转移经销商代理商
+func (c *DistributorHandler) SysAdminTransferDistributor(ctx context.Context, req *model.SysAdminTransferDistributorReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("DistributorHandler.SysAdminTransferDistributor request %#v ", *req)
+	s, err := server.NewDistributorService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.SysAdminTransferDistributor(ctx, req)
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 23 - 7
opms_parent/app/handler/cust/customer.go

@@ -17,7 +17,7 @@ type CustomerHeader struct{}
 var isPublic, noPublic = "10", "20" // 公海,非公海
 var noCustomer = true               // 区分公海列表 和 客户列表 true  公海
 
-//Swagger:Customer 客户 客户列表
+// Swagger:Customer 客户 客户列表
 func (c *CustomerHeader) GetList(ctx context.Context, req *model.CustCustomerSearchReq, rsp *comm_def.CommonMsg) error {
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
@@ -32,7 +32,7 @@ func (c *CustomerHeader) GetList(ctx context.Context, req *model.CustCustomerSea
 
 }
 
-//Swagger:Customer 客户 公海列表
+// Swagger:Customer 客户 公海列表
 func (c *CustomerHeader) PublicGetList(ctx context.Context, req *model.CustCustomerSearchReq, rsp *comm_def.CommonMsg) error {
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
@@ -52,7 +52,7 @@ func (c *CustomerHeader) PublicGetList(ctx context.Context, req *model.CustCusto
 
 }
 
-//Swagger:Customer 客户 创建客户
+// Swagger:Customer 客户 创建客户
 func (c *CustomerHeader) Create(ctx context.Context, req *model.CustomerAddSeq, rsp *comm_def.CommonMsg) error {
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
 		return err
@@ -73,7 +73,7 @@ func (c *CustomerHeader) Create(ctx context.Context, req *model.CustomerAddSeq,
 	return nil
 }
 
-//Swagger:Customer 客户 修改客户
+// Swagger:Customer 客户 修改客户
 func (c *CustomerHeader) UpdateById(ctx context.Context, req *model.UpdateCustomer, rsp *comm_def.CommonMsg) error {
 	s, err := server.NewCustomerService(ctx)
 	if err != nil {
@@ -89,7 +89,7 @@ func (c *CustomerHeader) UpdateById(ctx context.Context, req *model.UpdateCustom
 	return nil
 }
 
-//Swagger:Customer 客户 客户详情
+// Swagger:Customer 客户 客户详情
 func (c *CustomerHeader) GetEntityById(ctx context.Context, req *comm_def.IdsReq, rsp *comm_def.CommonMsg) error {
 	if len(req.Ids) == 0 {
 		return myerrors.ValidError("参数有误")
@@ -107,7 +107,7 @@ func (c *CustomerHeader) GetEntityById(ctx context.Context, req *comm_def.IdsReq
 	return nil
 }
 
-//Swagger:Customer 客户 删除客户
+// Swagger:Customer 客户 删除客户
 func (c *CustomerHeader) DeleteById(ctx context.Context, req *model.DelCustomer, rsp *comm_def.CommonMsg) error {
 	if len(req.Ids) == 0 {
 		return myerrors.ValidError("参数有误")
@@ -125,7 +125,7 @@ func (c *CustomerHeader) DeleteById(ctx context.Context, req *model.DelCustomer,
 	return nil
 }
 
-//Swagger:Customer 客户 判断客户名称是否存在
+// Swagger:Customer 客户 判断客户名称是否存在
 func (c *CustomerHeader) GetCustNameIsExist(ctx context.Context, req *model.IsExistsCustName, rsp *comm_def.CommonMsg) error {
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
 		return err
@@ -254,3 +254,19 @@ func (c *CustomerHeader) Export(ctx context.Context, req *model.CustCustomerExpo
 	rsp.Data = g.Map{"list": buffer}
 	return nil
 }
+
+// Swagger:Customer 客户 系统管理员转移客户(不走审批)
+func (c *CustomerHeader) SysAdminTransCustomer(ctx context.Context, req *model.AssignCustomerReq, rsp *comm_def.CommonMsg) error {
+	if len(req.Ids) == 0 || req.SalesId == 0 {
+		return myerrors.ValidError("参数有误")
+	}
+	s, err := server.NewCustomerService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.SysAdminTransCustomer(ctx, req)
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 18 - 0
opms_parent/app/handler/proj/business.go

@@ -252,6 +252,24 @@ func (p *BusinessHandler) BusinessTransfer(ctx context.Context, req *projModel.B
 	return nil
 }
 
+// SysAdminBusinessTransfer 管理员项目转移销售(未涉及审批的)
+// Swagger:Business 项目 管理员项目转移销售(未涉及审批的)
+func (p *BusinessHandler) SysAdminBusinessTransfer(ctx context.Context, req *projModel.SysAdminBusinessTransferReq, rsp *comm_def.CommonMsg) error {
+	// 参数校验
+	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
+		return err
+	}
+	businessService, err := projSrv.NewBusinessService(ctx)
+	if err != nil {
+		return err
+	}
+	err = businessService.SysAdminBusinessTransfer(req)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
 // ConvertToReserve 转为储备项目
 // Swagger:Business 项目 转为储备项目
 func (p *BusinessHandler) ConvertToReserve(ctx context.Context, req *projModel.BusinessToReserveReq, rsp *comm_def.CommonMsg) error {

+ 8 - 0
opms_parent/app/model/base/base_distributor.go

@@ -152,3 +152,11 @@ type DistributorContractListReq struct {
 type DeleteDistributorReq struct {
 	Ids []int64 `p:"id" json:"ids" v:"required# id不能为空"`
 }
+
+// SysAdminTransferDistributorReq 系统管理员转移渠道请求
+type SysAdminTransferDistributorReq struct {
+	Ids      []int  `json:"ids"         v:"required# ids不能为空"` // 主键
+	UserId   int    `json:"userId"     v:"required# 负责人不能为空"`  // 负责人
+	UserName string `json:"userName"   v:"required# 负责人不能为空"`  // 负责人
+	Remark   string `json:"remark"`                            // 备注
+}

+ 9 - 9
opms_parent/app/model/cust/cust_customer.go

@@ -112,15 +112,15 @@ type CustList struct {
 
 // 跟进摘要
 type Follow struct {
-	FollowCount     int     `json:"followCount"`     // 跟进次数
-	NotFollowDay    int     `json:"notFollowDay"`    // 未跟进天数
-	Business        int     `json:"business"`        // 商机数量
-	BusinessTotal   float64 `json:"businessTotal"`   // 商机总额
-	DealCount       int     `json "dealCotal"`       // 成交次数
-	DealTotal       float64 `json "dealTotal"`       // 成交总额
-	PaymentTotal    float64 `json "paymentTotal"`    // 回款总额
-	NotPaymentTotal float64 `json "notPaymentTotal"` // 未回款总额
-	DrawTotal       float64 `json "drawTotal"`       // 开票总额
+	FollowCount     int     `json:"followCount"`      // 跟进次数
+	NotFollowDay    int     `json:"notFollowDay"`     // 未跟进天数
+	Business        int     `json:"business"`         // 商机数量
+	BusinessTotal   float64 `json:"businessTotal"`    // 商机总额
+	DealCount       int     `json: "dealCotal"`       // 成交次数
+	DealTotal       float64 `json: "dealTotal"`       // 成交总额
+	PaymentTotal    float64 `json: "paymentTotal"`    // 回款总额
+	NotPaymentTotal float64 `json: "notPaymentTotal"` // 未回款总额
+	DrawTotal       float64 `json: "drawTotal"`       // 开票总额
 }
 
 // 分配 领取 转移 客户参数

+ 8 - 0
opms_parent/app/model/proj/proj_business.go

@@ -209,6 +209,14 @@ type BusinessTransferReq struct {
 	Remark   string `json:"remark"`                                // 备注
 }
 
+// SysAdminBusinessTransferReq 系统管理员项目转移请求
+type SysAdminBusinessTransferReq struct {
+	Ids      []int  `json:"ids"         v:"required# ids不能为空"` // 主键
+	UserId   int    `json:"userId"     v:"required# 负责人不能为空"`  // 负责人
+	UserName string `json:"userName"   v:"required# 负责人不能为空"`  // 负责人
+	Remark   string `json:"remark"`                            // 备注
+}
+
 // BusinessToReserveReq 项目转为储备项目
 type BusinessToReserveReq struct {
 	Id                   int    `json:"id"        v:"required|min:1#|id不能为空"`                 // 主键

+ 44 - 4
opms_parent/app/service/base/base_distributor.go

@@ -689,6 +689,46 @@ func (s *distributorService) TransRecord(ctx context.Context, req *model.Distrib
 	return total, ents, nil
 }
 
+func (s *distributorService) SysAdminTransferDistributor(ctx context.Context, req *model.SysAdminTransferDistributorReq) (err error) {
+	// 校验用户是否有修改权限
+	arr := garray.NewStrArrayFrom(s.CxtUser.Roles, true)
+	if !arr.Contains("SysAdmin") {
+		return myerrors.TipsError("权限不足")
+	}
+	var updateData = g.Map{}
+	updateData[s.Dao.C.BelongSaleId] = req.UserId
+	updateData[s.Dao.C.BelongSale] = req.UserName
+	service.SetUpdatedInfo(updateData, s.GetCxtUserId(), s.GetCxtUserName())
+
+	dynamicsList := make([]model.BaseDistributorDynamics, 0)
+	for _, id := range req.Ids {
+		dynamics := model.BaseDistributorDynamics{
+			DistId:      id,
+			OpnPeopleId: s.GetCxtUserId(),
+			OpnPeople:   s.GetCxtUserName(),
+			OpnDate:     gtime.Now(),
+			OpnType:     "转移渠道",
+			OpnContent:  gconv.String(g.Map{"toUserId": req.UserId, "toUserNickName": req.UserName, "operName": s.GetCxtUserName()}),
+			Remark:      "",
+			CreatedBy:   s.GetCxtUserId(),
+			CreatedName: s.GetCxtUserName(),
+		}
+		dynamicsList = append(dynamicsList, dynamics)
+	}
+
+	err = s.Dao.Transaction(s.Ctx, func(ctx context.Context, tx *gdb.TX) error {
+		// 项目修改
+		_, err = s.Dao.TX(tx).WherePri(req.Ids).FieldsEx(service.UpdateFieldEx...).Data(updateData).Update()
+		if err != nil {
+			return err
+		}
+		_, err = s.DynamicsDao.TX(tx).InsertAndGetId(dynamicsList)
+		return err
+	})
+
+	return err
+}
+
 // DeleteByIds 删除
 func (s *distributorService) DeleteByIds(ids []int64) (err error) {
 	_, err = s.Dao.WhereIn(s.Dao.C.Id, ids).Delete()
@@ -699,7 +739,7 @@ func (s *distributorService) DeleteByIds(ids []int64) (err error) {
 
 }
 
-func (s distributorService) AddDynamicsByCurrentUser(tx *gdb.TX, distId int, opnType string, content map[string]interface{}) error {
+func (s *distributorService) AddDynamicsByCurrentUser(tx *gdb.TX, distId int, opnType string, content map[string]interface{}) error {
 	contentByte, err := json.Marshal(content)
 	if err != nil {
 		return err
@@ -722,7 +762,7 @@ func (s distributorService) AddDynamicsByCurrentUser(tx *gdb.TX, distId int, opn
 	return err
 }
 
-func (s distributorService) ContractList(ctx context.Context, req *model.DistributorContractListReq) (int, []*contractmodel.CtrContractListRsp, error) {
+func (s *distributorService) ContractList(ctx context.Context, req *model.DistributorContractListReq) (int, []*contractmodel.CtrContractListRsp, error) {
 	dao := s.ContractDao.As("a")
 	if req.DistId != 0 {
 		dao = dao.Where("a.distributor_id = ?", req.DistId)
@@ -805,7 +845,7 @@ func (s distributorService) ContractList(ctx context.Context, req *model.Distrib
 	return total, ents, nil
 }
 
-func (s distributorService) ProjectList(ctx context.Context, req *model.DistributorProjectListReq) (int, []*projmodel.ProjBusiness, error) {
+func (s *distributorService) ProjectList(ctx context.Context, req *model.DistributorProjectListReq) (int, []*projmodel.ProjBusiness, error) {
 	dao := &s.ProjDao.ProjBusinessDao
 	if req.DistId != 0 {
 		dao = dao.Where("distributor_id = ?", req.DistId)
@@ -850,7 +890,7 @@ func (s distributorService) ProjectList(ctx context.Context, req *model.Distribu
 	return total, ents, nil
 }
 
-func (s distributorService) DynamicsList(ctx context.Context, req *model.DistributorDynamicsListReq) (int, interface{}, error) {
+func (s *distributorService) DynamicsList(ctx context.Context, req *model.DistributorDynamicsListReq) (int, interface{}, error) {
 	dao := &s.DynamicsDao.BaseDistributorDynamicsDao
 	if req.SearchText != "" {
 		likestr := fmt.Sprintf("%%%s%%", req.SearchText)

+ 45 - 18
opms_parent/app/service/cust/cust_customer.go

@@ -5,13 +5,12 @@ import (
 	"context"
 	"encoding/json"
 	"fmt"
+	"github.com/gogf/gf/container/garray"
 	"math"
 	"strconv"
 	"strings"
 	"time"
 
-	"dashoo.cn/common_definition/comm_def"
-	"dashoo.cn/opms_libary/micro_srv"
 	"dashoo.cn/opms_libary/plugin/dingtalk/workflow"
 	"dashoo.cn/opms_libary/request"
 	"dashoo.cn/opms_libary/utils"
@@ -725,6 +724,50 @@ func (s *CustomerService) MoveToPublicApproval(flow *workflowModel.PlatWorkflow,
 	}, int64(cust.Id))
 }
 
+// SysAdminTransCustomer 系统管理员转移客户(不走审批)
+func (s *CustomerService) SysAdminTransCustomer(ctx context.Context, req *model.AssignCustomerReq) error {
+	// 校验用户是否有修改权限
+	arr := garray.NewStrArrayFrom(s.CxtUser.Roles, true)
+	if !arr.Contains("SysAdmin") {
+		return myerrors.TipsError("权限不足")
+	}
+	if req.Remark == "" {
+		return myerrors.TipsError("请输入转移原因")
+	}
+	customerList, err := s.Dao.WherePri(req.Ids).Where(s.Dao.C.IsPublic, "20").All()
+	if err != nil {
+		return err
+	}
+	if len(customerList) == 0 {
+		return myerrors.TipsError("转移客户不能为空")
+	}
+	var customerIds []int64
+	for _, item := range customerList {
+		customerIds = append(customerIds, int64(item.Id))
+	}
+	err = s.ChangeCustBelong(customerIds, req.SalesId, req.SalesName)
+	if err != nil {
+		return err
+	}
+	err = s.BatchCreatebelong(customerList, &model.AssignCustomerReq{
+		Ids:       customerIds,
+		SalesId:   req.SalesId,
+		SalesName: req.SalesName,
+		Remark:    req.Remark,
+		Receive:   OperaTion,
+	})
+	if err != nil {
+		return err
+	}
+
+	s.CreateDynamics("转移客户", map[string]interface{}{
+		"toUserId":       req.SalesId,
+		"toUserNickName": req.SalesName,
+		"remark":         "系统管理员转移客户",
+	}, customerIds...)
+	return nil
+}
+
 // 转移客户
 func (s *CustomerService) TransCustomerRequest(ctx context.Context, req *model.AssignCustomerReq) error {
 	if req.Remark == "" {
@@ -1319,19 +1362,3 @@ func (s *CustomerService) Export(ctx context.Context, req *model.CustCustomerExp
 
 	return &con, err
 }
-
-func GetUser(ctx context.Context, id int) error {
-	srv := micro_srv.InitMicroSrvClient("User", "micro_srv.auth")
-	defer srv.Close()
-	resp := &comm_def.CommonMsg{}
-	err := srv.Call(ctx, "GetUserInfo", &comm_def.IdReq{
-		Id: int64(id),
-	}, resp)
-	if err != nil {
-		return fmt.Errorf("获取用户信息 %d %s", id, err.Error())
-	}
-	fmt.Println(resp.Data)
-	fmt.Println("---------------")
-	fmt.Println(resp.Data.(map[string]interface{})["entity"])
-	return nil
-}

+ 0 - 10
opms_parent/app/service/cust/cust_customer_test.go

@@ -88,16 +88,6 @@ func TestAssignTransCustomerApproval(t *testing.T) {
 	}
 }
 
-func TestGetUser(t *testing.T) {
-	ctx := context.WithValue(context.Background(), share.ReqMetaDataKey, map[string]string{
-		"tenant":      testTenant,
-		share.AuthKey: "iuxauv5FSTslRo+jIJhl19cupXNs5/H9kZ2o5Aazkw5LFkV7hO4gRforyS4s1yvX",
-	})
-
-	err := GetUser(ctx, 1)
-	fmt.Println(err)
-}
-
 func TestGetDictDataByType(t *testing.T) {
 	ctx := context.WithValue(context.Background(), share.ReqMetaDataKey, map[string]string{
 		"tenant":      testTenant,

+ 51 - 0
opms_parent/app/service/proj/business.go

@@ -3,6 +3,7 @@ package proj
 import (
 	"context"
 	platDao "dashoo.cn/micro/app/dao/plat"
+	"github.com/gogf/gf/container/garray"
 	"os"
 
 	contractDao "dashoo.cn/micro/app/dao/contract"
@@ -495,6 +496,56 @@ func (p *businessService) DeleteByIds(ids []int64) (err error) {
 	return
 }
 
+// SysAdminBusinessTransfer 管理员项目转移销售(未涉及审批的)
+func (p *businessService) SysAdminBusinessTransfer(req *model.SysAdminBusinessTransferReq) error {
+	// 校验用户是否有修改权限
+	arr := garray.NewStrArrayFrom(p.CxtUser.Roles, true)
+	if !arr.Contains("SysAdmin") {
+		return myerrors.TipsError("权限不足")
+	}
+	businessList, err := p.Dao.WherePri(req.Ids).WhereNot(p.Dao.C.ApproStatus, ApprovalWaiting).All()
+	if err != nil {
+		return err
+	}
+	if len(businessList) == 0 {
+		return myerrors.TipsError("转移项目不能为空")
+	}
+	var updateData = g.Map{}
+	updateData[p.Dao.C.SaleId] = req.UserId
+	updateData[p.Dao.C.SaleName] = req.UserName
+	updateData[p.Dao.C.Remark] = req.Remark
+	service.SetUpdatedInfo(updateData, p.GetCxtUserId(), p.GetCxtUserName())
+
+	// 添加项目动态
+	for _, item := range businessList {
+		err := p.Dao.Transaction(p.Ctx, func(ctx context.Context, tx *gdb.TX) error {
+			// 项目修改
+			_, err = p.Dao.TX(tx).WherePri(item.Id).FieldsEx(service.UpdateFieldEx...).Data(updateData).Update()
+			if err != nil {
+				return err
+			}
+			dynamics := model.ProjBusinessDynamics{
+				BusId:   item.Id,
+				OpnType: OpnTransfer,
+				Remark:  req.Remark,
+			}
+			opnContent := gconv.Map(gconv.String(updateData))
+			opnContent["origSaleId"] = item.SaleId
+			opnContent["origSaleName"] = item.SaleName
+			_, err = p.CreateProjBusinessDynamics(tx, dynamics, opnContent)
+			if err != nil {
+				g.Log().Error(err)
+				return err
+			}
+			return nil
+		})
+		if err != nil {
+			g.Log().Error(fmt.Sprintf("管理员转移项目销售:%v 由%v转移至%v失败", item.NboName, item.SaleName, req.UserName), err.Error())
+		}
+	}
+	return nil
+}
+
 // BusinessTransfer 项目转移
 func (p *businessService) BusinessTransfer(req *model.BusinessTransferReq) error {
 	business, err := p.Dao.WherePri(req.Id).WhereNot(p.Dao.C.ApproStatus, ApprovalWaiting).One()