dev
parent
ec259a9b29
commit
8dd0751873
|
|
@ -2918,6 +2918,167 @@ public partial class DroneCaseInfoSingleApp : SqlSugarBaseApp<DroneCaseInfoSingl
|
|||
Result = dic
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<Response<Dictionary<string, object>>> LoadLanLingMyTask(TaskUncompletReq req)
|
||||
{
|
||||
//获取当前用户
|
||||
var authStrategyContext = _auth.GetCurrentUser();
|
||||
var user = authStrategyContext.User;
|
||||
RefAsync<int> totalcount = 0;
|
||||
string sql1 = "select min(\"Level\") from sys_userorg where \"UserId\"=" + user.Id;
|
||||
int level = client.Ado.GetInt(sql1);
|
||||
//该用户下包含所有部门
|
||||
List<string> deplist = new List<string>();
|
||||
string sqlpart = " ";
|
||||
string sqlpart1 = " ";
|
||||
if (user != null && user.Id != -1 && level != 0)
|
||||
{
|
||||
var departs = client.Queryable<SysUserOrg>().Where(r => r.UserId == user.Id).ToList();
|
||||
foreach (var item in departs)
|
||||
{
|
||||
var list = client.Queryable<SysOrg>().ToChildList(it => it.ParentId, item.OrgId)
|
||||
?.Select(it => it.Id.ToString()).ToList();
|
||||
deplist = deplist.Union(list).ToList();
|
||||
}
|
||||
|
||||
string orgs = "\'" + string.Join("\',\'", deplist) + "\'";
|
||||
sqlpart = $" and (e.countyid in ({orgs}) or e.streetid in ({orgs}) or e.communityid in ({orgs})) ";
|
||||
sqlpart1 = $" and (c.countyid in ({orgs}) or c.streetid in ({orgs}) or c.communityid in ({orgs})) ";
|
||||
}
|
||||
|
||||
var schemeCode = _configuration.GetSection("AppSetting:DroneCaseInfoSchemeCode").Value;
|
||||
string sql = "";
|
||||
string sqlcount = "";
|
||||
int allCount = 0;
|
||||
|
||||
sqlcount =
|
||||
$"select count(a.*) from wf_task a LEFT JOIN wf_process " +
|
||||
$"b on a.\"ProcessId\"=b.\"Id\" \r\nLEFT JOIN drone_ssnyd c on b.\"InstanceInfo\"->>'pkeyValue'=c.\"Id\" where 1=1 and a.\"ProcessCode\"='004' ";
|
||||
|
||||
string sqlcount1 =
|
||||
$"select count(a.*) from wf_task a LEFT JOIN wf_process " +
|
||||
$"b on a.\"ProcessId\"=b.\"Id\" \r\nLEFT JOIN drone_ssnyd_rcjg c on b.\"InstanceInfo\"->>'pkeyValue'=c.\"Id\" RIGHT JOIN drone_ssnyd d on d.\"Id\"=c.ssnyd_id where 1=1 and a.\"ProcessCode\"='005'";
|
||||
// $"a.\"ProcessCode\"='" +
|
||||
// schemeCode + "' ";
|
||||
|
||||
sql = $"select * from ((select a.\"Id\" as taskId,a.\"UnitName\" as unitName,b.\"Title\" as title,c.synchronoustime as createDate," +
|
||||
$"c.xiangmu_no as caseNo,c.countyname,c.streetname,c.communityname,\r\n a.\"ProcessCode\" as processcode,a.\"ProcessId\" as processid," +
|
||||
$"c.gengdi_area as gengdiArea,yongjiujibennongtian_area as yongjiujibennongtianArea ,nongyongdi_area as nongyongdiArea,c.geomid," +
|
||||
$"c.\"Id\" as caseid\r\n from wf_task a LEFT JOIN wf_process b on a.\"ProcessId\"=b.\"Id\"\r\nLEFT JOIN drone_ssnyd c " +
|
||||
$"on b.\"InstanceInfo\"->>'pkeyValue'=c.\"Id\" where 1=1 and a.\"ProcessCode\"='004' and a.\"UnitName\" in ('开工核查','开工问题整改','建中核查','建中问题整改','完工核查','完工 问题整改','日常监管','监管问题整改','现场复核','监管接收')" +
|
||||
$" ) UNION \r\n\r\n(select a.\"Id\" as taskId,a.\"UnitName\" as unitName,b.\"Title\" as title,c.synchronoustime as createDate,c.xiangmu_no as caseNo,c.countyname,c.streetname,c.communityname," +
|
||||
$"\r\n a.\"ProcessCode\" as processcode,a.\"ProcessId\" as processid,c.gengdi_area as gengdiArea,yongjiujibennongtian_area as yongjiujibennongtianArea ,nongyongdi_area as nongyongdiArea,c.geomid,c.\"Id\" as caseid\r\n" +
|
||||
$" from wf_task a LEFT JOIN wf_process b on a.\"ProcessId\"=b.\"Id\"\r\nLEFT JOIN drone_ssnyd_rcjg d on b.\"InstanceInfo\"->>'pkeyValue'=d.\"Id\" RIGHT JOIN drone_ssnyd c on c.\"Id\"=d.ssnyd_id where 1=1 " +
|
||||
$" and a.\"ProcessCode\"='005' and a.\"UnitName\" in ('开工核查','开工问题整改','建中核查','建中问题整改','完工核查','完工 问题整改','日常监管','监管问题整改','现场复核','监管接收'))) e where 1=1 ";
|
||||
|
||||
|
||||
string sqlpart2 = sqlpart1 + $" and a.\"UnitName\" in ('开工核查','开工问题整改','建中核查','建中问题整改','完工核查','完工问题整改','日常监管','监管问题整改','现场复核','监管接收')";
|
||||
allCount = await client.Ado.GetIntAsync(sqlcount + sqlpart2);
|
||||
var allCount1 = await client.Ado.GetIntAsync(sqlcount1 + sqlpart2);
|
||||
allCount = allCount + allCount1;
|
||||
|
||||
if (!string.IsNullOrEmpty(req.caseNo))
|
||||
{
|
||||
sqlpart = sqlpart + $" and e.xiangmu_no like '%" + req.caseNo + "%'";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(req.tubanArea1) && !string.IsNullOrEmpty(req.tubanArea2))
|
||||
{
|
||||
sqlpart = sqlpart + $" and CAST(COALESCE(NULLIF(c.area, '')::numeric, 0) AS numeric) between " +
|
||||
double.Parse(req.tubanArea1) + " and " +
|
||||
double.Parse(req.tubanArea2);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(req.tubanArea1) && string.IsNullOrEmpty(req.tubanArea2))
|
||||
{
|
||||
sqlpart = sqlpart + $" and CAST(COALESCE(NULLIF(c.area, '')::numeric, 0) AS numeric)> " +
|
||||
double.Parse(req.tubanArea1);
|
||||
}
|
||||
else if (string.IsNullOrEmpty(req.tubanArea1) && !string.IsNullOrEmpty(req.tubanArea2))
|
||||
{
|
||||
sqlpart = sqlpart + $" and CAST(COALESCE(NULLIF(c.area, '')::numeric, 0) AS numeric)< " +
|
||||
double.Parse(req.tubanArea2);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(req.gengdiArea1) && !string.IsNullOrEmpty(req.gengdiArea2))
|
||||
{
|
||||
sqlpart = sqlpart + $" and CAST(COALESCE(NULLIF(c.gengdi_area, '')::numeric, 0) AS numeric) between " +
|
||||
double.Parse(req.gengdiArea1) +
|
||||
" and " + double.Parse(req.gengdiArea2);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(req.gengdiArea1) && string.IsNullOrEmpty(req.gengdiArea2))
|
||||
{
|
||||
sqlpart = sqlpart + $" and CAST(COALESCE(NULLIF(c.gengdi_area, '')::numeric, 0) AS numeric)> " +
|
||||
double.Parse(req.gengdiArea1);
|
||||
}
|
||||
else if (string.IsNullOrEmpty(req.gengdiArea1) && !string.IsNullOrEmpty(req.gengdiArea2))
|
||||
{
|
||||
sqlpart = sqlpart + $" and CAST(COALESCE(NULLIF(c.gengdi_area, '')::numeric, 0) AS numeric)< " +
|
||||
double.Parse(req.gengdiArea2);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(req.nongyongdiArea1) && !string.IsNullOrEmpty(req.nongyongdiArea2))
|
||||
{
|
||||
sqlpart = sqlpart +
|
||||
$" and CAST(COALESCE(NULLIF(c.nongyongdi_area, '')::numeric, 0) AS numeric) between " +
|
||||
double.Parse(req.nongyongdiArea1) +
|
||||
" and " + double.Parse(req.nongyongdiArea2);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(req.nongyongdiArea1) && string.IsNullOrEmpty(req.nongyongdiArea2))
|
||||
{
|
||||
sqlpart = sqlpart + $" and CAST(COALESCE(NULLIF(c.nongyongdi_area, '')::numeric, 0) AS numeric)> " +
|
||||
double.Parse(req.nongyongdiArea1);
|
||||
}
|
||||
else if (string.IsNullOrEmpty(req.nongyongdiArea1) && !string.IsNullOrEmpty(req.nongyongdiArea2))
|
||||
{
|
||||
sqlpart = sqlpart + $" and CAST(COALESCE(NULLIF(c.nongyongdi_area, '')::numeric, 0) AS numeric)< " +
|
||||
double.Parse(req.nongyongdiArea2);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(req.jibenArea1) && !string.IsNullOrEmpty(req.jibenArea2))
|
||||
{
|
||||
sqlpart = sqlpart +
|
||||
$" and CAST(COALESCE(NULLIF(c.yongjiujibennongtian_area, '')::numeric, 0) AS numeric) between " +
|
||||
double.Parse(req.jibenArea1) +
|
||||
" and " + double.Parse(req.jibenArea2);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(req.jibenArea1) && string.IsNullOrEmpty(req.jibenArea2))
|
||||
{
|
||||
sqlpart = sqlpart +
|
||||
$" and CAST(COALESCE(NULLIF(c.yongjiujibennongtian_area, '')::numeric, 0) AS numeric)> " +
|
||||
double.Parse(req.jibenArea1);
|
||||
}
|
||||
else if (string.IsNullOrEmpty(req.jibenArea1) && !string.IsNullOrEmpty(req.jibenArea2))
|
||||
{
|
||||
sqlpart = sqlpart +
|
||||
$" and CAST(COALESCE(NULLIF(c.yongjiujibennongtian_area, '')::numeric, 0) AS numeric)< " +
|
||||
double.Parse(req.jibenArea2);
|
||||
}
|
||||
|
||||
|
||||
sqlpart += $" ORDER BY e.createdate desc";
|
||||
|
||||
|
||||
Console.WriteLine(sql + sqlpart);
|
||||
var info = await client.SqlQueryable<dynamic>(sql + sqlpart).ToPageListAsync(req.page, req.limit, totalcount);
|
||||
|
||||
Dictionary<string, object> dic = new Dictionary<string, object>();
|
||||
dic.Add("allcount", allCount);
|
||||
|
||||
PageInfo<List<dynamic>> list1 = new PageInfo<List<dynamic>>
|
||||
{
|
||||
Items = info,
|
||||
Total = totalcount,
|
||||
};
|
||||
dic.Add("list", list1);
|
||||
return new Response<Dictionary<string, object>>
|
||||
{
|
||||
Result = dic
|
||||
};
|
||||
}
|
||||
|
||||
public Response<List<dynamic>> loadStreet()
|
||||
{
|
||||
var authStrategyContext = _auth.GetCurrentUser();
|
||||
|
|
|
|||
|
|
@ -313,6 +313,13 @@ public class DroneCaseInfoSingleController : ControllerBase
|
|||
{
|
||||
return await _app.LoadLanLingChildTask(caseid);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<Response<Dictionary<string, object>>> LoadLanLingMyTask([FromQuery] TaskUncompletReq req)
|
||||
{
|
||||
return await _app.LoadLanLingMyTask(req);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Response<List<dynamic>> loadStreet()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue