xingzai 1 år sedan
förälder
incheckning
ac12247981
3 ändrade filer med 14 tillägg och 2 borttagningar
  1. 3 0
      controllers/company.go
  2. 10 2
      controllers/cygx/contract_allocation.go
  3. 1 0
      models/company/company_product.go

+ 3 - 0
controllers/company.go

@@ -2906,6 +2906,9 @@ func (this *CompanyController) Add() {
 	if seller.Mobile == "13065778668" {
 		companyProduct.IsOverseas = 1
 	}
+	if productId == utils.COMPANY_PRODUCT_RAI_ID && req.Status == utils.COMPANY_STATUS_FOREVER { // 权益的永续客户给一个状态初始化的记录
+		companyProduct.InitStatus = req.Status
+	}
 	companyProductId, err := company.AddCompanyProduct(companyProduct)
 	if err != nil {
 		br.Msg = "新增失败"

+ 10 - 2
controllers/cygx/contract_allocation.go

@@ -767,6 +767,14 @@ func (this *ContractAllocationController) CompanyContracUpdate() {
 		br.ErrMsg = "获取合同信息失败,Err:" + err.Error()
 		return
 	}
+
+	companyProduct, err := company.GetCompanyProductByCompanyIdAndProductId(contractItem.CompanyId, utils.COMPANY_PRODUCT_RAI_ID)
+	if err != nil {
+		br.Msg = "查询客户产品信息失败"
+		br.ErrMsg = "查询客户产品信息失败,Err:" + err.Error()
+		return
+	}
+
 	money := contractItem.Money / 10000 // 合同金额,万为单位
 	var moneyAvg float64                // 行业所占合同的平均金额
 	hasPermissions, e := company.GetCompanyContractPermissionByCompanyContractId(companyContractId)
@@ -831,7 +839,7 @@ func (this *ContractAllocationController) CompanyContracUpdate() {
 		itemPermission.Money = v.Money
 		if v.ChartPermissionName != utils.CHART_PERMISSION_NAME_MAI_FANG_YANXUAN {
 			itemPermission.MoneyAvg = moneyAvg
-			if v.Money < moneyAvg/2 {
+			if v.Money < moneyAvg/2 && companyProduct.Status == utils.COMPANY_STATUS_FOREVER { //永续客户不做这种限制
 				br.Msg = "单行业占比值不得低于平均值的一半"
 				br.ErrMsg = "单行业占比值不得低于平均值的一半,Err:" + fmt.Sprint(proportionSum)
 				return
@@ -844,7 +852,7 @@ func (this *ContractAllocationController) CompanyContracUpdate() {
 		var userProportionSum float64 // 校验前端传过来的占比使用
 
 		for _, v2 := range v.List {
-			if v2.Proportion < -20 {
+			if v2.Proportion < -20 && companyProduct.Status == utils.COMPANY_STATUS_FOREVER { //永续客户不做这种限制
 				br.Msg = "研究员占比值不得小于总额的-20%"
 				br.ErrMsg = "研究员占比值不得小于总额的20%,Err:" + fmt.Sprint(proportionSum)
 				return

+ 1 - 0
models/company/company_product.go

@@ -15,6 +15,7 @@ type CompanyProduct struct {
 	Source              string    `description:"来源"`
 	Reasons             string    `description:"新增理由"`
 	Status              string    `description:"客户状态"`
+	InitStatus          string    `description:"客户初始化状态(目前用来处理权益的永续客户使用)"`
 	IndustryId          int       `description:"行业id"`
 	IndustryName        string    `description:"行业名称"`
 	SellerId            int       `description:"销售id"`