Browse Source

feat:代码规范调整

Cheng Jian 3 years ago
parent
commit
8baec06ae8

+ 6 - 26
opms_parent/app/handler/cust/contant.go

@@ -6,7 +6,6 @@ import (
 	"dashoo.cn/common_definition/comm_def"
 	"dashoo.cn/opms_libary/myerrors"
 	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/os/gtime"
 	"github.com/gogf/gf/util/gconv"
 	"github.com/gogf/gf/util/gvalid"
 
@@ -16,12 +15,6 @@ import (
 
 type CustomerContantHeader struct{}
 
-const (
-	ContantCreate     = "创建联系人"
-	ContantUpdateById = "修改联系人"
-	ContantDeleteById = "删除联系人"
-)
-
 //Create 创建客户联系人
 func (c *CustomerContantHeader) Create(ctx context.Context, req *model.CustCustomerContactSeq, rsp *comm_def.CommonMsg) error {
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
@@ -38,10 +31,9 @@ func (c *CustomerContantHeader) Create(ctx context.Context, req *model.CustCusto
 
 		return err
 	}
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(req.CustId))
-	c.OperationLog(ctx, ContantCreate, Ids, req)
 
+	s, err := server.NewCustomerService(ctx)
+	s.CreateDynamics("创建联系人", req, gconv.Int64(req.CustId))
 	return nil
 }
 
@@ -59,9 +51,8 @@ func (c *CustomerContantHeader) UpdateById(ctx context.Context, req *model.Updat
 	if err != nil {
 		return err
 	}
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(req.CustId))
-	c.OperationLog(ctx, ContantUpdateById, Ids, req)
+	s, err := server.NewCustomerService(ctx)
+	s.CreateDynamics("修改联系人", req, gconv.Int64(req.CustId))
 	return nil
 }
 
@@ -98,18 +89,7 @@ func (c *CustomerContantHeader) DeleteById(ctx context.Context, req *model.DelCu
 		return err
 	}
 	//删除联系人 记录客户Id
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(req.CustId))
-	c.OperationLog(ctx, ContantDeleteById, Ids, req)
+	s, err := server.NewCustomerService(ctx)
+	s.CreateDynamics("删除联系人", req, gconv.Int64(req.CustId))
 	return nil
 }
-
-//OperationLog 操作日志
-func (c *CustomerContantHeader) OperationLog(ctx context.Context, custType string, Id []int64, req interface{}) {
-	CustomerService, _ := server.NewCustomerService(ctx)
-	custDynameics := new(model.AddCustomerDynameicsReq)
-	custDynameics.OpnType = custType
-	custDynameics.OpnDate = gtime.Now()
-	custDynameics.OpnContent = req
-	CustomerService.OperationLog(ctx, Id, custDynameics)
-}

+ 67 - 99
opms_parent/app/handler/cust/customer.go

@@ -6,8 +6,6 @@ import (
 	"dashoo.cn/common_definition/comm_def"
 	"dashoo.cn/opms_libary/myerrors"
 	"github.com/gogf/gf/frame/g"
-	"github.com/gogf/gf/os/gtime"
-	"github.com/gogf/gf/util/gconv"
 	"github.com/gogf/gf/util/gvalid"
 
 	model "dashoo.cn/micro/app/model/cust"
@@ -18,60 +16,80 @@ type CustomerHeader struct{}
 
 var isPublic, noPublic = "10", "20" // 公海,非公海
 var noCustomer = true               // 区分公海列表 和 客户列表 true  公海
-const (
-	Creates          = "创建客户"
-	UpdateBytransfer = "转移客户"
-	DistriCustomer   = "分配客户"
-	DeleteById       = "删除客户"
-	MoveToPubic      = "移入公海"
-	Mergecustomer    = "合并客户"
-	UpdateById       = "修改客户"
-	Receive          = "领取"
-)
+
+//GetList 客户列表
+func (c *CustomerHeader) GetList(ctx context.Context, req *model.CustCustomerSearchReq, rsp *comm_def.CommonMsg) error {
+	customerServer, err := server.NewCustomerService(ctx)
+	if err != nil {
+		return err
+	}
+	total, list, err := customerServer.GetList(req)
+	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	rsp.Data = g.Map{"list": list, "total": total}
+	return nil
+
+}
+
+//PublicGetList 公海列表
+func (c *CustomerHeader) PublicGetList(ctx context.Context, req *model.CustCustomerSearchReq, rsp *comm_def.CommonMsg) error {
+	customerServer, err := server.NewCustomerService(ctx)
+	if err != nil {
+
+		return err
+	}
+
+	req.IsPublic = noCustomer
+
+	total, list, err := customerServer.GetList(req)
+	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
+	if err != nil {
+
+		return err
+	}
+	rsp.Data = g.Map{"list": list, "total": total}
+	return nil
+
+}
 
 //Create 创建客户
 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
 	}
