chenzx
2024-10-18 86613de5005a06d65c6f2e9679e6e4032ff558a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using CommonHelper;
using GasolineBlend.BLL;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.Web.Razor.Tokenizer.Symbols;
 
 
namespace GasolineBlend.Controllers
{
    public class SubsidyDataController : BaseController
    {
        private SubsidyDataBLL _acc = new SubsidyDataBLL();
        /// <summary>
        ///获取补贴列表数据
        /// </summary>
        /// <param name="PageNumber"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult GetSubsidyDataList(int PageNumber,int PageSize,string Keyword,string CompanyName) 
        {
            try
            {
                var list = _acc.GetSubsidyDataList(PageNumber, PageSize, Keyword, CompanyName);
                var response = new
                {
                    Data = list.Data,
                    TotalCount = list.TotalCount,
                    TotalPages = list.TotalPages
                };
                return SuccessNoShow(data: response);
            }
            catch (Exception e)
            {
                LogHelper.Write(Level.Error, "获取政策列表数据 GetSubsidyDataList", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
                return Error();
            }
        }
 
        [HttpPost]
        public ActionResult UploadFile(HttpPostedFileBase file)
        {
            if (file != null && file.ContentLength > 0)
            {
                try
                {
                    // 获取文件名
                    string fileName = Path.GetFileName(file.FileName);
 
                    // 设置文件保存路径
                    string path = Path.Combine(Server.MapPath("~/HaoshuRobot"), fileName);
                    // 保存文件到服务器
                    file.SaveAs(path);
 
                    // 返回成功消息
                    return Json(new { success = true, message = "文件上传成功。", filePath = path }, JsonRequestBehavior.AllowGet);
                }
                catch (Exception ex)
                {
                    // 记录错误信息
                    // LogHelper.Write(Level.Error, "上传文件时发生错误", ex);
                    return Json(new { success = false, message = "文件上传失败:" + ex.Message }, JsonRequestBehavior.AllowGet);
                }
            }
            else
            {
                return Json(new { success = false, message = "请选择一个文件上传。" }, JsonRequestBehavior.AllowGet);
            }
        }
        /// <summary>
        ///访问Moonshot
        /// </summary>
        /// <param name="CompanyName"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult GetPolicyApplied(string CompanyName)
        {
            try
            {
                var list = _acc.GetPolicyApplied(CompanyName);
                var response = new
                {
                    Data = list.Data,
                };
                return SuccessNoShow(data: response);
            }
            catch (Exception e)
            {
                LogHelper.Write(Level.Error, "访问Moonshot GetPolicyApplied", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
                return Error();
            }
        }
        /// <summary>
        ///访问Moonshot
        /// </summary>
        /// <param name="CompanyName"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult GetPolicyAnswer(string CompanyName)
        {
            try
            {
                string list = _acc.GetPolicyAnswer(CompanyName);
                var response = new
                {
                    Data = list,
                };
                return SuccessNoShow(data: response);
            }
            catch (Exception e)
            {
                LogHelper.Write(Level.Error, "访问Moonshot GetPolicyAnswer", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
                return Error();
            }
        }
 
 
    }
}