瀏覽代碼

Merge branch 'master' of http://192.168.1.222:3000/zhengbingbing/ZLJ_API_V6.0

zhengbingbing 5 年之前
父節點
當前提交
634aa6586b

+ 10 - 0
代码/System.IRepositories/IBus_TagRepository.cs

@@ -0,0 +1,10 @@
1
+using System.Common;
2
+using System;
3
+using System.Model;
4
+
5
+namespace System.IRepositories
6
+{
7
+    public interface IBus_TagRepository : IRepository<T_Bus_Tag>
8
+    {
9
+    }
10
+}

+ 84 - 0
代码/System.Model/T_Bus_Tag.cs

@@ -0,0 +1,84 @@
1
+using System;
2
+namespace System.Model
3
+{
4
+	/// <summary>
5
+	/// 标签管理表
6
+	/// </summary>
7
+	[Serializable]
8
+	public partial class T_Bus_Tag
9
+	{
10
+		public T_Bus_Tag()
11
+		{ }
12
+		#region Model
13
+		private string _f_tagname="";
14
+		private int _f_type=0;
15
+		private int _f_class=1;
16
+		private int _f_userid;
17
+		private string _f_username="";
18
+		private int _f_sort = 100;
19
+		private DateTime _f_updatetime = DateTime.Now;
20
+
21
+
22
+
23
+		
24
+		/// <summary>
25
+		/// 上次更新时间
26
+		/// </summary>
27
+		public DateTime F_UpdateTime
28
+		{
29
+			set { _f_updatetime = value; }
30
+			get { return _f_updatetime; }
31
+		}
32
+		/// <summary>
33
+		/// 标签名称
34
+		/// </summary>
35
+		public string F_TagName
36
+		{
37
+			set { _f_tagname = value; }
38
+			get { return _f_tagname; }
39
+		}
40
+		/// <summary>
41
+		/// 标签类型 0产品 1会员(暂不启用)
42
+		/// </summary>
43
+		public int F_Type
44
+		{
45
+			set { _f_type = value; }
46
+			get { return _f_type; }
47
+		}
48
+		/// <summary>
49
+		/// 标签分组 1系统标签 不能更改 2基础标签 3活动标签
50
+		/// </summary>
51
+		public int F_CLass
52
+		{
53
+			set { _f_class = value; }
54
+			get { return _f_class; }
55
+		}
56
+		/// <summary>
57
+		/// 操作人id
58
+		/// </summary>
59
+		public int F_UserId
60
+		{
61
+			set { _f_userid = value; }
62
+			get { return _f_userid; }
63
+		}
64
+		/// <summary>
65
+		/// 操作人名称
66
+		/// </summary>
67
+		public string F_UserName
68
+		{
69
+			set { _f_username = value; }
70
+			get { return _f_username; }
71
+		}
72
+		/// <summary>
73
+		/// 排序 正序
74
+		/// </summary>
75
+		public int F_Sort
76
+		{
77
+			set { _f_sort = value; }
78
+			get { return _f_sort; }
79
+		}
80
+		#endregion Model
81
+
82
+	}
83
+}
84
+

+ 46 - 1
代码/System.Model/T_Cus_VipInfo.cs

@@ -58,7 +58,7 @@ namespace System.Model
58 58
             get { return _f_birthday; }
59 59
         }
60 60
         /// <summary>
61
-        /// 手机号
61
+        /// 固定电话
62 62
         /// </summary>
63 63
         public string F_Phone
64 64
         {
@@ -170,6 +170,51 @@ namespace System.Model
170 170
         /// 删除工号
171 171
         /// </summary>
172 172
         public string F_DeleteBy { get; set; }
173
+        /// <summary>
174
+		/// 年龄
175
+        /// </summary>				
176
+        public int F_Age { get; set; }
177
+        /// <summary>
178
+        /// 手机号1
179
+        /// </summary>				
180
+        public string F_Mobile { get; set; }
181
+        /// <summary>
182
+        /// 手机号2
183
+        /// </summary>				
184
+        public string F_Mobile1 { get; set; }
185
+        /// <summary>
186
+        /// 省
187
+        /// </summary>				
188
+        public string F_Province { get; set; }
189
+        /// <summary>
190
+        /// 县、区
191
+        /// </summary>				
192
+        public string F_Area { get; set; }
193
+        /// <summary>
194
+        /// 乡镇
195
+        /// </summary>				
196
+        public string F_Town { get; set; }
197
+        /// <summary>
198
+        /// 邮编
199
+        /// </summary>				
200
+        public string F_Postcode { get; set; }
201
+        /// <summary>
202
+        /// 鞋码
203
+        /// </summary>				
204
+        public int F_ShoeSize { get; set; }
205
+        /// <summary>
206
+        /// 会员积分
207
+        /// </summary>				
208
+        public decimal F_Score { get; set; }
209
+        /// <summary>
210
+        /// 累计消费金额
211
+        /// </summary>				
212
+        public decimal F_Money { get; set; }
213
+        /// <summary>
214
+        /// 累计积分
215
+        /// </summary>				
216
+        public decimal F_TotalScore { get; set; }
217
+
173 218
         #endregion Model
174 219
     }
