update接口增加政策

This commit is contained in:
路 范
2021-09-15 15:01:48 +08:00
parent cb1a9d4cb5
commit aa1b20a10c
21 changed files with 270 additions and 74 deletions

View File

@@ -0,0 +1,183 @@
//----------PoliciesRegulations开始----------
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
//using System.Data.Entity.ModelConfiguration;
using Ewide.NbzsZheliban.Entity;
using System.Runtime.Serialization;
namespace Ewide.NbzsZheliban.Entity
{
/// <summary>
/// 数据表实体类PoliciesRegulations
/// </summary>
[Table("PoliciesRegulations")]
public partial class PoliciesRegulations: BaseEntity {
/// <summary>
/// 无描述
/// </summary>
[Display(Name="无描述")]
[Key]
[Column("ID")]
[DataMember]
public Guid ID {get;set;}
/// <summary>
/// 项目id 关联Projects表ID
/// </summary>
[Display(Name="项目id 关联Projects表ID")]
[Column("ProjectID")]
[DataMember]
public Guid? ProjectID {get;set;}
/// <summary>
/// 项目名称
/// </summary>
[Display(Name="项目名称")]
[Column("ProjectName")]
[DataMember]
public string ProjectName {get;set;}
/// <summary>
/// 所属区域ID
/// </summary>
[Display(Name="所属区域ID")]
[Column("AreaID")]
[DataMember]
public Guid? AreaID {get;set;}
/// <summary>
/// 所属区域
/// </summary>
[Display(Name="所属区域")]
[Column("Area")]
[DataMember]
public string Area {get;set;}
/// <summary>
/// 标题
/// </summary>
[Display(Name="标题")]
[Column("Title")]
[DataMember]
public string Title {get;set;}
/// <summary>
/// 征文内容
/// </summary>
[Display(Name="征文内容")]
[Column("Contents")]
[DataMember]
public string Contents {get;set;}
/// <summary>
/// 是否公开
/// </summary>
[Display(Name="是否公开")]
[Column("IsPublic")]
[DataMember]
public bool IsPublic {get;set;}
/// <summary>
/// 发布时间
/// </summary>
[Display(Name="发布时间")]
[Column("PublicTime")]
[DataMember]
public DateTime? PublicTime {get;set;}
/// <summary>
/// 使用截止时间
/// </summary>
[Display(Name="使用截止时间")]
[Column("PublicTimeEnd")]
[DataMember]
public DateTime? PublicTimeEnd {get;set;}
/// <summary>
/// 无描述
/// </summary>
[Display(Name="无描述")]
[Column("CreateUserName")]
[DataMember]
public string CreateUserName {get;set;}
/// <summary>
/// 无描述
/// </summary>
[Display(Name="无描述")]
[Column("UpdateTime")]
[DataMember]
public DateTime? UpdateTime {get;set;}
/// <summary>
/// 无描述
/// </summary>
[Display(Name="无描述")]
[Column("UpdateUserId")]
[DataMember]
public Guid? UpdateUserId {get;set;}
/// <summary>
/// 无描述
/// </summary>
[Display(Name="无描述")]
[Column("UpdateUserName")]
[DataMember]
public string UpdateUserName {get;set;}
/// <summary>
/// 无描述
/// </summary>
[Display(Name="无描述")]
[Column("Remark")]
[DataMember]
public string Remark {get;set;}
/// <summary>
/// 无描述
/// </summary>
[Display(Name="无描述")]
[Column("Files")]
[DataMember]
public string Files {get;set;}
}
/**
/// <summary>
/// 数据表实体类MapPoliciesRegulations
/// </summary>
public class PoliciesRegulationsMap : EntityTypeConfiguration<PoliciesRegulations>
{
public PoliciesRegulationsMap()
{
this.ToTable("PoliciesRegulations");
this.HasKey(t => t.ID);
this.Property(t => t.ProjectID).HasColumnName("ProjectID");
this.Property(t => t.ProjectName).HasColumnName("ProjectName");
this.Property(t => t.AreaID).HasColumnName("AreaID");
this.Property(t => t.Area).HasColumnName("Area");
this.Property(t => t.Title).HasColumnName("Title");
this.Property(t => t.Contents).HasColumnName("Contents");
this.Property(t => t.IsPublic).HasColumnName("IsPublic");
this.Property(t => t.PublicTime).HasColumnName("PublicTime");
this.Property(t => t.PublicTimeEnd).HasColumnName("PublicTimeEnd");
this.Property(t => t.CreateTime).HasColumnName("CreateTime");
this.Property(t => t.CreateUserId).HasColumnName("CreateUserId");
this.Property(t => t.CreateUserName).HasColumnName("CreateUserName");
this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
this.Property(t => t.UpdateUserId).HasColumnName("UpdateUserId");
this.Property(t => t.UpdateUserName).HasColumnName("UpdateUserName");
this.Property(t => t.Remark).HasColumnName("Remark");
this.Property(t => t.Files).HasColumnName("Files");
this.Property(t => t.Sort).HasColumnName("Sort").IsRequired();
}
}**/
}
//----------PoliciesRegulations结束----------

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
@@ -33,6 +34,7 @@ namespace Ewide.NbzsZheliban.Entity.Extends
/// 项目信息
/// </summary>
public List<H5IndexPrjModel> PrjList { get; set; }
public List<PoliciesRegulation> PoliciesRegulationsList { get; set; }
}
public class H5IndexPrjModel
{
@@ -41,6 +43,8 @@ namespace Ewide.NbzsZheliban.Entity.Extends
/// 区域
/// </summary>
public string Area { get; set; }
[Newtonsoft.Json.JsonIgnore]
public string AreaID { get; set; }
/// <summary>
/// 征收部门
/// </summary>
@@ -66,4 +70,12 @@ namespace Ewide.NbzsZheliban.Entity.Extends
/// </summary>
public object BcxyList { get; set; }
}
public class PoliciesRegulation
{
public Guid ID { get; set; }
public string Title { get; set; }
public string Contents { get; set; }
public DateTime? PublicTime { get; set; }
}
}

