Browse Source

修改业务统计时间

xuzhiheng 2 years ago
parent
commit
cd82a4950f

+ 15 - 0
src/order/orderManageController.go

@@ -1192,6 +1192,7 @@ func CreateBigOrder(context *admin.Context) (interface{}, error) {
 		code := fmt.Sprintf("%s%s", time.Now().Format("150405"), qutil.GetRandom(6))
 		var status error
 		param.CreatePerson = context.User.Username
+		param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
 		if param.CreateType == 1 {
 			status = NewBigOrder(subStatus, dateType, startdate, enddate, userId, code, sName, &param)
 		} else if param.CreateType == 2 {
@@ -1310,6 +1311,10 @@ func UpdateBigOrder(context *admin.Context) (interface{}, error) {
 		if auditStatus != util.OrderPassed {
 			return nil, errors.New("仅可编辑订单审核状态为已通过的订单")
 		}
+		//若业绩时间改变,时分秒改为当前时分秒
+		if param.SaleTime != qutil.ObjToString(res["sale_time"]) {
+			param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
+		}
 		if res["user_phone"] != param.Phone {
 			userData, ok := util.MQFW.FindOne("user", map[string]interface{}{"s_phone": param.Phone})
 			memberStatus := 0
@@ -1903,6 +1908,7 @@ func CreateSubOrder(context *admin.Context) (interface{}, error) {
 	}
 	param.BuySubject = "1" //大会员补充包/子账号 均为购买个体
 	param.CreatePerson = context.User.Username
+	param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
 	if param.Phone != "" {
 		userId, memberStatus := "", 0
 		bigStart, bigEnd, pay_sub_num, free_sub_num := int64(0), int64(0), 0, 0
@@ -2141,6 +2147,10 @@ func UpdateSubOrder(context *admin.Context) (interface{}, error) {
 		if auditStatus != util.OrderPassed {
 			return nil, errors.New("仅可编辑订单审核状态为已通过的订单")
 		}
+		//若业绩时间改变,时分秒改为当前时分秒
+		if param.SaleTime != qutil.ObjToString(res["sale_time"]) {
+			param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
+		}
 		//处理回款状态
 		//原来实收金额
 		payMoney := qutil.IntAll(qutil.If(res["pay_money"] == "", 0, res["pay_money"]))
@@ -2357,6 +2367,7 @@ func CreateSupplyOrder(context *admin.Context) (interface{}, error) {
 	}
 	param.BuySubject = "1" //大会员补充包/子账号 均为购买个体
 	param.CreatePerson = context.User.Username
+	param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
 	if param.Phone != "" {
 		userId := ""
 		bigStart, bigEnd, memberStatus := int64(0), int64(0), 0
@@ -2648,6 +2659,10 @@ func UpdateSupplyOrder(context *admin.Context) (interface{}, error) {
 		if auditStatus != util.OrderPassed {
 			return nil, errors.New("仅可编辑订单审核状态为已通过的订单")
 		}
+		//若业绩时间改变,时分秒改为当前时分秒
+		if param.SaleTime != qutil.ObjToString(res["sale_time"]) {
+			param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
+		}
 		//处理回款状态
 		//原来实收金额
 		payMoney := qutil.IntAll(qutil.If(res["pay_money"] == "", 0, res["pay_money"]))

+ 0 - 2
src/order/orderManageService.go

@@ -3717,7 +3717,6 @@ func NewBigOrder(subStatus, dateType int, startdate, enddate time.Time, userId,
 	filter, _ := json.Marshal(filterMap)
 	agreementTime := time.Unix(param.AgreementTime, 0)
 	serverMap := GetServerPid()
-	log.Println("serverMap", serverMap)
 	if param.BigPayMoney > -1 {
 		paramOrder := map[string]interface{}{
 			"order_money":    param.BigMoney + param.SubMoney + param.SupplyMoney,
@@ -5323,7 +5322,6 @@ func ParentDownload(rdata *[]map[string]interface{}) string {
 func GetServerPid() map[int]int {
 	pidMap := map[int]int{}
 	datas := util.JysqlDB.Find("bigmember_service", map[string]interface{}{"i_status": 0}, "id,i_pid", "", 0, 0)
-	log.Println("bigmember_service:", datas)
 	if datas != nil && len(*datas) > 0 {
 		for _, v := range *datas {
 			if v["i_pid"] != nil {

+ 9 - 1
src/order/otherOrderController.go

@@ -210,6 +210,7 @@ func CreateOtherOrder(context *admin.Context) (interface{}, error) {
 		param.ProductType = "3A信用认证"
 	}
 	param.CreatePerson = context.User.Username
+	param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
 	code := fmt.Sprintf("%s%s", time.Now().Format("150405"), qutil.GetRandom(6))
 
 	if param.ProductType == "企业商机管理" {
@@ -419,6 +420,10 @@ func UpdateOtherOrder(context *admin.Context) (interface{}, error) {
 		}
 		util.JysqlDB.Update("dataexport_order", map[string]interface{}{"order_code": qutil.ObjToString(param.OrderCode)}, map[string]interface{}{"user_phone": param.Phone, "user_id": userId})
 	}
+	//若业绩时间改变,时分秒改为当前时分秒
+	if param.SaleTime != qutil.ObjToString(res["sale_time"]) {
+		param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
+	}
 
 	//处理订单状态
 	//原来实收金额
@@ -670,10 +675,13 @@ func UpdateOrder(context *admin.Context) (interface{}, error) {
 		return nil, errors.New("缺少销售渠道")
 	}
 	param.CreatePerson = context.User.Username
+	if param.SaleTime != "" {
+		param.SaleTime = strings.Split(param.SaleTime, " ")[0] + " " + strings.Split(qutil.NowFormat(qutil.Date_Full_Layout), " ")[1]
+	}
 	insertData := map[string]interface{}{
 		"salesperson":          param.SalesPerson,
 		"salesperson_id":       param.SalesPersonId,
-		"sale_time":            qutil.If(param.SaleTime == "", nil, param.SaleTime), // 业务统计时间,   // 业务统计时间
+		"sale_time":            qutil.If(param.SaleTime == "", nil, param.SaleTime), // 业务统计时间
 		"distribution_channel": param.SalesChannel,
 		"last_update_person":   param.CreatePerson,
 		"last_update_time":     qutil.NowFormat(qutil.Date_Full_Layout),