add 任务管理

This commit is contained in:
2021-06-01 17:40:52 +08:00
parent 27c19929cb
commit 10000884c7
22 changed files with 1224 additions and 78 deletions

View File

@@ -66,12 +66,12 @@ namespace Ewide.Application.Service.HouseCode
[HttpPost("/houseCode/page")]
public async Task<dynamic> QueryPage([FromBody] QueryHouseCodeInput input)
{
var sql = @"SELECT HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,Proj.Name+'('+Proj.Note+')' FullProjName FROM bs_house_code HC
var sql = @"SELECT HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.Name,'(',Proj.Note,')') FullProjName FROM bs_house_code HC
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
LEFT JOIN sys_area_code RA ON RA.AdCode = SUBSTR(CA.AdCode,1,9)
LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6) WHERE HC.Address LIKE @Address AND HC.HouseCode LIKE @HouseCode";
return await _dapperRepository.QueryPageData(sql, input, param: new { Address = '%' + input.Address + '%', HouseCode = '%' + input.HouseCode + '%'});
LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6) ";
return await _dapperRepository.QueryPageDataDynamic(sql, input, filterFields: new string[] {"Type", "Address", "HouseCode" });
}
/// <summary>

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application
{
class HouseInfoInput
{
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application
{
public class HouseInfoOutput
{
}
}

View File

@@ -0,0 +1,32 @@
using Dapper;
using Furion.DatabaseAccessor;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application.Service.HouseSafety.HouseInfo
{
public class HouseInfoService : IHouseInfoService, IDynamicApiController, ITransient
{
private readonly IRepository<BsHouseInfo> _houseInfoRep;
private readonly IDapperRepository _dapperRepository;
public HouseInfoService(IRepository<BsHouseInfo> HouseInfoRep, IDapperRepository dapperRepository)
{
_houseInfoRep = HouseInfoRep;
_dapperRepository = dapperRepository;
}
//[HttpGet("/houseInfo/getByTaskId")]
//public async Task<HouseInfoOutput> GetByTaskId([Required] string taskId)
//{
//}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application.Service
{
public interface IHouseInfoService
{
//async Task<HouseInfoOutput> GetByTaskId(string taskId);
}
}

View File

@@ -23,18 +23,21 @@ namespace Ewide.Application.Service
private readonly IRepository<BsHouseMemberRelation> _bsHouseMemberRelationRep;
private readonly IRepository<BsHouseCode> _bsHouseCodeRep;
private readonly IRepository<BsHouseTask> _bsHouseTaskRep;
private readonly IHouseZoneService _houseZoneService;
public HouseSelectorService(
IDapperRepository dapperRep,
IRepository<BsHouseMemberRelation> bsHouseMemberRelationRep,
IRepository<BsHouseCode> bsHouseCodeRep,
IRepository<BsHouseTask> bsHouseTaskRep,
IHouseZoneService houseZoneService
)
{
_dapperRep = dapperRep;
_bsHouseMemberRelationRep = bsHouseMemberRelationRep;
_bsHouseCodeRep = bsHouseCodeRep;
_bsHouseTaskRep = bsHouseTaskRep;
_houseZoneService = houseZoneService;
}
@@ -145,6 +148,25 @@ WHERE 1=1
SysUserId = input.UserId,
HouseCodeId = p
}.Insert();
var initTask = _bsHouseTaskRep.DetachedEntities.FirstOrDefault(t => t.TaskType == 0);
if (initTask == null)
{
new BsHouseTask
{
Id = System.Guid.NewGuid().ToString(),
HouseCodeId = p,
UserID = input.UserId,
EndTime = System.DateTime.Now.AddMonths(1),
Status = 0,
TaskType = 0
}.Insert();
}
else
{
initTask.UserID = input.UserId;
initTask.Update();
}
});
}

View File

