|
@@ -9,7 +9,7 @@ import (
|
|
|
)
|
|
|
|
|
|
// TryOutToFormal 试用转正式
|
|
|
-func TryOutToFormal(companyId, productId, sellerId, companyContractId int, startDate, endDate, sellerName, productName string, packageType int) (err error) {
|
|
|
+func TryOutToFormal(companyId, productId, sellerId, companyContractId int, startDate, endDate, sellerName, productName string, packageType, raiPackageType int) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
tx, err := o.Begin()
|
|
|
if err != nil {
|
|
@@ -24,15 +24,15 @@ func TryOutToFormal(companyId, productId, sellerId, companyContractId int, start
|
|
|
}()
|
|
|
|
|
|
// 套餐类型为0时, 不更新套餐类型
|
|
|
- sql := `UPDATE company_product SET status='正式',try_out_time=NULL,last_description_time=NULL,freeze_time=NULL,renewal_intention=0,is_suspend=0,is_formal=1,start_date=?,end_date=?,package_type=?,modify_time=NOW(),formal_time=NOW(),try_stage=1 WHERE company_id=? AND product_id=? `
|
|
|
+ sql := `UPDATE company_product SET status='正式',try_out_time=NULL,last_description_time=NULL,freeze_time=NULL,renewal_intention=0,is_suspend=0,is_formal=1,start_date=?,end_date=?,package_type=?,rai_package_type=?,modify_time=NOW(),formal_time=NOW(),try_stage=1 WHERE company_id=? AND product_id=? `
|
|
|
if packageType == 0 {
|
|
|
- sql = `UPDATE company_product SET status='正式',try_out_time=NULL,last_description_time=NULL,freeze_time=NULL,renewal_intention=0,is_suspend=0,is_formal=1,start_date=?,end_date=?,modify_time=NOW(),formal_time=NOW(),try_stage=1 WHERE company_id=? AND product_id=? `
|
|
|
- _, err = tx.Raw(sql, startDate, endDate, companyId, productId).Exec()
|
|
|
+ sql = `UPDATE company_product SET status='正式',try_out_time=NULL,last_description_time=NULL,freeze_time=NULL,renewal_intention=0,is_suspend=0,is_formal=1,start_date=?,end_date=?,rai_package_type=?,modify_time=NOW(),formal_time=NOW(),try_stage=1 WHERE company_id=? AND product_id=? `
|
|
|
+ _, err = tx.Raw(sql, startDate, endDate, raiPackageType, companyId, productId).Exec()
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
} else {
|
|
|
- _, err = tx.Raw(sql, startDate, endDate, packageType, companyId, productId).Exec()
|
|
|
+ _, err = tx.Raw(sql, startDate, endDate, packageType, raiPackageType, companyId, productId).Exec()
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -74,9 +74,9 @@ func TryOutToFormal(companyId, productId, sellerId, companyContractId int, start
|
|
|
}
|
|
|
for _, pv := range contractPermission {
|
|
|
sql = `INSERT INTO company_report_permission(company_id, report_permission_id,created_time, last_updated_time,
|
|
|
- chart_permission_id, start_date,end_date,product_id,product_name, modify_time,company_contract_id,status,is_upgrade)
|
|
|
- VALUES(?,?,NOW(),NOW(),?,?,?,?,?,NOW(),?,?,?) `
|
|
|
- _, err = tx.Raw(sql, companyId, pv.ChartPermissionId, pv.ChartPermissionId, pv.StartDate, pv.EndDate, productId, productName, companyContractId, "正式", pv.IsUpgrade).Exec()
|
|
|
+ chart_permission_id, start_date,end_date,product_id,product_name, modify_time,company_contract_id,status,is_upgrade,expensive_yx)
|
|
|
+ VALUES(?,?,NOW(),NOW(),?,?,?,?,?,NOW(),?,?,?,?) `
|
|
|
+ _, err = tx.Raw(sql, companyId, pv.ChartPermissionId, pv.ChartPermissionId, pv.StartDate, pv.EndDate, productId, productName, companyContractId, "正式", pv.IsUpgrade, pv.ExpensiveYx).Exec()
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -149,7 +149,7 @@ func ApplyServiceUpdateOld(companyId, productId, sellerId, companyContractId int
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func ApplyServiceUpdate(companyId, productId, sellerId, companyContractId int, startDate, endDate, sellerName, productName string, packageType int) (err error) {
|
|
|
+func ApplyServiceUpdate(companyId, productId, sellerId, companyContractId int, startDate, endDate, sellerName, productName string, packageType, raiPackageType int) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
tx, err := o.Begin()
|
|
|
if err != nil {
|
|
@@ -232,14 +232,14 @@ func ApplyServiceUpdate(companyId, productId, sellerId, companyContractId int, s
|
|
|
//更新客户产品信息
|
|
|
if packageType == 0 {
|
|
|
// 套餐类型为0时, 不更新套餐类型
|
|
|
- sql = `UPDATE company_product SET status='正式',try_out_time=NULL,last_description_time=NULL,freeze_time=NULL,is_formal=1,is_suspend=0,start_date=?,end_date=?,modify_time=NOW(),try_stage=1 WHERE company_id=? AND product_id=? `
|
|
|
- _, err = tx.Raw(sql, updateStartDateTime, updateEndDateTime, companyId, productId).Exec()
|
|
|
+ sql = `UPDATE company_product SET status='正式',try_out_time=NULL,last_description_time=NULL,freeze_time=NULL,is_formal=1,is_suspend=0,start_date=?,end_date=?,rai_package_type=?,modify_time=NOW(),try_stage=1 WHERE company_id=? AND product_id=? `
|
|
|
+ _, err = tx.Raw(sql, updateStartDateTime, updateEndDateTime, raiPackageType, companyId, productId).Exec()
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
} else {
|
|
|
- sql = `UPDATE company_product SET status='正式',try_out_time=NULL,last_description_time=NULL,freeze_time=NULL,is_formal=1,is_suspend=0,start_date=?,end_date=?,package_type=?,modify_time=NOW(),try_stage=1 WHERE company_id=? AND product_id=? `
|
|
|
- _, err = tx.Raw(sql, updateStartDateTime, updateEndDateTime, packageType, companyId, productId).Exec()
|
|
|
+ sql = `UPDATE company_product SET status='正式',try_out_time=NULL,last_description_time=NULL,freeze_time=NULL,is_formal=1,is_suspend=0,start_date=?,end_date=?,package_type=?,rai_package_type=?,modify_time=NOW(),try_stage=1 WHERE company_id=? AND product_id=? `
|
|
|
+ _, err = tx.Raw(sql, updateStartDateTime, updateEndDateTime, packageType, raiPackageType, companyId, productId).Exec()
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -281,8 +281,8 @@ func ApplyServiceUpdate(companyId, productId, sellerId, companyContractId int, s
|
|
|
|
|
|
//如果 需要更新 字段 为 true,那么就去更新
|
|
|
if needUpdate {
|
|
|
- sql = `update company_report_permission set end_date=?,last_updated_time=now(),modify_time=now(),company_contract_id=?,status=? where company_report_permission_id=? `
|
|
|
- _, tmpErr := tx.Raw(sql, pv.EndDate, companyContractId, "正式", nowPermission.CompanyReportPermissionId).Exec()
|
|
|
+ sql = `update company_report_permission set end_date=?,last_updated_time=now(),modify_time=now(),company_contract_id=?,status=?,is_upgrade=?,expensive_yx=? where company_report_permission_id=? `
|
|
|
+ _, tmpErr := tx.Raw(sql, pv.EndDate, companyContractId, "正式", pv.IsUpgrade, pv.ExpensiveYx, nowPermission.CompanyReportPermissionId).Exec()
|
|
|
err = tmpErr
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -291,9 +291,9 @@ func ApplyServiceUpdate(companyId, productId, sellerId, companyContractId int, s
|
|
|
|
|
|
} else {
|
|
|
sql = `INSERT INTO company_report_permission(company_id, report_permission_id,created_time, last_updated_time,
|
|
|
- chart_permission_id, start_date,end_date,product_id,product_name, modify_time,company_contract_id,status)
|
|
|
- VALUES(?,?,NOW(),NOW(),?,?,?,?,?,NOW(),?,?) `
|
|
|
- _, tmpErr := tx.Raw(sql, companyId, pv.ChartPermissionId, pv.ChartPermissionId, pv.StartDate, pv.EndDate, productId, productName, companyContractId, "正式").Exec()
|
|
|
+ chart_permission_id, start_date,end_date,product_id,product_name, modify_time,company_contract_id,status,is_upgrade,expensive_yx)
|
|
|
+ VALUES(?,?,NOW(),NOW(),?,?,?,?,?,NOW(),?,?,?,?) `
|
|
|
+ _, tmpErr := tx.Raw(sql, companyId, pv.ChartPermissionId, pv.ChartPermissionId, pv.StartDate, pv.EndDate, productId, productName, companyContractId, "正式", pv.IsUpgrade, pv.ExpensiveYx).Exec()
|
|
|
err = tmpErr
|
|
|
if err != nil {
|
|
|
return
|