@ -2743,6 +2743,168 @@ public partial class DroneCaseInfoSingleApp : SqlSugarBaseApp<DroneCaseInfoSingl
} ;
}
public async Task < Response < Dictionary < string , object > > > LoadLanLingMyUncompletedTask ( 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 = " " ;
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 (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 ;
if ( req . type = = 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 " ;
// $"a.\"ProcessCode\"='" +
// schemeCode + "' ";
sql =
$"select a.\" Id \ " as taskId,a.\"UnitName\" as unitName,b.\"Title\" as title,c.synchronoustime as createDate,c.original_case_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" ;
//$"a.\"ProcessCode\"='" +
//schemeCode + "' ";
sqlpart = sqlpart + $" and a.\" UnitName \ " in ('开工核查','开工问题整改','建中核查','建中问题整改','完工核查','完工问题整改','日常监管','监管问题整改','现场复核','子流程') and c.is_closed=0 and a.\"State\"=1 " ;
allCount = await client . Ado . GetIntAsync ( sqlcount + sqlpart ) ;
}
if ( ! string . IsNullOrEmpty ( req . caseNo ) )
{
sqlpart = sqlpart + $" and c.case_no like '%" + req . caseNo + "%'" ;
}
if ( ! string . IsNullOrEmpty ( req . typename ) )
{
sqlpart = sqlpart + $" and c.typename='" + req . typename + "'" ;
}
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 ) ;
}
if ( string . IsNullOrEmpty ( req . lat ) | | string . IsNullOrEmpty ( req . lng ) )
{
sqlpart + = $" ORDER BY c.synchronoustime desc" ;
}
else
{
sqlpart + = $" ORDER BY distance" ;
}
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 ( ) ;