|
@@ -4,11 +4,13 @@ import (
|
|
|
"context"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
+ "hongze/hongze_task/models"
|
|
|
"hongze/hongze_task/models/company"
|
|
|
"hongze/hongze_task/models/company_approval"
|
|
|
"hongze/hongze_task/models/company_contract"
|
|
|
"hongze/hongze_task/utils"
|
|
|
"strings"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
|
|
@@ -41,11 +43,17 @@ func HandleCompanyContract(cont context.Context) (err error) {
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ companyProduct, err := models.GetCompanyProduct(v.CompanyId, v.ProductId)
|
|
|
+ if err != nil {
|
|
|
+ errorList = append(errorList, fmt.Sprint("合同id:", v.CompanyContractId, ";寻找客户产品时异常", ";Err:"+err.Error()))
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if companyProduct == nil {
|
|
|
+ errorList = append(errorList, fmt.Sprint("合同id:", v.CompanyContractId, ";寻找客户产品时异常2", ";Err:"+err.Error()))
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -74,6 +82,35 @@ func HandleCompanyContract(cont context.Context) (err error) {
|
|
|
errorList = append(errorList, fmt.Sprint("合同id:", v.CompanyContractId, ";审批单类型异常"))
|
|
|
continue
|
|
|
}
|
|
|
+
|
|
|
+ {
|
|
|
+ updateSource := ``
|
|
|
+ switch companyApproval.ApplyMethod {
|
|
|
+ case 1:
|
|
|
+ updateSource = `turn_positive`
|
|
|
+ case 2:
|
|
|
+ updateSource = "thaw"
|
|
|
+ case 3:
|
|
|
+ updateSource = "delay"
|
|
|
+ case 4:
|
|
|
+ updateSource = "apply_receive"
|
|
|
+ case 5:
|
|
|
+ updateSource = "service_update"
|
|
|
+ case 6:
|
|
|
+ updateSource = "add_agreement"
|
|
|
+ }
|
|
|
+ companyProductUpdateLog := &models.CompanyProductUpdateLog{
|
|
|
+ Id: 0,
|
|
|
+ CompanyId: companyProduct.CompanyId,
|
|
|
+ ProductId: companyProduct.ProductId,
|
|
|
+ Status: companyProduct.Status,
|
|
|
+ SellerId: companyProduct.SellerId,
|
|
|
+ SellerName: companyProduct.SellerName,
|
|
|
+ Source: updateSource,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ }
|
|
|
+ go models.AddCompanyProductUpdateLog(companyProductUpdateLog)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|