胡轶钦 6 年 前
コミット
12a9c94116

+ 2
- 2
controllers/cases/key.go ファイルの表示

@@ -29,11 +29,11 @@ func (c *CaseController) GetKeyList() {
29 29
 // AddKeys 新增钥匙
30 30
 func (c *CaseController) AddKeys() {
31 31
 	caseid := c.GetString("caseid")
32
-	orgid := c.GetString("orgid")
32
+	org := c.Context.Get("org").(model.SysOrg)
33 33
 	beginnum, _ := c.GetInt("beginnum")
34 34
 	endnum, _ := c.GetInt("endnum")
35 35
 
36
-	err := c.dao.AddKeys(orgid, caseid, beginnum, endnum)
36
+	err := c.dao.AddKeys(org.OrgId, caseid, beginnum, endnum)
37 37
 	if err != nil {
38 38
 		c.ResponseError(err)
39 39
 	}

+ 1
- 1
controllers/statistics/cardcoupon.go ファイルの表示

@@ -293,5 +293,5 @@ func (c *StatisticsController) CardCouponVerifyStatisticsExcel() {
293 293
 			verifystatus,
294 294
 		})
295 295
 	}
296
-	c.SaveToExcel("卡券核销列表.xlsx", excel)
296
+	c.SaveToExcel("课程核销列表.xlsx", excel)
297 297
 }

+ 1
- 2
models/goods/goods.go ファイルの表示

