Commit 38f71a92 by 泽锋 李

fix

parent cb319105
...@@ -130,4 +130,27 @@ namespace AutoTurnOver.Models ...@@ -130,4 +130,27 @@ namespace AutoTurnOver.Models
{ {
public string data_type { get; set; } public string data_type { get; set; }
} }
public class report_cash_flow_view_dto
{
public string remarks { get; set; }
public string date_type_str { get; set; }
public int date_type { get; set; }
public List<date_dto> dates { get; set; }
public class date_dto
{
public string date_title { get; set; }
public DateTime btime { get; set; }
public DateTime etime { get; set; }
public decimal occur_val { get; set; }
public decimal pay_val { get; set; }
}
}
public class report_cash_flow_view_search_dto
{
public DateTime? btime { get; set; }
public DateTime? etime { get; set; }
}
} }
using AutoTurnOver.DB;
using AutoTurnOver.Models;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Text;
namespace AutoTurnOver.Services
{
public class CashFlowServices
{
public List<dynamic> GetView(report_cash_flow_view_search_dto search_data)
{
var order_list = report_cash_flow_dao.GetView(search_data);
List<dynamic> datas = new List<dynamic>();
foreach (var item in order_list)
{
dynamic o = new ExpandoObject();
o.date_type = item.date_type;
o.date_type_str = item.date_type_str;
o.remarks = item.remarks;
foreach (var dat_item in item.dates)
{
var dic = (IDictionary<string, object>)o;
dic["occur_" + (dat_item.date_title)] = new { val = Math.Round(dat_item.occur_val, 2), btime = dat_item.btime, etime = dat_item.etime, data_type = item.date_type };
dic["pay_" + (dat_item.date_title)] = new { val = Math.Round(dat_item.pay_val, 2), btime = dat_item.btime, etime = dat_item.etime, data_type = item.date_type };
}
datas.Add(o);
}
return datas;
}
}
}
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.0.2105168" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.0.2105168" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.10" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoTurnOver.Models;
using AutoTurnOver.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace AutoTurnOver.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class CashFlowController : ControllerBase
{
public JsonResult GetView(DateTime? btime, DateTime? etime)
{
report_cash_flow_view_search_dto search_data = new report_cash_flow_view_search_dto
{
etime = etime,
btime = btime,
};
var list = new CashFlowServices().GetView(search_data);
return new JsonResult(new
{
rows = list,
total = 0,
});
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment