Quellcode durchsuchen

Merge branch 'master' of http://8.136.199.33:3000/hongze/hz_crm_api into crm/crm_16.1

zhangchuanxing vor 5 Tagen
Ursprung
Commit
11c88b5153

+ 12 - 0
controllers/business_trip/business_apply.go

@@ -78,6 +78,11 @@ func (this *BusinessTrip) ApplyAdd() {
 		return
 	}
 
+	if req.Itinerary == "" {
+		br.Msg = "请填写行程说明"
+		return
+	}
+
 	startP, _ := time.ParseInLocation(utils.FormatDate, req.ArriveDate, time.Local)
 	endP, _ := time.ParseInLocation(utils.FormatDate, req.ReturnDate, time.Local)
 	nowDate, _ := time.ParseInLocation(utils.FormatDate, time.Now().Format(utils.FormatDate), time.Local)
@@ -188,6 +193,7 @@ func (this *BusinessTrip) ApplyAdd() {
 	item.ApproveName = approveItem.RealName
 	item.CreateTime = time.Now()
 	item.ModifyTime = time.Now()
+	item.Itinerary = req.Itinerary
 	applyId, err := business_trip.AddBusinessApply(item)
 	if err != nil {
 		br.Msg = "申请失败"
@@ -332,6 +338,11 @@ func (this *BusinessTrip) ApplyEdit() {
 		return
 	}
 
+	if req.Itinerary == "" {
+		br.Msg = "请填写行程说明"
+		return
+	}
+
 	startP, _ := time.ParseInLocation(utils.FormatDate, req.ArriveDate, time.Local)
 	endP, _ := time.ParseInLocation(utils.FormatDate, req.ReturnDate, time.Local)
 	nowDate, _ := time.ParseInLocation(utils.FormatDate, time.Now().Format(utils.FormatDate), time.Local)
@@ -459,6 +470,7 @@ func (this *BusinessTrip) ApplyEdit() {
 	updateParams["refuse_reason"] = ""
 	updateParams["create_time"] = time.Now()
 	updateParams["modify_time"] = time.Now()
+	updateParams["itinerary"] = req.Itinerary
 
 	err = business_trip.UpdateBusinessApply(whereParams, updateParams)
 	if err != nil {

+ 1 - 0
controllers/cygx/activity.go

@@ -471,6 +471,7 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 			item.IsShowHz = isShowHz
 			item.ChartPermissionIdDeputy = charInfo.ChartPermissionId
 			item.ChartPermissionNameDeputy = charInfo.PermissionName
+			item.IsZoom = req.IsZoom
 			if len(labelList) == 1 {
 				item.IsCanAppointmentMinutes = labelList[0].IsCanAppointmentMinutes
 			} else {

+ 10 - 0
controllers/roadshow/calendar.go

@@ -1478,6 +1478,16 @@ func (this *CalendarController) Accept() {
 		return
 	}
 
+	rsCalendarResearcherItemList, err := roadshow.GetRsCalendarResearcherListById(req.RsCalendarId)
+	if err != nil {
+		br.Msg = "获取数据失败!"
+		br.ErrMsg = "获取数据失败!GetRsCalendarResearcherById:" + err.Error()
+		return
+	}
+	for _, v := range rsCalendarResearcherItemList {
+		go roadshowService.CalendarToSH(*rsCalendar, *v)
+	}
+
 	//模板消息通知
 	{
 		if rsCalendar != nil {

+ 52 - 2
controllers/statistic_company_merge.go

@@ -222,7 +222,7 @@ func (this *StatisticCompanyMergerController) MergeCompanyList() {
 		} else {
 			condition1, pars1 = getQueryParams(condition1, pars1, sysUser, "c.")
 		}
-		condition1 += ` AND a.create_time >= ? AND a.create_time <= ? AND a.operation in ("add","receive")  	AND b.company_id  NOT IN  (	SELECT  company_id  FROM company_operation_record WHERE   product_id = 2 	AND  operation  ="loss"   GROUP BY company_id ) `
+		condition1 += ` AND a.create_time >= ? AND a.create_time <= ? AND a.operation in ("add","receive")  	AND b.company_id  NOT IN  (	SELECT  company_id  FROM company_operation_record WHERE   product_id = 2 	AND  operation  ="loss"   GROUP BY company_id )  AND c.status = '试用' `
 		pars1 = append(pars1, startDate, endDate)
 
 		total, err := models.GetIncrementalCompanyCountByOperationRecord(condition1, pars1)
@@ -2342,7 +2342,7 @@ func init323() {
 }
 
 //func init() {
-//	init16_1_03()
+//	init16_1_05()
 //}
 
 func init16_1_01() {
@@ -2422,6 +2422,56 @@ func init16_1_03() {
 	}
 }
 
+func init16_1_04() {
+	var condition string
+	var pars []interface{}
+
+	condition = "  AND  product_id = 2  AND  seller_id_init = 0    "
+
+	CompanyApprovalList, e := company.GetCompanyContracList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		fmt.Println(e)
+		return
+	}
+
+	for _, v := range CompanyApprovalList {
+		productItem, e := company.GetCompanyProductByCompanyIdAndProductId(v.CompanyId, 2)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			fmt.Println(e)
+			return
+		}
+		if productItem == nil {
+			continue
+		}
+		e = company.UpdateCompanyContractTypeinit16_1_02(productItem.SellerName, productItem.SellerId, v.CompanyContractId)
+		if e != nil {
+			fmt.Println(e)
+			return
+		}
+	}
+}
+
+//func init16_1_05() {
+//	var condition string
+//	var pars []interface{}
+//
+//	condition = "  AND  product_id = 2    "
+//
+//	listProduct, e := company.GetCompanyProductList(condition, pars)
+//	if e != nil {
+//		fmt.Println(e)
+//		return
+//	}
+//	for _, v := range listProduct {
+//		e = company.UpdateCompanyProductSellerUnexpiredInitinit16_1_05(v.SellerId, v.SellerName, v.CompanyId)
+//		if e != nil {
+//			fmt.Println(e)
+//			return
+//		}
+//	}
+//	fmt.Println("end")
+//}
+
 //更新权益销客户后一个正式的销售为当前销售
 //func init(){
 //	SELECT * FROM company_product  WHERE 1= 1  AND  product_id =2   AND  share_seller_id > 0 ;

+ 4 - 0
models/business_trip/business_apply.go

@@ -28,6 +28,7 @@ type BusinessApply struct {
 	CloseTime       time.Time `description:"关闭时间"`
 	CreateTime      time.Time `description:"创建时间"`
 	ModifyTime      time.Time `description:"修改时间"`
+	Itinerary       string    `description:"行程说明"`
 }
 
 // 添加出差申请
@@ -49,6 +50,7 @@ type BusinessApplyReq struct {
 	Transportation string `description:"交通工具"`
 	PeerPeopleId   string `description:"同行人id"`
 	PeerPeopleName string `description:"同行人"`
+	Itinerary      string `description:"行程说明"`
 }
 
 type BusinessApplyView struct {
@@ -73,6 +75,7 @@ type BusinessApplyView struct {
 	ModifyTime      string `description:"修改时间"`
 	IsClose         bool   `description:"true,可关闭,false,不可关闭"`
 	CloseReason     string `description:"关闭理由"`
+	Itinerary       string `description:"行程说明"`
 }
 
 func GetBusinessApplyListCount(condition string, pars []interface{}) (count int, err error) {
@@ -161,6 +164,7 @@ type BusinessApplyEditReq struct {
 	Transportation  string `description:"交通工具"`
 	PeerPeopleId    string `description:"同行人id"`
 	PeerPeopleName  string `description:"同行人"`
+	Itinerary       string `description:"行程说明"`
 }
 
 func CheckBusinessApplyDateCount(condition string, pars []interface{}) (count int, err error) {

+ 11 - 0
models/company/company_product.go

@@ -723,3 +723,14 @@ func UpdateCompanyProductSellerUnexpired(sellerId, shareSellerInit int, sellerNa
 	_, err = o.Raw(sql, sellerId, sellerName, shareSellerInit, shareSeller, companyId).Exec()
 	return
 }
+
+// 合同未到期更新对应销售的信息
+func UpdateCompanyProductSellerUnexpiredInitinit16_1_05(sellerId int, sellerName string, companyId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE company_product SET
+                            seller_id_last = ? , 
+                            seller_name_last = ? 
+                            WHERE company_id = ?  AND product_id= 2 `
+	_, err = o.Raw(sql, sellerId, sellerName, companyId).Exec()
+	return
+}

+ 6 - 0
models/cygx/activity.go

@@ -93,6 +93,7 @@ type ActivityRep struct {
 	BackgroundImg           string                       `description:"封面图片"`
 	ShareImg                string                       `description:"分享图片"`
 	AreaType                int                          `description:"地区,1国内,2海外,默认1"`
+	IsZoom                  int                          `description:"是否是Zoom模版  1是,0否"`
 }
 
 // 活动添加、修改入参
@@ -180,6 +181,7 @@ type ActivityDetail struct {
 	ShareImg                  string                     `description:"分享图片"`
 	TopTime                   int                        `description:"置顶时间"`
 	AreaType                  int                        `description:"地区,1国内,2海外,默认1"`
+	IsZoom                    int                        `description:"是否是Zoom模版  1是,0否"`
 }
 
 type ActivityDetailRep struct {
@@ -253,6 +255,8 @@ type CygxActivity struct {
 	ChartPermissionNameDeputy string    `description:"行业名称"`
 	CancelDeadline            string    `description:"取消报名截止时间"`
 	AreaType                  int       `description:"地区,1国内,2海外,默认1"`
+	IsZoom                    int       `description:"是否是Zoom模版  1是,0否"`
+	MeetingId                 string    `description:"会议ID"`
 }
 
 type CygxActivityEditDetail struct {
@@ -426,6 +430,8 @@ func EditActivity(item *CygxActivity, oldPublishStatus int, industrialActivityIt
 	updateParams["ChartPermissionIdDeputy"] = item.ChartPermissionIdDeputy
 	updateParams["CancelDeadline"] = item.CancelDeadline
 	updateParams["AreaType"] = item.AreaType
+	updateParams["MeetingId"] = item.MeetingId
+	updateParams["IsZoom"] = item.IsZoom
 	//修改活动信息
 	ptrStructOrTableName := "cygx_activity"
 	whereParam := map[string]interface{}{"activity_id": item.ActivityId}

+ 3 - 0
services/cygx/acitvity.go

@@ -690,6 +690,9 @@ func ActivityBodyAnalysis(body string, activeState int, req cygx.ActivityRep) (i
 		if strings.Contains(contentTxt, "腾讯会议号:") {
 			item.TencentConferenceNumber = strings.Replace(contentTxt, "腾讯会议号:", "", -1)
 		}
+		if strings.Contains(contentTxt, "会议ID:") {
+			item.MeetingId = strings.Replace(contentTxt, "会议ID:", "", -1)
+		}
 	})
 
 	strnum := strings.Index(body, "活动亮点:")

+ 3 - 0
services/roadshow/calendar.go

@@ -393,6 +393,9 @@ func GetAccessToken(isRefresh bool) (token string, err error) {
 
 // CalendarToSH 创建活动时同步上海的前置函数
 func CalendarToSH(rsCalendar roadshow.RsCalendar, researcher roadshow.RsCalendarResearcher) {
+	if researcher.Status != 2 { //研究员的路演申请,需要研究员接受后,再同步到老CRM
+		return
+	}
 	var err error
 	errMsg := ``
 	defer func() {