@@ -54,8 +54,7 @@ func (m *GoodsDAO) GetGoodsListPageNavi(name, typeID, caseID string, limit []int
54 54
 	sql += `		
55 55
 		AND status > ` + strconv.Itoa(models.STATUS_DEL) + `
56 56
 		ORDER BY
57
-			type_id,
58
-			create_date
57
+			create_date desc
59 58
 	`
60 59
 
61 60
 	// sql += ` limit ` + strconv.Itoa(limit[0]) + ` OFFSET ` + strconv.Itoa(limit[1])

+ 0
- 3
models/statistics/cardcoupon.go ファイルの表示

@@ -5,8 +5,6 @@ import (
5 5
 	"strconv"
6 6
 	"strings"
7 7
 	"time"
8
-
9
-	"github.com/astaxie/beego"
10 8
 )
11 9
 
12 10
 // CardCouponStatistics 商品统计信息
@@ -403,7 +401,6 @@ func (m *StatisticsDAO) CardCouponUsedCountStatistics(caseids, tel, name, receiv
403 401
 	if enddate != "" {
404 402
 		sql = sql + ` and DATE_FORMAT(tab.receive_date, '%Y-%m-%d') <= '` + enddate + `'`
405 403
 	}
406
-	beego.Error(sql)
407 404
 	err := m.db.Sql(sql).Find(&cardCoupons)
408 405
 	return cardCoupons, err
409 406
 }

+ 27
- 10
models/statistics/goods.go ファイルの表示

@@ -133,19 +133,27 @@ func (m *StatisticsDAO) GetGoodsOrderStatistics(status, usertype, caseids, begin
133 133
 						d.case_name,
134 134
 						a.user_type,
135 135
 						a.create_date,
136
-						a.status,
136
+						a. STATUS,
137 137
 						a.make_status,
138 138
 						a.area_name,
139 139
 						a.table_no,
140
-						c.customer_name,
141
-						c. NAME,
142
-						c.phone,
140
+						b.customer_name,
141
+						(
142
+							CASE
143
+							WHEN c.real_name IS NULL
144
+							OR c.real_name = '' THEN
145
+								b. NAME
146
+							ELSE
147
+								c.real_name
148
+							END
149
+						) AS NAME,
150
+						b.phone,
143 151
 						a.remark
144 152
 					FROM
145 153
 						ta_goods_orders a
146 154
 					INNER JOIN ta_customer b ON a.user_id = b.customer_id
147
-					INNER JOIN ta_customer c ON b.customer_id = c.customer_id
148 155
 					INNER JOIN sys_case d ON a.case_id = d.case_id
156
+					LEFT JOIN sys_user c ON b.user_id = c.user_id
149 157
 					where d.case_id in ('` + strings.Replace(caseids, ",", "','", -1) + `')`
150 158
 
151 159
 	if usertype != "" {
@@ -192,19 +200,27 @@ func (m *StatisticsDAO) GetGoodsOrderStatisticsCount(status, usertype, caseids,
192 200
 						d.case_name,
193 201
 						a.user_type,
194 202
 						a.create_date,
195
-						a.status,
203
+						a. STATUS,
196 204
 						a.make_status,
197 205
 						a.area_name,
198 206
 						a.table_no,
199
-						c.customer_name,
200
-						c. NAME,
201
-						c.phone,
207
+						b.customer_name,
208
+						(
209
+							CASE
210
+							WHEN c.real_name IS NULL
211
+							OR c.real_name = '' THEN
212
+								b. NAME
213
+							ELSE
214
+								c.real_name
215
+							END
216
+						) AS NAME,
217
+						b.phone,
202 218
 						a.remark
203 219
 					FROM
204 220
 						ta_goods_orders a
205 221
 					INNER JOIN ta_customer b ON a.user_id = b.customer_id
206
-					INNER JOIN ta_customer c ON b.customer_id = c.customer_id
207 222
 					INNER JOIN sys_case d ON a.case_id = d.case_id
223
+					LEFT JOIN sys_user c ON b.user_id = c.user_id
208 224
 					where d.case_id in ('` + strings.Replace(caseids, ",", "','", -1) + `')`
209 225
 
210 226
 	if usertype != "" {
@@ -219,6 +235,7 @@ func (m *StatisticsDAO) GetGoodsOrderStatisticsCount(status, usertype, caseids,
219 235
 	if status != "" {
220 236
 		sql = sql + ` and a.make_status='` + status + `'`
221 237
 	}
238
+	sql += ` order by a.create_date desc `
222 239
 	err := m.db.Sql(sql).Find(&orders)
223 240
 	return orders, err
224 241
 }

+ 1
- 4
models/vipcard/vipcard.go ファイルの表示

@@ -59,7 +59,7 @@ WHERE
59 59
 	if userName != "" {
60 60
 		sql = sql + ` and tc.customer_name like '%` + userName + `%'`
61 61
 	}
62
-	sql = sql + " order by vc.create_date, vip_card_child_code desc limit " + strconv.Itoa((page-1)*pageSize) + ", " + strconv.Itoa(pageSize)
62
+	sql = sql + " order by vc.create_date desc limit " + strconv.Itoa((page-1)*pageSize) + ", " + strconv.Itoa(pageSize)
63 63
 	err := m.db.Sql(sql).Find(&vipcards)
64 64
 	return vipcards, err
65 65
 }
@@ -168,7 +168,6 @@ func (m *VipcardDAO) GenerateChildCode() string {
168 168
 	return code
169 169
 }
170 170
 
171
-
172 171
 // GetVipCardListExcel 获取VIP卡列表 excel
173 172
 func (m *VipcardDAO) GetVipCardListExcel(caseids, cardNo, sellerName, userName string) ([]VipChild, error) {
174 173
 	var vipcards []VipChild
@@ -200,5 +199,3 @@ WHERE
200 199
 	err := m.db.Sql(sql).Find(&vipcards)
201 200
 	return vipcards, err
202 201
 }
203
-
204
-

+ 1
- 1
service/card/card.go ファイルの表示

@@ -289,7 +289,7 @@ func (s *CardServ) GiveCardTo(from *model.SysUser, to *model.TaCustomer, card *c
289 289
 		GiftId:     card.CardId,
290 290
 		GiftName:   card.CardName,
291 291
 		FromId:     from.UserId,
292
-		FromName:   from.UserName,
292
+		FromName:   from.RealName,
293 293
 		ToId:       to.CustomerId,
294 294
 		ToName:     to.CustomerName,
295 295
 		CreateDate: time.Now().Local(),

+ 3
- 0
service/cases/key.go ファイルの表示

@@ -52,6 +52,9 @@ func (s *CaseServ) GetKeysByCase(caseids, num string, page, pageSize int) (map[s
52 52
 
53 53
 // AddKeys 保存钥匙
54 54
 func (s *CaseServ) AddKeys(orgid, caseid string, beginnum, endnum int) error {
55
+	if caseid == "" {
56
+		return utils.LogError("请先选择案场!")
57
+	}
55 58
 	if endnum < beginnum {
56 59
 		return utils.LogError("锁柜编号起始编号不能大于截止编号!")
57 60
 	}

+ 1
- 1
service/coupon/coupon.go ファイルの表示

@@ -318,7 +318,7 @@ func (s *CouponServ) GiveCouponTo(from *model.SysUser, to *model.TaCustomer, cp
318 318
 		GiftId:     cp.CouponId,
319 319
 		GiftName:   cp.CouponName,
320 320
 		FromId:     from.UserId,
321
-		FromName:   from.UserName,
321
+		FromName:   from.RealName,
322 322
 		ToId:       to.CustomerId,
323 323
 		ToName:     to.CustomerName,
324 324
 		CreateDate: now,