Bladeren bron

客户联调

wangxingcheng 3 jaren geleden
bovenliggende
commit
192cb77d15

+ 1 - 8
opms_parent/app/handler/cust/customer.go

@@ -301,20 +301,13 @@ func (c *CustomerHeader) WriteCustLog(ctx context.Context, custType string, cust
 }
 
 func (c *CustomerHeader) DeriveList(ctx context.Context, req *model.CustCustomerExport, rsp *comm_def.CommonMsg) error {
-	//s := g.Server()
+
 	customerServer, err := server.NewCustomerService(ctx)
 	if err != nil {
 		g.Log().Error(err)
 		return gerror.New("系统异常,请重新尝试")
 	}
-	//g.Server()
-	//r := new(ghttp.Request)
 	buffer, _ := customerServer.Derive(req)
-	//fileName := gconv.String(gtime.Now()) + ".csv"
-	//r.Response.Header().Set("Content-Type", "text/csv")
-	//r.Response.Header().Set("Content-Disposition", "attachment;filename="+fileName)
-	//r.Response.Write(buffer.Bytes())
-
 	rsp.Data = g.Map{"list": buffer}
 	return nil
 }

+ 4 - 3
opms_parent/app/model/cust/cust_customer.go

@@ -23,15 +23,16 @@ type CustCustomerSearchReq struct {
 	CustIndustry string `json:"custIndustry"`
 	CustLevel    string `json:"custLevel"`
 	TargetType   string `json:"targetType,omitempty"`
+	FollowUpDate string `json:"followUpDate,omitempty"`
 	request.PageReq
 }
 
 //导出参数
 
 type CustCustomerExport struct {
-	CustCustomerSearchReq *CustCustomerSearchReq
-	Columns               []string `json:"columns"` // 导出列
-	request.PageReq
+	CustCustomerSearchReq
+	Columns []string `json:"columns"` // 导出列
+
 }
 
 //导出字节流

+ 14 - 4
opms_parent/app/service/cust/cust_customer.go

@@ -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) {
 	var con model.CustExport
 	req.CustCustomerSearchReq.TargetType = "11"
-	total, data, err := c.GetList(req.CustCustomerSearchReq)
+	total, data, err := c.GetList(&req.CustCustomerSearchReq)
 	if err != nil {
 		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) {
+
 	g.Log().Info("serverS", req)
 	Model := c.Dao.M
 	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)
 		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()
 	if err != nil {
 		g.Log().Error(err)
@@ -310,7 +315,7 @@ func (c *CustomerService) MoveToPubic(ids []int64) error {
 func (c *CustomerService) DistriCustomer(req *model.DistriCustomer) error {
 	custModel := c.Dao.M
 	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("该数据不存在")
 		return err
 	}
@@ -329,6 +334,7 @@ func (c *CustomerService) DistriCustomer(req *model.DistriCustomer) error {
 	}
 	maps["sale_name"] = req.SalesName
 	maps["opn_people"] = c.GetCxtUserName()
+	//maps["created_by"] = c.GetCxtUserId()
 	err = c.belongInsters(rep.List(), maps)
 	if err != nil {
 		err = gerror.New("分配客户失败")
@@ -343,6 +349,10 @@ func (c *CustomerService) GetEntityById(ids []int64) (entityInfo []*model.CustLi
 	//FollowModel := c.FollowDao.M
 
 	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 {
 		g.Log().Error(err)
 		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_people"] = parameter["opn_people"]
 		belong["opn_datetime"] = date_time
-		belong["created_by"] = parameter["created_by"]
+		belong["created_by"] = c.GetCxtUserId()
 		belong["remark"] = parameter["remark"]
-		belong["created_name"] = "admin"
+		belong["created_name"] = c.GetCxtUserName()
 		belong["created_time"] = date_time
 		belong["opn_datetime"] = date_time
 		maps = append(maps, belong)

+ 8 - 5
opms_parent/main.go

@@ -3,14 +3,14 @@ package main
 import (
 	"context"
 
-	"dashoo.cn/micro/app/handler/plat"
-
-	"dashoo.cn/micro/app/handler/base"
-	"dashoo.cn/micro/app/handler/cust"
-
 	"dashoo.cn/opms_libary/micro_srv"
 	"github.com/gogf/gf/frame/g"
 	"github.com/smallnest/rpcx/protocol"
+
+	"dashoo.cn/micro/app/handler/base"
+	"dashoo.cn/micro/app/handler/cust"
+	"dashoo.cn/micro/app/handler/plat"
+	"dashoo.cn/micro/app/handler/work"
 )
 
 func main() {
@@ -35,6 +35,9 @@ func main() {
 	s.RegisterName("TaskLog", new(plat.TaskLogHandler), "")
 	s.RegisterName("TaskProgress", new(plat.TaskProgressHandler), "")
 
+	//工单
+	s.RegisterName("WorkOrder", new(work.WorkOrderHandler), "")
+
 	// 注册服务对象
 	//s.RegisterName("Auth", new(handler.Auth), "")