diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs
index c268551..08bb370 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs
@@ -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; }
}
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs
index 10ea34b..7cbf742 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs
@@ -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; }
+ ///
+ /// 总建筑面积
+ ///
+ public float? TotalArea { get; set; }
+ ///
+ /// 总户数(户)
+ ///
+ public int? HouseHolds { get; set; }
+
+ ///
+ /// 房屋单元数
+ ///
+ public int? Units { get; set; }
+
+ ///
+ /// 各单元每层户数(户)
+ ///
+ public int? UnitFloorHolds { get; set; }
+
+ ///
+ /// 总层数
+ ///
+ public int? TotalFloor { get; set; }
+
+ ///
+ /// 地上层数
+ ///
+ public int? LandFloorCount { get; set; }
+
+ ///
+ /// 地上商业层数开始
+ ///
+ public int? LandBsFloorStart { get; set; }
+
+ ///
+ /// 地上商业层数结束
+ ///
+ public int? LandBsFloorEnd { get; set; }
+
+ ///
+ /// 地上车棚层开始
+ ///
+ public int? LandBikeFloorStart { get; set; }
+
+ ///
+ /// 地上住宅层开始
+ ///
+ public int? LandResidenceFloorStart { get; set; }
+
+ ///
+ /// 地上住宅层结束
+ ///
+ public int? LandResidenceFloorEnd { get; set; }
+
+ ///
+ /// 地下层数
+ ///
+ public int? UnderFloorCount { get; set; }
+ #endregion
+ #region 权属情况ownership
+ ///
+ /// 产权性质
+ ///
+ public string PropertyRights { get; set; }
+
+ ///
+ /// 总共套数
+ ///
+ public int? HouseCount { get; set; }
+
+ /// 直管公房套数
+ ///
+ public int? StraightHouseCount { get; set; }
+
+ ///
+ /// 自管公房套数
+ ///
+ public int? SelfHouseCount { get; set; }
+
+ ///
+ /// 私房套数
+ ///
+ public int? PrivateHouseCount { get; set; }
+
+ ///
+ /// 商品房套数
+ ///
+ public int? BusinessCount { get; set; }
+
+ ///
+ /// 房改房套数
+ ///
+ public int? ChangeHouseCount { get; set; }
+
+ ///
+ /// 拆迁安置房套数
+ ///
+ public int? ResettlementHouseCount { get; set; }
+
+ ///
+ /// 其它套数
+ ///
+ public int? OtherCount { get; set; }
+
+ #endregion
+ #region 管理情况manager
+ #endregion
+ #region 调查情况investigation
+ ///
+ /// 房屋场地
+ ///
+ public string HouseSite { get; set; }
+
+ ///
+ /// 相邻施工
+ ///
+ public string AdjacentConstruction { get; set; }
+
+ ///
+ /// 化学侵蚀
+ ///
+ public string ChemicalErosion { get; set; }
+
+ ///
+ /// 结构拆改
+ ///
+ public int? StructuralDismantling { get; set; }
+
+ ///
+ /// 加层改造
+ ///
+ public int? AddingLayer { get; set; }
+
+ ///
+ /// 修缮加固
+ ///
+ public string RepairAndReinforce { get; set; }
+
+ ///
+ /// 历史灾害
+ ///
+ public string HistoricalCalamity { get; set; }
+
+ ///
+ /// 使用功能变更
+ ///
+ public string FunctionalChange { get; set; }
+
+ ///
+ /// 其他调查内容
+ ///
+ public string OtherContents { get; set; }
+ #endregion
+ #region 鉴定治理identification
+
+ ///
+ /// 房屋等级 1,2,3,4,C,d
+ ///
+ public int? HouseLevel { get; set; }
+
+ ///
+ /// 房屋使用状态
+ ///
+ public int? UsedStatus { get; set; }
+ #endregion
+
+ #region 图纸资料存档处drawing
+
+ ///
+ /// 图纸资料存档处
+ ///
+ public string DrawingMaterial { get; set; }
+
+ ///
+ /// 其他图纸存档
+ ///
+ public string DrawingMaterialText { get; set; }
+ #endregion
+
+ #region 相关附件资料attachments
+ ///
+ /// 立项文件
+ ///
+ public string AnEntryDocument { get; set; }
+
+ ///
+ /// 规划许可
+ ///
+ public string PlanningPermission { get; set; }
+
+ ///
+ /// 竣工验收备案
+ ///
+ public string CompletedRecord { get; set; }
+
+ ///
+ /// 监理资料
+ ///
+ public string MonitorDocument { get; set; }
+
+ ///
+ /// 鉴定报告
+ ///
+ public string IdentificationReport { get; set; }
+
+ ///
+ /// 其它资料
+ ///
+ public string OtherDocument { get; set; }
+ #endregion
+
+ #region 建筑概貌aspect
+ ///
+ /// 外立面照片
+ ///
+ public string FacadePhoto { get; set; }
+ #endregion
+
+ #region 调查单位unit
+ ///
+ /// 调查登记机构
+ ///
+ public string InvestigateAgency { get; set; }
+
+ ///
+ /// 纸质资料调查人
+ ///
+ public string InvestigateUser { get; set; }
+
+ ///
+ /// 纸质资料审核人
+ ///
+ public string OfflineAuditor { get; set; }
+
+ ///
+ /// 主管部门
+ ///
+ public string CompetentDepartment { get; set; }
+ #endregion
+
}
+
+ public class HouseInfoInputAdd
+ {
+ public HouseCodeOutput houseCode { get; set; }
+ public HouseInfoInput houseInfo { get; set; }
+ public EditHouseTaskInput PatrolInfo { get; set; }
+ }
}
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs
index 7ed5809..6b2385b 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs
@@ -278,13 +278,7 @@ namespace Ewide.Application
public HouseCodeOutput houseCode { get; set; }
#endregion
- public HouseInfoOutput houseInfoOutput { get; set; }
- public PatrolInfo PatrolInfo { get; set; }
+ public HouseInfoOutput houseInfo { get; set; }
+ public HouseTaskOutput PatrolInfo { get; set; }
}
-
- public class PatrolInfo
- {
- public DateTime? PatrolDate { get; set; }
- public string PatrolUser { get; set; }
- }
}
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs
index 657abdf..732253b 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs
@@ -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();
+ 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();
+ 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();
+ houseTask.HouseCodeId = input.houseCode.Id;
+ await houseTask.UpdateExcludeAsync(new string[] { }, ignoreNullValues: true);
+ }
+ }
+
[HttpGet("/houseInfo/getByTaskId")]
- [AllowAnonymous]
public async Task GetByTaskId([Required] string taskId)
{
var houseTaskRep = Db.GetRepository();
+ //获取任务实体
var houseTask = await houseTaskRep.DetachedEntities.FirstOrDefaultAsync(t=>t.Id == taskId);
if(houseTask == null) throw Oops.Oh("任务不存在");
+ //获取房屋编码信息
var houseCodeOutputAsync = await _dapperRepository.QueryAsync(
- @"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("SELECT * FROM bs_house_info HI WHERE Id = @HouseCodeId", new { houseTask.HouseCodeId });
var houseInfoOutput = houseInfoOutputAsync.SingleOrDefault();
- houseInfoOutputForDetailPage.houseInfoOutput = houseInfoOutput;
+ houseInfoOutputForDetailPage.houseInfo = houseInfoOutput;
return houseInfoOutputForDetailPage;
}
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs
index 2c35201..39538f0 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs
@@ -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
///
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; }
///
@@ -74,17 +71,11 @@ namespace Ewide.Application
///
/// 巡查结果:1正常,-1异常
///
- [Required(ErrorMessage = "巡查结果不能为空")]
+ //[Required(ErrorMessage = "巡查结果不能为空")]
public int PatrolResult { get; set; }
public string PatrolResultRemark { get; set; }
- ///
- /// -1:退回 0:待处理 1:保存待提交 2:待审核 3:审核通过
- ///
- [Required(ErrorMessage = "任务目标状态能为空")]
- public int Status { get; set; }
-
///
/// 上报街道
///
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
index bf03eb8..0c76088 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
@@ -8,5 +8,7 @@ namespace Ewide.Application
{
public class HouseTaskOutput
{
+ public DateTime? PatrolDate { get; set; }
+ public string PatrolUser { get; set; }
}
}