@@ -0,0 +1,129 @@
using Ewide.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application
{
public class HouseTaskInput : PageInputBase
{
[Required(ErrorMessage = "房屋编码ID不能为空")]
public string HouseCodeId { get; set; }
[Required(ErrorMessage = "巡查日期不能为空")]
public DateTime PatrolDate { get; set; }
[Required(ErrorMessage = "巡查人员/单位不能为空")]
public string PatrolUser { get; set; }
/// <summary>
/// 沉降倾斜
/// </summary>
public string SettlementTilt { get; set; }
/// <summary>
/// 沉降倾斜附件
/// </summary>
public string SettlementTiltFiles { get; set; }
/// <summary>
/// 其他情况
/// </summary>
public string OtherInfo { get; set; }
/// <summary>
/// 其他情况附件
/// </summary>
public string OtherInfoFiles { get; set; }
[Required(ErrorMessage = "巡查初始等级不能为空")]
public int InitLevel { get; set; }
[Required(ErrorMessage = "巡查损坏等级不能为空")]
public int DamageLevel { get; set; }
[Required(ErrorMessage = "巡查综合等级不能为空")]
public int ComprehensiveLevel { get; set; }
/// <summary>
/// 主要安全隐患综述
/// </summary>
public string MainSafety { get; set; }
/// <summary>
/// 处理意见
/// </summary>
public int? HandlingOpinion { get; set; }
/// <summary>
/// 处理意见备注
/// </summary>
public string HandlingOpinionRemark { get; set; }
/// <summary>
/// 整改情况
/// </summary>
public int? RectifyAndReform { get; set; }
/// <summary>
/// 整改情况备注
/// </summary>
public string RectifyAndReformRemark { get; set; }
/// <summary>
/// 巡查结果1正常,-1异常
/// </summary>
[Required(ErrorMessage = "巡查结果不能为空")]
public int PatrolResult { get; set; }
public string PatrolResultRemark { get; set; }
/// <summary>
/// -1退回 0待处理 1保存待提交 2待审核 3审核通过
/// </summary>
[Required(ErrorMessage = "任务目标状态能为空")]
public int Status { get; set; }
/// <summary>
/// 上报街道
/// </summary>
public int? ReportRoad { get; set; }
/// <summary>
/// 上报街道时间
/// </summary>
public DateTime? ReportRoadTime { get; set; }
/// <summary>
/// 上报区住建
/// </summary>
public int? ReportArea { get; set; }
/// <summary>
/// 上报区住建时间
/// </summary>
public DateTime? ReportAreaTime { get; set; }
/// <summary>
/// 上报备注
/// </summary>
public string ReportRemark { get; set; }
}
public class AddHouseTaskInput : HouseTaskInput
{
}
public class EditHouseTaskInput
{
[Required(ErrorMessage = "任务Id不能为空")]
public string Id { get; set; }
}
public class QueryHouseTaskInput : PageInputBase
{
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application
{
public class HouseTaskOutput
{
}
}

View File

@@ -0,0 +1,46 @@
using Dapper;
using Ewide.Core.Extension;
using Furion.DatabaseAccessor;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application.Service
{
/// <summary>
/// 房屋任务(巡查任务/建档任务)
/// </summary>
[ApiDescriptionSettings(Name = "HouseTask", Order = 190)]
public class HouseTaskService : IHouseTaskService, IDynamicApiController, ITransient
{
private readonly IRepository<BsHouseTask> _houseTaskRep;
private readonly IDapperRepository _dapperRepository;
public HouseTaskService(IRepository<BsHouseTask> HouseTaskRep, IDapperRepository dapperRepository)
{
_houseTaskRep = HouseTaskRep;
_dapperRepository = dapperRepository;
}
[HttpPost("/houseTask/page")]
public async Task<dynamic> QueryPage([FromBody] QueryHouseTaskInput input)
{
var sql = @"SELECT T.Id,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,Proj.Name,CONCAT(Proj.Name,'(',Proj.Note,')') FullProjName,HC.HouseCode,HC.Address,T.EndTime,HC.Type,HC.Industry,HC.No FROM `bs_house_task` T
LEFT JOIN bs_house_code HC ON T.HouseCodeId = HC.Id
LEFT JOIN bs_house_info HI ON HI.HouseCodeId = T.HouseCodeId
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
LEFT JOIN sys_area_code RA ON RA.AdCode = SUBSTR(CA.AdCode,1,9)
LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6)";
return await _dapperRepository.QueryPageDataDynamic(sql, input, filterFields: new string[] { "Type", "Address", "HouseCode" });
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application.Service
{
public interface IHouseTaskService
{
Task<dynamic> QueryPage(QueryHouseTaskInput input);
}
}