update 浙里办代码闭环

This commit is contained in:
路 范
2021-09-10 13:51:30 +08:00
parent d550f22253
commit f157223a17
27 changed files with 349 additions and 115 deletions

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.NbzsZheliban.Entity.Base
{
[Serializable, System.Runtime.Serialization.DataContract]
public class RespModel
{
/// <summary>
/// 是否成功
/// </summary>
[System.Runtime.Serialization.DataMember]
public bool issuccess { get; set; }
/// <summary>
/// 错误码
/// </summary>
[System.Runtime.Serialization.DataMember]
public string errorcode { get; set; }
[System.Runtime.Serialization.DataMember]
public string message { get; set; }
/// <summary>
///
/// </summary>
[System.Runtime.Serialization.DataMember]
public object data { get; set; }
/// <summary>
///
/// </summary>
[System.Runtime.Serialization.DataMember]
public int allcount { get; set; }
/// <summary>
/// 附加对象
/// </summary>
[System.Runtime.Serialization.DataMember]
public object addition { get; set; }
/// <summary>
/// 消耗时间,单位毫秒
/// </summary>
[System.Runtime.Serialization.DataMember]
public long consume_time { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using Furion.JsonSerialization;
using Ewide.NbzsZheliban.Entity.Base;
using Furion.JsonSerialization;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -10,6 +11,5 @@ namespace Ewide.NbzsZheliban.Service
{
public class BaseService : Furion.DynamicApiController.IDynamicApiController
{
}
}

View File

@@ -1,6 +1,10 @@
using Ewide.NbzsZheliban.Entity;
using Ewide.NbzsZheliban.Entity.Base;
using Ewide.NbzsZheliban.Entity.Extends;
using Ewide.NbzsZheliban.Tools;
using Furion;
using Furion.DataEncryption;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
@@ -30,35 +34,93 @@ namespace Ewide.NbzsZheliban.Service
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
[HttpGet("/project/list")]
[HttpPost("/project/list")]
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
public async Task<dynamic> PrjList([FromBody] JObject args)
{
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 + " ); ");
#region
var ticket = args.GetJsonValue("ticket", isThrowExp: true);
//var ticket = Request.Query["ticket"];
if (!string.IsNullOrWhiteSpace(ticket))
{
var time = DateTime.Now.ToString("yyyyMMddHHmmss");
var servicecode = App.Configuration["zlb_setting:servicecode"];
var servicepwd = App.Configuration["zlb_setting:servicepwd"];
var sign = MD5Encryption.Encrypt(servicecode + servicepwd + time);
var datatype = "json";
var url = App.Configuration["zlb_setting:ticket_url"]
.Replace("{servicecode}", servicecode)
.Replace("{time}", time)
.Replace("{sign}", sign)
.Replace("{ticket}", ticket)
.Replace("{datatype}", datatype)
;
var tickerRsltStr = Ewide.NbzsZheliban.Tools.HttpHelper.CallUrl(url, "");
JObject ticketObj = null;
try
{
ticketObj = JObject.Parse(tickerRsltStr);
}
catch (Newtonsoft.Json.JsonReaderException)
{
throw Oops.Oh($"ticket接口返回值有误,[{tickerRsltStr}]");
}
if (ticketObj["result"].Value<int>() != 0)
throw Oops.Oh($"ticket接口返回值有误,[{tickerRsltStr}]");
time = DateTime.Now.ToString("yyyyMMddHHmmss");
sign = MD5Encryption.Encrypt(servicecode + servicepwd + time);
url = App.Configuration["zlb_setting:token_url"]
.Replace("{servicecode}", servicecode)
.Replace("{time}", time)
.Replace("{sign}", sign)
.Replace("{token}", ticketObj["token"].ToString())
.Replace("{datatype}", datatype)
;
var userinfoRsltStr = Ewide.NbzsZheliban.Tools.HttpHelper.CallUrl(url, "");
JObject userinfoObj = null;
try
{
userinfoObj = JObject.Parse(userinfoRsltStr);
}
catch (Newtonsoft.Json.JsonReaderException)
{
throw Oops.Oh($"token接口返回值有误,[{tickerRsltStr}]");
}
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 =>
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
};
return h5IndexModel;
}
else
{
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
};
return h5IndexModel;
throw Oops.Oh("无效访问");
}
}
}
}

View File

@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Http;
using Furion.FriendlyException;
using Microsoft.AspNetCore.Http;
using Microsoft.VisualBasic;
using Newtonsoft.Json.Linq;
using System;
@@ -900,12 +901,12 @@ namespace Ewide.NbzsZheliban.Tools
public static string GetJsonValue(this JObject jObject, string jsonName, bool isToLower = true, bool isThrowExp = false)
{
if (jObject == null)
throw new Exception("参数为空");
throw Oops.Oh("参数为空");
JToken token = jObject[isToLower ? jsonName.ToLower() : jsonName];
if (token == null)
{
if (isThrowExp)
throw new Exception(jsonName + "是必需的");
throw Oops.Oh(jsonName + "是必需的");
return string.Empty;
}
else
@@ -989,7 +990,7 @@ namespace Ewide.NbzsZheliban.Tools
if (jObject == null)
{
if (isThrowExp)
throw new Exception(jsonName + "是必需的");
throw Oops.Oh(jsonName + "是必需的");
return null;
}
string v = GetJsonValue(jObject, jsonName, isToLower);
@@ -1000,7 +1001,7 @@ namespace Ewide.NbzsZheliban.Tools
else
{
if (isThrowExp)
throw new Exception(jsonName + "是必需的");
throw Oops.Oh(jsonName + "是必需的");
return null;
}
}
@@ -1018,7 +1019,7 @@ namespace Ewide.NbzsZheliban.Tools
else
{
if (isThrowExp)
throw new Exception(jsonName + "是必需的");
throw Oops.Oh(jsonName + "是必需的");
return null;
}
}
@@ -1200,7 +1201,7 @@ namespace Ewide.NbzsZheliban.Tools
value = jobj.GetJsonBoolValue(pro.Name, isToLower);
break;
default:
throw new Exception("补充类型:" + propName);
throw Oops.Oh("补充类型:" + propName);
}
pro.SetValue(obj, value, null);
}

View File

@@ -1 +1 @@
e18cbf8e59bc83ce9fd9daee67e8ec04308bbafb
fbae486d0767770514b6ba877c8b825b66bbda21

View File

@@ -1 +1 @@
4bde41c8041738fd99537bb8a528c2972537dead
e152e943102a596d81738a7c8388c9d1012f3a29