update 建档登记保存
This commit is contained in:
@@ -21,6 +21,7 @@ namespace Ewide.Application
|
||||
public string ProjectNote { get; set; }
|
||||
public string ProjectFullName { get; set; }
|
||||
public string HouseCode { get; set; }
|
||||
public int No { get; set; }
|
||||
public string Lng { get; set; }
|
||||
public string Lat { get; set; }
|
||||
}
|
||||
|
||||
@@ -8,5 +8,275 @@ namespace Ewide.Application
|
||||
{
|
||||
public class HouseInfoInput
|
||||
{
|
||||
#region 建筑物基本信息building
|
||||
public string BuildingName { get; set; }
|
||||
|
||||
public int? LandAttribute { get; set; }
|
||||
|
||||
public int? StructureType { get; set; }
|
||||
|
||||
public int? SeismicGrade { get; set; }
|
||||
|
||||
public int? BaseInfo { get; set; }
|
||||
|
||||
public string InsulationMaterial { get; set; }
|
||||
|
||||
public string WallMaterial { get; set; }
|
||||
|
||||
public string FireproofGrade { get; set; }
|
||||
public int? CurtainWall { get; set; }
|
||||
public int? FaceBrick { get; set; }
|
||||
public int? WhiteWash { get; set; }
|
||||
public int? Coating { get; set; }
|
||||
public string Elevator { get; set; }
|
||||
public DateTime? CompletedDate { get; set; }
|
||||
public int? UsefulYear { get; set; }
|
||||
/// <summary>
|
||||
/// 总建筑面积
|
||||
/// </summary>
|
||||
public float? TotalArea { get; set; }
|
||||
/// <summary>
|
||||
/// 总户数(户)
|
||||
/// </summary>
|
||||
public int? HouseHolds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房屋单元数
|
||||
/// </summary>
|
||||
public int? Units { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 各单元每层户数(户)
|
||||
/// </summary>
|
||||
public int? UnitFloorHolds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总层数
|
||||
/// </summary>
|
||||
public int? TotalFloor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上层数
|
||||
/// </summary>
|
||||
public int? LandFloorCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上商业层数开始
|
||||
/// </summary>
|
||||
public int? LandBsFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上商业层数结束
|
||||
/// </summary>
|
||||
public int? LandBsFloorEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上车棚层开始
|
||||
/// </summary>
|
||||
public int? LandBikeFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上住宅层开始
|
||||
/// </summary>
|
||||
public int? LandResidenceFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上住宅层结束
|
||||
/// </summary>
|
||||
public int? LandResidenceFloorEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地下层数
|
||||
/// </summary>
|
||||
public int? UnderFloorCount { get; set; }
|
||||
#endregion
|
||||
#region 权属情况ownership
|
||||
/// <summary>
|
||||
/// 产权性质
|
||||
/// </summary>
|
||||
public string PropertyRights { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总共套数
|
||||
/// </summary>
|
||||
public int? HouseCount { get; set; }
|
||||
|
||||
/// 直管公房套数
|
||||
/// </summary>
|
||||
public int? StraightHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自管公房套数
|
||||
/// </summary>
|
||||
public int? SelfHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 私房套数
|
||||
/// </summary>
|
||||
public int? PrivateHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品房套数
|
||||
/// </summary>
|
||||
public int? BusinessCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房改房套数
|
||||
/// </summary>
|
||||
public int? ChangeHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拆迁安置房套数
|
||||
/// </summary>
|
||||
public int? ResettlementHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其它套数
|
||||
/// </summary>
|
||||
public int? OtherCount { get; set; }
|
||||
|
||||
#endregion
|
||||
#region 管理情况manager
|
||||
#endregion
|
||||
#region 调查情况investigation
|
||||
/// <summary>
|
||||
/// 房屋场地
|
||||
/// </summary>
|
||||
public string HouseSite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 相邻施工
|
||||
/// </summary>
|
||||
public string AdjacentConstruction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 化学侵蚀
|
||||
/// </summary>
|
||||
public string ChemicalErosion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结构拆改
|
||||
/// </summary>
|
||||
public int? StructuralDismantling { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 加层改造
|
||||
/// </summary>
|
||||
public int? AddingLayer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修缮加固
|
||||
/// </summary>
|
||||
public string RepairAndReinforce { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 历史灾害
|
||||
/// </summary>
|
||||
public string HistoricalCalamity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 使用功能变更
|
||||
/// </summary>
|
||||
public string FunctionalChange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他调查内容
|
||||
/// </summary>
|
||||
public string OtherContents { get; set; }
|
||||
#endregion
|
||||
#region 鉴定治理identification
|
||||
|
||||
/// <summary>
|
||||
/// 房屋等级 1,2,3,4,C,d
|
||||
/// </summary>
|
||||
public int? HouseLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房屋使用状态
|
||||
/// </summary>
|
||||
public int? UsedStatus { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 图纸资料存档处drawing
|
||||
|
||||
/// <summary>
|
||||
/// 图纸资料存档处
|
||||
/// </summary>
|
||||
public string DrawingMaterial { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他图纸存档
|
||||
/// </summary>
|
||||
public string DrawingMaterialText { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 相关附件资料attachments
|
||||
/// <summary>
|
||||
/// 立项文件
|
||||
/// </summary>
|
||||
public string AnEntryDocument { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规划许可
|
||||
/// </summary>
|
||||
public string PlanningPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 竣工验收备案
|
||||
/// </summary>
|
||||
public string CompletedRecord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 监理资料
|
||||
/// </summary>
|
||||
public string MonitorDocument { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 鉴定报告
|
||||
/// </summary>
|
||||
public string IdentificationReport { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其它资料
|
||||
/// </summary>
|
||||
public string OtherDocument { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 建筑概貌aspect
|
||||
/// <summary>
|
||||
/// 外立面照片
|
||||
/// </summary>
|
||||
public string FacadePhoto { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 调查单位unit
|
||||
/// <summary>
|
||||
/// 调查登记机构
|
||||
/// </summary>
|
||||
public string InvestigateAgency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纸质资料调查人
|
||||
/// </summary>
|
||||
public string InvestigateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纸质资料审核人
|
||||
/// </summary>
|
||||
public string OfflineAuditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主管部门
|
||||
/// </summary>
|
||||
public string CompetentDepartment { get; set; }
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public class HouseInfoInputAdd
|
||||
{
|
||||
public HouseCodeOutput houseCode { get; set; }
|
||||
public HouseInfoInput houseInfo { get; set; }
|
||||
public EditHouseTaskInput PatrolInfo { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,13 +278,7 @@ namespace Ewide.Application
|
||||
public HouseCodeOutput houseCode { get; set; }
|
||||
#endregion
|
||||
|
||||
public HouseInfoOutput houseInfoOutput { get; set; }
|
||||
public PatrolInfo PatrolInfo { get; set; }
|
||||
}
|
||||
|
||||
public class PatrolInfo
|
||||
{
|
||||
public DateTime? PatrolDate { get; set; }
|
||||
public string PatrolUser { get; set; }
|
||||
public HouseInfoOutput houseInfo { get; set; }
|
||||
public HouseTaskOutput PatrolInfo { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using Dapper;
|
||||
using Ewide.Core;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DatabaseAccessor.Extensions;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Furion.FriendlyException;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -37,16 +39,47 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo
|
||||
_dapperRepository = dapperRepository;
|
||||
}
|
||||
|
||||
[HttpPost("/houseInfo/saveDetail")]
|
||||
[UnitOfWork]
|
||||
public async Task SaveDetail([FromBody] HouseInfoInputAdd input)
|
||||
{
|
||||
var houseCode = input.houseCode.Adapt<BsHouseCode>();
|
||||
await houseCode.UpdateIncludeAsync(new[] { nameof(BsHouseCode.Address), nameof(BsHouseCode.Lng), nameof(BsHouseCode.Lat) }, true);
|
||||
|
||||
var houseEntity = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == input.houseCode.Id);
|
||||
var houseInfo = input.houseInfo.Adapt<BsHouseInfo>();
|
||||
houseInfo.HouseCodeId = input.houseCode.Id;
|
||||
if(houseEntity == null)
|
||||
{
|
||||
houseInfo.Id = Guid.NewGuid().ToString();
|
||||
houseInfo.State = 0;
|
||||
await houseInfo.InsertAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
houseInfo.Id = houseEntity.Id;
|
||||
await houseInfo.UpdateExcludeAsync(new[] { nameof(BsHouseInfo.State) }, true) ;
|
||||
}
|
||||
|
||||
if(houseInfo.State != 6)
|
||||
{
|
||||
var houseTask = input.PatrolInfo.Adapt<BsHouseTask>();
|
||||
houseTask.HouseCodeId = input.houseCode.Id;
|
||||
await houseTask.UpdateExcludeAsync(new string[] { }, ignoreNullValues: true);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("/houseInfo/getByTaskId")]
|
||||
[AllowAnonymous]
|
||||
public async Task<HouseInfoOutputForDetailPage> GetByTaskId([Required] string taskId)
|
||||
{
|
||||
var houseTaskRep = Db.GetRepository<BsHouseTask>();
|
||||
//获取任务实体
|
||||
var houseTask = await houseTaskRep.DetachedEntities.FirstOrDefaultAsync(t=>t.Id == taskId);
|
||||
if(houseTask == null) throw Oops.Oh("任务不存在");
|
||||
|
||||
//获取房屋编码信息
|
||||
var houseCodeOutputAsync = await _dapperRepository.QueryAsync<HouseCodeOutput>(
|
||||
@"SELECT HC.Id,HC.Address,HC.ProjectId,HC.ZoneId,HC.Type,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.Note ProjectNote,CONCAT(Proj.Name,'(',Proj.Note,')') ProjectFullName,HC.HouseCode,HC.Lng,HC.Lat FROM bs_house_code HC
|
||||
@"SELECT HC.Id,HC.Address,HC.ProjectId,HC.ZoneId,HC.Type,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.Note ProjectNote,CONCAT(Proj.Name,'(',Proj.Note,')') ProjectFullName,HC.HouseCode,HC.Lng,HC.Lat,HC.No 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)
|
||||
@@ -54,27 +87,33 @@ LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6)
|
||||
WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId }
|
||||
);
|
||||
var houseCodeOutput= houseCodeOutputAsync.SingleOrDefault();
|
||||
if (houseCodeOutput == null) throw Oops.Oh("任务已失效:房屋编码不存在");
|
||||
if (houseCodeOutput == null) throw Oops.Oh("任务已失效:房屋编码不存在,请重新加载任务列表");
|
||||
|
||||
//获取当前登录账号
|
||||
var currentUser = await _userManager.CheckUserAsync();
|
||||
|
||||
//查询房屋详细信息是否存在
|
||||
var houseInfo = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == houseTask.HouseCodeId);
|
||||
var houseInfoOutputForDetailPage = new HouseInfoOutputForDetailPage
|
||||
{
|
||||
houseCode = houseCodeOutput
|
||||
};
|
||||
houseInfoOutputForDetailPage.PatrolInfo = new PatrolInfo();
|
||||
houseInfoOutputForDetailPage.PatrolInfo.PatrolDate = houseTask.PatrolDate.GetValueOrDefault(DateTime.Now);
|
||||
houseInfoOutputForDetailPage.PatrolInfo.PatrolUser = String.IsNullOrEmpty(houseTask.PatrolUser) ? currentUser.Name : houseTask.PatrolUser;
|
||||
|
||||
houseInfoOutputForDetailPage.PatrolInfo = new HouseTaskOutput
|
||||
{
|
||||
PatrolDate = houseTask.PatrolDate.GetValueOrDefault(DateTime.Now),
|
||||
PatrolUser = String.IsNullOrEmpty(houseTask.PatrolUser) ? currentUser.Name : houseTask.PatrolUser
|
||||
};
|
||||
|
||||
if (houseInfo == null)
|
||||
{
|
||||
houseInfoOutputForDetailPage.houseInfoOutput = new HouseInfoOutput();
|
||||
houseInfoOutputForDetailPage.houseInfo = new HouseInfoOutput();
|
||||
return houseInfoOutputForDetailPage;
|
||||
}
|
||||
|
||||
var houseInfoOutputAsync = await _dapperRepository.QueryAsync<HouseInfoOutput>("SELECT * FROM bs_house_info HI WHERE Id = @HouseCodeId", new { houseTask.HouseCodeId });
|
||||
var houseInfoOutput = houseInfoOutputAsync.SingleOrDefault();
|
||||
houseInfoOutputForDetailPage.houseInfoOutput = houseInfoOutput;
|
||||
houseInfoOutputForDetailPage.houseInfo = houseInfoOutput;
|
||||
|
||||
return houseInfoOutputForDetailPage;
|
||||
}
|
||||
|
||||
@@ -8,11 +8,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
public class HouseTaskInput : PageInputBase
|
||||
public class HouseTaskInput
|
||||
{
|
||||
[Required(ErrorMessage = "房屋编码ID不能为空")]
|
||||
public string HouseCodeId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "巡查日期不能为空")]
|
||||
public DateTime PatrolDate { get; set; }
|
||||
|
||||
@@ -39,11 +36,11 @@ namespace Ewide.Application
|
||||
/// </summary>
|
||||
public string OtherInfoFiles { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "巡查初始等级不能为空")]
|
||||
//[Required(ErrorMessage = "巡查初始等级不能为空")]
|
||||
public int InitLevel { get; set; }
|
||||
[Required(ErrorMessage = "巡查损坏等级不能为空")]
|
||||
//[Required(ErrorMessage = "巡查损坏等级不能为空")]
|
||||
public int DamageLevel { get; set; }
|
||||
[Required(ErrorMessage = "巡查综合等级不能为空")]
|
||||
//[Required(ErrorMessage = "巡查综合等级不能为空")]
|
||||
public int ComprehensiveLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -74,17 +71,11 @@ namespace Ewide.Application
|
||||
/// <summary>
|
||||
/// 巡查结果:1正常,-1异常
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "巡查结果不能为空")]
|
||||
//[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>
|
||||
|
||||
@@ -8,5 +8,7 @@ namespace Ewide.Application
|
||||
{
|
||||
public class HouseTaskOutput
|
||||
{
|
||||
public DateTime? PatrolDate { get; set; }
|
||||
public string PatrolUser { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user