-	customerServer, err := server.NewCustomerService(ctx)
+	s, err := server.NewCustomerService(ctx)
 	if err != nil {
 
 		return err
 
 	}
-	id, err := customerServer.Create(req)
+	id, err := s.Create(req)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
 
 		return err
 	}
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(id))
-	//创建客户
-	c.OperationLog(ctx, Creates, Ids, req)
+	s.CreateDynamics("创建客户", req, id)
 	rsp.Data = g.Map{"lastId": id}
 	return nil
 }
 
 //UpdateById 修改客户
 func (c *CustomerHeader) UpdateById(ctx context.Context, req *model.UpdateCustomer, rsp *comm_def.CommonMsg) error {
-
-	customerServer, err := server.NewCustomerService(ctx)
+	s, err := server.NewCustomerService(ctx)
 	if err != nil {
 
 		return err
 	}
-	err = customerServer.UpdateById(req)
+	err = s.UpdateById(req)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
 
 		return err
 	}
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(req.Id))
-	c.OperationLog(ctx, UpdateById, Ids, req)
+	s.CreateDynamics("创建客户", req, req.Id)
 	return nil
 }
 
@@ -99,17 +117,17 @@ func (c *CustomerHeader) DeleteById(ctx context.Context, req *model.DelCustomer,
 	if len(req.Ids) == 0 {
 		return myerrors.NewMsgError(nil, "参数有误")
 	}
-	customerServer, err := server.NewCustomerService(ctx)
+	s, err := server.NewCustomerService(ctx)
 	if err != nil {
 		return err
 	}
-	err = customerServer.DeleteByIds(req.Ids)
+	err = s.DeleteByIds(req.Ids)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
 		return err
 	}
 	//删除客户
-	c.OperationLog(ctx, DeleteById, req.Ids, req)
+	s.CreateDynamics("删除客户", req, req.Ids...)
 	return nil
 }
 
@@ -131,61 +149,23 @@ func (c *CustomerHeader) GetCustNameIsExist(ctx context.Context, req *model.Cust
 	return nil
 }
 
-//PublicGetList 公海列表
-func (c *CustomerHeader) PublicGetList(ctx context.Context, req *model.CustCustomerSearchReq, rsp *comm_def.CommonMsg) error {
-	customerServer, err := server.NewCustomerService(ctx)
-	if err != nil {
-
-		return err
-	}
-
-	req.IsPublic = noCustomer
-
-	total, list, err := customerServer.GetList(req)
-	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
-	if err != nil {
-
-		return err
-	}
-	rsp.Data = g.Map{"list": list, "total": total}
-	return nil
-
-}
-
-//GetList 客户列表
-func (c *CustomerHeader) GetList(ctx context.Context, req *model.CustCustomerSearchReq, rsp *comm_def.CommonMsg) error {
-	customerServer, err := server.NewCustomerService(ctx)
-	if err != nil {
-		return err
-	}
-	total, list, err := customerServer.GetList(req)
-	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
-	if err != nil {
-		return err
-	}
-	rsp.Data = g.Map{"list": list, "total": total}
-	return nil
-
-}
-
 //TransCustomer 转移客户
 func (c *CustomerHeader) TransCustomer(ctx context.Context, req *model.AssignCustomerReq, rsp *comm_def.CommonMsg) error {
 	if len(req.Ids) == 0 || req.SalesId == 0 {
 		return myerrors.NewMsgError(nil, "参数有误")
 	}
-	customerServer, err := server.NewCustomerService(ctx)
+	s, err := server.NewCustomerService(ctx)
 	if err != nil {
 		return err
 	}
-	err = customerServer.TransCustomer(req)
+	err = s.TransCustomer(req)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
 		return err
 	}
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(req.Ids))
+
 	//转移客户
