| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.Logging;
- using Microsoft.Extensions.Options;
- using Microsoft.AspNetCore.Authorization;
- using System.Web;
- using MySystem.Models.Main1;
- using MySystem.Service.Main1;
- using LitJson;
- using Library;
- namespace MySystem.Areas.Api.Controllers.v1.Main1
- {
- [Area("Api")]
- [Route("/v1/QrCodePlateMain/[controller]/[action]")]
- public class ExportExcelsController : BaseController
- {
- public ExportExcelsController(IHttpContextAccessor accessor) : base(accessor)
- {
- }
- #region 我的下载-我的下载
- [Authorize]
- public JsonResult DownloadsList(string value)
- {
- value = PublicFunction.DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- Dictionary<string, object> Other = new Dictionary<string, object>();
- List<Dictionary<string, object>> dataList = DownloadsListDo(value, out Other);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
- }
- private List<Dictionary<string, object>> DownloadsListDo(string value, out Dictionary<string, object> Other)
- {
- JsonData data = JsonMapper.ToObject(value);
- string CreateDate = data["CreateDate"].ToString(); //创建时间
- string FileName = data["FileName"].ToString(); //文件名
- string FileUrl = data["FileUrl"].ToString(); //文件路径
- int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
- int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
- string condition = "";
- if (!string.IsNullOrEmpty(CreateDate))
- {
- string[] datelist = CreateDate.Split(new string[] { " - " }, StringSplitOptions.None);
- string start = datelist[0];
- string end = datelist[1];
- condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
- }
- if (!string.IsNullOrEmpty(FileName))
- {
- condition += " and FileName like '%" + FileName + "%'";
- }
- if (!string.IsNullOrEmpty(FileUrl))
- {
- condition += " and FileUrl like '%" + FileUrl + "%'";
- }
- List<RelationData> relationData = new List<RelationData>();
- Other = new Dictionary<string, object>();
- int count = 0;
- List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
- List<Dictionary<string, object>> source = ExportExcelsService.List(relationData, condition, out count, pageNum, pageSize);
- foreach (Dictionary<string, object> subdata in source)
- {
- Dictionary<string, object> curData = new Dictionary<string, object>();
- curData.Add("Id", subdata["Id"].ToString()); //记录Id
- curData.Add("CreateDate", subdata["CreateDate"].ToString() == "" ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //创建时间
- curData.Add("FileName", subdata["FileName"].ToString()); //文件名
- curData.Add("FileUrl", subdata["FileUrl"].ToString()); //文件路径
- dataList.Add(curData);
- }
- Other.Add("Count", count); //总数
- return dataList;
- }
- #endregion
- }
- }
|