add 协议明细接口

This commit is contained in:
路 范
2021-09-17 14:03:52 +08:00
parent a3e41aee85
commit 82dde0078d
40 changed files with 332 additions and 38 deletions

View File

@@ -6,11 +6,14 @@ using Furion;
using Furion.DataEncryption;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using Furion.UnifyResult;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using Newtonsoft.Json.Linq;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -113,35 +116,34 @@ namespace Ewide.NbzsZheliban.Service
var list_projects = await db.Ado.SqlQueryAsync<H5IndexPrjModel>("select a.ID Prjid,a.area,a.AreaID,a.HouseAcquisitionDepartment as zsbm,a.CollectDecisionNo1 as year,(isnull(a.CollectDecisionNoHeadName,'')+'['+cast(a.CollectDecisionNo1 as varchar)+']'+ isnull(cast(a.CollectDecisionNo2 as varchar),'')+'号') zsjdh,dbo.get_current_state(a.ID) CurrentState from Projects a where ID in ('" + string.Join("','", list_dcbs.Select(p => p.PrjId)) + "') ");
//分户评估
var InvestigateTableID_param = "'" + string.Join("','", list_dcbs.Select(p => p.dcbId)) + "'";
var list_fhpgs = await db.Ado.SqlQueryAsync<Fhpgs>("select e.ProjectId as PrjId ,d.AssessmentNo,e.HouseAddress,d.countValue from InvestigateTable_Assessment d inner join InvestigateTable e on d.InvestigateTableId=e.ID where d.InvestigateTableID in ( " + InvestigateTableID_param + " ) union all select e.ProjectId as PrjId ,AssessmentNo, e.HouseAddress, d.countValue from NonInvestigateTable_Assessment d inner join NonResidentialInvestigateTable e on d.NonInvestigateTableID = e.ID where d.NonInvestigateTableID in ( " + InvestigateTableID_param + " ) ;");
var list_fhpgs = await db.Ado.SqlQueryAsync<Fhpgs>("select d.id,e.ProjectId as PrjId ,d.AssessmentNo,e.HouseAddress,d.countValue,e.id dcbId,d.CreateTime,d.CreateUserName from InvestigateTable_Assessment d inner join InvestigateTable e on d.InvestigateTableId=e.ID where d.InvestigateTableID in ( " + InvestigateTableID_param + " ) union all select d.id,e.ProjectId as PrjId ,AssessmentNo, e.HouseAddress, d.countValue,e.id dcbId,d.CreateTime,d.CreateUserName from NonInvestigateTable_Assessment d inner join NonResidentialInvestigateTable e on d.NonInvestigateTableID = e.ID where d.NonInvestigateTableID in ( " + InvestigateTableID_param + " ) ;");
//补偿协议
var list_bcxys = await db.Ado.SqlQueryAsync<Bcxy>("select isnull(d.CollectDecisionNoHeadName,'')+isnull(d.No1,'')+'-'+isnull(d.No2,'')+(case when (d.No3 is null or d.No3 = '') then '' else ('-'+d.No3) end ) XyNo,d.SwitchProductionWay,e.HouseAddress,d.SummationShouldCompensateMoney,e.ProjectId as PrjId from ResidentialAgreement d inner join InvestigateTable e on d.InvestigateTableId=e.ID where d.InvestigateTableID in ( " + InvestigateTableID_param + " ) union all select isnull(d.CollectDecisionNoHeadName, '') + isnull(d.No2, '') + '-' + isnull(d.No3, '') XyNo , d.SwitchProductionWay, e.HouseAddress, d.SummationShouldCompensateMoney, e.ProjectId as PrjId from NonResidentialAgreement d inner join NonResidentialInvestigateTable e on d.NonInvestigateTableID = e.ID where d.NonInvestigateTableID in ( " + InvestigateTableID_param + " ); ");
//政策
var list_PoliciesRegulations = await db.Queryable<Entity.PoliciesRegulations>().ToListAsync();
var listAreas = new List<Guid?>
{
Guid.Parse("B2A0291C-84C7-4D86-A6D5-CB9FCCF4A2D8")
};
var list_bcxys = await db.Ado.SqlQueryAsync<Bcxy>("select d.id,isnull(d.CollectDecisionNoHeadName,'')+isnull(d.No1,'')+'-'+isnull(d.No2,'')+(case when (d.No3 is null or d.No3 = '') then '' else ('-'+d.No3) end ) XyNo,d.SwitchProductionWay,e.HouseAddress,d.SummationShouldCompensateMoney,e.ProjectId as PrjId,e.id dcbId,d.SignTime from ResidentialAgreement d inner join InvestigateTable e on d.InvestigateTableId=e.ID where d.InvestigateTableID in ( " + InvestigateTableID_param + " ) union all select d.id,isnull(d.CollectDecisionNoHeadName, '') + isnull(d.No2, '') + '-' + isnull(d.No3, '') XyNo , d.SwitchProductionWay, e.HouseAddress, d.SummationShouldCompensateMoney, e.ProjectId as PrjId,e.id dcbId,d.SignTime from NonResidentialAgreement d inner join NonResidentialInvestigateTable e on d.NonInvestigateTableID = e.ID where d.NonInvestigateTableID in ( " + InvestigateTableID_param + " ); ");
var listAreas = new List<Guid?> { Guid.Parse("B2A0291C-84C7-4D86-A6D5-CB9FCCF4A2D8") };
list_projects.ForEach(p =>
{
p.FhpgList = list_fhpgs.Where(a => a.PrjId == p.PrjId);
p.BcxyList = list_bcxys.Where(a => a.PrjId == p.PrjId);
p.FhpgList = list_fhpgs.Where(a => a.PrjId == p.PrjId).ToList();
var bcxy = list_bcxys.Where(a => a.PrjId == p.PrjId).ToList();
bcxy.ForEach(a => a.countValue = list_fhpgs.Where(b => b.dcbId == a.dcbId).First().countValue);
p.BcxyList = bcxy;
listAreas.Add(Guid.Parse(p.AreaID));
});
var listPr = list_PoliciesRegulations.Where(a => listAreas.Contains(a.AreaID)).Select(b => new PoliciesRegulation
//政策
var list_PoliciesRegulations = await db.Queryable<Entity.PoliciesRegulations>().Where(a => listAreas.Contains(a.AreaID)).Select(b => new PoliciesRegulation
{
ID = b.ID,
Contents = b.Contents,
PublicTime = b.PublicTime,
Title = b.Title,
Area = b.Area
}).ToList();
}).ToListAsync();
H5IndexModel h5IndexModel = new()
{
PrjList = list_projects,
IdCard = cardno,
UserName = username,
PoliciesRegulationsLists = new Entity.Extends.PoliciesRegulations { List = listPr, TotalCount = listPr.Count }
PoliciesRegulationsLists = new Entity.Extends.PoliciesRegulations { List = list_PoliciesRegulations, TotalCount = list_PoliciesRegulations.Count }
};
return h5IndexModel;
}
@@ -196,5 +198,138 @@ namespace Ewide.NbzsZheliban.Service
}).FirstAsync();
return entity;
}
/// <summary>
/// 协议详细
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
[HttpPost("/agreement/info")]
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
public IActionResult AgreementInfo([FromBody] JObject args)
{
var ticket = args.GetJsonValue("ticket", isThrowExp: true);
var id = args.GetJsonGuidValue("id", isThrowExp: true);
JObject userInfoObj = GetInfoByTicket(ticket);
var XyFile = "";
//住宅
var entity_zz = db.Queryable<Entity.ResidentialAgreement>().Where(p => p.ID == id).Select(p => new { p.ID, p.XyFile }).First();
if (entity_zz != null)
{
XyFile = entity_zz.XyFile;
}
//非住宅
else
{
var entity_fzz = db.Queryable<Entity.NonResidentialAgreement>().Where(p => p.ID == id).Select(p => new { p.ID, p.XyFile }).First();
if (entity_fzz != null)
{
XyFile = entity_fzz.XyFile;
}
else
throw Oops.Oh("ID错误");
}
if (string.IsNullOrEmpty(XyFile))
throw Oops.Oh("未上传附件");
var filePath = App.Configuration["nbzs_file_path"] + XyFile;
return new FileStreamResult(new FileStream(filePath, FileMode.Open), "application/octet-stream") { FileDownloadName = new FileInfo(filePath).Name };
}
/// <summary>
/// 分布评估详细
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
[HttpPost("/house_estimate/info")]
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
public async Task<dynamic> HouseEstimateInfo([FromBody] JObject args)
{
var ticket = args.GetJsonValue("ticket", isThrowExp: true);
var id = args.GetJsonGuidValue("id", isThrowExp: true);
JObject userInfoObj = GetInfoByTicket(ticket);
var entity_zz = db.Queryable<Entity.InvestigateTable_Assessment>().Where(p => p.ID == id).First();
if (entity_zz != null)
{
if (entity_zz.ValuationMethod == 0)
{
return null;
}
else
throw Oops.Oh(199, "请使用文件接口");
}
else
{
var entity_fzz = db.Queryable<Entity.NonInvestigateTable_Assessment>().Where(p => p.ID == id).First();
if (entity_fzz != null)
{
if (entity_fzz.ValuationMethod == 0)
{
return null;
}
else
throw Oops.Oh(199, "请使用文件接口");
}
else
throw Oops.Oh("ID错误");
}
}
/// <summary>
/// 分布评估详细
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
[HttpPost("/house_estimate/file")]
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
public IActionResult HouseEstimateInfoFile([FromBody] JObject args)
{
var ticket = args.GetJsonValue("ticket", isThrowExp: true);
var id = args.GetJsonGuidValue("id", isThrowExp: true);
JObject userInfoObj = GetInfoByTicket(ticket);
var entity_zz = db.Queryable<Entity.InvestigateTable_Assessment>().Where(p => p.ID == id).First();
if (entity_zz != null)
{
switch (entity_zz.ValuationMethod)
{
//pdf上传
case 1:
case 2:
if (!string.IsNullOrEmpty(entity_zz.File))
{
var filePath = App.Configuration["nbzs_file_path"] + entity_zz.File;
return new FileStreamResult(new FileStream(filePath, FileMode.Open), "application/octet-stream") { FileDownloadName = new FileInfo(filePath).Name };
}
else
throw Oops.Oh("未上传文件");
//金额录入
default:
throw Oops.Oh("无文件");
}
}
else
{
var entity_fzz = db.Queryable<Entity.NonInvestigateTable_Assessment>().Where(p => p.ID == id).First();
if (entity_fzz != null)
{
switch (entity_fzz.ValuationMethod)
{
//pdf上传
case 1:
if (!string.IsNullOrEmpty(entity_fzz.File))
{
var filePath = App.Configuration["nbzs_file_path"] + entity_fzz.File;
return new FileStreamResult(new FileStream(filePath, FileMode.Open), "application/octet-stream") { FileDownloadName = new FileInfo(filePath).Name };
}
else
throw Oops.Oh("未上传文件");
//金额录入
default:
throw Oops.Oh("无文件");
}
}
else
throw Oops.Oh("ID错误");
}
throw Oops.Oh("出错了");
}
}
}