175 220
 }

+ 13 - 0
代码/System.Repositories/Bus_TagRepository.cs

@@ -0,0 +1,13 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Text;
4
+using System.IRepositories;
5
+using System.Model;
6
+using System.Common;
7
+
8
+namespace System.Repositories
9
+{
10
+    public class Bus_TagRepository : BaseRepository<T_Bus_Tag>, IBus_TagRepository
11
+    {
12
+    }
13
+}

+ 10 - 3
代码/TVShoppingCallCenter_ZLJ/Controllers/Customer/VIPInfoController.cs

@@ -48,9 +48,16 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
48 48
             conModels.Add(new ConditionalModel() { FieldName = "F_State", ConditionalType = ConditionalType.Equal, FieldValue = ((int)EnumDelState.Enabled).ToString() });
49 49
 
50 50
             if (!string.IsNullOrEmpty(keyword))
51
-            {
52
-                conModels.Add(new ConditionalModel() { FieldName = "F_Name", ConditionalType = ConditionalType.Like, FieldValue = keyword });
53
-            }
51
+                conModels.Add(new ConditionalCollections()
52
+                {
53
+                    ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
54
+                    {
55
+                        new  KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel() { FieldName = "F_Name", ConditionalType = ConditionalType.Like, FieldValue = keyword }),
56
+                        new  KeyValuePair<WhereType, ConditionalModel>( WhereType.Or , new ConditionalModel() { FieldName = "F_Phone", ConditionalType = ConditionalType.Like, FieldValue = keyword }),
57
+                        new  KeyValuePair<WhereType, ConditionalModel>( WhereType.Or, new ConditionalModel() { FieldName = "F_VIPCode", ConditionalType = ConditionalType.Like, FieldValue = keyword })
58
+                       
59
+                    }
60
+                });
54 61
             #endregion
55 62
             int recordCount = 0;
56 63
             var list = await _cus_vip_infoRepository.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount });

+ 12 - 0
代码/TVShoppingCallCenter_ZLJ/Controllers/Customer/VipLabelInfoController.cs

@@ -51,6 +51,16 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
51 51
             {
52 52
                 conModels.Add(new ConditionalModel() { FieldName = "F_Name", ConditionalType = ConditionalType.Like, FieldValue = keyword });
53 53
             }
54
+            if (!string.IsNullOrEmpty(keyword))
55
+                conModels.Add(new ConditionalCollections()
56
+                {
57
+                    ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
58
+                    {
59
+                        new  KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel() { FieldName = "F_Name", ConditionalType = ConditionalType.Like, FieldValue = keyword }),
60
+                        new  KeyValuePair<WhereType, ConditionalModel>( WhereType.Or , new ConditionalModel() { FieldName = "F_Type", ConditionalType = ConditionalType.Like, FieldValue = keyword })
61
+
62
+                    }
63
+                });
54 64
             #endregion
55 65
             int recordCount = 0;
56 66
             var list = await _cus_vip_labelinfoRepository.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount });
@@ -177,5 +187,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
177 187
             else
178 188
                 return Error("请选择要删除的记录");
179 189
         }
190
+
191
+
180 192
     }
181 193
 }

+ 165 - 2
代码/TVShoppingCallCenter_ZLJ/Controllers/Product/ProductController.cs

@@ -26,11 +26,13 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
26 26
     {
27 27
 
28 28
         private readonly IBus_ProductRepository _productRepository;
29
-        private readonly IBus_ProductClassRepository _productClassRepository;
30
-        public ProductController(IBus_ProductRepository productRepository, IBus_ProductClassRepository productClassRepository)
29
+        private readonly IBus_ProductClassRepository _productClassRepository; 
30
+        private readonly IBus_TagRepository _tagRepository;
31
+        public ProductController(IBus_ProductRepository productRepository, IBus_ProductClassRepository productClassRepository, IBus_TagRepository tagRepository)
31 32
         {
32 33
             _productRepository = productRepository;
33 34
             _productClassRepository = productClassRepository;
35
+            _tagRepository = tagRepository;
34 36
         }
35 37
         [AllowAnonymous]
36 38
         [HttpGet("/api/test")]
@@ -658,6 +660,167 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
658 660
 
659 661
         #endregion
660 662
 
663
+
664
+
665
+        #region 标签操作
666
+
667
+        /// <summary>
668
+        /// 新增标签
669
+        /// </summary>
670
+        /// <param name="input"></param>
671
+        /// <returns></returns>
672
+        [HttpPost("addtag")]
673
+        public async Task<IActionResult> AddTag(TagInput input)
674
+        {
675
+
676
+            #region 验证 参数
677
+
678
+
679
+            if (string.IsNullOrEmpty(input.TagName))
680
+                return Error("请输入分类名称");
681
+            if (input.CLass<1)
682
+                return Error("请输入标签分类");
683
+            if (input.Type < 0)
684
+                input.Type = 1;
685
+
686
+            #endregion
687
+            Expression<Func<T_Bus_Tag, bool>> eq = a => a.F_TagName == input.TagName;
688
+
689
+            if (await _tagRepository.GetCount(eq.And(b => b.F_Type == input.Type)) > 0)
690
+            {
691
+                return Error("标签名称重复");
692
+            }
693
+            T_Bus_Tag T_Bus_TagModel = new T_Bus_Tag();
694
+
695
+            T_Bus_TagModel.F_Type = input.Type;
696
+            T_Bus_TagModel.F_TagName = input.TagName;
697
+            T_Bus_TagModel.F_Sort = 100;
698
+            T_Bus_TagModel.F_CLass = input.CLass;
699
+            T_Bus_TagModel.F_UserName = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name).Value;
700
+            T_Bus_TagModel.F_UserId = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
701
+            T_Bus_TagModel.F_UpdateTime = DateTime.Now;
702
+
703
+            if (await _tagRepository.Add(T_Bus_TagModel) > 0)
704
+            {
705
+                return Success("新增标签成功");
706
+            }
707
+            else
708
+            {
709
+                return Error("标签重复或失败,请重试!");
710
+            }
711
+        }
712
+
713
+
714
+        /// <summary>
715
+        /// 更新标签
716
+        /// </summary>
717
+        /// <param name="input"></param>
718
+        /// <returns></returns>
719
+        [HttpPost("updatetag")]
720
+        public async Task<IActionResult> UpdateTag(TagInput input)
721
+        {
722
+
723
+            #region 验证 参数
724
+
725
+
726
+            if (string.IsNullOrEmpty(input.TagName))
727
+                return Error("请输入原标签名称");
728
+            if (string.IsNullOrEmpty(input.NewTagName))
729
+                return Error("请输入标签名称");
730
+            if (input.Type < 0)
731
+                input.Type = 1;
732
+            if (input.Sort <1)
733
+                return Error("请输入标签排序序号");
734
+
735
+            #endregion
736
+
737
+            Expression<Func<T_Bus_Tag, bool>> eq = a => a.F_TagName == input.TagName;
738
+
739
+            T_Bus_Tag T_Bus_TagModel = await _tagRepository.GetSingle(eq.And(b=>b.F_Type== input.Type));
740
+            //除非某固定权限 定之后再加
741
+            if (T_Bus_TagModel.F_CLass == 1)
742
+            {
743
+                return Error("系统标签不能更改");
744
+            }
745
+            T_Bus_TagModel.F_TagName = input.NewTagName;
746
+            T_Bus_TagModel.F_Sort = input.Sort;
747
+
748
+
749
+            T_Bus_TagModel.F_UserName = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name).Value;
750
+            T_Bus_TagModel.F_UserId = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
751
+            T_Bus_TagModel.F_UpdateTime = DateTime.Now;
752
+
753
+            if (await _tagRepository.Update(T_Bus_TagModel))
754
+            {
755
+                return Success("更新标签成功");
756
+            }
757
+            else
758
+            {
759
+                return Error("标签重复或失败,请重试!");
760
+            }
761
+        }
762
+
763
+        /// <summary>
764
+        /// 删除标签
765
+        /// </summary>
766
+        /// <param name="tagName"></param>
767
+        /// <returns></returns>
768
+        [HttpPost("deletetag")]
769
+        public async Task<IActionResult> DeleteTag(TagInput input)
770
+        {
771
+
772
+
773
+            if (string.IsNullOrEmpty(input.TagName))
774
+                return Error("请选择标签");
775
+            if (input.CLass<2)
776
+                return Error("系统标签不能删除");
777
+
778
+
779
+            Expression<Func<T_Bus_Tag, bool>> eq = a => a.F_TagName == input.TagName;
780
+            //非系统标签可以随意删除,与商品没有关联
781
+            if (await _tagRepository.Delete(eq.And(b=>b.F_Type==input.Type)))
782
+            {
783
+                return Success("删除标签成功");
784
+            }
785
+            else
786
+            {
787
+                return Error("删除标签失败,请重试!");
788
+            }
789
+        }
790
+
791
+        /// <summary>
792
+        /// 查询符合条件所有标签
793
+        /// </summary>
794
+        /// <param name="input"></param>
795
+        /// <returns></returns>
796
+        [HttpPost("gettagall")]
797
+        public async Task<IActionResult> GetTagAll(TagInput input)
798
+        {
799
+
800
+
801
+            #region  拼接条件
802
+
803
+            Expression<Func<T_Bus_Tag, bool>> eq = a => a.F_Type == 1;
804
+
805
+            //if (input.Type > 0)
806
+            //    eq = eq.And(a => a.F_Type == input.Type);
807
+            if (input.CLass > 0)
808
+            {
809
+                eq = eq.And(a => a.F_CLass == input.CLass);
810
+            }
811
+
812
+
813
+            #endregion
814
+
815
+
816
+            List<T_Bus_Tag> list = await _tagRepository.GetListALL(eq,c=>c.F_Sort,OrderByType.Asc);
817
+
818
+            return Success("成功", list);
819
+
820
+        }
821
+
822
+        #endregion
823
+
661 824
         #region 库存对接