-	c.OperationLog(ctx, UpdateBytransfer, Ids, req)
+	s.CreateDynamics("转移客户", req, req.Ids...)
 	return nil
 }
 
@@ -194,22 +174,22 @@ func (c *CustomerHeader) AssignCustomer(ctx context.Context, req *model.AssignCu
 	if len(req.Ids) == 0 || req.SalesId == 0 {
 		return myerrors.NewMsgError(nil, "参数有误")
 	}
-	customerServer, err := server.NewCustomerService(ctx)
+	s, err := server.NewCustomerService(ctx)
 	if err != nil {
 		return err
 	}
-	err = customerServer.AssignCustomer(req)
+	err = s.AssignCustomer(req)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
 		return err
 	}
 	var behavior string
 	if req.Receive == "" {
-		behavior = DistriCustomer
+		behavior = "分配客户"
 	} else {
-		behavior = Receive
+		behavior = "领取"
 	}
-	c.OperationLog(ctx, behavior, req.Ids, req)
+	s.CreateDynamics(behavior, req, req.Ids...)
 	return nil
 
 }
@@ -219,11 +199,11 @@ func (c *CustomerHeader) MoveToPubic(ctx context.Context, req *model.MoveToPubic
 	if len(req.Ids) == 0 {
 		return myerrors.NewMsgError(nil, "参数有误")
 	}
-	customerServer, err := server.NewCustomerService(ctx)
+	s, err := server.NewCustomerService(ctx)
 	if err != nil {
 		return err
 	}
-	err = customerServer.MoveToPubic(req.Ids)
+	err = s.MoveToPubic(req.Ids)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
 
@@ -232,8 +212,7 @@ func (c *CustomerHeader) MoveToPubic(ctx context.Context, req *model.MoveToPubic
 	if req.Remark == "" {
 		req.Remark = ""
 	}
-	c.OperationLog(ctx, MoveToPubic, req.Ids, req)
-
+	s.CreateDynamics("移入公海", req, req.Ids...)
 	return nil
 }
 
@@ -253,27 +232,26 @@ func (c *CustomerHeader) GetDynamicsList(ctx context.Context, req *model.Custome
 }
 
 //MergeCustomer 合并客户
-func (c *CustomerHeader) MergeCustomer(ctx context.Context, req *model.MergecustomerRep, rsp *comm_def.CommonMsg) error {
+func (c *CustomerHeader) MergeCustomer(ctx context.Context, req *model.MergeCustomerRep, rsp *comm_def.CommonMsg) error {
 	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
 		return err
 	}
-	customerServer, err := server.NewCustomerService(ctx)
+	s, err := server.NewCustomerService(ctx)
 	if err != nil {
 		return err
 	}
-	err = customerServer.MergeCustomer(req)
+	err = s.MergeCustomer(req)
 	_, err, rsp.Code, rsp.Msg = myerrors.CheckError(err)
 	if err != nil {
 		return err
 	}
-	var Ids []int64
-	Ids = append(Ids, gconv.Int64(req.Id))
-	c.OperationLog(ctx, Mergecustomer, Ids, req)
+
+	s.CreateDynamics("合并客户", req, req.Id)
 	return nil
 }
 
-//CustAbstract 客户摘要
-func (c *CustomerHeader) CustAbstract(ctx context.Context, req *comm_def.IdReq, rsp *comm_def.CommonMsg) error {
+//GetCustAbstract 客户摘要
+func (c *CustomerHeader) GetCustAbstract(ctx context.Context, req *comm_def.IdReq, rsp *comm_def.CommonMsg) error {
 	if req.Id == 0 {
 		return myerrors.NewMsgError(nil, "参数有误")
 	}
@@ -290,18 +268,8 @@ func (c *CustomerHeader) CustAbstract(ctx context.Context, req *comm_def.IdReq,
 	return nil
 }
 
-//OperationLog 操作日志
-func (c *CustomerHeader) OperationLog(ctx context.Context, custType string, custId []int64, req interface{}) {
-	CustomerService, _ := server.NewCustomerService(ctx)
-	custDynameics := new(model.AddCustomerDynameicsReq)
-	custDynameics.OpnDate = gtime.Now()
-	custDynameics.OpnType = custType
-	custDynameics.OpnContent = req
-	CustomerService.OperationLog(ctx, custId, custDynameics)
-}
-
-//DeriveList 导出
-func (c *CustomerHeader) DeriveList(ctx context.Context, req *model.CustCustomerExport, rsp *comm_def.CommonMsg) error {
+//Export 导出
+func (c *CustomerHeader) Export(ctx context.Context, req *model.CustCustomerExport, rsp *comm_def.CommonMsg) error {
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
 		return err

+ 3 - 2
opms_parent/app/model/base/base_product.go

@@ -16,8 +16,9 @@ type BaseProduct internal.BaseProduct
 // Fill with you ideas below.
 
 type ProductSearchReq struct {
-	ProdCode string `json:"prodCode"`
-	ProdName string `json:"prodName"`
+	ProdCode  string `json:"prodCode"`
+	ProdName  string `json:"prodName"`
+	ProdClass string `json:"ProdClass"`
 	request.PageReq
 }
 

+ 16 - 33
opms_parent/app/model/cust/cust_customer.go

@@ -15,7 +15,8 @@ import (
 type CustCustomer internal.CustCustomer
 
 // Fill with you ideas below.
-//列表搜索参数
+
+//CustCustomerSearchReq 列表搜索参数
 type CustCustomerSearchReq struct {
 	IsPublic     bool   `json:"isPublic,omitempty"` //区分是否是公海用户列表
 	CustCode     string `json:"custCode"`
@@ -28,8 +29,7 @@ type CustCustomerSearchReq struct {
 	request.PageReq
 }
 
-//导出参数
-
+//CustCustomerExport 导出参数
 type CustCustomerExport struct {
 	CustCustomerSearchReq
 	Columns []string `json:"columns"` // 导出列
@@ -42,38 +42,22 @@ type CustExport struct {
 	Content []byte `json:"content"` // 导出数据流
 }
 
-// 添加客户信息表
-type AddCustCustomerReq struct {
-	Cust *CustomerAddSeq
-	Info *Information
-}
-
-// 单表添加客户信息表
+//CustomerAddSeq 单表添加客户信息表
 type CustomerAddSeq struct {
-	CustName     string      `p:"custName"        json:"custName"   v:"required#客户名称不能为空"`
+	CustName     string      `p:"custName"        json:"custName"      v:"required#客户名称不能为空"`
 	AbbrName     string      `p:"abbrName"        json:"abbrName"   `                         // 助计名
 	CustLocation string      `p:"custLocation"    json:"custLocation"    `                    // 所在地区
 	CustAddress  string      `p:"custAddress"     json:"custAddress"   `                      // 详细地址
-	FollowUpDate *gtime.Time `p:"followUpDate"     json:"followUpDate"   `                    //跟进时间
-	CustIndustry string      `p:"custIndustry"     json:"custIndustry" v:"required#客户行业不能为空"` //客户行业
-	CustLevel    string      `p:"custLevel"     json:"custLevel"       v:"required#客户级别不能为空"` //客户级别
-	CustSource   string      `p:"custSource"     json:"source"       v:"required#客户来源不能为空"`   //客户级别
-	CustDistCode int         `p:"custDistCode" json:"custDistCode"  v:"required#省份不能为空" `     // 省份Id
-	Remark       string      `p:"remark" json:"remark""`                                      //备注
+	FollowUpDate *gtime.Time `p:"followUpDate"    json:"followUpDate"   `                     //跟进时间
+	CustIndustry string      `p:"custIndustry"    json:"custIndustry"  v:"required#客户行业不能为空"` //客户行业
+	CustLevel    string      `p:"custLevel"       json:"custLevel"     v:"required#客户级别不能为空"` //客户级别
+	CustSource   string      `p:"custSource"      json:"source"        v:"required#客户来源不能为空"` //客户级别
+	CustDistCode int         `p:"custDistCode"    json:"custDistCode"  v:"required#省份不能为空" `  // 省份Id
+	Remark       string      `p:"remark"          json:"remark""`                             //备注
 	SalesName    string      `p:"salesName"       json:"salesName"   `                        //
 	SalesId      int         `p:"salesId"         json:"salesId"   `                          //
 }
 
-//客户联系人信息
-type Information struct {
-	CuctName   string `p:"cuctName"    json:"cuctName"     v:"required#联系人名字不能为空"`
-	TelePhone  string `p:"telePhone"   json:"telePhone"    v:"required|phone#手机号不能为空|手机号格式错误" orm:"telephone"`
-	CuctGender string `p:"cuctGender"  json:"cuctGender"   `                                 // 尊称  性别
-	Postion    string `p:"postion"     json:"postion"   `                                    // 职位
-	Email      string `p:"email"       json:"email"         v:"email#邮箱格式错误" orm:"email"   ` // 邮箱
-	Remark     string `p:"remark"      json:"remark"   `                                     // 备注
-}
-
 //返回信息
 type CustList struct {
 	Id           int    `orm:"id,primary"     json:"id"`           // 主键
@@ -136,18 +120,17 @@ type DelCustomerContact struct {
 	CustId int     `json:custId` //客户Id
 }
 
-//合并客户参数
-type MergecustomerRep struct {
-	Id int `json:"id"` //目标Id
+//MergeCustomerRep 合并客户参数
+type MergeCustomerRep struct {
+	Id int64 `json:"id"` //目标Id
 	*CustomerAddSeq
-	//*CustCustomerContactSeq
 	*CustomerBelongAddSeq
 	ChooseId []int64 `json:"chooseId,omitempty"` //被合并的客户id
 }
 
-//修改客户
+//UpdateCustomer 修改客户
 type UpdateCustomer struct {
-	Id int `json:"id,omitempty"` //客户id
+	Id int64 `json:"id,omitempty"` //客户id
 	*CustomerAddSeq
 }
 

+ 1 - 0
opms_parent/app/model/cust/cust_customer_dynamics.go

@@ -25,6 +25,7 @@ type AddCustomerDynameicsReq struct {
 	Remark      string      `json:"remark"`       //备注
 	OpnContent  interface{} ` json:"opnContent"`  // 操作内容
 }
+
 type CustomerDynameicsReq struct {
 	CustId int `    json:"custId"` // 客户Id
 	//request.PageReq

+ 1 - 1
opms_parent/app/model/cust/internal/cust_customer_dynamics.go

@@ -12,7 +12,7 @@ import (
 type CustCustomerDynamics struct {
 	Id          int         `orm:"id,primary"    json:"id"`          // 主键
 	OpnPeopleId int         `orm:"opn_people_id" json:"opnPeopleId"` // 操作人ID
-	CustId      int         `orm:"cust_id" json:"custId"`            // 客户ID
+	CustId      int         `orm:"cust_id"       json:"custId"`      // 客户ID
 	OpnPeople   string      `orm:"opn_people"    json:"opnPeople"`   // 操作人
 	OpnDate     *gtime.Time `orm:"opn_date"      json:"opnDate"`     // 操作日期
 	OpnType     string      `orm:"opn_type"      json:"opnType"`     // 操作类型

+ 11 - 2
opms_parent/app/service/base/base_product.go

@@ -37,6 +37,10 @@ func (s *productService) GetList(req *model.ProductSearchReq) (total int, produc
 		Dao = Dao.Where("prod_name like ?", "%"+req.ProdName+"%")
 	}
 
+	if req.ProdClass != "" {
+		Dao = Dao.Where("prod_class = ?", req.ProdClass)
+	}
+
 	total, err = Dao.Count()
 	if err != nil {
 		g.Log().Error(err)
@@ -85,7 +89,7 @@ func (s *productService) UpdateById(req *model.UpdateProductReq) (err error) {
 		return
 	}
 	service.SetUpdatedInfo(product, s.GetCxtUserId(), s.GetCxtUserName())
-	_, err = s.Dao.WherePri(req.Id).Update()
+	_, err = s.Dao.WherePri(req.Id).Update(product)
 	if err != nil {
 		g.Log().Error(err)
 		return
@@ -95,7 +99,6 @@ func (s *productService) UpdateById(req *model.UpdateProductReq) (err error) {
 
 //DeleteByIds 删掉数据
 func (s *productService) DeleteByIds(ids []int64) (err error) {
-
 	if len(ids) == 1 {
 		count, err := s.Dao.WherePri(ids[0]).Count()
 		if err != nil {
@@ -105,6 +108,12 @@ func (s *productService) DeleteByIds(ids []int64) (err error) {
 		if count == 0 {
 			return myerrors.NewMsgError(nil, "数据不存在或已被删除,请刷新页面")
 		}
+		_, err = s.Dao.WherePri(s.Dao.Columns.Id, ids[0]).Delete()
+		if err != nil {
+			g.Log().Error(err)
+			return err
+		}
+		return err
 	} else {
 		_, err := s.Dao.WhereIn(s.Dao.Columns.Id, ids).LockShared().Count()
 		if err != nil {

+ 19 - 27
opms_parent/app/service/cust/cust_customer.go

@@ -4,6 +4,7 @@ import (
 	"bytes"
 	"context"
 	"fmt"
+	"github.com/gogf/gf/encoding/gjson"
 	"math"
 	"strconv"
 
@@ -384,31 +385,22 @@ func (s *CustomerService) ChangeCustBelong(Ids []int64, salesId int64, salesName
 	return
 }
 
-//OperationLog 客户操作日志
-func (s *CustomerService) OperationLog(ctx context.Context, ids []int64, req *model.AddCustomerDynameicsReq) (err error) {
-	cusDynameics := new(model.CustCustomerDynamics)
-	if err = gconv.Struct(req, cusDynameics); err != nil {
-		err = myerrors.NewMsgError(nil, "操作日志验证结构体失败")
-		return
-	}
-
-	maps := []map[string]interface{}{}
-	for _, v := range ids {
-		contact := map[string]interface{}{}
-		contact["cust_id"] = v
-		contact["opn_people_id"] = s.GetCxtUserId()
-		contact["opn_people"] = s.GetCxtUserName()
-		contact["opn_date"] = req.OpnDate
-		contact["opn_type"] = req.OpnType
-		contact["remark"] = ""
-		contact["created_by"] = s.GetCxtUserId()
-		contact["created_name"] = s.CxtUser.NickName
-		contact["created_by"] = s.GetCxtUserId()
-		contact["created_time"] = gtime.Now()
-		contact["opn_content"] = req.OpnContent
-		maps = append(maps, contact)
-	}
-	_, err = s.DynamicsDao.Insert(maps)
+//CreateDynamics 创建客户动态信息
+func (s *CustomerService) CreateDynamics(opnTpye string, content interface{}, ids ...int64) (err error) {
+	datas := make([]*model.CustCustomerDynamics, 0)
+	for _, id := range ids {
+		dynameics := new(model.CustCustomerDynamics)
+		dynameics.CustId = int(id)
+		dynameics.OpnPeopleId = s.GetCxtUserId()
+		dynameics.OpnPeople = s.GetCxtUserName()
+		dynameics.OpnDate = gtime.Now()
+		dynameics.OpnType = opnTpye
+		v, _ := gjson.Encode(content)
+		dynameics.OpnContent = gconv.String(v)
+		service.SetCreatedInfo(dynameics, s.GetCxtUserId(), s.GetCxtUserName())
+		datas = append(datas, dynameics)
+	}
+	_, err = s.DynamicsDao.Insert(datas)
 	if err != nil {
 		g.Log().Error(err)
 		return
@@ -448,7 +440,7 @@ func (s *CustomerService) GetDynamicsList(req *model.CustomerDynameicsReq) (tota
 }
 
 //MergeCustomer 合并客户
-func (s *CustomerService) MergeCustomer(req *model.MergecustomerRep) (err error) {
+func (s *CustomerService) MergeCustomer(req *model.MergeCustomerRep) (err error) {
 	//当前目标客户是否存在
 	customerCount, err := s.Dao.FindCount(req.Id)
 	if err != nil {
@@ -491,7 +483,7 @@ func (s *CustomerService) MergeCustomer(req *model.MergecustomerRep) (err error)
 		return
 	}
 	//插入一条合并成功的归属记录
-	req.CustomerBelongAddSeq.CustId = req.Id
+	req.CustomerBelongAddSeq.CustId = int(req.Id)
 	req.CustomerBelongAddSeq.OpnType = Merge
 	req.CustomerBelongAddSeq.OpnPeople = s.GetCxtUserName()
 	req.CustomerBelongAddSeq.OpnDatetime = gtime.Now()