wangxingcheng 3 年之前
父節點
當前提交
14689ceb1f
共有 2 個文件被更改,包括 39 次插入31 次删除
  1. 12 11
      opms_parent/app/model/cust/cust_customer.go
  2. 27 20
      opms_parent/app/service/cust/cust_customer.go

+ 12 - 11
opms_parent/app/model/cust/cust_customer.go

@@ -15,7 +15,7 @@ import (
 type CustCustomer internal.CustCustomer
 
 // Fill with you ideas below.
-//列表搜索参数
+// 列表搜索参数
 type CustCustomerSearchReq struct {
 	IsPublic     bool   `json:"isPublic,omitempty"` //区分是否是公海用户列表
 	CustCode     string `json:"custCode"`
@@ -25,6 +25,7 @@ type CustCustomerSearchReq struct {
 	TargetType   string `json:"targetType,omitempty"`
 	FollowUpDate string `json:"followUpDate,omitempty"`
 	Remark       string `json:"remark"`
+	IsRemovePage bool   `json:"isRemovePage,omitempty"` //是否去掉分页
 	request.PageReq
 }
 
@@ -64,7 +65,7 @@ type CustomerAddSeq struct {
 	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"`
@@ -74,7 +75,7 @@ type Information struct {
 	Remark     string `p:"remark"      json:"remark"   `                                     // 备注
 }
 
-//返回信息
+// 返回信息
 type CustList struct {
 	Id           int    `orm:"id,primary"     json:"id"`           // 主键
 	CustCode     string `orm:"cust_code"      json:"custCode"`     // 客户编号
@@ -95,7 +96,7 @@ type CustList struct {
 	//Follow       *Follow     `json:"follow"`
 }
 
-//跟进摘要
+// 跟进摘要
 type Follow struct {
 	FollowCount     int     `json:"followCount"`     // 跟进次数
 	NotFollowDay    int     `json:"notFollowDay"`    // 未跟进天数
@@ -108,7 +109,7 @@ type Follow struct {
 	DrawTotal       float64 `json "drawTotal"`       // 开票总额
 }
 
-//转移客户参数
+// 转移客户参数
 type CustSalesReq struct {
 	Ids       []int64 `json:"ids,omitempty"`
 	SalesIds  int64   `json:"salesIds,omitempty"`
@@ -117,7 +118,7 @@ type CustSalesReq struct {
 	Receive   string  `json:"receive,omitempty"` //有值领取 无值分配
 }
 
-//分配 领取 转移 客户参数
+// 分配 领取 转移 客户参数
 type AssignCustomerReq struct {
 	Ids       []int64 `json:"ids,omitempty"`       //客户id
 	SalesId   int64   `json:"salesId,omitempty"`   //分配到销售人员的id
@@ -126,7 +127,7 @@ type AssignCustomerReq struct {
 	Receive   string  `json:"receive,omitempty"` //有值领取 无值分配
 }
 
-//删除客户参数
+// 删除客户参数
 type DelCustomer struct {
 	Ids []int64 `json:"ids"` //客户ids
 }
@@ -136,7 +137,7 @@ type DelCustomerContact struct {
 	CustId int     `json:custId` //客户Id
 }
 
-//合并客户参数
+// 合并客户参数
 type MergecustomerRep struct {
 	Id int `json:"id"` //目标Id
 	*CustomerAddSeq
@@ -145,19 +146,19 @@ type MergecustomerRep struct {
 	ChooseId []int64 `json:"chooseId,omitempty"` //被合并的客户id
 }
 
-//修改客户
+// 修改客户
 type UpdateCustomer struct {
 	Id int `json:"id,omitempty"` //客户id
 	*CustomerAddSeq
 }
 
-//移入公海
+// 移入公海
 type MoveToPubicRep struct {
 	Ids    []int64 `json:"ids,omitempty"`
 	Remark string  `json:"remark,omitempty"`
 }
 
-//客户名称
+// 客户名称
 type CustName struct {
 	CustName string `json:"custName"` // 客户名称
 }

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

@@ -52,7 +52,7 @@ func NewCustomerService(ctx context.Context) (svc *CustomerService, err error) {
 	return svc, nil
 }
 
-//GetList 客户列表列表
+// GetList 客户列表列表
 func (s *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int, customerList []*model.CustList, err error) {
 	Model := s.Dao.M
 	if req.TargetType == "" {
@@ -90,7 +90,13 @@ func (s *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int,
 		return
 	}
 
-	err = Model.Page(req.GetPage()).Order("id desc").Scan(&customerList)
+	if req.IsRemovePage {
+
+		Model = Model
+	} else {
+		Model = Model.Page(req.GetPage())
+	}
+	err = Model.Order("id desc").Scan(&customerList)
 	if err != nil {
 		g.Log().Error(err)
 		return
@@ -98,7 +104,7 @@ func (s *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int,
 	return
 }
 
-//Create 创建客户
+// Create 创建客户
 func (s *CustomerService) Create(req *model.CustomerAddSeq) (insertId int64, err error) {
 	cusTomer := new(model.CustCustomer)
 	count, err := s.Dao.Where(s.Dao.Columns.CustName, req.CustName).Count()
@@ -147,7 +153,7 @@ func (s *CustomerService) Create(req *model.CustomerAddSeq) (insertId int64, err
 	return insertId, err
 }
 
-//CreateBelong 创建客户归属信息
+// CreateBelong 创建客户归属信息
 func (s *CustomerService) CreateBelong(custId int) (insertId int64, err error) {
 	belong := new(model.CustomerBelongAddSeq)
 	belong.CustId = custId
@@ -163,7 +169,7 @@ func (s *CustomerService) CreateBelong(custId int) (insertId int64, err error) {
 	return
 }
 
-//删除客户
+// 删除客户
 func (s *CustomerService) DeleteByIds(Ids []int64) (err error) {
 	customerCount, err := s.Dao.Where(" id in (?)", Ids).Count()
 	if err != nil {
@@ -196,7 +202,7 @@ func (s *CustomerService) DeleteByIds(Ids []int64) (err error) {
 	return
 }
 
-//UpdateById 修改客户
+// UpdateById 修改客户
 func (s *CustomerService) UpdateById(req *model.UpdateCustomer) (err error) {
 	//判断数据是否存在
 	count, err := s.Dao.Where("id = ", req.Id).Count()
@@ -233,7 +239,7 @@ func (s *CustomerService) UpdateById(req *model.UpdateCustomer) (err error) {
 	return
 }
 
-//MoveToPubic 移入公海
+// MoveToPubic 移入公海
 func (s *CustomerService) MoveToPubic(Ids []int64) (err error) {
 	count, err := s.Dao.WhereIn(s.Dao.Columns.Id, Ids).Count()
 	if err != nil {
@@ -264,7 +270,7 @@ func (s *CustomerService) MoveToPubic(Ids []int64) (err error) {
 	return nil
 }
 
-//AssignCustomer 分配客户
+// AssignCustomer 分配客户
 func (s *CustomerService) AssignCustomer(req *model.AssignCustomerReq) (err error) {
 	data, err := s.Dao.Where("id in (?)", req.Ids).LockShared().All()
 	if err != nil {
@@ -293,7 +299,7 @@ func (s *CustomerService) AssignCustomer(req *model.AssignCustomerReq) (err erro
 	return
 }
 
-//GetEntityById 客户详情
+// GetEntityById 客户详情
 func (s *CustomerService) GetEntityById(Ids []int64) (entityInfo []*model.CustList, err error) {
 	Model := s.Dao //
 	err = Model.Where(" id  in (?)", Ids).Scan(&entityInfo)
@@ -304,7 +310,7 @@ func (s *CustomerService) GetEntityById(Ids []int64) (entityInfo []*model.CustLi
 	return
 }
 
-//GetCustNameIsExist 获取客户名称
+// GetCustNameIsExist 获取客户名称
 func (s *CustomerService) GetCustNameIsExist(name string) (exist bool, err error) {
 	count, err := s.Dao.Where(cust.CustCustomer.Columns.CustName, name).Count()
 	if err != nil {
@@ -318,7 +324,7 @@ func (s *CustomerService) GetCustNameIsExist(name string) (exist bool, err error
 	return
 }
 
-//CustAbstract 客户摘要
+// CustAbstract 客户摘要
 func (s *CustomerService) CustAbstract(Id int64) (followInfo *model.Follow, err error) {
 	count, err := s.FollowDao.Where(s.FollowDao.Columns.CustId, Id).Count()
 	if err != nil {
@@ -349,7 +355,7 @@ func (s *CustomerService) CustAbstract(Id int64) (followInfo *model.Follow, err
 	return
 }
 
-//TransCustomer 转移客户
+// TransCustomer 转移客户
 func (s *CustomerService) TransCustomer(req *model.AssignCustomerReq) (err error) {
 	data, err := s.Dao.Fields("sales_id,sales_name,id").Where("id in (?)", req.Ids).All()
 	if err != nil {
@@ -366,7 +372,7 @@ func (s *CustomerService) TransCustomer(req *model.AssignCustomerReq) (err error
 	return
 }
 
-//ChangeCustBelong 变更客户所属关系
+// ChangeCustBelong 变更客户所属关系
 func (s *CustomerService) ChangeCustBelong(Ids []int64, salesId int64, salesName string) (err error) {
 	_, err = s.Dao.Data(g.Map{
 		"sales_id":     salesId,
@@ -384,8 +390,8 @@ func (s *CustomerService) ChangeCustBelong(Ids []int64, salesId int64, salesName
 	return
 }
 
-//OperationLog 客户操作日志
-func (s *CustomerService) OperationLog(ids []int64, req *model.AddCustomerDynameicsReq) (err error) {
+// 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, "操作日志验证结构体失败")
@@ -417,7 +423,7 @@ func (s *CustomerService) OperationLog(ids []int64, req *model.AddCustomerDyname
 	return
 }
 
-//GetDynamicsList 客户动态
+// GetDynamicsList 客户动态
 func (s *CustomerService) GetDynamicsList(req *model.CustomerDynameicsReq) (total int, result []interface{}, err error) {
 	total, err = s.DynamicsDao.Where("cust_id = ", req.CustId).Count()
 	if err != nil {
@@ -447,7 +453,7 @@ func (s *CustomerService) GetDynamicsList(req *model.CustomerDynameicsReq) (tota
 	return
 }
 
-//MergeCustomer 合并客户
+// MergeCustomer 合并客户
 func (s *CustomerService) MergeCustomer(req *model.MergecustomerRep) (err error) {
 	//当前目标客户是否存在
 	customerCount, err := s.Dao.FindCount(req.Id)
@@ -511,8 +517,8 @@ func (s *CustomerService) Createcontact(Ids []int64, req *model.CustCustomerCont
 	return
 }
 
-//BatchCreatebelong 批量插入客户归属记录表
-func (s *CustomerService) BatchCreatebelong(rep []*model.CustCustomer, req *model.AssignCustomerReq) (err error) {
+// BatchCreatebelong 批量插入客户归属记录表
+func (s *CustomerService) BatchCreatebelong(rep []*model.CustCustomer, req *model.AssignCustomerReq, n ...interface{}) (err error) {
 	var belongData []*model.CustCustomerBelong
 	userName := s.GetCxtUserName()
 	for _, v := range rep {
@@ -538,9 +544,10 @@ func (s *CustomerService) BatchCreatebelong(rep []*model.CustCustomer, req *mode
 	return
 }
 
-//导出数据
+// 导出数据
 func (s *CustomerService) Export(req *model.CustCustomerExport) (content *model.CustExport, err error) {
 	var con model.CustExport
+	req.IsRemovePage = true // 去掉分页标识
 	total, data, err := s.GetList(&req.CustCustomerSearchReq)
 	if err != nil {
 		return