662 825
 
663 826
         /// <summary>

+ 65 - 0
代码/TVShoppingCallCenter_ZLJ/Models/Inputs/TagInput.cs

@@ -0,0 +1,65 @@
1
+using System;
2
+namespace TVShoppingCallCenter_ZLJ.Models.Inputs
3
+{
4
+	/// <summary>
5
+	/// 标签管理表
6
+	/// </summary>
7
+	[Serializable]
8
+	public partial class TagInput
9
+	{
10
+		public TagInput()
11
+		{ }
12
+		#region Model
13
+		private string _f_tagname="";
14
+		private string _newtagname = "";
15
+		private int _f_type=0;
16
+		private int _f_class=1;
17
+		private int _f_userid;
18
+		private string _f_username="";
19
+		private int _f_sort = 100;
20
+		/// <summary>
21
+		/// 新标签名称
22
+		/// </summary>
23
+		public string NewTagName
24
+		{
25
+			set { _newtagname = value; }
26
+			get { return _newtagname; }
27
+		}
28
+		/// <summary>
29
+		/// 标签名称
30
+		/// </summary>
31
+		public string TagName
32
+		{
33
+			set { _f_tagname = value; }
34
+			get { return _f_tagname; }
35
+		}
36
+		/// <summary>
37
+		/// 标签类型 1产品 2会员(暂不启用)
38
+		/// </summary>
39
+		public int Type
40
+		{
41
+			set { _f_type = value; }
42
+			get { return _f_type; }
43
+		}
44
+		/// <summary>
45
+		/// 标签分组 1系统标签 不能更改 2基础标签 3活动标签
46
+		/// </summary>
47
+		public int CLass
48
+		{
49
+			set { _f_class = value; }
50
+			get { return _f_class; }
51
+		}
52
+
53
+		/// <summary>
54
+		/// 排序 正序
55
+		/// </summary>
56
+		public int Sort
57
+		{
58
+			set { _f_sort = value; }
59
+			get { return _f_sort; }
60
+		}
61
+		#endregion Model
62
+
63
+	}
64
+}
65
+

+ 1 - 0
代码/TVShoppingCallCenter_ZLJ/Startup.cs

@@ -118,6 +118,7 @@ namespace TVShoppingCallCenter_ZLJ
118 118
 
119 119
             services.AddTransient<IBus_ProductClassRepository, Bus_ProductClassRepository>();
120 120
             services.AddTransient<IBus_ProductRepository, Bus_ProductRepository>();
121
+            services.AddTransient<IBus_TagRepository, Bus_TagRepository>();
121 122
 
122 123
             services.AddTransient<ICus_VipInfoRepository, Cus_VipInfoRepository>();
123 124
             services.AddTransient<ICus_VipLabelInfoRepository, Cus_VipLabelInfoRepository>();