|
@@ -57,7 +57,7 @@ func NewCustomerService(ctx context.Context) (svc *CustomerService, err error) {
|
|
|
func (c *CustomerService) Derive(req *model.CustCustomerExport) (content *model.CustExport, err error) {
|
|
func (c *CustomerService) Derive(req *model.CustCustomerExport) (content *model.CustExport, err error) {
|
|
|
var con model.CustExport
|
|
var con model.CustExport
|
|
|
req.CustCustomerSearchReq.TargetType = "11"
|
|
req.CustCustomerSearchReq.TargetType = "11"
|
|
|
- total, data, err := c.GetList(req.CustCustomerSearchReq)
|
|
|
|
|
|
|
+ total, data, err := c.GetList(&req.CustCustomerSearchReq)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
@@ -174,6 +174,7 @@ func (c *CustomerService) CreateBelong(req *model.AddCustomerBelong) (err error)
|
|
|
|
|
|
|
|
//客户列表列表
|
|
//客户列表列表
|
|
|
func (c *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int, customerList []*model.CustList, err error) {
|
|
func (c *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int, customerList []*model.CustList, err error) {
|
|
|
|
|
+
|
|
|
g.Log().Info("serverS", req)
|
|
g.Log().Info("serverS", req)
|
|
|
Model := c.Dao.M
|
|
Model := c.Dao.M
|
|
|
Model = Model.Where(c.Dao.Columns.DeletedTime + " is null")
|
|
Model = Model.Where(c.Dao.Columns.DeletedTime + " is null")
|
|
@@ -203,6 +204,10 @@ func (c *CustomerService) GetList(req *model.CustCustomerSearchReq) (total int,
|
|
|
g.Log().Info("level", req.CustLevel)
|
|
g.Log().Info("level", req.CustLevel)
|
|
|
Model = Model.Where(c.Dao.Columns.CustLevel, req.CustLevel)
|
|
Model = Model.Where(c.Dao.Columns.CustLevel, req.CustLevel)
|
|
|
}
|
|
}
|
|
|
|
|
+ //
|
|
|
|
|
+ if req.FollowUpDate != "" {
|
|
|
|
|
+ Model = Model.Where(c.Dao.Columns.FollowUpDate+" like ? ", req.FollowUpDate+"%")
|
|
|
|
|
+ }
|
|
|
total, err = Model.Count()
|
|
total, err = Model.Count()
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
g.Log().Error(err)
|
|
g.Log().Error(err)
|
|
@@ -310,7 +315,7 @@ func (c *CustomerService) MoveToPubic(ids []int64) error {
|
|
|
func (c *CustomerService) DistriCustomer(req *model.DistriCustomer) error {
|
|
func (c *CustomerService) DistriCustomer(req *model.DistriCustomer) error {
|
|
|
custModel := c.Dao.M
|
|
custModel := c.Dao.M
|
|
|
rep, err := custModel.Where(cust.CustCustomer.Columns.Id+" in (?) ", req.Ids).Where(cust.CustCustomer.Columns.IsPublic, isPublic).All()
|
|
rep, err := custModel.Where(cust.CustCustomer.Columns.Id+" in (?) ", req.Ids).Where(cust.CustCustomer.Columns.IsPublic, isPublic).All()
|
|
|
- if err != nil || rep.IsEmpty() {
|
|
|
|
|
|
|
+ if err != nil {
|
|
|
err = gerror.New("该数据不存在")
|
|
err = gerror.New("该数据不存在")
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
@@ -329,6 +334,7 @@ func (c *CustomerService) DistriCustomer(req *model.DistriCustomer) error {
|
|
|
}
|
|
}
|
|
|
maps["sale_name"] = req.SalesName
|
|
maps["sale_name"] = req.SalesName
|
|
|
maps["opn_people"] = c.GetCxtUserName()
|
|
maps["opn_people"] = c.GetCxtUserName()
|
|
|
|
|
+ //maps["created_by"] = c.GetCxtUserId()
|
|
|
err = c.belongInsters(rep.List(), maps)
|
|
err = c.belongInsters(rep.List(), maps)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
err = gerror.New("分配客户失败")
|
|
err = gerror.New("分配客户失败")
|
|
@@ -343,6 +349,10 @@ func (c *CustomerService) GetEntityById(ids []int64) (entityInfo []*model.CustLi
|
|
|
//FollowModel := c.FollowDao.M
|
|
//FollowModel := c.FollowDao.M
|
|
|
|
|
|
|
|
err = Model.Where(cust.CustCustomer.Columns.Id+" in (?)", ids).Scan(&entityInfo)
|
|
err = Model.Where(cust.CustCustomer.Columns.Id+" in (?)", ids).Scan(&entityInfo)
|
|
|
|
|
+ for _, v := range entityInfo {
|
|
|
|
|
+ v.FollowUpDate = gstr.SubStr(v.FollowUpDate, 0, 16)
|
|
|
|
|
+ v.CreatedTime = gstr.SubStr(v.CreatedTime, 0, 16)
|
|
|
|
|
+ }
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
g.Log().Error(err)
|
|
g.Log().Error(err)
|
|
|
return nil, gerror.New("获取用户数据失败")
|
|
return nil, gerror.New("获取用户数据失败")
|
|
@@ -640,9 +650,9 @@ func (c *CustomerService) belongInsters(rep []map[string]interface{}, parameter
|
|
|
belong["opn_type"] = parameter["opn_type"]
|
|
belong["opn_type"] = parameter["opn_type"]
|
|
|
belong["opn_people"] = parameter["opn_people"]
|
|
belong["opn_people"] = parameter["opn_people"]
|
|
|
belong["opn_datetime"] = date_time
|
|
belong["opn_datetime"] = date_time
|
|
|
- belong["created_by"] = parameter["created_by"]
|
|
|
|
|
|
|
+ belong["created_by"] = c.GetCxtUserId()
|
|
|
belong["remark"] = parameter["remark"]
|
|
belong["remark"] = parameter["remark"]
|
|
|
- belong["created_name"] = "admin"
|
|
|
|
|
|
|
+ belong["created_name"] = c.GetCxtUserName()
|
|
|
belong["created_time"] = date_time
|
|
belong["created_time"] = date_time
|
|
|
belong["opn_datetime"] = date_time
|
|
belong["opn_datetime"] = date_time
|
|
|
maps = append(maps, belong)
|
|
maps = append(maps, belong)
|