View File

@@ -12,6 +12,7 @@

View File

@@ -16,7 +16,7 @@
string tableClass="";
//所有表名称
//string sqlGetTable = "SELECT Name FROM SysObjects Where XType='U' ORDER BY Name";
DataTable dt = GetDataTable(new List<string> { "Projects","InvestigateTable","NonResidentialInvestigateTable","InvestigateTable_Assessment","NonInvestigateTable_Assessment","NonResidentialAgreement","ResidentialAgreement" });
DataTable dt = GetDataTable(new List<string> { "Projects","InvestigateTable","NonResidentialInvestigateTable","InvestigateTable_Assessment","NonInvestigateTable_Assessment","NonResidentialAgreement","ResidentialAgreement","PoliciesRegulations" });
//DataTable dtRelationTable = GetRelationTable();
//所有表信息
string selectQuery ="select syscolumns.name,systypes.name,syscolumns.length from syscolumns,systypes where syscolumns.xusertype=systypes.xusertype and syscolumns.id=object_id('@tableName')";

View File

@@ -29,18 +29,8 @@ namespace Ewide.NbzsZheliban.Service
db = repository.Context;
_jsonSerializer = jsonSerializer;
}
/// <summary>
/// 被征收人关联的项目列表
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
[HttpPost("/project/list")]
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
public async Task<dynamic> PrjList([FromBody] JObject args)
private JObject GetInfoByTicket(string ticket)
{
#region
var ticket = args.GetJsonValue("ticket", isThrowExp: true);
//var ticket = Request.Query["ticket"];
if (!string.IsNullOrWhiteSpace(ticket))
{
var time = DateTime.Now.ToString("yyyyMMddHHmmss");
@@ -88,43 +78,72 @@ namespace Ewide.NbzsZheliban.Service
}
if (userinfoObj["result"].Value<int>() != 0)
throw Oops.Oh($"ticket接口返回值有误,[{tickerRsltStr}]");
var cardno = userinfoObj["idnum"].ToString();
var username = userinfoObj["username"].ToString();
#endregion
//var cardno = args.GetJsonValue("cardno", isThrowExp: true);
//住宅调查表
var list_zz_dcb = await db.Ado.SqlQueryAsync<Dcbs>("select ID dcbId,ProjectId PrjId from InvestigateTable b where b.ExpropriatedCardNo=@ExpropriatedCardNo", new List<SugarParameter> { new SugarParameter("ExpropriatedCardNo", cardno, System.Data.DbType.String) }.ToArray());
//非住宅调查表
var list_fzz_dcb = await db.Ado.SqlQueryAsync<Dcbs>("select ID dcbId,ProjectId PrjId from NonResidentialInvestigateTable b where b.PropertyRightCardNo=@ExpropriatedCardNo", new List<SugarParameter> { new SugarParameter("ExpropriatedCardNo", cardno, System.Data.DbType.String) }.ToArray());
//调查表集合
var list_dcbs = list_zz_dcb.Concat(list_fzz_dcb);
//项目列表
var list_projects = await db.Ado.SqlQueryAsync<H5IndexPrjModel>("select a.ID Prjid,a.area,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_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 + " ); ");
list_projects.ForEach(p =>
{
p.FhpgList = list_fhpgs.Where(a => a.PrjId == p.PrjId);
p.BcxyList = list_bcxys.Where(a => a.PrjId == p.PrjId);
});
H5IndexModel h5IndexModel = new()
{
PrjList = list_projects,
IdCard = cardno,
UserName = username
};
return h5IndexModel;
return userinfoObj;
}
else
{
throw Oops.Oh("无效访问");
}
}
private async Task<H5IndexModel> GetInfoByCardNoAsync(string cardno, string username)
{
//var cardno = args.GetJsonValue("cardno", isThrowExp: true);
//住宅调查表
var list_zz_dcb = await db.Ado.SqlQueryAsync<Dcbs>("select ID dcbId,ProjectId PrjId from InvestigateTable b where b.ExpropriatedCardNo=@ExpropriatedCardNo", new List<SugarParameter> { new SugarParameter("ExpropriatedCardNo", cardno, System.Data.DbType.String) }.ToArray());
//非住宅调查表
var list_fzz_dcb = await db.Ado.SqlQueryAsync<Dcbs>("select ID dcbId,ProjectId PrjId from NonResidentialInvestigateTable b where b.PropertyRightCardNo=@ExpropriatedCardNo", new List<SugarParameter> { new SugarParameter("ExpropriatedCardNo", cardno, System.Data.DbType.String) }.ToArray());
//调查表集合
var list_dcbs = list_zz_dcb.Concat(list_fzz_dcb);
//项目列表
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_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<PoliciesRegulations>().ToListAsync();
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);
listAreas.Add(Guid.Parse(p.AreaID));
});
H5IndexModel h5IndexModel = new()
{
PrjList = list_projects,
IdCard = cardno,
UserName = username,
PoliciesRegulationsList = list_PoliciesRegulations.Where(a => listAreas.Contains(a.AreaID)).Select(b => new PoliciesRegulation
{
ID = b.ID,
Contents = b.Contents,
PublicTime = b.PublicTime,
Title = b.Title
}).ToList()
};
return h5IndexModel;
}
/// <summary>
/// 被征收人关联的项目列表
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
[HttpPost("/project/list")]
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
public async Task<dynamic> PrjList([FromBody] JObject args)
{
var ticket = args.GetJsonValue("ticket", isThrowExp: true);
//var ticket = Request.Query["ticket"];
var userinfoObj = GetInfoByTicket(ticket);
var cardno = userinfoObj["idnum"].ToString();
var username = userinfoObj["username"].ToString();
return await GetInfoByCardNoAsync(cardno, username);
}
/// <summary>
/// 被征收人关联的项目列表
/// </summary>
@@ -136,35 +155,7 @@ namespace Ewide.NbzsZheliban.Service
{
var cardno = "341203199206303411";
var username = "张三丰";
//var cardno = args.GetJsonValue("cardno", isThrowExp: true);
//住宅调查表
var list_zz_dcb = await db.Ado.SqlQueryAsync<Dcbs>("select ID dcbId,ProjectId PrjId from InvestigateTable b where b.ExpropriatedCardNo=@ExpropriatedCardNo", new List<SugarParameter> { new SugarParameter("ExpropriatedCardNo", cardno, System.Data.DbType.String) }.ToArray());
//非住宅调查表
var list_fzz_dcb = await db.Ado.SqlQueryAsync<Dcbs>("select ID dcbId,ProjectId PrjId from NonResidentialInvestigateTable b where b.PropertyRightCardNo=@ExpropriatedCardNo", new List<SugarParameter> { new SugarParameter("ExpropriatedCardNo", cardno, System.Data.DbType.String) }.ToArray());
//调查表集合
var list_dcbs = list_zz_dcb.Concat(list_fzz_dcb);
//项目列表
var list_projects = await db.Ado.SqlQueryAsync<H5IndexPrjModel>("select a.ID Prjid,a.area,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_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 + " ); ");
list_projects.ForEach(p =>
{
p.FhpgList = list_fhpgs.Where(a => a.PrjId == p.PrjId);
p.BcxyList = list_bcxys.Where(a => a.PrjId == p.PrjId);
});
H5IndexModel h5IndexModel = new()
{
PrjList = list_projects,
IdCard = cardno,
UserName = username
};
return h5IndexModel;
return await GetInfoByCardNoAsync(cardno, username);
}
}
}

View File

@@ -1 +1 @@
fbae486d0767770514b6ba877c8b825b66bbda21
f1f4caefb72a8ff498e1136f2c067bdcb196bbb2

View File

@@ -1 +1 @@
e152e943102a596d81738a7c8388c9d1012f3a29
bb995a3e2bd3f9318c4170de209b003704c71518