Эх сурвалжийг харах

Merge remote-tracking branch 'origin/develop' into feature/培训工单

Sun Xinyuan 2 жил өмнө
parent
commit
9aa76e5d8a

+ 96 - 90
opms_parent/app/dao/cust/internal/product_consult_record.go

@@ -31,36 +31,38 @@ type ProductConsultRecordDao struct {
 
 // ProductConsultRecordColumns defines and stores column names for table product_consult_record.
 type productConsultRecordColumns struct {
-	Id              string // 主键
-	Code            string // 序号
-	ConsultTime     string // 日期时间
-	ProvinceId      string // 所在省ID
-	Province        string // 所在省
-	CityId          string // 所在市ID
-	City            string // 所在市
-	Unit            string // 单位名称
-	Name            string // 联系人
-	Contact         string // 联系方式
-	Product         string // 咨询产品
-	InchargeId      string // 对接人ID
-	InchargeName    string // 对接人(销售工程师)
-	Content         string // 内容
-	Progress        string // 进展
-	NextPlan        string // 下一步计划
-	DistributorId   string // 经销商ID
-	DistributorName string // 经销商
-	CustId          string // 关联客户
-	CustName        string // 客户名称
-	NboId           string // 关联项目
-	NboName         string // 项目名称
-	Remark          string // 备注
-	CreatedBy       string // 创建者
-	CreatedName     string // 创建人
-	CreatedTime     string // 创建时间
-	UpdatedBy       string // 更新者
-	UpdatedName     string // 更新人
-	UpdatedTime     string // 更新时间
-	DeletedTime     string // 删除时间
+	Id                    string // 主键
+	Code                  string // 序号
+	ConsultTime           string // 日期时间
+	ProvinceId            string // 所在省ID
+	Province              string // 所在省
+	CityId                string // 所在市ID
+	City                  string // 所在市
+	Unit                  string // 单位名称
+	Name                  string // 联系人
+	Contact               string // 联系方式
+	Product               string // 咨询产品
+	InchargeId            string // 对接人ID
+	InchargeName          string // 对接人(销售工程师)
+	Content               string // 内容
+	Progress              string // 进展
+	NextPlan              string // 下一步计划
+	DistributorId         string // 经销商ID
+	DistributorName       string // 经销商
+	CustId                string // 关联客户
+	CustName              string // 客户名称
+	NboId                 string // 关联项目
+	NboName               string // 项目名称
+	State                 string // 状态:10(其他)未跟进;20已跟进
+	FollowCommunicateCase string // 10、信息有效,可继续跟进,转C类订单;20、信息有效,可转为储备用户;30、信息无效,不再跟进。
+	Remark                string // 备注
+	CreatedBy             string // 创建者
+	CreatedName           string // 创建人
+	CreatedTime           string // 创建时间
+	UpdatedBy             string // 更新者
+	UpdatedName           string // 更新人
+	UpdatedTime           string // 更新时间
+	DeletedTime           string // 删除时间
 }
 
 var (
@@ -70,36 +72,38 @@ var (
 		DB:    g.DB("default"),
 		Table: "product_consult_record",
 		C: productConsultRecordColumns{
-			Id:              "id",
-			Code:            "code",
-			ConsultTime:     "consult_time",
-			ProvinceId:      "province_id",
-			Province:        "province",
-			CityId:          "city_id",
-			City:            "city",
-			Unit:            "unit",
-			Name:            "name",
-			Contact:         "contact",
-			Product:         "product",
-			InchargeId:      "incharge_id",
-			InchargeName:    "incharge_name",
-			Content:         "content",
-			Progress:        "progress",
-			NextPlan:        "next_plan",
-			DistributorId:   "distributor_id",
-			DistributorName: "distributor_name",
-			CustId:          "cust_id",
-			CustName:        "cust_name",
-			NboId:           "nbo_id",
-			NboName:         "nbo_name",
-			Remark:          "remark",
-			CreatedBy:       "created_by",
-			CreatedName:     "created_name",
-			CreatedTime:     "created_time",
-			UpdatedBy:       "updated_by",
-			UpdatedName:     "updated_name",
-			UpdatedTime:     "updated_time",
-			DeletedTime:     "deleted_time",
+			Id:                    "id",
+			Code:                  "code",
+			ConsultTime:           "consult_time",
+			ProvinceId:            "province_id",
+			Province:              "province",
+			CityId:                "city_id",
+			City:                  "city",
+			Unit:                  "unit",
+			Name:                  "name",
+			Contact:               "contact",
+			Product:               "product",
+			InchargeId:            "incharge_id",
+			InchargeName:          "incharge_name",
+			Content:               "content",
+			Progress:              "progress",
+			NextPlan:              "next_plan",
+			DistributorId:         "distributor_id",
+			DistributorName:       "distributor_name",
+			CustId:                "cust_id",
+			CustName:              "cust_name",
+			NboId:                 "nbo_id",
+			NboName:               "nbo_name",
+			State:                 "state",
+			FollowCommunicateCase: "follow_communicate_case",
+			Remark:                "remark",
+			CreatedBy:             "created_by",
+			CreatedName:           "created_name",
+			CreatedTime:           "created_time",
+			UpdatedBy:             "updated_by",
+			UpdatedName:           "updated_name",
+			UpdatedTime:           "updated_time",
+			DeletedTime:           "deleted_time",
 		},
 	}
 )
@@ -111,36 +115,38 @@ func NewProductConsultRecordDao(tenant string) ProductConsultRecordDao {
 		DB:    g.DB(tenant),
 		Table: "product_consult_record",
 		C: productConsultRecordColumns{
-			Id:              "id",
-			Code:            "code",
-			ConsultTime:     "consult_time",
-			ProvinceId:      "province_id",
-			Province:        "province",
-			CityId:          "city_id",
-			City:            "city",
-			Unit:            "unit",
-			Name:            "name",
-			Contact:         "contact",
-			Product:         "product",
-			InchargeId:      "incharge_id",
-			InchargeName:    "incharge_name",
-			Content:         "content",
-			Progress:        "progress",
-			NextPlan:        "next_plan",
-			DistributorId:   "distributor_id",
-			DistributorName: "distributor_name",
-			CustId:          "cust_id",
-			CustName:        "cust_name",
-			NboId:           "nbo_id",
-			NboName:         "nbo_name",
-			Remark:          "remark",
-			CreatedBy:       "created_by",
-			CreatedName:     "created_name",
-			CreatedTime:     "created_time",
-			UpdatedBy:       "updated_by",
-			UpdatedName:     "updated_name",
-			UpdatedTime:     "updated_time",
-			DeletedTime:     "deleted_time",
+			Id:                    "id",
+			Code:                  "code",
+			ConsultTime:           "consult_time",
+			ProvinceId:            "province_id",
+			Province:              "province",
+			CityId:                "city_id",
+			City:                  "city",
+			Unit:                  "unit",
+			Name:                  "name",
+			Contact:               "contact",
+			Product:               "product",
+			InchargeId:            "incharge_id",
+			InchargeName:          "incharge_name",
+			Content:               "content",
+			Progress:              "progress",
+			NextPlan:              "next_plan",
+			DistributorId:         "distributor_id",
+			DistributorName:       "distributor_name",
+			CustId:                "cust_id",
+			CustName:              "cust_name",
+			NboId:                 "nbo_id",
+			NboName:               "nbo_name",
+			State:                 "state",
+			FollowCommunicateCase: "follow_communicate_case",
+			Remark:                "remark",
+			CreatedBy:             "created_by",
+			CreatedName:           "created_name",
+			CreatedTime:           "created_time",
+			UpdatedBy:             "updated_by",
+			UpdatedName:           "updated_name",
+			UpdatedTime:           "updated_time",
+			DeletedTime:           "deleted_time",
 		},
 	}
 	return dao

+ 22 - 10
opms_parent/app/dao/train/internal/train_sale_apply.go

@@ -32,13 +32,17 @@ type trainSaleApplyColumns struct {
 	MainProduct       string // 主营产品
 	MainCustomer      string // 主要客户
 	Trainees          string // 参训人员
-	TrainingDate      string // 培训日期
-	SpecificStartTime string // 开始时间
-	SpecificEndTime   string // 结束时间
+	ExpectTrainDate   string // 期望培训日期
+	ExpectStartTime   string // 期望开始时间
+	ExpectEndTime     string // 期望结束时间
 	TrainTitle        string // 培训主题
 	InstructorRequire string // 讲师要求
 	FocusPoint        string // 关注要点
-	ApplyType         string // 申请状态(10 未总结 20 总结完成)
+	TrainInstructor   string // 培训讲师
+	TrainDate         string // 培训日期
+	SpecificStartTime string // 开始时间
+	SpecificEndTime   string // 结束时间
+	ApplyType         string // 申请状态(10 已提交 20 已确认 30 总结完成)
 	CreatedBy         string // 创建人
 	CreatedName       string // 创建人
 	CreatedTime       string // 创建时间
@@ -61,12 +65,16 @@ var (
 			MainProduct:       "main_product",
 			MainCustomer:      "main_customer",
 			Trainees:          "trainees",
-			TrainingDate:      "training_date",
-			SpecificStartTime: "specific_start_time",
-			SpecificEndTime:   "specific_end_time",
+			ExpectTrainDate:   "expect_train_date",
+			ExpectStartTime:   "expect_start_time",
+			ExpectEndTime:     "expect_end_time",
 			TrainTitle:        "train_title",
 			InstructorRequire: "instructor_require",
 			FocusPoint:        "focus_point",
+			TrainInstructor:   "train_instructor",
+			TrainDate:         "train_date",
+			SpecificStartTime: "specific_start_time",
+			SpecificEndTime:   "specific_end_time",
 			ApplyType:         "apply_type",
 			CreatedBy:         "created_by",
 			CreatedName:       "created_name",
@@ -92,12 +100,16 @@ func NewTrainSaleApplyDao(tenant string) TrainSaleApplyDao {
 			MainProduct:       "main_product",
 			MainCustomer:      "main_customer",
 			Trainees:          "trainees",
-			TrainingDate:      "training_date",
-			SpecificStartTime: "specific_start_time",
-			SpecificEndTime:   "specific_end_time",
+			ExpectTrainDate:   "expect_train_date",
+			ExpectStartTime:   "expect_start_time",
+			ExpectEndTime:     "expect_end_time",
 			TrainTitle:        "train_title",
 			InstructorRequire: "instructor_require",
 			FocusPoint:        "focus_point",
+			TrainInstructor:   "train_instructor",
+			TrainDate:         "train_date",
+			SpecificStartTime: "specific_start_time",
+			SpecificEndTime:   "specific_end_time",
 			ApplyType:         "apply_type",
 			CreatedBy:         "created_by",
 			CreatedName:       "created_name",

+ 3 - 3
opms_parent/app/dao/train/internal/train_sale_apply_summary.go

@@ -30,7 +30,7 @@ type trainSaleApplySummaryColumns struct {
 	ApplyId         string // 申请ID
 	ExplainDuration string // 讲解时长
 	QuestionRecord  string // 提问记录
-	TrainingSummary string // 培训效果总结
+	TrainSummary    string // 培训效果总结
 	NextStep        string // 下一步工作计划
 	CreatedBy       string // 创建人
 	CreatedName     string // 创建人
@@ -52,7 +52,7 @@ var (
 			ApplyId:         "apply_id",
 			ExplainDuration: "explain_duration",
 			QuestionRecord:  "question_record",
-			TrainingSummary: "training_summary",
+			TrainSummary:    "train_summary",
 			NextStep:        "next_step",
 			CreatedBy:       "created_by",
 			CreatedName:     "created_name",
@@ -76,7 +76,7 @@ func NewTrainSaleApplySummaryDao(tenant string) TrainSaleApplySummaryDao {
 			ApplyId:         "apply_id",
 			ExplainDuration: "explain_duration",
 			QuestionRecord:  "question_record",
-			TrainingSummary: "training_summary",
+			TrainSummary:    "train_summary",
 			NextStep:        "next_step",
 			CreatedBy:       "created_by",
 			CreatedName:     "created_name",

+ 13 - 0
opms_parent/app/handler/cust/product_consult_record.go

@@ -72,6 +72,19 @@ func (c *ProductConsultRecordHandler) Update(ctx context.Context, req *model.Pro
 	return nil
 }
 
+func (c *ProductConsultRecordHandler) FollowUp(ctx context.Context, req *model.FollowUpReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("ProductConsultRecordHandler.Update request %#v ", *req)
+	s, err := service.NewProductConsultRecordService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.FollowUp(ctx, req)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
 func (c *ProductConsultRecordHandler) Delete(ctx context.Context, req *model.IdsReq, rsp *comm_def.CommonMsg) error {
 	g.Log().Infof("ProductConsultRecordHandler.Delete request %#v ", *req)
 	s, err := service.NewProductConsultRecordService(ctx)

+ 32 - 30
opms_parent/app/model/cust/internal/product_consult_record.go

@@ -10,34 +10,36 @@ import (
 
 // ProductConsultRecord is the golang structure for table product_consult_record.
 type ProductConsultRecord struct {
-	Id              int         `orm:"id,primary"       json:"id"`              // 主键
-	Code            string      `orm:"code"             json:"code"`            // 序号
-	ConsultTime     *gtime.Time `orm:"consult_time"     json:"consultTime"`     // 日期时间
-	ProvinceId      int         `orm:"province_id"      json:"provinceId"`      // 所在省ID
-	Province        string      `orm:"province"         json:"province"`        // 所在省
-	CityId          int         `orm:"city_id"          json:"cityId"`          // 所在市ID
-	City            string      `orm:"city"             json:"city"`            // 所在市
-	Unit            string      `orm:"unit"             json:"unit"`            // 单位名称
-	Name            string      `orm:"name"             json:"name"`            // 联系人
-	Contact         string      `orm:"contact"          json:"contact"`         // 联系方式
-	Product         string      `orm:"product"          json:"product"`         // 咨询产品
-	InchargeId      int         `orm:"incharge_id"      json:"inchargeId"`      // 对接人ID
-	InchargeName    string      `orm:"incharge_name"    json:"inchargeName"`    // 对接人(销售工程师)
-	Content         string      `orm:"content"          json:"content"`         // 内容
-	Progress        string      `orm:"progress"         json:"progress"`        // 进展
-	NextPlan        string      `orm:"next_plan"        json:"nextPlan"`        // 下一步计划
-	DistributorId   int         `orm:"distributor_id"   json:"distributorId"`   // 经销商ID
-	DistributorName string      `orm:"distributor_name" json:"distributorName"` // 经销商
-	CustId          int         `orm:"cust_id"          json:"custId"`          // 关联客户
-	CustName        string      `orm:"cust_name"        json:"custName"`        // 客户名称
-	NboId           int         `orm:"nbo_id"           json:"nboId"`           // 关联项目
-	NboName         string      `orm:"nbo_name"         json:"nboName"`         // 项目名称
-	Remark          string      `orm:"remark"           json:"remark"`          // 备注
-	CreatedBy       int         `orm:"created_by"       json:"createdBy"`       // 创建者
-	CreatedName     string      `orm:"created_name"     json:"createdName"`     // 创建人
-	CreatedTime     *gtime.Time `orm:"created_time"     json:"createdTime"`     // 创建时间
-	UpdatedBy       int         `orm:"updated_by"       json:"updatedBy"`       // 更新者
-	UpdatedName     string      `orm:"updated_name"     json:"updatedName"`     // 更新人
-	UpdatedTime     *gtime.Time `orm:"updated_time"     json:"updatedTime"`     // 更新时间
-	DeletedTime     *gtime.Time `orm:"deleted_time"     json:"deletedTime"`     // 删除时间
+	Id                    int         `orm:"id,primary"              json:"id"`                    // 主键
+	Code                  string      `orm:"code"                    json:"code"`                  // 序号
+	ConsultTime           *gtime.Time `orm:"consult_time"            json:"consultTime"`           // 日期时间
+	ProvinceId            int         `orm:"province_id"             json:"provinceId"`            // 所在省ID
+	Province              string      `orm:"province"                json:"province"`              // 所在省
+	CityId                int         `orm:"city_id"                 json:"cityId"`                // 所在市ID
+	City                  string      `orm:"city"                    json:"city"`                  // 所在市
+	Unit                  string      `orm:"unit"                    json:"unit"`                  // 单位名称
+	Name                  string      `orm:"name"                    json:"name"`                  // 联系人
+	Contact               string      `orm:"contact"                 json:"contact"`               // 联系方式
+	Product               string      `orm:"product"                 json:"product"`               // 咨询产品
+	InchargeId            int         `orm:"incharge_id"             json:"inchargeId"`            // 对接人ID
+	InchargeName          string      `orm:"incharge_name"           json:"inchargeName"`          // 对接人(销售工程师)
+	Content               string      `orm:"content"                 json:"content"`               // 内容
+	Progress              string      `orm:"progress"                json:"progress"`              // 进展
+	NextPlan              string      `orm:"next_plan"               json:"nextPlan"`              // 下一步计划
+	DistributorId         int         `orm:"distributor_id"          json:"distributorId"`         // 经销商ID
+	DistributorName       string      `orm:"distributor_name"        json:"distributorName"`       // 经销商
+	CustId                int         `orm:"cust_id"                 json:"custId"`                // 关联客户
+	CustName              string      `orm:"cust_name"               json:"custName"`              // 客户名称
+	NboId                 int         `orm:"nbo_id"                  json:"nboId"`                 // 关联项目
+	NboName               string      `orm:"nbo_name"                json:"nboName"`               // 项目名称
+	State                 string      `orm:"state"                   json:"state"`                 // 状态:10(其他)未跟进;20已跟进
+	FollowCommunicateCase string      `orm:"follow_communicate_case" json:"followCommunicateCase"` // 10、信息有效,可继续跟进,转C类订单;20、信息有效,可转为储备用户;30、信息无效,不再跟进。
+	Remark                string      `orm:"remark"                  json:"remark"`                // 备注
+	CreatedBy             int         `orm:"created_by"              json:"createdBy"`             // 创建者
+	CreatedName           string      `orm:"created_name"            json:"createdName"`           // 创建人
+	CreatedTime           *gtime.Time `orm:"created_time"            json:"createdTime"`           // 创建时间
+	UpdatedBy             int         `orm:"updated_by"              json:"updatedBy"`             // 更新者
+	UpdatedName           string      `orm:"updated_name"            json:"updatedName"`           // 更新人
+	UpdatedTime           *gtime.Time `orm:"updated_time"            json:"updatedTime"`           // 更新时间
+	DeletedTime           *gtime.Time `orm:"deleted_time"            json:"deletedTime"`           // 删除时间
 }

+ 38 - 23
opms_parent/app/model/cust/product_consult_record.go

@@ -17,6 +17,7 @@ type ProductConsultRecord internal.ProductConsultRecord
 type ProductConsultRecordListReq struct {
 	request.PageReq
 	Name         string `json:"name"`         // 联系人
+	State        string `json:"state"`        // 状态
 	InchargeName string `json:"inchargeName"` // 对接人(销售工程师)
 	Unit         string `json:"unit"`         // 单位名称
 }
@@ -34,30 +35,44 @@ type ProductConsultRecordAddReq struct {
 	Product      string      `json:"product" v:"required#请输入咨询产品"`      // 咨询产品
 	InchargeId   int         `json:"inchargeId" v:"required#请输入对接人"`    // 对接人ID
 	InchargeName string      `json:"inchargeName"`                      // 对接人(销售工程师)
-	Content      string      `json:"content" v:"required#请输入400电话内容"`   // 内容
+	Remark       string      `json:"remark"`                            // 备注
 }
 
 type ProductConsultRecordUpdateReq struct {
-	Id              int         `json:"id" v:"required#请输入Id"`
-	ConsultTime     *gtime.Time `json:"consultTime"`     // 日期时间
-	ProvinceId      int         `json:"provinceId"`      // 所在省ID
-	Province        string      `json:"province"`        // 所在省
-	CityId          int         `json:"cityId"`          // 所在市ID
-	City            string      `json:"city"`            // 所在市
-	Unit            string      `json:"unit"`            // 单位名称
-	Name            string      `json:"name"`            // 联系人
-	Contact         string      `json:"contact"`         // 联系方式
-	Product         string      `json:"product"`         // 咨询产品
-	InchargeId      int         `json:"inchargeId"`      // 对接人ID
-	InchargeName    string      `json:"inchargeName"`    // 对接人(销售工程师)
-	Content         string      `json:"content"`         // 内容
-	Progress        string      `json:"progress"`        // 进展
-	NextPlan        string      `json:"nextPlan"`        // 下一步计划
-	DistributorId   int         `json:"distributorId"`   // 经销商ID
-	DistributorName string      `json:"distributorName"` // 经销商
-	CustId          int         `json:"custId"`          // 关联客户
-	CustName        string      `json:"custName"`        // 客户名称
-	NboId           int         `json:"nboId"`           // 关联项目
-	NboName         string      `json:"nboName"`         // 项目名称
-	Remark          string      `json:"remark"`          // 备注
+	Id           int         `json:"id" v:"required#请输入Id"`
+	ConsultTime  *gtime.Time `json:"consultTime"`  // 日期时间
+	ProvinceId   int         `json:"provinceId"`   // 所在省ID
+	Province     string      `json:"province"`     // 所在省
+	CityId       int         `json:"cityId"`       // 所在市ID
+	City         string      `json:"city"`         // 所在市
+	Unit         string      `json:"unit"`         // 单位名称
+	Name         string      `json:"name"`         // 联系人
+	Contact      string      `json:"contact"`      // 联系方式
+	Product      string      `json:"product"`      // 咨询产品
+	InchargeId   int         `json:"inchargeId"`   // 对接人ID
+	InchargeName string      `json:"inchargeName"` // 对接人(销售工程师)
+	Content      string      `json:"content"`      // 内容
+	//Progress        string      `json:"progress"`        // 进展
+	//NextPlan        string      `json:"nextPlan"`        // 下一步计划
+	//DistributorId   int         `json:"distributorId"`   // 经销商ID
+	//DistributorName string      `json:"distributorName"` // 经销商
+	//CustId          int         `json:"custId"`          // 关联客户
+	//CustName        string      `json:"custName"`        // 客户名称
+	//NboId           int         `json:"nboId"`           // 关联项目
+	//NboName         string      `json:"nboName"`         // 项目名称
+	Remark string `json:"remark"` // 备注
+}
+
+type FollowUpReq struct {
+	Id              int    `json:"id" v:"required#请输入Id"`
+	Content         string `json:"content"`         // 内容
+	Progress        string `json:"progress"`        // 进展
+	NextPlan        string `json:"nextPlan"`        // 下一步计划
+	DistributorId   int    `json:"distributorId"`   // 经销商ID
+	DistributorName string `json:"distributorName"` // 经销商
+	//CustId                int    `json:"custId"`                // 关联客户
+	//CustName              string `json:"custName"`              // 客户名称
+	NboId                 int    `json:"nboId"`                 // 关联项目
+	NboName               string `json:"nboName"`               // 项目名称
+	FollowCommunicateCase string `json:"followCommunicateCase"` // 10、信息有效,可继续跟进,转C类订单;20、信息有效,可转为储备用户;30、信息无效,不再跟进。
 }

+ 26 - 22
opms_parent/app/model/train/internal/train_sale_apply.go

@@ -5,29 +5,33 @@
 package internal
 
 import (
-    "github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/os/gtime"
 )
 
 // TrainSaleApply is the golang structure for table train_sale_apply.
 type TrainSaleApply struct {
-    Id                int         `orm:"id,primary"          json:"id"`                // 主键                               
-    DistributorId     int         `orm:"distributor_id"      json:"distributorId"`     // 渠道ID                             
-    DistributorName   string      `orm:"distributor_name"    json:"distributorName"`   // 渠道名称                           
-    MainProduct       string      `orm:"main_product"        json:"mainProduct"`       // 主营产品                           
-    MainCustomer      string      `orm:"main_customer"       json:"mainCustomer"`      // 主要客户                           
-    Trainees          string      `orm:"trainees"            json:"trainees"`          // 参训人员                           
-    TrainingDate      *gtime.Time `orm:"training_date"       json:"trainingDate"`      // 培训日期                           
-    SpecificStartTime *gtime.Time `orm:"specific_start_time" json:"specificStartTime"` // 开始时间                           
-    SpecificEndTime   *gtime.Time `orm:"specific_end_time"   json:"specificEndTime"`   // 结束时间                           
-    TrainTitle        string      `orm:"train_title"         json:"trainTitle"`        // 培训主题                           
-    InstructorRequire string      `orm:"instructor_require"  json:"instructorRequire"` // 讲师要求                           
-    FocusPoint        string      `orm:"focus_point"         json:"focusPoint"`        // 关注要点                           
-    ApplyType         string      `orm:"apply_type"          json:"applyType"`         // 申请状态(10 未总结 20 总结完成)  
-    CreatedBy         int         `orm:"created_by"          json:"createdBy"`         // 创建人                             
-    CreatedName       string      `orm:"created_name"        json:"createdName"`       // 创建人                             
-    CreatedTime       *gtime.Time `orm:"created_time"        json:"createdTime"`       // 创建时间                           
-    UpdatedBy         int         `orm:"updated_by"          json:"updatedBy"`         // 更新人                             
-    UpdatedName       string      `orm:"updated_name"        json:"updatedName"`       // 更新人                             
-    UpdatedTime       *gtime.Time `orm:"updated_time"        json:"updatedTime"`       // 更新时间                           
-    DeletedTime       *gtime.Time `orm:"deleted_time"        json:"deletedTime"`       // 删除时间                           
-}
+	Id                int         `orm:"id,primary"          json:"id"`                // 主键
+	DistributorId     int         `orm:"distributor_id"      json:"distributorId"`     // 渠道ID
+	DistributorName   string      `orm:"distributor_name"    json:"distributorName"`   // 渠道名称
+	MainProduct       string      `orm:"main_product"        json:"mainProduct"`       // 主营产品
+	MainCustomer      string      `orm:"main_customer"       json:"mainCustomer"`      // 主要客户
+	Trainees          string      `orm:"trainees"            json:"trainees"`          // 参训人员
+	ExpectTrainDate   *gtime.Time `orm:"expect_train_date"   json:"expectTrainDate"`   // 期望培训日期
+	ExpectStartTime   *gtime.Time `orm:"expect_start_time"   json:"expectStartTime"`   // 期望开始时间
+	ExpectEndTime     *gtime.Time `orm:"expect_end_time"     json:"expectEndTime"`     // 期望结束时间
+	TrainTitle        string      `orm:"train_title"         json:"trainTitle"`        // 培训主题
+	InstructorRequire string      `orm:"instructor_require"  json:"instructorRequire"` // 讲师要求
+	FocusPoint        string      `orm:"focus_point"         json:"focusPoint"`        // 关注要点
+	TrainInstructor   string      `orm:"train_instructor"    json:"trainInstructor"`   // 培训讲师
+	TrainDate         *gtime.Time `orm:"train_date"          json:"trainDate"`         // 培训日期
+	SpecificStartTime *gtime.Time `orm:"specific_start_time" json:"specificStartTime"` // 开始时间
+	SpecificEndTime   *gtime.Time `orm:"specific_end_time"   json:"specificEndTime"`   // 结束时间
+	ApplyType         string      `orm:"apply_type"          json:"applyType"`         // 申请状态(10 已提交 20 已确认 30 总结完成)
+	CreatedBy         int         `orm:"created_by"          json:"createdBy"`         // 创建人
+	CreatedName       string      `orm:"created_name"        json:"createdName"`       // 创建人
+	CreatedTime       *gtime.Time `orm:"created_time"        json:"createdTime"`       // 创建时间
+	UpdatedBy         int         `orm:"updated_by"          json:"updatedBy"`         // 更新人
+	UpdatedName       string      `orm:"updated_name"        json:"updatedName"`       // 更新人
+	UpdatedTime       *gtime.Time `orm:"updated_time"        json:"updatedTime"`       // 更新时间
+	DeletedTime       *gtime.Time `orm:"deleted_time"        json:"deletedTime"`       // 删除时间
+}

+ 1 - 1
opms_parent/app/model/train/internal/train_sale_apply_summary.go

@@ -14,7 +14,7 @@ type TrainSaleApplySummary struct {
     ApplyId         int         `orm:"apply_id"         json:"applyId"`         // 申请ID          
     ExplainDuration string      `orm:"explain_duration" json:"explainDuration"` // 讲解时长        
     QuestionRecord  string      `orm:"question_record"  json:"questionRecord"`  // 提问记录        
-    TrainingSummary string      `orm:"training_summary" json:"trainingSummary"` // 培训效果总结    
+    TrainSummary    string      `orm:"train_summary"    json:"trainSummary"`    // 培训效果总结    
     NextStep        string      `orm:"next_step"        json:"nextStep"`        // 下一步工作计划  
     CreatedBy       int         `orm:"created_by"       json:"createdBy"`       // 创建人          
     CreatedName     string      `orm:"created_name"     json:"createdName"`     // 创建人          

+ 35 - 26
opms_parent/app/model/train/train_sale_apply.go

@@ -17,6 +17,7 @@ type TrainSaleApply internal.TrainSaleApply
 
 type TrainSaleApplySearchReq struct {
 	request.PageReq
+	CreatedBy     int    `json:"createdBy"`     // 创建人
 	DistributorId int    `json:"distributorId"` // 渠道ID
 	MainProduct   string `json:"mainProduct"`   // 主营产品
 }
@@ -28,41 +29,49 @@ type TrainSaleApplyRes struct {
 	MainProduct       string      `json:"mainProduct"`       // 主营产品
 	MainCustomer      string      `json:"mainCustomer"`      // 主要客户
 	Trainees          string      `json:"trainees"`          // 参训人员
-	TrainingDate      *gtime.Time `json:"trainingDate"`      // 培训日期
+	ExpectTrainDate   *gtime.Time `json:"expectTrainDate"`   // 期望培训日期
+	ExpectStartTime   *gtime.Time `json:"expectStartTime"`   // 期望开始时间
+	ExpectEndTime     *gtime.Time `json:"expectEndTime"`     // 期望结束时间
+	TrainInstructor   string      `json:"trainInstructor"`   // 培训讲师
+	TrainDate         *gtime.Time `json:"trainDate"`         // 培训日期
 	SpecificStartTime *gtime.Time `json:"specificStartTime"` // 开始时间
 	SpecificEndTime   *gtime.Time `json:"specificEndTime"`   // 结束时间
 	TrainTitle        string      `json:"trainTitle"`        // 培训主题
 	InstructorRequire string      `json:"instructorRequire"` // 讲师要求
 	FocusPoint        string      `json:"focusPoint"`        // 关注要点
-	ApplyType         string      `json:"applyType"`         // 申请状态(10 未总结 20 总结完成)
+	ApplyType         string      `json:"applyType"`         // 申请状态(10 已提交 20 已确认 30 总结完成)
 }
 
 type TrainSaleApplyCreateReq struct {
-	DistributorId     int         `json:"distributorId" v:"required|min:1#|渠道不能为空"` // 渠道ID
-	DistributorName   string      `json:"distributorName" v:"required#渠道不能为空"`      // 渠道名称
-	MainProduct       string      `json:"mainProduct" v:"required#渠道名称不能为空"`        // 主营产品
-	MainCustomer      string      `json:"mainCustomer" v:"required#渠道名称不能为空"`       // 主要客户
-	Trainees          string      `json:"trainees" v:"required#渠道名称不能为空"`           // 参训人员
-	TrainingDate      *gtime.Time `json:"trainingDate" v:"required#渠道名称不能为空"`       // 培训日期
-	SpecificStartTime *gtime.Time `json:"specificStartTime" v:"required#开始时间不能为空"`  // 开始时间
-	SpecificEndTime   *gtime.Time `json:"specificEndTime" v:"required#结束时间不能为空"`    // 结束时间
-	TrainTitle        string      `json:"trainTitle" v:"required#渠道名称不能为空"`         // 培训主题
-	InstructorRequire string      `json:"instructorRequire" v:"required#渠道名称不能为空"`  // 讲师要求
-	FocusPoint        string      `json:"focusPoint" v:"required#渠道名称不能为空"`         // 关注要点
+	DistributorId     int         `json:"distributorId" v:"required|min:1#|渠道ID不能为空"`  // 渠道ID
+	DistributorName   string      `json:"distributorName" v:"required#渠道不能为空"`         // 渠道名称
+	MainProduct       string      `json:"mainProduct" v:"required#主营产品不能为空"`         // 主营产品
+	MainCustomer      string      `json:"mainCustomer" v:"required#主要客户不能为空"`        // 主要客户
+	Trainees          string      `json:"trainees" v:"required#参训人员不能为空"`            // 参训人员
+	ExpectTrainDate   *gtime.Time `json:"expectTrainDate" v:"required#期望培训日期不能为空"` // 期望培训日期
+	ExpectStartTime   *gtime.Time `json:"expectStartTime" v:"required#期望开始时间不能为空"` // 期望开始时间
+	ExpectEndTime     *gtime.Time `json:"expectEndTime" v:"required#期望结束时间不能为空"`   // 期望结束时间
+	TrainTitle        string      `json:"trainTitle" v:"required#培训主题不能为空"`          // 培训主题
+	InstructorRequire string      `json:"instructorRequire" v:"required#讲师要求不能为空"`   // 讲师要求
+	FocusPoint        string      `json:"focusPoint" v:"required#关注要点不能为空"`          // 关注要点
 }
 
 type TrainSaleApplyUpdateReq struct {
-	Id                int         `json:"id" v:"required|min:1#|主ID不能为空"`           // 主键
-	DistributorId     int         `json:"distributorId" v:"required|min:1#|渠道不能为空"` // 渠道ID
-	DistributorName   string      `json:"distributorName" v:"required#渠道不能为空"`      // 渠道名称
-	MainProduct       string      `json:"mainProduct" v:"required#渠道名称不能为空"`        // 主营产品
-	MainCustomer      string      `json:"mainCustomer" v:"required#渠道名称不能为空"`       // 主要客户
-	Trainees          string      `json:"trainees" v:"required#渠道名称不能为空"`           // 参训人员
-	TrainingDate      *gtime.Time `json:"trainingDate" v:"required#渠道名称不能为空"`       // 培训日期
-	SpecificStartTime *gtime.Time `json:"specificStartTime" v:"required#开始时间不能为空"`  // 开始时间
-	SpecificEndTime   *gtime.Time `json:"specificEndTime" v:"required#结束时间不能为空"`    // 结束时间
-	TrainTitle        string      `json:"trainTitle" v:"required#渠道名称不能为空"`         // 培训主题
-	InstructorRequire string      `json:"instructorRequire" v:"required#渠道名称不能为空"`  // 讲师要求
-	FocusPoint        string      `json:"focusPoint" v:"required#渠道名称不能为空"`         // 关注要点
-	ApplyType         string      `json:"applyType" v:"required#申请状态不能为空"`          // 申请状态(10 未总结 20 总结完成)
+	Id                int         `json:"id" v:"required|min:1#|主ID不能为空"`               // 主键
+	DistributorId     int         `json:"distributorId" v:"required|min:1#|渠道ID不能为空"`  // 渠道ID
+	DistributorName   string      `json:"distributorName" v:"required#渠道不能为空"`         // 渠道名称
+	MainProduct       string      `json:"mainProduct" v:"required#主营产品不能为空"`         // 主营产品
+	MainCustomer      string      `json:"mainCustomer" v:"required#主要客户不能为空"`        // 主要客户
+	Trainees          string      `json:"trainees" v:"required#参训人员不能为空"`            // 参训人员
+	ExpectTrainDate   *gtime.Time `json:"expectTrainDate" v:"required#期望培训日期不能为空"` // 期望培训日期
+	ExpectStartTime   *gtime.Time `json:"expectStartTime" v:"required#期望开始时间不能为空"` // 期望开始时间
+	ExpectEndTime     *gtime.Time `json:"expectEndTime" v:"required#期望结束时间不能为空"`   // 期望结束时间
+	TrainTitle        string      `json:"trainTitle" v:"required#培训主题不能为空"`          // 培训主题
+	InstructorRequire string      `json:"instructorRequire" v:"required#讲师要求不能为空"`   // 讲师要求
+	FocusPoint        string      `json:"focusPoint" v:"required#关注要点不能为空"`          // 关注要点
+	TrainInstructor   string      `json:"trainInstructor" v:"required#培训讲师不能为空"`     // 培训讲师
+	TrainDate         *gtime.Time `json:"trainDate" v:"required#培训日期不能为空"`           // 培训日期
+	SpecificStartTime *gtime.Time `json:"specificStartTime" v:"required#开始时间不能为空"`   // 开始时间
+	SpecificEndTime   *gtime.Time `json:"specificEndTime" v:"required#结束时间不能为空"`     // 结束时间
+	ApplyType         string      `json:"applyType" v:"required#申请状态不能为空"`           // 申请状态(10 已提交 20 已确认 30 总结完成)
 }

+ 12 - 12
opms_parent/app/model/train/train_sale_apply_summary.go

@@ -22,23 +22,23 @@ type TraSaleApplySummaryRes struct {
 	ApplyId         int    `json:"applyId"`         // 申请ID
 	ExplainDuration string `json:"explainDuration"` // 讲解时长
 	QuestionRecord  string `json:"questionRecord"`  // 提问记录
-	TrainingSummary string `json:"trainingSummary"` // 培训效果总结
+	TrainSummary    string `json:"trainSummary"`    // 培训效果总结
 	NextStep        string `json:"nextStep"`        // 下一步工作计划
 }
 
 type TraSaleApplySummaryCreateReq struct {
-	ApplyId         int    `json:"applyId" v:"required|min:1#|申请ID不能为空"`  // 申请ID
-	ExplainDuration string `json:"explainDuration" v:"required#讲解时长为空"`   // 讲解时长
-	QuestionRecord  string `json:"questionRecord" v:"required#提问记录为空"`    // 提问记录
-	TrainingSummary string `json:"trainingSummary" v:"required#培训效果总结为空"` // 培训效果总结
-	NextStep        string `json:"nextStep" v:"required#下一步工作计划为空"`       // 下一步工作计划
+	ApplyId         int    `json:"applyId" v:"required|min:1#|申请ID不能为空"` // 申请ID
+	ExplainDuration string `json:"explainDuration" v:"required#讲解时长为空"`  // 讲解时长
+	QuestionRecord  string `json:"questionRecord" v:"required#提问记录为空"`   // 提问记录
+	TrainSummary    string `json:"trainSummary" v:"required#培训效果总结为空"`   // 培训效果总结
+	NextStep        string `json:"nextStep" v:"required#下一步工作计划为空"`      // 下一步工作计划
 }
 
 type TraSaleApplySummaryUpdateReq struct {
-	Id              int    `json:"id" v:"required|min:1#|主ID不能为空"`        // 主键
-	ApplyId         int    `json:"applyId" v:"required|min:1#|申请ID不能为空"`  // 申请ID
-	ExplainDuration string `json:"explainDuration" v:"required#讲解时长为空"`   // 讲解时长
-	QuestionRecord  string `json:"questionRecord" v:"required#提问记录为空"`    // 提问记录
-	TrainingSummary string `json:"trainingSummary" v:"required#培训效果总结为空"` // 培训效果总结
-	NextStep        string `json:"nextStep" v:"required#下一步工作计划为空"`       // 下一步工作计划
+	Id              int    `json:"id" v:"required|min:1#|主ID不能为空"`       // 主键
+	ApplyId         int    `json:"applyId" v:"required|min:1#|申请ID不能为空"` // 申请ID
+	ExplainDuration string `json:"explainDuration" v:"required#讲解时长为空"`  // 讲解时长
+	QuestionRecord  string `json:"questionRecord" v:"required#提问记录为空"`   // 提问记录
+	TrainSummary    string `json:"trainSummary" v:"required#培训效果总结为空"`   // 培训效果总结
+	NextStep        string `json:"nextStep" v:"required#下一步工作计划为空"`      // 下一步工作计划
 }

+ 72 - 70
opms_parent/app/service/cust/product_consult_record.go

@@ -58,6 +58,9 @@ func (s ProductConsultRecordService) List(ctx context.Context, req *model.Produc
 		likestr := fmt.Sprintf("%%%s%%", req.Name)
 		dao = dao.Where("name like ?", likestr)
 	}
+	if req.State != "" {
+		dao = dao.Where("state = ?", req.State)
+	}
 	if req.InchargeName != "" {
 		likestr := fmt.Sprintf("%%%s%%", req.InchargeName)
 		dao = dao.Where("incharge_name like ?", likestr)
@@ -92,7 +95,7 @@ func (s ProductConsultRecordService) List(ctx context.Context, req *model.Produc
 	return total, ents, err
 }
 
-func (s *ProductConsultRecordService) consultCode() (string, error) {
+func (s ProductConsultRecordService) consultCode() (string, error) {
 	sequence, err := service.Sequence(s.Dao.DB, "consult_code")
 	if err != nil {
 		return "", err
@@ -133,8 +136,8 @@ func (s ProductConsultRecordService) Add(ctx context.Context, req *model.Product
 		Product:      req.Product,
 		InchargeId:   req.InchargeId,
 		InchargeName: req.InchargeName,
-		Content:      req.Content,
-		Remark:       "",
+		State:        "10",
+		Remark:       req.Remark,
 		CreatedBy:    int(s.userInfo.Id),
 		CreatedName:  s.userInfo.NickName,
 		CreatedTime:  gtime.Now(),
@@ -165,78 +168,77 @@ func (s ProductConsultRecordService) Update(ctx context.Context, req *model.Prod
 	dao := &s.Dao.ProductConsultRecordDao
 	toupdate := map[string]interface{}{}
 
-	if req.ConsultTime != nil {
-		toupdate["consult_time"] = req.ConsultTime
-	}
-	if req.ProvinceId != 0 {
-		toupdate["province_id"] = req.ProvinceId
-	}
-	if req.Province != "" {
-		toupdate["province"] = req.Province
-	}
-	if req.CityId != 0 {
-		toupdate["city_id"] = req.CityId
-	}
-	if req.City != "" {
-		toupdate["city"] = req.City
-	}
-	if req.Unit != "" {
-		toupdate["unit"] = req.Unit
-	}
-	if req.Name != "" {
-		toupdate["name"] = req.Name
-	}
-	if req.Contact != "" {
-		toupdate["contact"] = req.Contact
-	}
-	if req.Product != "" {
-		toupdate["product"] = req.Product
-	}
-	if req.InchargeId != 0 {
-		toupdate["incharge_id"] = req.InchargeId
-	}
-	if req.InchargeName != "" {
-		toupdate["incharge_name"] = req.InchargeName
-	}
-	if req.Content != "" {
-		toupdate["content"] = req.Content
-	}
-	if req.Progress != "" {
-		toupdate["progress"] = req.Progress
-	}
-	if req.NextPlan != "" {
-		toupdate["next_plan"] = req.NextPlan
-	}
-	if req.DistributorId != 0 {
-		toupdate["distributor_id"] = req.DistributorId
-	}
-	if req.DistributorName != "" {
-		toupdate["distributor_name"] = req.DistributorName
-	}
-	if req.CustId != 0 {
-		toupdate["cust_id"] = req.CustId
-	}
-	if req.CustName != "" {
-		toupdate["cust_name"] = req.CustName
+	toupdate["consult_time"] = req.ConsultTime
+	toupdate["province_id"] = req.ProvinceId
+	toupdate["province"] = req.Province
+	toupdate["city_id"] = req.CityId
+	toupdate["city"] = req.City
+	toupdate["unit"] = req.Unit
+	toupdate["name"] = req.Name
+	toupdate["contact"] = req.Contact
+	toupdate["product"] = req.Product
+	toupdate["incharge_id"] = req.InchargeId
+	toupdate["incharge_name"] = req.InchargeName
+	//toupdate["content"] = req.Content
+	//toupdate["progress"] = req.Progress
+	//toupdate["next_plan"] = req.NextPlan
+	//toupdate["distributor_id"] = req.DistributorId
+	//toupdate["distributor_name"] = req.DistributorName
+	//toupdate["cust_id"] = req.CustId
+	//toupdate["cust_name"] = req.CustName
+	//toupdate["nbo_id"] = req.NboId
+	//toupdate["nbo_name"] = req.NboName
+	toupdate["remark"] = req.Remark
+
+	toupdate["updated_by"] = int(s.userInfo.Id)
+	toupdate["updated_name"] = s.userInfo.NickName
+	toupdate["updated_time"] = gtime.Now()
+	_, err = dao.Where("Id", req.Id).Data(toupdate).Update()
+	if err != nil {
+		return err
 	}
-	if req.NboId != 0 {
-		toupdate["nbo_id"] = req.NboId
+
+	return nil
+}
+
+func (s ProductConsultRecordService) FollowUp(ctx context.Context, req *model.FollowUpReq) error {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return myerrors.TipsError(validErr.Current().Error())
 	}
-	if req.NboName != "" {
-		toupdate["nbo_name"] = req.NboName
+
+	ent, err := s.Dao.Where("id = ?", req.Id).One()
+	if err != nil {
+		return err
 	}
-	if req.Remark != "" {
-		toupdate["remark"] = req.Remark
+	if ent == nil {
+		return myerrors.TipsError(fmt.Sprintf("记录不存在: %d", req.Id))
 	}
-	if len(toupdate) != 0 {
-		toupdate["updated_by"] = int(s.userInfo.Id)
-		toupdate["updated_name"] = s.userInfo.NickName
-		toupdate["updated_time"] = gtime.Now()
-		_, err = dao.Where("Id", req.Id).Data(toupdate).Update()
-		if err != nil {
-			return err
-		}
+
+	dao := &s.Dao.ProductConsultRecordDao
+	toupdate := map[string]interface{}{}
+
+	toupdate["content"] = req.Content
+	toupdate["progress"] = req.Progress
+	toupdate["next_plan"] = req.NextPlan
+	//toupdate["distributor_id"] = req.DistributorId
+	//toupdate["distributor_name"] = req.DistributorName
+	//toupdate["cust_id"] = req.CustId
+	//toupdate["cust_name"] = req.CustName
+	toupdate["nbo_id"] = req.NboId
+	toupdate["nbo_name"] = req.NboName
+	toupdate["state"] = "20"
+	toupdate["follow_communicate_case"] = req.FollowCommunicateCase
+
+	toupdate["updated_by"] = int(s.userInfo.Id)
+	toupdate["updated_name"] = s.userInfo.NickName
+	toupdate["updated_time"] = gtime.Now()
+
+	_, err = dao.Where("Id", req.Id).Data(toupdate).Update()
+	if err != nil {
+		return err
 	}
+
 	return nil
 }
 

+ 10 - 2
opms_parent/app/service/home/home.go

@@ -223,8 +223,16 @@ func (s *HomeService) getNumStatisticsData(id int64, params *map[string]interfac
 	case 10015: //当年未开票金额,数据=2023年未开票金额
 		count, err := contractDao.DataScope(s.Ctx, "incharge_id").
 			Where("year(contract_sign_time) = ?", time.Now().Year()).
-			Sum(contractDao.C.ContractAmount + " - " + contractDao.C.InvoiceAmount)
-		return gconv.String(count), err
+			Sum(contractDao.C.ContractAmount)
+		if err != nil {
+			return "", err
+		}
+		count1, err := contractDao.As("a").DataScope(s.Ctx, "incharge_id").InnerJoin("ctr_contract_invoice b", "a.id=b.contract_id").Where("b.invoice_date>=? AND b.invoice_date<=? AND b.appro_status='30'", yearStart, yearEnd).
+			Sum("b.invoice_amount")
+		if err != nil {
+			return "", err
+		}
+		return gconv.String(count - count1), err
 
 	case 10016: //当年签约未回款金额,数据=2023年合同中未回款金额,过程中有实际回款时数据
 		count, err := contractDao.DataScope(s.Ctx, "incharge_id").

+ 42 - 13
opms_parent/app/service/home/report.go

@@ -175,8 +175,22 @@ func getCompanyContractReportData(ctx context.Context, dataType string, params *
 		}
 	}
 
+	// 过滤掉已删除的销售
+	normalUserMap := make(map[int]bool)
+	normalUsers, err := srv.Dao.DB.Model("sys_user").Where("status='10'").FindAll()
+	if err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	for _, user := range normalUsers {
+		normalUserMap[user["id"].Int()] = true
+	}
+
 	// 统计目标值和实际值
 	for index, target := range targets {
+		// 过滤掉已删除的销售
+		if !normalUserMap[target["sale_user_id"].Int()] {
+			continue
+		}
 		reportData.XData = append(reportData.XData, target["sale_user_name"].String())
 		reportData.YDataTarget = append(reportData.YDataTarget, target[targetField].Float64())
 		if realData, ok := realMap[target["sale_user_id"].Int()]; ok {
@@ -226,19 +240,19 @@ func getQuarterGoalReportData(ctx context.Context, dataType string, params *map[
 	}
 
 	got := map[string]float64{}
-	ctrdao := srv.Dao.Where("year(created_time) = ?", year)
+	ctrdao := srv.Dao.As("a").InnerJoin("sys_user b", "a.incharge_id=b.id").Where("b.status='10'").Where("year(a.created_time) = ?", year)
 	if quarter != 0 {
 		if quarter == 1 {
-			ctrdao = ctrdao.Where("month(created_time) in (1,2,3)")
+			ctrdao = ctrdao.Where("month(a.created_time) in (1,2,3)")
 		}
 		if quarter == 2 {
-			ctrdao = ctrdao.Where("month(created_time) in (4,5,6)")
+			ctrdao = ctrdao.Where("month(a.created_time) in (4,5,6)")
 		}
 		if quarter == 3 {
-			ctrdao = ctrdao.Where("month(created_time) in (7,8,9)")
+			ctrdao = ctrdao.Where("month(a.created_time) in (7,8,9)")
 		}
 		if quarter == 4 {
-			ctrdao = ctrdao.Where("month(created_time) in (10,11,12)")
+			ctrdao = ctrdao.Where("month(a.created_time) in (10,11,12)")
 		}
 	}
 	ctrent, err := ctrdao.All()
@@ -305,8 +319,23 @@ func getClockfrequency(ctx context.Context, dataType string, params *map[string]
 	if err != nil && err != sql.ErrNoRows {
 		return nil, err
 	}
+
+	// 过滤掉已删除的销售
+	normalUserMap := make(map[int]bool)
+	normalUsers, err := srv.Dao.DB.Model("sys_user").Where("status='10'").FindAll()
+	if err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	for _, user := range normalUsers {
+		normalUserMap[user["id"].Int()] = true
+	}
+
 	// 赋值实际值
 	for index, target := range platpunchrecords {
+		// 过滤掉已删除的销售
+		if !normalUserMap[target["user_id"].Int()] {
+			continue
+		}
 		reportData.XData = append(reportData.XData, target["user_nick_name"].String())
 		reportData.YDataTarget = append(reportData.YDataTarget, target["punch_sum"].Float64())
 		if realData, ok := realMap[target["punch_sum"].Int()]; ok {
@@ -637,9 +666,9 @@ func (s *HomeService) getNewAndConvertBusiness(productLine []string, params *map
 // 报表数据   三大产品线,AB类项目出货金额
 func (s *HomeService) getShipmentAmount(productLine, nboType []string) (interface{}, error) {
 	businessDao := projDao.NewProjBusinessDao(s.Tenant)
-	data, err := businessDao.Fields("product_line, nbo_type, SUM(est_trans_price) as est_trans_price").
-		WhereIn("product_line", productLine).WhereIn("nbo_type", nboType).
-		Group("product_line, nbo_type").Order("product_line ASC, nbo_type ASC").DataScope(s.Ctx, "sale_id").All()
+	data, err := businessDao.As("a").InnerJoin("sys_user b", "a.sale_id=b.id").Fields("a.product_line, a.nbo_type, SUM(a.est_trans_price) as est_trans_price").Where("b.status='10'").
+		WhereIn("a.product_line", productLine).WhereIn("a.nbo_type", nboType).
+		Group("a.product_line, a.nbo_type").Order("a.product_line ASC, a.nbo_type ASC").DataScope(s.Ctx, "a.sale_id").All()
 	if err != nil {
 		return nil, err
 	}
@@ -665,28 +694,28 @@ func (s *HomeService) getProductLineSignedAndBackAmount(productLine []string) (i
 	monthEnd := currentTime.EndOfMonth()
 
 	contractDao := contDao.NewCtrContractDao(s.Tenant)
-	commonDao := contractDao.DataScope(s.Ctx, "incharge_id").WhereIn(contractDao.C.ProductLine, productLine).
+	commonDao := contractDao.As("a").InnerJoin("sys_user b", "a.incharge_id=b.id").DataScope(s.Ctx, "incharge_id").WhereIn(contractDao.C.ProductLine, productLine).Where("b.status='10'").
 		Group(contractDao.C.ProductLine).OrderAsc(contractDao.C.ProductLine)
 
 	//累计签约合同金额 contract_amount
-	allContractAmount, err := commonDao.Fields("product_line, SUM(contract_amount) as contract_amount").All()
+	allContractAmount, err := commonDao.Fields("a.product_line, SUM(a.contract_amount) as contract_amount").All()
 	if err != nil {
 		return nil, err
 	}
 	//累计回款金额 collected_amount
-	allCollectedAmount, err := commonDao.Fields("product_line, SUM(collected_amount) as collected_amount").All()
+	allCollectedAmount, err := commonDao.Fields("a.product_line, SUM(a.collected_amount) as collected_amount").All()
 	if err != nil {
 		return nil, err
 	}
 	//当月签约合同金额(维度:月)
 	monthContractAmount, err := commonDao.WhereGTE(contractDao.C.ContractStartTime, monthStart).WhereLTE(contractDao.C.ContractStartTime, monthEnd).
-		Fields("product_line, SUM(contract_amount) as contract_amount").All()
+		Fields("a.product_line, SUM(a.contract_amount) as contract_amount").All()
 	if err != nil {
 		return nil, err
 	}
 	//当月回款金额(维度:月)
 	monthCollectedAmount, err := commonDao.WhereGTE(contractDao.C.ContractStartTime, monthStart).WhereLTE(contractDao.C.ContractStartTime, monthEnd).
-		Fields("product_line, SUM(collected_amount) as collected_amount").All()
+		Fields("a.product_line, SUM(a.collected_amount) as collected_amount").All()
 	if err != nil {
 		return nil, err
 	}

+ 3 - 1
opms_parent/app/service/train/sale_apply.go

@@ -28,6 +28,9 @@ func NewSaleApplyService(ctx context.Context) (svc *SaleApplyService, err error)
 // GetList 销售申请信息列表
 func (s *SaleApplyService) GetList(ctx context.Context, req *model.TrainSaleApplySearchReq) (total int, distributorList []*model.TrainSaleApplyRes, err error) {
 	distributorModel := s.Dao.Ctx(ctx).FieldsEx(s.Dao.C.DeletedTime)
+	if req.CreatedBy != 0 {
+		distributorModel = distributorModel.Where(s.Dao.C.CreatedBy, req.CreatedBy)
+	}
 	if req.DistributorId != 0 {
 		distributorModel = distributorModel.Where(s.Dao.C.DistributorId, req.DistributorId)
 	}
@@ -104,5 +107,4 @@ func (s *SaleApplyService) DeleteByIds(ctx context.Context, ids []int64) (err er
 		return err
 	}
 	return
-
 }

+ 1 - 2
opms_parent/app/service/train/sale_apply_summary.go

@@ -61,7 +61,7 @@ func (s *SaleApplySummaryService) Create(ctx context.Context, req *model.TraSale
 		if err != nil {
 			return err
 		}
-		_, err = svc.Dao.Ctx(ctx).TX(tx).WherePri(req.ApplyId).Data(g.Map{svc.Dao.C.ApplyType: "20"}).Update()
+		_, err = svc.Dao.Ctx(ctx).TX(tx).WherePri(req.ApplyId).Data(g.Map{svc.Dao.C.ApplyType: "30"}).Update()
 		if err != nil {
 			return err
 		}
@@ -105,5 +105,4 @@ func (s *SaleApplySummaryService) DeleteByIds(ctx context.Context, ids []int64)
 		return err
 	}
 	return
-
 }