|
|
@@ -163,7 +163,7 @@ func (s *CustomerService) Create(req *model.CustomerAddSeq) (insertId int64, err
|
|
|
return
|
|
|
}
|
|
|
service.SetCreatedInfo(cusTomer, s.GetCxtUserId(), s.CxtUser.NickName)
|
|
|
- custCode, err := s.customerCode(req.CustProvince, req.CustIndustryCode)
|
|
|
+ custCode, err := s.customerCode(req.CustProvince, req.CustIndustry)
|
|
|
if err != nil {
|
|
|
return 0, err
|
|
|
}
|
|
|
@@ -173,7 +173,7 @@ func (s *CustomerService) Create(req *model.CustomerAddSeq) (insertId int64, err
|
|
|
roles := s.GetCxtUserRoles()
|
|
|
isSales := false
|
|
|
for _, v := range roles {
|
|
|
- if v == "Sales" { // 销售角色
|
|
|
+ if v == "SalesEngineer" { // 销售角色
|
|
|
isSales = true
|
|
|
break
|
|
|
}
|
|
|
@@ -183,13 +183,14 @@ func (s *CustomerService) Create(req *model.CustomerAddSeq) (insertId int64, err
|
|
|
cusTomer.IsPublic = noPublic
|
|
|
cusTomer.SalesId = s.GetCxtUserId()
|
|
|
cusTomer.SalesName = s.CxtUser.NickName
|
|
|
+ cusTomer.CustStatus = "30"
|
|
|
insertId, err = s.Dao.InsertAndGetId(cusTomer)
|
|
|
if err != nil {
|
|
|
g.Log().Error(err)
|
|
|
return 0, err
|
|
|
}
|
|
|
- s.CreateBelong(gconv.Int(insertId))
|
|
|
- return
|
|
|
+ err = s.CreateBelong(gconv.Int(insertId))
|
|
|
+ return insertId, err
|
|
|
} else {
|
|
|
cusTomer.IsPublic = isPublic
|
|
|
insertId, err = s.Dao.InsertAndGetId(cusTomer)
|
|
|
@@ -478,6 +479,11 @@ func (s *CustomerService) MoveToPublicRequest(ctx context.Context, req *model.Mo
|
|
|
return myerrors.TipsError("移回用户不能为空")
|
|
|
}
|
|
|
|
|
|
+ cusType, err := service.GetDictDataByType(ctx, "cust_idy")
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
for _, v := range data {
|
|
|
if v.CustStatus == "10" {
|
|
|
return myerrors.TipsError(fmt.Sprintf("客户: %s 已被移回公海", v.CustName))
|
|
|
@@ -536,7 +542,7 @@ func (s *CustomerService) MoveToPublicRequest(ctx context.Context, req *model.Mo
|
|
|
{
|
|
|
Id: utils.String("TextField_S966SSJHCCG0"),
|
|
|
Name: utils.String("客户类别"),
|
|
|
- Value: utils.String(u.CustIndustry),
|
|
|
+ Value: utils.String(cusType[u.CustIndustry]),
|
|
|
},
|
|
|
{
|
|
|
Id: utils.String("TextField_Y3EQ11P49LC0"),
|
|
|
@@ -1145,13 +1151,17 @@ func (s *CustomerService) BatchCreatebelong(rep []*model.CustCustomer, req *mode
|
|
|
}
|
|
|
|
|
|
// 导出数据
|
|
|
-func (s *CustomerService) Export(req *model.CustCustomerExport) (content *model.CustExport, err error) {
|
|
|
+func (s *CustomerService) Export(ctx context.Context, 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
|
|
|
}
|
|
|
+ cusType, err := service.GetDictDataByType(ctx, "cust_idy")
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
f := excelize.NewFile()
|
|
|
index := f.NewSheet("Sheet1")
|
|
|
for index, item := range req.Columns {
|
|
|
@@ -1177,8 +1187,8 @@ func (s *CustomerService) Export(req *model.CustCustomerExport) (content *model.
|
|
|
if v == "所在地区" {
|
|
|
f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustLocation)
|
|
|
}
|
|
|
- if v == "客户行业" {
|
|
|
- f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustIndustry)
|
|
|
+ if v == "客户类型" {
|
|
|
+ f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), cusType[item.CustIndustry])
|
|
|
}
|
|
|
if v == "客户级别" {
|
|
|
f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustLevel)
|
|
|
@@ -1200,6 +1210,12 @@ func (s *CustomerService) Export(req *model.CustCustomerExport) (content *model.
|
|
|
if v == "创建时间" {
|
|
|
f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CreatedTime)
|
|
|
}
|
|
|
+ if v == "所在省" {
|
|
|
+ f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustProvince)
|
|
|
+ }
|
|
|
+ if v == "所在市" {
|
|
|
+ f.SetCellValue("Sheet1", service.Div(index+1)+strconv.Itoa(ck+2), item.CustCity)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|