diff --git a/20220330_Vote/Ewide.Application/Entity/BsHouseCode.cs b/20220330_Vote/Ewide.Application/Entity/BsHouseCode.cs
new file mode 100644
index 0000000..ded5654
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Entity/BsHouseCode.cs
@@ -0,0 +1,52 @@
+using Microsoft.EntityFrameworkCore;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Ewide.Application
+{
+ [Table("bs_house_code")]
+ [Comment("房屋编码表")]
+ public class BsHouseCode : Core.DEntityBase
+ {
+ [Comment("系统中唯一的房屋编码,生成即不再变更")]
+ [MaxLength(50)]
+ [Required]
+ public string HouseCode { get; set; }
+
+ [Comment("编号")]
+ [MaxLength(3)]
+ [Required]
+ public int No { get; set; }
+
+ [Comment("项目ID")]
+ [MaxLength(36)]
+ [Required]
+ public string ProjectId { get; set; }
+
+ [Comment("片区ID")]
+ [MaxLength(36)]
+ [Required]
+ public string ZoneId { get; set; }
+
+ [Comment("详细地址")]
+ [MaxLength(500)]
+ [Required]
+ public string Address { get; set; }
+
+ [Comment("性质")]
+ [Required]
+ public int Type { get; set; }
+
+ [Comment("所属行业")]
+ [Required]
+ public int Industry { get; set; }
+
+ [Comment("坐标-经度")]
+ [MaxLength(50)]
+ public string Lng { get; set; }
+
+ [Comment("坐标-纬度")]
+ [MaxLength(50)]
+ public string Lat { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Entity/BsHouseCompany.cs b/20220330_Vote/Ewide.Application/Entity/BsHouseCompany.cs
new file mode 100644
index 0000000..0849cdc
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Entity/BsHouseCompany.cs
@@ -0,0 +1,36 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ [Table("bs_house_company")]
+ [Comment("房屋相关单位表")]
+ public class BsHouseCompany : Core.DEntityBase
+ {
+ ///
+ /// 单位类型,多选
+ ///
+ [Comment("单位类型,多选")]
+ [MaxLength(20)]
+ public string Type { get; set; }
+
+ ///
+ /// 单位名称
+ ///
+ [Comment("单位名称")]
+ [MaxLength(200)]
+ public string Name { get; set; }
+
+ ///
+ /// 信息
+ ///
+ [Comment("信息")]
+ public string Info { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Entity/BsHouseInfo.cs b/20220330_Vote/Ewide.Application/Entity/BsHouseInfo.cs
new file mode 100644
index 0000000..f7c8ea8
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Entity/BsHouseInfo.cs
@@ -0,0 +1,378 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ [Table("bs_house_info")]
+ [Comment("房屋信息表")]
+ public class BsHouseInfo : Core.DEntityBase
+ {
+ ///
+ /// HouseCode主键ID
+ ///
+ [Comment("bs_house_code主键Id")]
+ [MaxLength(36)]
+ [Required]
+ public string HouseCodeId { get; set; }
+
+ ///
+ /// 幢名称
+ ///
+ [Comment("幢名称")]
+ [MaxLength(255)]
+ public string BuildingName { get; set; }
+
+ ///
+ /// 土地性质
+ ///
+ [Comment("土地性质")]
+ public int? LandAttribute { get; set; }
+
+ ///
+ /// 结构类型
+ ///
+ [Comment("结构类型")]
+ public int? StructureType { get; set; }
+
+ ///
+ /// 基础情况
+ ///
+ [Comment("基础情况")]
+ public int? BaseInfo { get; set; }
+
+ ///
+ /// 抗震等级
+ ///
+ [Comment("抗震等级")]
+ public int? SeismicGrade { get; set; }
+
+ ///
+ /// 竣工日期
+ ///
+ [Comment("竣工日期")]
+ public DateTime? CompletedDate { get; set; }
+
+ ///
+ /// 设计使用年限
+ ///
+ [Comment("设计使用年限")]
+ public int? UsefulYear { get; set; }
+
+ ///
+ /// 总层数
+ ///
+ [Comment("总层数")]
+ public int? TotalFloor { get; set; }
+
+ ///
+ /// 地上层数
+ ///
+ [Comment("地上层数")]
+ public int? LandFloorCount { get; set; }
+
+ ///
+ /// 地上商业层数开始
+ ///
+ [Comment("地上商业层数开始")]
+ public int? LandBsFloorStart { get; set; }
+
+ ///
+ /// 地上商业层数结束
+ ///
+ [Comment("地上商业层数结束")]
+ public int? LandBsFloorEnd { get; set; }
+
+ ///
+ /// 地上车棚层开始
+ ///
+ [Comment("地上车棚层开始")]
+ public int? LandBikeFloorStart { get; set; }
+
+ ///
+ /// 地上住宅层开始
+ ///
+ [Comment("地上住宅层开始")]
+ public int? LandResidenceFloorStart { get; set; }
+
+ ///
+ /// 地上住宅层结束
+ ///
+ [Comment("地上住宅层结束")]
+ public int? LandResidenceFloorEnd { get; set; }
+
+ ///
+ /// 地下层数
+ ///
+ [Comment("地下层数")]
+ public int? UnderFloorCount { get; set; }
+
+ ///
+ /// 总建筑面积
+ ///
+ [Comment("总建筑面积")]
+ public float? TotalArea { get; set; }
+
+ ///
+ /// 有无建筑幕墙
+ ///
+ [Comment("有无建筑幕墙")]
+ public int? CurtainWall { get; set; }
+
+ ///
+ /// 有无面砖
+ ///
+ [Comment("有无面砖")]
+ public int? FaceBrick { get; set; }
+
+ ///
+ /// 有无涂料
+ ///
+ [Comment("有无涂料")]
+ public int? Coating { get; set; }
+
+ ///
+ /// 有无粉刷
+ ///
+ [Comment("有无粉刷")]
+ public int? Painting { get; set; }
+
+ ///
+ /// 电梯
+ ///
+ [Comment("电梯")]
+ [MaxLength(20)]
+ public string Elevator { get; set; }
+
+ ///
+ /// 总户数(户)
+ ///
+ [Comment("总户数(户)")]
+ public int? HouseHolds { get; set; }
+
+ ///
+ /// 房屋单元数
+ ///
+ [Comment("房屋单元数")]
+ public int? Units { get; set; }
+
+ ///
+ /// 各单元每层户数(户)
+ ///
+ [Comment("各单元每层户数(户)")]
+ public int? UnitFloorHolds { get; set; }
+
+ ///
+ /// 建设单位ID
+ ///
+ [Comment("建设单位ID")]
+ [MaxLength(36)]
+ public string BuildingUnitId { get; set; }
+
+ ///
+ /// 设计单位ID
+ ///
+ [Comment("设计单位ID")]
+ [MaxLength(36)]
+ public string DesingerUnitId { get; set; }
+
+ ///
+ /// 施工单位ID
+ ///
+ [Comment("施工单位ID")]
+ [MaxLength(36)]
+ public string ConstructionUnitId { get; set; }
+
+ ///
+ /// 监理单位ID
+ ///
+ [Comment("监理单位ID")]
+ [MaxLength(36)]
+ public string MonitorUnitId { get; set; }
+
+ ///
+ /// 产权性质
+ ///
+ [Comment("产权性质")]
+ [MaxLength(100)]
+ public string PropertyRights { get; set; }
+
+ ///
+ /// 总共套数
+ ///
+ [Comment("总共套数")]
+ public int? HouseCount { get; set; }
+
+ ///
+ /// 直管公房套数
+ ///
+ [Comment("直管公房套数")]
+ public int? StraightHouseCount { get; set; }
+
+ ///
+ /// 自管公房套数
+ ///
+ [Comment("自管公房套数")]
+ public int? SelfHouseCount { get; set; }
+
+ ///
+ /// 私房套数
+ ///
+ [Comment("私房套数")]
+ public int? PrivateHouseCount { get; set; }
+
+ ///
+ /// 商品房套数
+ ///
+ [Comment("商品房套数")]
+ public int? BusinessCount { get; set; }
+
+ ///
+ /// 房改房套数
+ ///
+ [Comment("房改房套数")]
+ public int? ChangeHouseCount { get; set; }
+
+ ///
+ /// 拆迁安置房套数
+ ///
+ [Comment("拆迁安置房套数")]
+ public int? ResettlementHouseCount { get; set; }
+
+ ///
+ /// 其它套数
+ ///
+ [Comment("其它套数")]
+ public int? OtherCount { get; set; }
+
+ ///
+ /// 产权单位ID
+ ///
+ [Comment("产权单位ID")]
+ [MaxLength(36)]
+ public string PropertyUnitId { get; set; }
+
+ ///
+ /// 物业单位ID
+ ///
+ [Comment("物业单位ID")]
+ [MaxLength(36)]
+ public string WuYeUnitId { get; set; }
+
+ ///
+ /// 图纸资料存档处
+ ///
+ [Comment("图纸资料存档处")]
+ [MaxLength(50)]
+ public string DrawingMaterial { get; set; }
+
+ ///
+ /// 其他图纸存档
+ ///
+ [Comment("其他图纸存档")]
+ [MaxLength(100)]
+ public string DrawingMaterialText { get; set; }
+
+ ///
+ /// 立项文件
+ ///
+ [Comment("立项文件")]
+ [MaxLength(2000)]
+ public string AnEntryDocument { get; set; }
+
+ ///
+ /// 规划许可
+ ///
+ [Comment("规划许可")]
+ [MaxLength(2000)]
+ public string PlanningPermission { get; set; }
+
+ ///
+ /// 竣工验收备案
+ ///
+ [Comment("竣工验收备案")]
+ [MaxLength(2000)]
+ public string CompletionRecord { get; set; }
+
+ ///
+ /// 监理资料
+ ///
+ [Comment("监理资料")]
+ [MaxLength(2000)]
+ public string MonitorDocument { get; set; }
+
+ ///
+ /// 鉴定报告
+ ///
+ [Comment("鉴定报告")]
+ [MaxLength(2000)]
+ public string IdentificationReport { get; set; }
+
+ ///
+ /// 其它资料
+ ///
+ [Comment("其它资料")]
+ [MaxLength(2000)]
+ public string OtherDocument { get; set; }
+
+ ///
+ /// 外立面照片
+ ///
+ [Comment("外立面照片")]
+ [MaxLength(2000)]
+ public string FacadePhoto { get; set; }
+
+ ///
+ /// 房屋等级 1,2,3,4,C,d
+ ///
+ [Comment("房屋等级 1,2,3,4,C,d")]
+ public int? HouseGrade { get; set; }
+
+ ///
+ /// 房屋使用状态
+ ///
+ [Comment("房屋使用状态")]
+ public int? HouseUsedStatus { get; set; }
+
+ ///
+ /// -1 退回(审核被退回的数据) 1、待建档(需要建档的数据未暂存未保存的)2、暂存(点击了暂存的数据)3、待提交(点击了保存的数据) 5、审核中6、审核通过
+ ///
+ [Comment("-1 退回(审核被退回的数据) 1、待建档(需要建档的数据未暂存未保存的)2、暂存(点击了暂存的数据)3、待提交(点击了保存的数据) 5、审核中6、审核通过")]
+ [Required]
+ public int State { get; set; }
+
+ ///
+ /// 调查登记机构
+ ///
+ [Comment("调查登记机构")]
+ [MaxLength(100)]
+ public string InvestigateAgency { get; set; }
+
+ ///
+ /// 纸质资料调查人
+ ///
+ [Comment("纸质资料调查人")]
+ [MaxLength(50)]
+ public string InvestigateUser { get; set; }
+
+ ///
+ /// 纸质资料审核人
+ ///
+ [Comment("纸质资料审核人")]
+ [MaxLength(50)]
+ public string OfflineAuditor { get; set; }
+
+ ///
+ /// 主管部门
+ ///
+ [Comment("主管部门")]
+ [MaxLength(50)]
+ public string CompetentDepartment { get; set; }
+
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Entity/BsHouseLog.cs b/20220330_Vote/Ewide.Application/Entity/BsHouseLog.cs
new file mode 100644
index 0000000..bdcd8bd
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Entity/BsHouseLog.cs
@@ -0,0 +1,46 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ [Table("bs_house_log")]
+ [Comment("房屋流转日志")]
+ public class BsHouseLog : Core.DEntityBase
+ {
+ [Comment("房屋编码Id")]
+ [MaxLength(36)]
+ public string HouseCodeId { get; set; }
+
+ [Comment("目标处理人Id,可多个")]
+ public string TargetUserIds { get; set; }
+
+ [Comment("步骤类型")]
+ public HouseLogType Type { get; set; }
+
+ [Comment("状态")]
+ public HouseLogStatus Status { get; set; }
+
+ [Comment("备注信息")]
+ public string Remark { get; set; }
+
+ [Comment("完成时间")]
+ public DateTime? FinishedTime { get; set; }
+
+ [Comment("完成者Id")]
+ [MaxLength(36)]
+ public string FinishedUserId { get; set; }
+
+ [Comment("完成者名称")]
+ [MaxLength(20)]
+ public string FinishedUserName { get; set; }
+
+ [Comment("排序")]
+ public int Sort { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Entity/BsHouseMemberRelation.cs b/20220330_Vote/Ewide.Application/Entity/BsHouseMemberRelation.cs
new file mode 100644
index 0000000..98e42e2
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Entity/BsHouseMemberRelation.cs
@@ -0,0 +1,26 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ [Table("bs_house_member_relation")]
+ [Comment("房屋与人员关联表")]
+ public class BsHouseMemberRelation : Core.DEntityBase
+ {
+ [Comment("sys_user主键Id")]
+ [MaxLength(36)]
+ [Required]
+ public string SysUserId { get; set; }
+
+ [Comment("bs_house_code主键Id")]
+ [MaxLength(36)]
+ [Required]
+ public string HouseCodeId { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Entity/BsHouseProjectInfo.cs b/20220330_Vote/Ewide.Application/Entity/BsHouseProjectInfo.cs
new file mode 100644
index 0000000..1f294e2
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Entity/BsHouseProjectInfo.cs
@@ -0,0 +1,38 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Entity
+{
+ [Table("bs_house_projectinfo")]
+ [Comment("项目表")]
+ public class BsHouseProjectInfo : Core.DEntityBase
+ {
+ [Comment("名称")]
+ [MaxLength(100)]
+ [Required]
+ public string Name { get; set; }
+
+ [Comment("备注")]
+ [MaxLength(1000)]
+ public string Note { get; set; }
+
+ [Comment("排序")]
+ [Required]
+ public int Sort { get; set; }
+
+ [Comment("区域ID")]
+ [MaxLength(36)]
+ [Required]
+ public string AreaCode { get; set; }
+
+ [Comment("类型")]
+ [Required]
+ public int Type { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Entity/BsHouseTask.cs b/20220330_Vote/Ewide.Application/Entity/BsHouseTask.cs
new file mode 100644
index 0000000..fde1073
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Entity/BsHouseTask.cs
@@ -0,0 +1,266 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Ewide.Application
+{
+ [Table("bs_house_task")]
+ [Comment("房屋巡查任务表")]
+ public class BsHouseTask : Core.DEntityBase
+ {
+ ///
+ /// bs_house_code主键Id
+ ///
+ [Comment("bs_house_code主键Id")]
+ [MaxLength(36)]
+ [Required]
+ public string HouseCodeId { get; set; }
+
+ ///
+ /// 巡查日期
+ ///
+ [Comment("巡查日期")]
+ public DateTime? PatrolDate { get; set; }
+
+ ///
+ /// 巡查人姓名
+ ///
+ [Comment("巡查人姓名")]
+ [MaxLength(50)]
+ public string PatrolUser { get; set; }
+
+ ///
+ /// 沉降倾斜
+ ///
+ [Comment("沉降倾斜")]
+ [MaxLength(1000)]
+ public string SettlementTilt { get; set; }
+
+ ///
+ /// 沉降倾斜附件
+ ///
+ [Comment("沉降倾斜附件")]
+ [MaxLength(2000)]
+ public string SettlementTiltFiles { get; set; }
+
+ ///
+ /// 其他情况
+ ///
+ [Comment("其他情况")]
+ [MaxLength(1000)]
+ public string OtherInfo { get; set; }
+
+ ///
+ /// 其他情况附件
+ ///
+ [Comment("其他情况附件")]
+ [MaxLength(2000)]
+ public string OtherInfoFiles { get; set; }
+
+ ///
+ /// 初始等级
+ ///
+ [Comment("初始等级")]
+ public int? InitGrade { get; set; }
+
+ ///
+ /// 损坏等级
+ ///
+ [Comment("损坏等级")]
+ public int? DamageGrade { get; set; }
+
+ ///
+ /// 综合等级
+ ///
+ [Comment("综合等级")]
+ public int? ComprehensiveGrade { get; set; }
+
+ ///
+ /// 房屋场地
+ ///
+ [Comment("房屋场地")]
+ [MaxLength(100)]
+ public string HouseSite { get; set; }
+
+ ///
+ /// 相邻施工
+ ///
+ [Comment("相邻施工")]
+ [MaxLength(100)]
+ public string AdjacentConstruction { get; set; }
+
+ ///
+ /// 化学侵蚀
+ ///
+ [Comment("化学侵蚀")]
+ [MaxLength(100)]
+ public string ChemicalErosion { get; set; }
+
+ ///
+ /// 结构拆改
+ ///
+ [Comment("结构拆改")]
+ public int? StructuralDismantling { get; set; }
+
+ ///
+ /// 加层改造
+ ///
+ [Comment("加层改造")]
+ public int? AddingLayer { get; set; }
+
+ ///
+ /// 修缮加固
+ ///
+ [Comment("修缮加固")]
+ [MaxLength(100)]
+ public string RepairAndReinforce { get; set; }
+
+ ///
+ /// 历史灾害
+ ///
+ [Comment("历史灾害")]
+ [MaxLength(100)]
+ public string HistoricalCalamity { get; set; }
+
+ ///
+ /// 使用功能变更
+ ///
+ [Comment("使用功能变更")]
+ [MaxLength(100)]
+ public string FunctionalChange { get; set; }
+
+ ///
+ /// 其他调查内容
+ ///
+ [Comment("其他调查内容")]
+ [MaxLength(1000)]
+ public string OtherContents { get; set; }
+
+ ///
+ /// 主要安全隐患综述
+ ///
+ [Comment("主要安全隐患综述")]
+ [MaxLength(1000)]
+ public string MainSafety { get; set; }
+
+ ///
+ /// 处理意见
+ ///
+ [Comment("处理意见")]
+ public int? HandlingOpinion { get; set; }
+
+ ///
+ /// 处理意见备注
+ ///
+ [Comment("处理意见备注")]
+ [MaxLength(1000)]
+ public string HandlingOpinionRemark { get; set; }
+
+ ///
+ /// 整改情况
+ ///
+ [Comment("整改情况")]
+ public int? RectifyAndReform { get; set; }
+
+ ///
+ /// 整改情况备注
+ ///
+ [Comment("整改情况备注")]
+ [MaxLength(1000)]
+ public string RectifyAndReformRemark { get; set; }
+
+ ///
+ /// 巡查结果:1正常,-1异常
+ ///
+ [Comment("巡查结果:1正常,-1异常")]
+ public int? PatrolResult { get; set; }
+
+ ///
+ /// 巡查异常描述
+ ///
+ [Comment("巡查异常描述")]
+ [MaxLength(1000)]
+ public string PatrolResultRemark { get; set; }
+
+ ///
+ /// 任务人员ID
+ ///
+ [Comment("任务人员ID")]
+ [MaxLength(36)]
+ public string UserID { get; set; }
+
+ ///
+ /// 任务截止时间
+ ///
+ [Comment("任务截止时间")]
+ public DateTime? EndTime { get; set; }
+
+ ///
+ /// 是否过期
+ ///
+ [Comment("是否过期")]
+ public bool? IsDelay { get; set; }
+
+ ///
+ /// -1:退回0:待处理1:保存待提交2:待审核3:审核通过
+ ///
+ [Comment("-1:退回0:待处理1:保存待提交2:待审核6:审核通过")]
+ public int Status { get; set; } = 0;
+
+ ///
+ /// 0:建档任务1:系统派发的巡查任务2:主动巡查任务
+ ///
+ [Comment("0:建档任务1:系统派发的巡查任务2:主动巡查任务")]
+ public int? TaskType { get; set; }
+
+ ///
+ /// 上报街道
+ ///
+ [Comment("上报街道")]
+ public int? ReportRoad { get; set; }
+
+ ///
+ /// 上报街道时间
+ ///
+ [Comment("上报街道时间")]
+ public DateTime? ReportRoadTime { get; set; }
+
+ ///
+ /// 上报区住建
+ ///
+ [Comment("上报区住建")]
+ public int? ReportArea { get; set; }
+
+ ///
+ /// 上报区住建时间
+ ///
+ [Comment("上报区住建时间")]
+ public DateTime? ReportAreaTime { get; set; }
+
+ ///
+ /// 上报备注
+ ///
+ [Comment("上报备注")]
+ [MaxLength(1000)]
+ public string ReportRemark { get; set; }
+
+ ///
+ /// 提交时间
+ ///
+ [Comment("提交时间")]
+ public DateTime? SubmitTime { get; set; }
+
+ ///
+ /// 最后提交时间
+ ///
+ [Comment("最后提交时间")]
+ public DateTime? LastSubmitTime { get; set; }
+
+ ///
+ /// 是否有效
+ ///
+ [Comment("是否有效")]
+ public bool IsEnabled { get; set; } = true;
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Entity/BsHouseTaskCheckRecord.cs b/20220330_Vote/Ewide.Application/Entity/BsHouseTaskCheckRecord.cs
new file mode 100644
index 0000000..5fdf4e1
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Entity/BsHouseTaskCheckRecord.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Ewide.Application
+{
+ [Table("bs_house_task_check_record")]
+ [Comment("房屋任务审核记录表")]
+ public class BsHouseTaskCheckRecord : Core.DEntityBase
+ {
+ ///
+ /// 任务Id
+ ///
+ [Comment("任务Id")]
+ [MaxLength(36)]
+ public string TaskId { get; set; }
+
+ ///
+ /// 通过1;退回-1
+ ///
+ [Comment("通过3;退回-1")]
+ public int PassOrBack { get; set; }
+
+ ///
+ /// 审核内容
+ ///
+ [Comment("审核内容")]
+ [MaxLength(500)]
+ public string Content { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Entity/BsHouseTaskOptions.cs b/20220330_Vote/Ewide.Application/Entity/BsHouseTaskOptions.cs
new file mode 100644
index 0000000..c279a1b
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Entity/BsHouseTaskOptions.cs
@@ -0,0 +1,60 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+namespace Ewide.Application
+{
+ [Table("bs_house_task_options")]
+ [Comment("房屋巡查任务选项表")]
+ public class BsHouseTaskOptions : Core.DEntityBase
+ {
+ ///
+ /// bs_house_code主键Id
+ ///
+ [Comment("bs_house_code主键Id")]
+ [MaxLength(36)]
+ [Required]
+ public string TaskId { get; set; }
+
+ ///
+ /// 字典类型
+ ///
+ [Comment("字典类型")]
+ [MaxLength(50)]
+ public string DictType { get; set; }
+
+ ///
+ /// 字典code
+ ///
+ [Comment("字典code")]
+ [MaxLength(50)]
+ public string DictCode { get; set; }
+
+ ///
+ /// 字典值
+ ///
+ [Comment("字典值")]
+ [MaxLength(100)]
+ public string DictValue { get; set; }
+
+ ///
+ /// 备注
+ ///
+ [Comment("备注")]
+ [MaxLength(500)]
+ public string Remark { get; set; }
+
+ ///
+ /// 附件
+ ///
+ [Comment("附件")]
+ [MaxLength(2000)]
+ public string File { get; set; }
+
+ ///
+ /// 是否选中
+ ///
+ [Comment("是否选中")]
+ public bool? Checked { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Entity/README.md b/20220330_Vote/Ewide.Application/Entity/README.md
new file mode 100644
index 0000000..59bc7dd
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Entity/README.md
@@ -0,0 +1 @@
+/** 您的业务实体文件写在此文件夹下面 **/
diff --git a/20220330_Vote/Ewide.Application/Enum/DataStatus.cs b/20220330_Vote/Ewide.Application/Enum/DataStatus.cs
new file mode 100644
index 0000000..d073a7f
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Enum/DataStatus.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ public enum DataStatus
+ {
+ ///
+ /// 审核退回
+ ///
+ [Description("审核退回")]
+ Back = -1,
+
+ ///
+ /// 初始未处理
+ ///
+ [Description("初始未处理")]
+ Init = 0,
+
+ ///
+ /// 暂存
+ ///
+ [Description("暂存")]
+ TempSaved = 1,
+
+ ///
+ /// 已保存,待提交
+ ///
+ [Description("已保存,待提交")]
+ Saved = 2,
+
+ ///
+ /// 已提交,待审核
+ ///
+ [Description("已提交,待审核")]
+ Submited = 3,
+
+ ///
+ /// 审核通过
+ ///
+ [Description("审核通过")]
+ Passed = 6
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Enum/HouseLog.cs b/20220330_Vote/Ewide.Application/Enum/HouseLog.cs
new file mode 100644
index 0000000..29d707f
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Enum/HouseLog.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ public enum HouseLogType
+ {
+ [Description("创建房屋编码")]
+ CreateCode = 1,
+
+ [Description("人员选房")]
+ SelectMember = 2,
+
+ [Description("房屋建档")]
+ CreateInfo = 3,
+
+ [Description("审核")]
+ Check = 4,
+
+ [Description("审核通过")]
+ Agree = 5,
+
+ [Description("审核退回")]
+ Disagree = 6
+
+ }
+
+ public enum HouseLogStatus
+ {
+ [Description("待处理")]
+ Handle = 0,
+
+ [Description("正在处理")]
+ Handling = 1,
+
+ [Description("已处理")]
+ Handled = 2,
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Enum/HouseManagerRole.cs b/20220330_Vote/Ewide.Application/Enum/HouseManagerRole.cs
new file mode 100644
index 0000000..bb0909b
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Enum/HouseManagerRole.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ public enum HouseManagerRole
+ {
+ ///
+ /// 市住建部门
+ ///
+ CityManager,
+
+ ///
+ /// 区住建部门
+ ///
+ AreaManager,
+
+ ///
+ /// 街道管理员
+ ///
+ RoadManager,
+
+ ///
+ /// 片区监管员
+ ///
+ ZoneManager,
+
+ ///
+ /// 房屋安全管理员
+ ///
+ HouseSecurityManager
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Ewide.Application.csproj b/20220330_Vote/Ewide.Application/Ewide.Application.csproj
new file mode 100644
index 0000000..95dd765
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Ewide.Application.csproj
@@ -0,0 +1,27 @@
+
+
+
+ net5.0
+ 1701;1702;1591
+ Ewide.Application.xml
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+
+
+
+
+
+
diff --git a/20220330_Vote/Ewide.Application/Ewide.Application.xml b/20220330_Vote/Ewide.Application/Ewide.Application.xml
new file mode 100644
index 0000000..53d4ca2
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Ewide.Application.xml
@@ -0,0 +1,1490 @@
+
+
+
+ Ewide.Application
+
+
+
+
+ 单位类型,多选
+
+
+
+
+ 单位名称
+
+
+
+
+ 信息
+
+
+
+
+ HouseCode主键ID
+
+
+
+
+ 幢名称
+
+
+
+
+ 土地性质
+
+
+
+
+ 结构类型
+
+
+
+
+ 基础情况
+
+
+
+
+ 抗震等级
+
+
+
+
+ 竣工日期
+
+
+
+
+ 设计使用年限
+
+
+
+
+ 总层数
+
+
+
+
+ 地上层数
+
+
+
+
+ 地上商业层数开始
+
+
+
+
+ 地上商业层数结束
+
+
+
+
+ 地上车棚层开始
+
+
+
+
+ 地上住宅层开始
+
+
+
+
+ 地上住宅层结束
+
+
+
+
+ 地下层数
+
+
+
+
+ 总建筑面积
+
+
+
+
+ 有无建筑幕墙
+
+
+
+
+ 有无面砖
+
+
+
+
+ 有无涂料
+
+
+
+
+ 有无粉刷
+
+
+
+
+ 电梯
+
+
+
+
+ 总户数(户)
+
+
+
+
+ 房屋单元数
+
+
+
+
+ 各单元每层户数(户)
+
+
+
+
+ 建设单位ID
+
+
+
+
+ 设计单位ID
+
+
+
+
+ 施工单位ID
+
+
+
+
+ 监理单位ID
+
+
+
+
+ 产权性质
+
+
+
+
+ 总共套数
+
+
+
+
+ 直管公房套数
+
+
+
+
+ 自管公房套数
+
+
+
+
+ 私房套数
+
+
+
+
+ 商品房套数
+
+
+
+
+ 房改房套数
+
+
+
+
+ 拆迁安置房套数
+
+
+
+
+ 其它套数
+
+
+
+
+ 产权单位ID
+
+
+
+
+ 物业单位ID
+
+
+
+
+ 图纸资料存档处
+
+
+
+
+ 其他图纸存档
+
+
+
+
+ 立项文件
+
+
+
+
+ 规划许可
+
+
+
+
+ 竣工验收备案
+
+
+
+
+ 监理资料
+
+
+
+
+ 鉴定报告
+
+
+
+
+ 其它资料
+
+
+
+
+ 外立面照片
+
+
+
+
+ 房屋等级 1,2,3,4,C,d
+
+
+
+
+ 房屋使用状态
+
+
+
+
+ -1 退回(审核被退回的数据) 1、待建档(需要建档的数据未暂存未保存的)2、暂存(点击了暂存的数据)3、待提交(点击了保存的数据) 5、审核中6、审核通过
+
+
+
+
+ 调查登记机构
+
+
+
+
+ 纸质资料调查人
+
+
+
+
+ 纸质资料审核人
+
+
+
+
+ 主管部门
+
+
+
+
+ bs_house_code主键Id
+
+
+
+
+ 巡查日期
+
+
+
+
+ 巡查人姓名
+
+
+
+
+ 沉降倾斜
+
+
+
+
+ 沉降倾斜附件
+
+
+
+
+ 其他情况
+
+
+
+
+ 其他情况附件
+
+
+
+
+ 初始等级
+
+
+
+
+ 损坏等级
+
+
+
+
+ 综合等级
+
+
+
+
+ 房屋场地
+
+
+
+
+ 相邻施工
+
+
+
+
+ 化学侵蚀
+
+
+
+
+ 结构拆改
+
+
+
+
+ 加层改造
+
+
+
+
+ 修缮加固
+
+
+
+
+ 历史灾害
+
+
+
+
+ 使用功能变更
+
+
+
+
+ 其他调查内容
+
+
+
+
+ 主要安全隐患综述
+
+
+
+
+ 处理意见
+
+
+
+
+ 处理意见备注
+
+
+
+
+ 整改情况
+
+
+
+
+ 整改情况备注
+
+
+
+
+ 巡查结果:1正常,-1异常
+
+
+
+
+ 巡查异常描述
+
+
+
+
+ 任务人员ID
+
+
+
+
+ 任务截止时间
+
+
+
+
+ 是否过期
+
+
+
+
+ -1:退回0:待处理1:保存待提交2:待审核3:审核通过
+
+
+
+
+ 0:建档任务1:系统派发的巡查任务2:主动巡查任务
+
+
+
+
+ 上报街道
+
+
+
+
+ 上报街道时间
+
+
+
+
+ 上报区住建
+
+
+
+
+ 上报区住建时间
+
+
+
+
+ 上报备注
+
+
+
+
+ 提交时间
+
+
+
+
+ 最后提交时间
+
+
+
+
+ 是否有效
+
+
+
+
+ 任务Id
+
+
+
+
+ 通过1;退回-1
+
+
+
+
+ 审核内容
+
+
+
+
+ bs_house_code主键Id
+
+
+
+
+ 字典类型
+
+
+
+
+ 字典code
+
+
+
+
+ 字典值
+
+
+
+
+ 备注
+
+
+
+
+ 附件
+
+
+
+
+ 是否选中
+
+
+
+
+ 审核退回
+
+
+
+
+ 初始未处理
+
+
+
+
+ 暂存
+
+
+
+
+ 已保存,待提交
+
+
+
+
+ 已提交,待审核
+
+
+
+
+ 审核通过
+
+
+
+
+ 市住建部门
+
+
+
+
+ 区住建部门
+
+
+
+
+ 街道管理员
+
+
+
+
+ 片区监管员
+
+
+
+
+ 房屋安全管理员
+
+
+
+
+ 房屋编码相关
+
+
+
+
+ 获取同一区域下的下一个编号
+
+
+
+
+
+
+ 房屋详细信息
+
+
+
+
+ 住宅查询
+
+
+
+
+ 房屋流转日志
+
+
+
+
+ 分页查询用户
+
+
+
+
+
+
+ 增加用户
+
+
+
+
+
+
+ 获取角色
+
+
+
+
+
+
+ 获取用户拥有角色
+
+
+
+
+
+
+ 删除用户
+
+
+
+
+
+
+ 更新用户
+
+
+
+
+
+
+ 查看用户
+
+
+
+
+
+
+ 修改用户状态
+
+
+
+
+
+
+ 授权用户数据范围
+
+
+
+
+
+
+ 获取用户拥有数据
+
+
+
+
+
+
+ 获取当前机构中所创建的默认角色
+ 片区中的第一个帐号必定为片区监管员
+
+
+
+
+
+
+ 获取可创建的角色列表
+
+
+
+
+
+ 项目管理相关服务
+
+
+
+
+ 添加项目
+
+
+
+
+
+
+ 删除项目
+
+
+
+
+
+
+ 编辑项目
+
+
+
+
+
+
+ 通过ID获取项目
+
+
+
+
+
+
+ 分页查询
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 获取项目下拉列表
+
+
+
+
+
+
+ 选房相关
+
+
+
+
+ 获取人员允许绑定的房屋编码列表
+
+
+
+
+
+
+ 获取人员已经绑定的房屋编码列表
+
+
+
+
+
+
+ 从人员选择房屋
+
+
+
+
+
+
+ 房屋任务(巡查任务/建档任务)
+
+
+
+
+ 片区相关
+
+
+
+
+ 获取片区列表
+
+
+
+
+
+
+ 分页查询片区
+
+
+
+
+
+
+ 根据用户Id获取所在片区的Id
+
+
+
+
+
+
+ 总建筑面积
+
+
+
+
+ 总户数(户)
+
+
+
+
+ 房屋单元数
+
+
+
+
+ 各单元每层户数(户)
+
+
+
+
+ 总层数
+
+
+
+
+ 地上层数
+
+
+
+
+ 地上商业层数开始
+
+
+
+
+ 地上商业层数结束
+
+
+
+
+ 地上车棚层开始
+
+
+
+
+ 地上住宅层开始
+
+
+
+
+ 地上住宅层结束
+
+
+
+
+ 地下层数
+
+
+
+
+ 产权性质
+
+
+
+
+ 总共套数
+
+
+
+
+ 直管公房套数
+
+
+
+
+ 自管公房套数
+
+
+
+
+ 私房套数
+
+
+
+
+ 商品房套数
+
+
+
+
+ 房改房套数
+
+
+
+
+ 拆迁安置房套数
+
+
+
+
+ 其它套数
+
+
+
+
+ 房屋等级 1,2,3,4,C,d
+
+
+
+
+ 房屋使用状态
+
+
+
+
+ 图纸资料存档处
+
+
+
+
+ 其他图纸存档
+
+
+
+
+ 立项文件
+
+
+
+
+ 规划许可
+
+
+
+
+ 竣工验收备案
+
+
+
+
+ 监理资料
+
+
+
+
+ 鉴定报告
+
+
+
+
+ 其它资料
+
+
+
+
+ 外立面照片
+
+
+
+
+ 调查登记机构
+
+
+
+
+ 纸质资料调查人
+
+
+
+
+ 纸质资料审核人
+
+
+
+
+ 主管部门
+
+
+
+
+ 总建筑面积
+
+
+
+
+ 总户数(户)
+
+
+
+
+ 房屋单元数
+
+
+
+
+ 各单元每层户数(户)
+
+
+
+
+ 总层数
+
+
+
+
+ 地上层数
+
+
+
+
+ 地上商业层数开始
+
+
+
+
+ 地上商业层数结束
+
+
+
+
+ 地上车棚层开始
+
+
+
+
+ 地上住宅层开始
+
+
+
+
+ 地上住宅层结束
+
+
+
+
+ 地下层数
+
+
+
+
+ 产权性质
+
+
+
+
+ 总共套数
+
+
+
+
+ 直管公房套数
+
+
+
+
+ 自管公房套数
+
+
+
+
+ 私房套数
+
+
+
+
+ 商品房套数
+
+
+
+
+ 房改房套数
+
+
+
+
+ 拆迁安置房套数
+
+
+
+
+ 其它套数
+
+
+
+
+ 房屋等级 1,2,3,4,C,d
+
+
+
+
+ 房屋使用状态
+
+
+
+
+ 图纸资料存档处
+
+
+
+
+ 其他图纸存档
+
+
+
+
+ 立项文件
+
+
+
+
+ 规划许可
+
+
+
+
+ 竣工验收备案
+
+
+
+
+ 监理资料
+
+
+
+
+ 鉴定报告
+
+
+
+
+ 其它资料
+
+
+
+
+ 外立面照片
+
+
+
+
+ 调查登记机构
+
+
+
+
+ 纸质资料调查人
+
+
+
+
+ 纸质资料审核人
+
+
+
+
+ 主管部门
+
+
+
+
+ 任务Id
+
+
+
+
+ 通过3;退回-1
+
+
+
+
+ 审核内容
+
+
+
+
+ 沉降倾斜
+
+
+
+
+ 沉降倾斜附件
+
+
+
+
+ 其他情况
+
+
+
+
+ 其他情况附件
+
+
+
+
+ 房屋场地
+
+
+
+
+ 相邻施工
+
+
+
+
+ 化学侵蚀
+
+
+
+
+ 结构拆改
+
+
+
+
+ 加层改造
+
+
+
+
+ 修缮加固
+
+
+
+
+ 历史灾害
+
+
+
+
+ 使用功能变更
+
+
+
+
+ 其他调查内容
+
+
+
+
+ 主要安全隐患综述
+
+
+
+
+ 处理意见
+
+
+
+
+ 处理意见备注
+
+
+
+
+ 整改情况
+
+
+
+
+ 整改情况备注
+
+
+
+
+ 巡查结果:1正常,-1异常
+
+
+
+
+ 上报街道
+
+
+
+
+ 上报街道时间
+
+
+
+
+ 上报区住建
+
+
+
+
+ 上报区住建时间
+
+
+
+
+ 上报备注
+
+
+
+
+ 沉降倾斜
+
+
+
+
+ 沉降倾斜附件
+
+
+
+
+ 其他情况
+
+
+
+
+ 其他情况附件
+
+
+
+
+ 初始等级
+
+
+
+
+ 损坏等级
+
+
+
+
+ 综合等级
+
+
+
+
+ 房屋场地
+
+
+
+
+ 相邻施工
+
+
+
+
+ 化学侵蚀
+
+
+
+
+ 结构拆改
+
+
+
+
+ 加层改造
+
+
+
+
+ 修缮加固
+
+
+
+
+ 历史灾害
+
+
+
+
+ 使用功能变更
+
+
+
+
+ 其他调查内容
+
+
+
+
+ 主要安全隐患综述
+
+
+
+
+ 处理意见
+
+
+
+
+ 处理意见备注
+
+
+
+
+ 整改情况
+
+
+
+
+ 整改情况备注
+
+
+
+
+ 巡查结果:1正常,-1异常
+
+
+
+
+ 巡查异常描述
+
+
+
+
+ 上报街道
+
+
+
+
+ 上报街道时间
+
+
+
+
+ 上报区住建
+
+
+
+
+ 上报区住建时间
+
+
+
+
+ 上报备注
+
+
+
+
+ 提交时间
+
+
+
+
+ 最后提交时间
+
+
+
+
+ 是否有效
+
+
+
+
+ 所属街道
+
+
+
+
+ 名称
+
+
+
+
+ 机构Id
+
+
+
+
diff --git a/20220330_Vote/Ewide.Application/README.md b/20220330_Vote/Ewide.Application/README.md
new file mode 100644
index 0000000..11a79cd
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/README.md
@@ -0,0 +1,3 @@
+1、原则上服务应该放在Application层次,考虑将咱自己的业务层直接写在Application里面好些,后续升级后,咱大家直接升级就行了,减少冲突!
+2、系统默认ORM为EF Core,如果觉得不趁手,可以自行更换
+3、在此应用层默认集成了SqlSugar,其他ORM类同,可以多个ORM并行开发,熟悉哪个用哪个
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeInput.cs
new file mode 100644
index 0000000..d105eda
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeInput.cs
@@ -0,0 +1,65 @@
+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 HouseCodeInput
+ {
+ }
+
+ public class AddHouseCodeInput : PageInputBase
+ {
+ public string HouseCode { get; set; }
+ [Required(ErrorMessage = "行政区域编码不能为空")]
+ public string AreaCode { get; set; }
+ [Required(ErrorMessage = "项目Id不能为空")]
+ public string ProjectId { get; set; }
+ [Required(ErrorMessage = "房屋编号不能为空")]
+ public int No { get; set; }
+ [Required(ErrorMessage = "片区Id不能为空")]
+ public string ZoneId { get; set; }
+ [Required(ErrorMessage = "房屋地址不能为空")]
+ public string Address { get; set; }
+ [Required(ErrorMessage = "房屋性质不能为空")]
+ public int Type { get; set; }
+ [Required(ErrorMessage = "所属行业不能为空")]
+ public int Industry { get; set; }
+ [Required(ErrorMessage = "经度不能为空")]
+ public string Lng { get; set; }
+ [Required(ErrorMessage = "纬度不能为空")]
+ public string Lat { get; set; }
+ }
+
+ public class EditHouseCodeInput : AddHouseCodeInput
+ {
+ [Required(ErrorMessage = "房屋编码Id不能为空")]
+ public string Id { get; set; }
+ }
+
+ public class DeleteHouseCodeInput
+ {
+ [Required(ErrorMessage = "房屋编码ID不可为空")]
+ public string Id { get; set; }
+ }
+
+ public class QueryHouseCodeInput : PageInputBase
+ {
+ public string HouseCode { get; set; }
+ public int? No { get; set; }
+ public string Address { get; set; }
+ public string ProjectId { get; set; }
+ public string ZoonId { get; set; }
+ public int Type { get; set; }
+ }
+
+ public class GetHouseCodeInput
+ {
+ [Required(ErrorMessage = "房屋编码ID不可为空")]
+ public string Id { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs
new file mode 100644
index 0000000..bb691f8
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs
@@ -0,0 +1,43 @@
+using Ewide.Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ public class HouseCodeOutput
+ {
+ public string Id { get; set; }
+ public string Address { get; set; }
+ public string ProjectId { get; set; }
+ public string ZoneId { get; set; }
+ public int Type { get; set; }
+ public string AreaName { get; set; }
+ public string RoadName { get; set; }
+ public string CommName { get; set; }
+ public string ZoneName { get; set; }
+ public string ProjectNote { get; set; }
+ public string FullProjName { get; set; }
+ public string HouseCode { get; set; }
+ public int No { get; set; }
+ public string Lng { get; set; }
+ public string Lat { get; set; }
+ }
+
+ public class GetHouseCodeOutput
+ {
+ public string Id { get; set; }
+ public string HouseCode { get; set; }
+ public int Type { get; set; }
+ public int Industry { get; set; }
+ public string AreaCode { get; set; }
+ public string ProjectId { get; set; }
+ public int No { get; set; }
+ public string ZoneId { get; set; }
+ public string Address { get; set; }
+ public string Lng { get; set; }
+ public string Lat { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/HouseCodeService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/HouseCodeService.cs
new file mode 100644
index 0000000..8175ddd
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/HouseCodeService.cs
@@ -0,0 +1,123 @@
+using Ewide.Application.Entity;
+using Ewide.Core;
+using Furion.DatabaseAccessor;
+using Furion.DatabaseAccessor.Extensions;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Furion.FriendlyException;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System.Threading.Tasks;
+using Dapper;
+using Ewide.Core.Extension;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace Ewide.Application.Service.HouseCode
+{
+ ///
+ /// 房屋编码相关
+ ///
+ [ApiDescriptionSettings(Name = "HouseCode", Order = 180)]
+ public class HouseCodeService : IHouseCodeService, IDynamicApiController, ITransient
+ {
+ private readonly IRepository _houseCodeRep;
+ private readonly IDapperRepository _dapperRepository;
+
+ private readonly IUserManager _userManager;
+ private readonly IHouseLogService _houseLogService;
+
+ public HouseCodeService(IRepository HouseCodeRep, IDapperRepository dapperRepository, IUserManager userManager, IHouseLogService houseLogService)
+ {
+ _houseCodeRep = HouseCodeRep;
+ _dapperRepository = dapperRepository;
+
+ _userManager = userManager;
+ _houseLogService = houseLogService;
+ }
+
+ [HttpPost("/houseCode/add")]
+ [UnitOfWork]
+ public async Task AddHouseCode(AddHouseCodeInput input)
+ {
+ var houseProjectInfoRep = Db.GetRepository();
+ var houseProject = await houseProjectInfoRep.FirstOrDefaultAsync(p => p.Id == input.ProjectId);
+ if (houseProject == null) throw Oops.Oh("项目参数有误,添加失败");
+
+ var areaCodeRep = Db.GetRepository();
+ var areaCode = await areaCodeRep.DetachedEntities.FirstOrDefaultAsync(a => a.Code == input.AreaCode && a.LevelType == 4);
+ if(areaCode == null) throw Oops.Oh("区域编码有误,添加失败");
+ input.HouseCode = areaCode.AdCode + houseProject.Sort.ToString().PadLeft(3, '0') + input.No.ToString().PadLeft(3, '0');
+ var id = System.Guid.NewGuid().ToString().ToLower();
+ var houseCode = input.Adapt();
+ houseCode.Id = id;
+ var isExist = await _houseCodeRep.AnyAsync(p => p.HouseCode == houseCode.HouseCode);
+ if (isExist) throw Oops.Oh("房屋编码已存在,不可重复添加");
+ await houseCode.InsertAsync();
+
+ // 添加到流转日志
+ var sort = await _houseLogService.AddThenDone(id, _userManager.User, HouseLogType.CreateCode);
+ sort = await _houseLogService.Add(id, _userManager.User, HouseLogType.SelectMember, sort: sort);
+ }
+
+ [HttpPost("/houseCode/edit")]
+ public async Task EditHouseCode(EditHouseCodeInput input)
+ {
+ var houseCode = input.Adapt();
+ await houseCode.UpdateExcludeAsync(new[] { nameof(BsHouseCode.HouseCode) }, true);
+ }
+
+ [HttpPost("/houseCode/delete")]
+ public async Task DeleteHouseCode(DeleteHouseCodeInput input)
+ {
+ var houseCode = _houseCodeRep.FirstOrDefault(p => p.Id == input.Id);
+ await houseCode.DeleteNowAsync();
+ }
+
+ [HttpPost("/houseCode/page")]
+ public async Task QueryPage([FromBody] QueryHouseCodeInput input)
+ {
+ var sql = @"SELECT
+HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',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) ";
+ return await _dapperRepository.QueryPageDataDynamic(sql, input, filterFields: new string[] {"Type", "Address", "HouseCode","AreaCode"});
+ }
+
+ [HttpGet("/houseCode/detail")]
+ public async Task GetHouserCode([FromQuery] GetHouseCodeInput input)
+ {
+ var houseCode = await _houseCodeRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == input.Id);
+ var areaCode = (await Db.GetRepository().DetachedEntities.FirstOrDefaultAsync(p => p.Id == houseCode.ProjectId)).AreaCode;
+ var result = houseCode.Adapt();
+ result.AreaCode = areaCode;
+ return result;
+ }
+
+ ///
+ /// 获取同一区域下的下一个编号
+ ///
+ ///
+ ///
+ [HttpGet("/houseCode/getNextNoByCode")]
+ public async Task GetNextNoByFullNumber([Required] string projectId)
+ {
+ var areaCodeRep = Db.GetRepository();
+ var houseProjectInfoRep = Db.GetRepository();
+ var houseProject = await houseProjectInfoRep.FirstOrDefaultAsync(p => p.Id == projectId);
+ if(houseProject == null) throw Oops.Oh("项目参数有误,房屋编码生成失败");
+ //取到社区编码
+ var commAreaCode = await areaCodeRep.FirstOrDefaultAsync(a => a.Code == houseProject.AreaCode && a.LevelType == 4);
+ if(commAreaCode == null) throw Oops.Oh("项目区域编码有误,房屋编码生成失败");
+ var maxNo = await _houseCodeRep.DetachedEntities
+ .Where(h => h.HouseCode.Contains(commAreaCode.AdCode + houseProject.Sort.ToString().PadLeft(3, '0')))
+ .MaxAsync(h => (int?)h.No);
+ return maxNo.GetValueOrDefault(0) + 1;
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/IHouseCodeService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/IHouseCodeService.cs
new file mode 100644
index 0000000..c1e1e4f
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCode/IHouseCodeService.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseCode
+{
+ public interface IHouseCodeService
+ {
+ Task AddHouseCode(AddHouseCodeInput input);
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/Dto/HouseCompanyInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/Dto/HouseCompanyInput.cs
new file mode 100644
index 0000000..95fcd6e
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/Dto/HouseCompanyInput.cs
@@ -0,0 +1,61 @@
+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 HouseCompanyInput
+ {
+ [Required(ErrorMessage = "Id不能为空")]
+ public string Id { get; set; }
+ }
+
+ public class HouseCompanyInfoInput
+ {
+ [Required(ErrorMessage = "信息名称不能为空")]
+ public string Name { get; set; }
+ [Required(ErrorMessage = "信息内容不能为空")]
+ public string Value { get; set; }
+ }
+
+ public class HouseCompanyPageInput : PageInputBase {}
+
+ public class HouseCompanyAddInput
+ {
+ [Required(ErrorMessage = "名称不能为空")]
+ public virtual string Name { get; set; }
+
+ private string _Type { get; set; }
+
+ [Required(ErrorMessage = "类型不能为空")]
+ public virtual string Type
+ {
+ get
+ {
+ return _Type;
+ }
+ set
+ {
+ _Type = String.Join(",", value.Split(',').Select(p => $"[{p}]"));
+ }
+ }
+
+ public virtual List Info { get; set; }
+ }
+
+ public class HouseCompanyEditInput : HouseCompanyAddInput
+ {
+ [Required(ErrorMessage = "Id不能为空")]
+ public string Id { get; set; }
+ }
+
+ public class HouseCompanyListInput
+ {
+ [Required(ErrorMessage = "类型不能为空")]
+ public string Type { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/Dto/HouseCompanyOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/Dto/HouseCompanyOutput.cs
new file mode 100644
index 0000000..8692722
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/Dto/HouseCompanyOutput.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ public class HouseCompanyInfoOutput
+ {
+ public string Name { get; set; }
+ public string Value { get; set; }
+ }
+
+ public class HouseCompanyDetailOutput
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ private string _Type { get; set; }
+ public string Type
+ {
+ get
+ {
+ return _Type;
+ }
+ set
+ {
+ _Type = String.Join(",", value.Split(',').Select(p => p.Replace("[", "").Replace("]", "")));
+ }
+ }
+ public List Info { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/HouseCompanyService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/HouseCompanyService.cs
new file mode 100644
index 0000000..dc99898
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/HouseCompanyService.cs
@@ -0,0 +1,101 @@
+using Ewide.Core.Extension;
+using Furion.DatabaseAccessor;
+using Furion.DatabaseAccessor.Extensions;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ [ApiDescriptionSettings(Name = "HouseCompany")]
+ public class HouseCompanyService : IHouseCompanyService, IDynamicApiController, ITransient
+ {
+ private readonly IRepository _bsHouseCompanyRep;
+
+ public HouseCompanyService(IRepository bsHouseCompanyRep)
+ {
+ _bsHouseCompanyRep = bsHouseCompanyRep;
+ }
+
+ [HttpPost("/houseCompany/page")]
+ public async Task Page([FromBody] HouseCompanyPageInput input)
+ {
+ var config = new TypeAdapterConfig().ForType()
+ .Map(target => target.Info, src => JsonConvert.DeserializeObject>(src.Info))
+ .Config;
+ return await _bsHouseCompanyRep.DetachedEntities.ToPageData(input, config);
+ }
+
+ [HttpPost("/houseCompany/add")]
+ public async Task Add([FromBody] HouseCompanyAddInput input)
+ {
+ var info = JsonConvert.SerializeObject(input.Info);
+ var config = new TypeAdapterConfig().ForType()
+ .Map(target => target.Info, src => JsonConvert.SerializeObject(src.Info))
+ .Config;
+ var company = input.Adapt(config);
+ await company.InsertAsync();
+ }
+
+ [HttpPost("/houseCompany/edit")]
+ public async Task Edit([FromBody] HouseCompanyEditInput input)
+ {
+ var config = new TypeAdapterConfig().ForType()
+ .Map(target => target.Info, src => JsonConvert.SerializeObject(src.Info))
+ .Config;
+ var company = input.Adapt(config);
+ await company.UpdateAsync();
+ }
+
+ [HttpPost("/houseCompany/delete")]
+ public async Task Delete([FromBody] HouseCompanyInput input)
+ {
+ var company = await _bsHouseCompanyRep.FirstOrDefaultAsync(p => p.Id.Equals(input.Id));
+ await company.DeleteAsync();
+ }
+
+ [HttpGet("/houseCompany/detail")]
+ public async Task Detail([FromQuery] HouseCompanyInput input)
+ {
+ var company = await _bsHouseCompanyRep.FirstOrDefaultAsync(p => p.Id.Equals(input.Id));
+ var config = new TypeAdapterConfig().ForType()
+ .Map(target => target.Info, src => JsonConvert.DeserializeObject>(src.Info))
+ .Config;
+ var output = company.Adapt(config);
+ return output;
+ }
+
+ [HttpGet("/houseCompany/list")]
+ public async Task List([FromQuery] HouseCompanyListInput input)
+ {
+ var types = input.Type.Split(',');
+ var result = new List();
+ var config = new TypeAdapterConfig().ForType()
+ .Map(target => target.Info, src => JsonConvert.DeserializeObject>(src.Info))
+ .Config;
+ foreach (var type in types)
+ {
+ var list = (await _bsHouseCompanyRep.DetachedEntities
+ .Where(p => EF.Functions.Like(p.Type, $"%[{type.Trim()}]%"))
+ .OrderBy(p => p.Name)
+ .ToListAsync())
+ .Select(p =>
+ {
+ var output = p.Adapt(config);
+ return output;
+ });
+ result.AddRange(list);
+ }
+
+ return result.Distinct();
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/IHouseCompanyService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/IHouseCompanyService.cs
new file mode 100644
index 0000000..94eac4e
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseCompany/IHouseCompanyService.cs
@@ -0,0 +1,19 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ public interface IHouseCompanyService
+ {
+ Task Page([FromBody] HouseCompanyPageInput input);
+ Task Add([FromBody] HouseCompanyAddInput input);
+ Task Edit([FromBody] HouseCompanyEditInput input);
+ Task Delete([FromBody] HouseCompanyInput input);
+ Task Detail([FromQuery] HouseCompanyInput input);
+ Task List([FromQuery] HouseCompanyListInput input);
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs
new file mode 100644
index 0000000..6977a3f
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs
@@ -0,0 +1,239 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+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 鉴定治理identification
+
+ ///
+ /// 房屋等级 1,2,3,4,C,d
+ ///
+ public int? HouseGrade { get; set; }
+
+ ///
+ /// 房屋使用状态
+ ///
+ public int? HouseUsedStatus { 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 CompletionRecord { 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 int State { get; set; }
+ }
+
+ public class HouseInfoInputSave
+ {
+ public HouseCodeOutput houseCode { get; set; }
+ public HouseInfoInput houseInfo { get; set; }
+ public EditHouseTaskInput PatrolInfo { get; set; }
+ public HouseTaskCheckRecordInput TaskCheckRecord { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs
new file mode 100644
index 0000000..104f44d
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs
@@ -0,0 +1,239 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ public class HouseInfoOutput
+ {
+ #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 鉴定治理identification
+
+ ///
+ /// 房屋等级 1,2,3,4,C,d
+ ///
+ public int? HouseGrade { get; set; }
+
+ ///
+ /// 房屋使用状态
+ ///
+ public int? HouseUsedStatus { 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 CompletionRecord { 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
+ public int State { get; set; }
+ #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 HouseInfoOutputForDetailPage
+ {
+ #region header
+ public HouseCodeOutput HouseCode { get; set; }
+ #endregion
+
+ public HouseInfoOutput HouseInfo { get; set; }
+ public HouseTaskOutput PatrolInfo { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs
new file mode 100644
index 0000000..a5b2d5e
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs
@@ -0,0 +1,208 @@
+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;
+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
+{
+ ///
+ /// 房屋详细信息
+ ///
+ [ApiDescriptionSettings(Name = "HouseInfo", Order = 200)]
+ public class HouseInfoService : IHouseInfoService, IDynamicApiController, ITransient
+ {
+
+ private readonly IRepository _houseCodeRep;
+ private readonly IRepository _houseInfoRep;
+ private readonly IRepository _houseTaskRep;
+ private readonly IRepository _sysUserRep;
+ private readonly IUserManager _userManager;
+ private readonly IDapperRepository _dapperRepository;
+
+ private readonly IHouseLogService _houseLogService;
+
+
+ public HouseInfoService(
+ IRepository HouseCodeRep,
+ IRepository HouseInfoRep,
+ IRepository HouseTaskRep,
+ IRepository sysUserRep,
+ IUserManager userManager, IDapperRepository dapperRepository, IHouseLogService houseLogService)
+ {
+ _houseCodeRep = HouseCodeRep;
+ _houseInfoRep = HouseInfoRep;
+ _houseTaskRep = HouseTaskRep;
+ _sysUserRep = sysUserRep;
+ _userManager = userManager;
+ _dapperRepository = dapperRepository;
+
+ _houseLogService = houseLogService;
+ }
+
+ [HttpPost("/houseInfo/save")]
+ [UnitOfWork]
+ [AllowAnonymous]
+ public async Task Save([FromBody] HouseInfoInputSave input)
+ {
+ await InputDataProcess(input, DataStatus.Saved);
+ }
+
+ [HttpPost("/houseInfo/submitToCheck")]
+ [UnitOfWork]
+ [AllowAnonymous]
+ public async Task SubmitToCheck([FromBody] HouseInfoInputSave input)
+ {
+ await InputDataProcess(input,DataStatus.Submited);
+ }
+
+ [HttpPost("/houseInfo/check")]
+ [UnitOfWork]
+ public async Task Check([FromBody] HouseInfoInputSave input)
+ {
+ await InputDataProcess(input, input.TaskCheckRecord.PassOrBackDataStatus );
+ }
+
+ [HttpGet("/houseInfo/getByTaskId")]
+ [UnitOfWork]
+ public async Task GetByTaskId([Required] string taskId)
+ {
+ //获取任务实体
+ 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,O.Name ZoneName,Proj.Note ProjectNote,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName,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_org O ON HC.ZoneId = O.Id
+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.Id=@HouseCodeId", new { houseTask.HouseCodeId }
+ );
+ var houseCodeOutput= houseCodeOutputAsync.SingleOrDefault();
+ 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
+ };
+
+ var taskOutput = houseTask.Adapt();
+ taskOutput.PatrolDate = houseTask.PatrolDate.GetValueOrDefault(DateTime.Now);
+ taskOutput.PatrolUser = String.IsNullOrEmpty(houseTask.PatrolUser) ? currentUser.Name : houseTask.PatrolUser;
+ houseInfoOutputForDetailPage.PatrolInfo = taskOutput;
+
+ if (houseInfo == null || houseInfo.State <= (int)DataStatus.Submited)
+ {
+ // 未建档或者当前数据未提交时打开,标记为已读
+ await _houseLogService.Read(houseCodeOutput.Id);
+ }
+
+ if (houseInfo == null)
+ {
+ houseInfoOutputForDetailPage.HouseInfo = new HouseInfoOutput();
+ return houseInfoOutputForDetailPage;
+ }
+
+ var houseInfoOutput = (await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.HouseCodeId == houseTask.HouseCodeId)).Adapt();
+ houseInfoOutputForDetailPage.HouseInfo = houseInfoOutput;
+
+ return houseInfoOutputForDetailPage;
+ }
+
+ [NonAction]
+ [UnitOfWork]
+ public async Task InputDataProcess(HouseInfoInputSave input,DataStatus dataStatus = DataStatus.Init)
+ {
+ //房屋编码地址/坐标单独更新
+ 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);
+
+ //建档审核通过的房屋数据修改时,对应的建档任务Task不处理
+ var houseTask = await _houseTaskRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == input.PatrolInfo.Id);
+ if (houseEntity == null || houseEntity.State != 6)
+ {
+ var _houseTask = input.PatrolInfo.Adapt();
+ _houseTask.HouseCodeId = input.houseCode.Id;
+ //任务没有暂存状态,其他状态与HouseInfo的State一致
+ _houseTask.Status = dataStatus == DataStatus.TempSaved ? (int)DataStatus.Saved : (int)dataStatus;
+ await _houseTask.UpdateExcludeAsync(new string[] { nameof(BsHouseTask.TaskType) }, ignoreNullValues: true);
+ }
+ //判断房屋建档状态
+ //dataStatus == DataStatus.Saved 若是保存操作 则判断是新增/更新
+ //判断是新增/更新 根据传入参数dataStatus确定
+ input.houseInfo.State = dataStatus == DataStatus.Saved ? (houseEntity == null ? (int)DataStatus.Saved : houseEntity.State) : (int)dataStatus;
+ var houseInfo = input.houseInfo.Adapt();
+ houseInfo.HouseCodeId = input.houseCode.Id;
+
+ if (houseEntity == null)
+ {
+ houseInfo.Id = Guid.NewGuid().ToString();
+ await houseInfo.InsertAsync();
+ }
+ else
+ {
+ houseInfo.Id = houseEntity.Id;
+ await houseInfo.UpdateExcludeAsync(new[] { nameof(BsHouseInfo.HouseGrade) }, true);
+ }
+
+ int? logSort = null;
+
+ if (dataStatus == DataStatus.Submited)
+ {
+ await _houseLogService.Done(input.houseCode.Id);
+
+ var org = await _userManager.GetUserOrgInfo();
+
+ var _sysEmpRep = Db.GetRepository();
+ var _sysUserRoleRep = Db.GetRepository();
+ var _sysRoleRep = Db.GetRepository();
+ var zoneManagerList = await (from u in _sysUserRep.DetachedEntities
+ join e in _sysEmpRep.DetachedEntities on u.Id equals e.Id
+ join ur in _sysUserRoleRep.DetachedEntities on u.Id equals ur.SysUserId
+ join r in _sysRoleRep.DetachedEntities on ur.SysRoleId equals r.Id
+ where e.OrgId == org.Id && r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase()
+ select u).ToListAsync();
+
+ logSort = await _houseLogService.Add(input.houseCode.Id, zoneManagerList, HouseLogType.Check);
+ }
+ //审核操作则新增一条审核记录
+ if (dataStatus == DataStatus.Back || dataStatus == DataStatus.Passed)
+ {
+ var checkRecord = input.TaskCheckRecord.Adapt();
+ await checkRecord.InsertAsync();
+ await _houseLogService.Done(input.houseCode.Id);
+ logSort = await _houseLogService.AddThenDone(input.houseCode.Id, _userManager.User, dataStatus == DataStatus.Passed ? HouseLogType.Agree : HouseLogType.Disagree, remark: checkRecord.Content, sort: logSort);
+ if (dataStatus == DataStatus.Back)
+ {
+ var user = await _sysUserRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(houseTask.UserID));
+ logSort = await _houseLogService.Add(input.houseCode.Id, user, HouseLogType.CreateInfo, sort: logSort);
+ }
+ }
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/IHouseInfoService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/IHouseInfoService.cs
new file mode 100644
index 0000000..14dda5f
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseInfo/IHouseInfoService.cs
@@ -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
+ {
+ Task GetByTaskId(string taskId);
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogInput.cs
new file mode 100644
index 0000000..356d221
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogInput.cs
@@ -0,0 +1,15 @@
+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 HouseLogInput
+ {
+ [Required(ErrorMessage = "Id不能为空")]
+ public string Id { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogOutput.cs
new file mode 100644
index 0000000..fdd2831
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogOutput.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ public class HouseLogOutput
+ {
+ public string Id { get; set; }
+ public string TargetUserNames { get; set; }
+ public int Type { get; set; }
+ public int Status { get; set; }
+ public string Remark { get; set; }
+ public DateTime? FinishedTime { get; set; }
+ public string FinishedUserId { get; set; }
+ public string FinishedUserName { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs
new file mode 100644
index 0000000..85cf06f
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs
@@ -0,0 +1,209 @@
+using Dapper;
+using Ewide.Core;
+using Furion.DatabaseAccessor;
+using Furion.DatabaseAccessor.Extensions;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ ///
+ /// 房屋流转日志
+ ///
+ [ApiDescriptionSettings(Name = "HouseLog", Order = 210)]
+ public class HouseLogService : IHouseLogService, IDynamicApiController, ITransient
+ {
+ private readonly IDapperRepository _dapperRep;
+
+ private readonly IUserManager _userManager;
+
+ private readonly IRepository _bsHouseLogRep;
+
+ public HouseLogService(IDapperRepository dapperRep, IUserManager userManager, IRepository bsHouseLogRep)
+ {
+ _dapperRep = dapperRep;
+ _userManager = userManager;
+ _bsHouseLogRep = bsHouseLogRep;
+ }
+
+ [NonAction]
+ [UnitOfWork]
+ public async Task Add(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null)
+ {
+ return await Add(houseCodeId, new List { targetUser }, type, remark, sort);
+ }
+
+ [NonAction]
+ [UnitOfWork]
+ public async Task Add(string houseCodeId, List targetUsers, HouseLogType type, string remark = null, int? sort = null)
+ {
+ if (!sort.HasValue)
+ {
+ sort = await _bsHouseLogRep.DetachedEntities.Where(p => p.HouseCodeId.Equals(houseCodeId)).MaxAsync(p => p.Sort);
+ }
+ var _sort = sort.GetValueOrDefault(1) + 1;
+ await new BsHouseLog
+ {
+ Id = Guid.NewGuid().ToString(),
+ HouseCodeId = houseCodeId,
+ TargetUserIds = String.Join(",", targetUsers.Select(p => p.Id)),
+ Type = type,
+ Status = HouseLogStatus.Handle,
+ Remark = remark,
+ Sort = _sort
+ }.InsertAsync();
+
+ return _sort;
+ }
+
+ [NonAction]
+ [UnitOfWork]
+ public async Task Read(string houseCodeId)
+ {
+ var log = await _bsHouseLogRep
+ .Where(p => p.HouseCodeId.Equals(houseCodeId) && p.Status.Equals(HouseLogStatus.Handle))
+ .OrderByDescending(p => p.CreatedTime)
+ .FirstOrDefaultAsync();
+ if (log != null)
+ {
+ log.Status = HouseLogStatus.Handling;
+ await log.UpdateAsync();
+ }
+ }
+
+ [NonAction]
+ [UnitOfWork]
+ public async Task Done(string houseCodeId)
+ {
+ var log = await _bsHouseLogRep
+ .Where(p => p.HouseCodeId.Equals(houseCodeId) && !p.Status.Equals(HouseLogStatus.Handled))
+ .OrderByDescending(p => p.CreatedTime)
+ .FirstOrDefaultAsync();
+ if (log != null)
+ {
+ log.Status = HouseLogStatus.Handled;
+ log.FinishedTime = DateTime.Now;
+ log.FinishedUserId = _userManager.UserId;
+ log.FinishedUserName = _userManager.User.Account;
+ await log.UpdateAsync();
+ }
+ }
+
+ [NonAction]
+ [UnitOfWork]
+ public async Task AddThenRead(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null)
+ {
+ return await AddThenRead(houseCodeId, new List { targetUser }, type, remark, sort);
+ }
+
+ [NonAction]
+ [UnitOfWork]
+ public async Task AddThenRead(string houseCodeId, List targetUsers, HouseLogType type, string remark = null, int? sort = null)
+ {
+ if (!sort.HasValue)
+ {
+ sort = await _bsHouseLogRep.DetachedEntities.Where(p => p.HouseCodeId.Equals(houseCodeId)).MaxAsync(p => p.Sort);
+ }
+ var _sort = sort.GetValueOrDefault(1) + 1;
+ await new BsHouseLog
+ {
+ Id = Guid.NewGuid().ToString(),
+ HouseCodeId = houseCodeId,
+ TargetUserIds = String.Join(",", targetUsers.Select(p => p.Id)),
+ Type = type,
+ Status = HouseLogStatus.Handling,
+ Remark = remark,
+ Sort = _sort
+ }.InsertAsync();
+
+ return _sort;
+ }
+
+ [NonAction]
+ [UnitOfWork]
+ public async Task AddThenDone(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null)
+ {
+ return await AddThenDone(houseCodeId, new List { targetUser }, type, remark, sort);
+ }
+
+ [NonAction]
+ [UnitOfWork]
+ public async Task AddThenDone(string houseCodeId, List targetUsers, HouseLogType type, string remark = null, int? sort = null)
+ {
+ if (!sort.HasValue)
+ {
+ sort = await _bsHouseLogRep.DetachedEntities.Where(p => p.HouseCodeId.Equals(houseCodeId)).MaxAsync(p => p.Sort);
+ }
+ var _sort = sort.GetValueOrDefault(1) + 1;
+ await new BsHouseLog
+ {
+ Id = Guid.NewGuid().ToString(),
+ HouseCodeId = houseCodeId,
+ TargetUserIds = String.Join(",", targetUsers.Select(p => p.Id)),
+ Type = type,
+ Status = HouseLogStatus.Handled,
+ Remark = remark,
+ FinishedTime = DateTime.Now,
+ FinishedUserId = _userManager.UserId,
+ FinishedUserName = _userManager.User.Account,
+ Sort = _sort
+ }.InsertAsync();
+
+ return _sort;
+ }
+
+ [HttpGet("/houseLog/list")]
+ public async Task List([FromQuery] HouseLogInput input)
+ {
+ var sql = @"SELECT
+ HL.Id,
+ HL.Type,
+ HL.`Status`,
+ HL.Remark,
+ HL.FinishedTime,
+ HL.FinishedUserId,
+ IFNULL(NickName, `Name`) FinishedUserName,
+(SELECT GROUP_CONCAT(IFNULL(NickName,`Name`)) FROM sys_user
+ WHERE Id IN (
+ SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(_HL.TargetUserIds,',',HT.help_topic_id + 1),',',-1)
+ FROM bs_house_log _HL
+ JOIN mysql.help_topic HT ON HT.help_topic_id < (LENGTH(_HL.TargetUserIds) - LENGTH(REPLACE(_HL.TargetUserIds,',','')) + 1)
+ WHERE _HL.Id = HL.Id
+ )
+) TargetUserNames
+FROM bs_house_log HL
+LEFT JOIN sys_user SU ON HL.FinishedUserId = SU.Id
+WHERE HouseCodeId = @HouseCodeId
+ORDER BY Sort DESC";
+
+ return await _dapperRep.QueryAsync(sql, new { houseCodeId = input.Id });
+ }
+
+ [HttpGet("/houseLog/listByInfoId")]
+ public async Task ListByInfoId([FromQuery] HouseLogInput input)
+ {
+ var info = await Db.GetRepository().DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.Id));
+ return await List(new HouseLogInput
+ {
+ Id = info.HouseCodeId
+ });
+ }
+
+ [HttpGet("/houseLog/listByTaskId")]
+ public async Task ListByTaskId([FromQuery] HouseLogInput input)
+ {
+ var task = await Db.GetRepository().DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.Id));
+ return await List(new HouseLogInput
+ {
+ Id = task.HouseCodeId
+ });
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs
new file mode 100644
index 0000000..056db2b
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs
@@ -0,0 +1,24 @@
+using Ewide.Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ public interface IHouseLogService
+ {
+ Task Add(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null);
+ Task Add(string houseCodeId, List targetUsers, HouseLogType type, string remark = null, int? sort = null);
+ Task Read(string houseCodeId);
+ Task Done(string houseCodeId);
+ Task AddThenRead(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null);
+ Task AddThenRead(string houseCodeId, List targetUsers, HouseLogType type, string remark = null, int? sort = null);
+ Task AddThenDone(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null);
+ Task AddThenDone(string houseCodeId, List targetUsers, HouseLogType type, string remark = null, int? sort = null);
+ Task List(HouseLogInput input);
+ Task ListByInfoId(HouseLogInput input);
+ Task ListByTaskId(HouseLogInput input);
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/Dto/HouseMemberInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/Dto/HouseMemberInput.cs
new file mode 100644
index 0000000..e3634ea
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/Dto/HouseMemberInput.cs
@@ -0,0 +1,16 @@
+using Ewide.Core.Service;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ public class AddHouseMemberInput : AddUserInput
+ {
+ [Required(ErrorMessage = "角色不能为空")]
+ public string RoleId { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/Dto/HouseMemberOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/Dto/HouseMemberOutput.cs
new file mode 100644
index 0000000..73d2395
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/Dto/HouseMemberOutput.cs
@@ -0,0 +1,13 @@
+using Ewide.Core.Service;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ public class HouseMemberOutput
+ {
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs
new file mode 100644
index 0000000..a77a0b5
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs
@@ -0,0 +1,326 @@
+using Dapper;
+using Ewide.Core;
+using Ewide.Core.Extension;
+using Ewide.Core.Service;
+using Furion.DatabaseAccessor;
+using Furion.DataEncryption;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Furion.FriendlyException;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System;
+
+namespace Ewide.Application.Service
+{
+ [ApiDescriptionSettings(Name = "HouseMember")]
+ public class HouseMemberService : IHouseMemberService, IDynamicApiController, ITransient
+ {
+ private readonly IDapperRepository _dapperRepository;
+
+ private readonly IRepository _sysUserRep; // 用户表仓储
+ private readonly IUserManager _userManager;
+ private readonly ISysUserService _sysUserService;
+ private readonly ISysEmpService _sysEmpService;
+
+ public HouseMemberService(
+ IDapperRepository dapperRepository,
+ IRepository sysUserRep,
+ IUserManager userManager,
+ ISysUserService sysUserService,
+ ISysEmpService sysEmpService
+ )
+ {
+ _dapperRepository = dapperRepository;
+ _sysUserRep = sysUserRep;
+ _userManager = userManager;
+ _sysUserService = sysUserService;
+ _sysEmpService = sysEmpService;
+ }
+
+ ///
+ /// 分页查询用户
+ ///
+ ///
+ ///
+ [HttpPost("/houseMember/page")]
+ public async Task QueryMemberPageList([FromBody] UserInput input)
+ {
+ var dataScopes = await _userManager.GetUserAllDataScopeList();
+
+ var sql = @"SELECT
+SU.*,
+SO.Name OrgName,
+SUR.RoleName,
+SUR.RoleCode
+FROM sys_user SU
+LEFT JOIN sys_emp SE ON SU.Id = SE.Id
+LEFT JOIN sys_org SO ON SE.OrgId = SO.Id
+LEFT JOIN (
+ SELECT
+ SUR.SysUserId,
+ GROUP_CONCAT(SR.Name) RoleName,
+ GROUP_CONCAT(SR.Code) RoleCode
+ FROM sys_user_role SUR
+ LEFT JOIN sys_role SR ON SUR.SysRoleId = SR.Id
+ GROUP BY SUR.SysUserId
+) SUR ON SU.Id = SUR.SysUserId
+WHERE 1=1";
+ var param = new DynamicParameters();
+
+ if (!string.IsNullOrEmpty(input.SearchValue))
+ {
+ sql += @" AND (SU.Account Like @SearchValue
+ OR SU.Name Like @SearchValue
+ OR SU.Phone Like @SearchValue)";
+ param.Add("SearchValue", "%" + input.SearchValue + "%");
+ }
+
+ if (!string.IsNullOrEmpty(input.SysEmpParam.OrgId))
+ {
+ var filter = " AND (SO.Id = @OrgId {0}) ";
+ filter = String.Format(filter, input.TreeNodeDataScope.GetValueOrDefault(1) == 2 ? " OR SO.Pids Like CONCAT('%[', @OrgId, ']%') " : "");
+ sql += filter;
+ param.Add("OrgId", input.SysEmpParam.OrgId);
+ }
+
+ if (input.SearchStatus >= 0)
+ {
+ sql += " AND SU.Status = @Status";
+ param.Add("Status", input.SearchStatus);
+ }
+
+ if (!_userManager.SuperAdmin)
+ {
+ sql += " AND SU.AdminType <> @AdminType";
+ param.Add("AdminType", AdminType.SuperAdmin);
+
+ sql += " AND SU.Id <> @UserId";
+ param.Add("UserId", _userManager.UserId);
+
+ if (dataScopes.Count > 0)
+ {
+ sql += " AND SO.Id IN @OrgIds";
+ param.Add("OrgIds", dataScopes.ToArray());
+ }
+ }
+
+ var users = await _dapperRepository.QueryPageData(sql, input, param);
+
+ //foreach (var user in users.Items)
+ //{
+ // user.SysEmpInfo = await _sysEmpService.GetEmpInfo(user.Id);
+ //}
+ return PageDataResult.PageResult(users);
+ }
+
+ ///
+ /// 增加用户
+ ///
+ ///
+ ///
+ [HttpPost("/houseMember/add")]
+ [UnitOfWork]
+ public async Task AddUser(AddHouseMemberInput input)
+ {
+ var id = await _sysUserService.AddUser(input);
+ var grantRoleInput = input.Adapt();
+ grantRoleInput.Id = id;
+
+ // 添加角色
+ grantRoleInput.GrantRoleIdList.Add(input.RoleId);
+ await _sysUserService.GrantUserRole(grantRoleInput);
+ }
+
+ ///
+ /// 获取角色
+ ///
+ ///
+ ///
+ [HttpGet("/houseMember/defaultRole")]
+ public async Task DefaultRole([FromQuery] string orgId)
+ {
+ return (await GetDefaultRole(orgId)).Adapt();
+ }
+
+ ///
+ /// 获取用户拥有角色
+ ///
+ ///
+ ///
+ [HttpGet("/houseMember/ownRole")]
+ public async Task GetUserOwnRole([FromQuery] QueryUserInput input)
+ {
+ return await _sysUserService.GetUserOwnRole(input);
+ }
+
+ [HttpGet("/houseMember/defaultRoleRange")]
+ public async Task DefaultRoleRange()
+ {
+ return (await GetRoleRange()).Select(p => p.Adapt()).ToList();
+ }
+
+ ///
+ /// 删除用户
+ ///
+ ///
+ ///
+ [HttpPost("/houseMember/delete")]
+ [UnitOfWork]
+ public async Task DeleteUser(DeleteUserInput input)
+ {
+ /*
+ * 未处理逻辑
+ * 片区监管员在本片区已有安全员的情况下无法删除
+ */
+
+ await _sysUserService.DeleteUser(input);
+ }
+
+ ///
+ /// 更新用户
+ ///
+ ///
+ ///
+ [HttpPost("/houseMember/edit")]
+ [UnitOfWork]
+ public async Task UpdateUser(UpdateUserInput input)
+ {
+ /*
+ * 未处理逻辑
+ * 如果移动组织架构,会产生以下几种逻辑
+ * 片区1监管员(无安全员或有其他监管员)=>片区2,直接成功
+ * 片区1监管员(有安全员并且无其他监管员)=>片区2,无法移动
+ * 片区1安全员=>片区2(有监管员),直接成功
+ * 片区1安全员=>片区2(无监管员),无法移动,需要创建监管员
+ */
+
+ await _sysUserService.UpdateUser(input);
+ }
+
+ ///
+ /// 查看用户
+ ///
+ ///
+ ///
+ [HttpGet("/houseMember/detail")]
+ public async Task GetUser([FromQuery] QueryUserInput input)
+ {
+ var sql = @"SELECT
+SU.*,
+SO.Name OrgName,
+SUR.RoleName,
+SUR.RoleCode
+FROM sys_user SU
+LEFT JOIN sys_emp SE ON SU.Id = SE.Id
+LEFT JOIN sys_org SO ON SE.OrgId = SO.Id
+LEFT JOIN (
+ SELECT
+ SUR.SysUserId,
+ GROUP_CONCAT(SR.Name) RoleName,
+ GROUP_CONCAT(SR.Code) RoleCode
+ FROM sys_user_role SUR
+ LEFT JOIN sys_role SR ON SUR.SysRoleId = SR.Id
+ GROUP BY SUR.SysUserId
+) SUR ON SU.Id = SUR.SysUserId
+WHERE SU.Id=@Id";
+ var user = (await _dapperRepository.QueryAsync(sql, new { input.Id })).SingleOrDefault();
+ if (user != null)
+ {
+ user.SysEmpInfo = await _sysEmpService.GetEmpInfo(user.Id);
+ }
+ return user;
+ }
+
+ ///
+ /// 修改用户状态
+ ///
+ ///
+ ///
+ [HttpPost("/houseMember/changeStatus")]
+ public async Task ChangeUserStatus(UpdateUserInput input)
+ {
+ await _sysUserService.ChangeUserStatus(input);
+ }
+
+ ///
+ /// 授权用户数据范围
+ ///
+ ///
+ ///
+ [HttpPost("/houseMember/grantData")]
+ public async Task GrantUserData(UpdateUserInput input)
+ {
+ await _sysUserService.GrantUserData(input);
+ }
+
+ ///
+ /// 获取用户拥有数据
+ ///
+ ///
+ ///
+ [HttpGet("/houseMember/ownData")]
+ public async Task GetUserOwnData([FromQuery] QueryUserInput input)
+ {
+ return await _sysUserService.GetUserOwnData(input);
+ }
+
+ ///
+ /// 获取当前机构中所创建的默认角色
+ /// 片区中的第一个帐号必定为片区监管员
+ ///
+ ///
+ ///
+ [NonAction]
+ private async Task GetDefaultRole(string orgId)
+ {
+ var roles = await GetRoleRange();
+ if (roles.Count < 2) throw Oops.Oh("未配置正确的角色");
+
+ var _sysOrgRep = Db.GetRepository();
+ var org = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == orgId);
+ // 如果当前组织为街道, 则直接返回安全员
+ if (org == null || org.Type <= (int)OrgType.乡镇街道办事处)
+ {
+ return roles.LastOrDefault();
+ }
+
+ var _sysEmpRep = Db.GetRepository();
+ var _sysUserRoleRep = Db.GetRepository();
+ var userIds = await _sysEmpRep.DetachedEntities.Where(p => p.OrgId == orgId).Select(p => p.Id).ToListAsync();
+ var roleIds = await _sysUserRoleRep.DetachedEntities.Where(p => userIds.Contains(p.SysUserId)).Select(p => p.SysRoleId).ToListAsync();
+
+ var _sysRoleRep = Db.GetRepository();
+ var isExistZoneManager = await _sysRoleRep.DetachedEntities.AnyAsync(p => roleIds.Contains(p.Id) && p.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase());
+ // 存在片区监管员,返回安全员, 否则返回监管员
+ if (isExistZoneManager)
+ {
+ return roles.LastOrDefault();
+ }
+
+ return roles.FirstOrDefault();
+ }
+
+ ///
+ /// 获取可创建的角色列表
+ ///
+ ///
+ [NonAction]
+ private async Task> GetRoleRange()
+ {
+ var codes = (new[] {
+ Enum.GetName(HouseManagerRole.ZoneManager),
+ Enum.GetName(HouseManagerRole.HouseSecurityManager),
+ }).Select(p => p.ToUnderScoreCase());
+
+ var _sysRoleRep = Db.GetRepository();
+ var roles = await _sysRoleRep.DetachedEntities.Where(p => codes.Contains(p.Code)).ToListAsync();
+
+ return roles;
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/IHouseMemberService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/IHouseMemberService.cs
new file mode 100644
index 0000000..76ea0f5
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseMember/IHouseMemberService.cs
@@ -0,0 +1,22 @@
+using Ewide.Core.Service;
+using Microsoft.AspNetCore.Mvc;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ public interface IHouseMemberService
+ {
+ Task QueryMemberPageList([FromBody] UserInput input);
+ Task AddUser(AddHouseMemberInput input);
+ Task DefaultRole([FromQuery] string orgId);
+ Task DeleteUser(DeleteUserInput input);
+ Task UpdateUser(UpdateUserInput input);
+ Task GetUser([FromQuery] QueryUserInput input);
+ Task ChangeUserStatus(UpdateUserInput input);
+ Task GetUserOwnRole([FromQuery] QueryUserInput input);
+ Task GrantUserData(UpdateUserInput input);
+ Task GetUserOwnData([FromQuery] QueryUserInput input);
+ Task DefaultRoleRange();
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/Dto/HouseProjectInfoInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/Dto/HouseProjectInfoInput.cs
new file mode 100644
index 0000000..b2e4e17
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/Dto/HouseProjectInfoInput.cs
@@ -0,0 +1,52 @@
+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.Service.HouseProjectInfo.Dto
+{
+ public class HouseProjectInfoInput : InputBase
+ {
+ public string Name { get; set; }
+ public string Note { get; set; }
+ public int Sort { get; set; }
+ public string AreaCode { get; set; }
+ public int Type { get; set; }
+ }
+ public class AddProjectInput : HouseProjectInfoInput
+ {
+
+ }
+ public class UpdateProjectInput : HouseProjectInfoInput
+ {
+ [Required(ErrorMessage = "项目ID不可为空")]
+ public string Id { get; set; }
+ }
+
+ public class DeleteProjectInput
+ {
+ [Required(ErrorMessage = "项目ID不可为空")]
+ public string Id { get; set; }
+ }
+
+ public class QueryProjectInput : UpdateProjectInput
+ {
+
+ }
+
+ public class PageProjectInput: HouseProjectInfoInput
+ {
+ public string pid { get; set; }
+ }
+
+ public class ListHouseProjectInfoInput
+ {
+ [Required(ErrorMessage = "区域编码不可为空")]
+ public string AreaCode { get; set; }
+ [Required(ErrorMessage = "性质不可为空")]
+ public int Type { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/Dto/HouseProjectOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/Dto/HouseProjectOutput.cs
new file mode 100644
index 0000000..307b548
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/Dto/HouseProjectOutput.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseProjectInfo.Dto
+{
+ public class HouseProjectOutput
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ public string Note { get; set; }
+ public int Sort { get; set; }
+ public string AreaCode { get; set; }
+ public string AreaName { get; set; }
+ public int Type { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs
new file mode 100644
index 0000000..d0f8112
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs
@@ -0,0 +1,147 @@
+using Ewide.Application.Entity;
+using Ewide.Application.Service.HouseProjectInfo.Dto;
+using Ewide.Core;
+using Ewide.Core.Service;
+using Furion.DatabaseAccessor;
+using Furion.DatabaseAccessor.Extensions;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Furion.FriendlyException;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseProjectInfo
+{
+ ///
+ /// 项目管理相关服务
+ ///
+ [ApiDescriptionSettings(Name = "HouseProjectInfo", Order = 170)]
+ public class HouseProjectInfoService : IHouseProjectInfoService, ITransient, IDynamicApiController
+ {
+ private readonly IRepository _houseProjectInfoRep;
+
+ public HouseProjectInfoService(IRepository houseProjectInfoRep)
+ {
+ _houseProjectInfoRep = houseProjectInfoRep;
+ }
+
+ ///
+ /// 添加项目
+ ///
+ ///
+ ///
+ [HttpPost("/houseProjectInfo/add")]
+ public async Task AddProject(AddProjectInput input)
+ {
+ await _houseProjectInfoRep.InsertNowAsync(input.Adapt());
+ }
+
+ ///
+ /// 删除项目
+ ///
+ ///
+ ///
+ [HttpPost("/houseProjectInfo/delete")]
+ public async Task DeleteProject(DeleteProjectInput input)
+ {
+ var project = _houseProjectInfoRep.FirstOrDefault(p => p.Id == input.Id);
+ await project.DeleteNowAsync();
+ }
+
+ ///
+ /// 编辑项目
+ ///
+ ///
+ ///
+ [HttpPost("/houseProjectInfo/edit")]
+ public async Task UpdateProject(UpdateProjectInput input)
+ {
+ var project = input.Adapt();
+ await project.UpdateExcludeAsync(new[] { nameof(BsHouseProjectInfo.AreaCode) }, true);
+ }
+
+ ///
+ /// 通过ID获取项目
+ ///
+ ///
+ ///
+ [HttpGet("/houseProjectInfo/getById")]
+ public async Task GetById([Required] string projectId)
+ {
+ return await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == projectId);
+ }
+
+ ///
+ /// 分页查询
+ ///
+ ///
+ ///
+ [HttpPost("/houseProjectInfo/page")]
+ public async Task QueryProjectPageList([FromBody] PageProjectInput input)
+ {
+ var areaCodeRep = Db.GetRepository();
+ var projects = await _houseProjectInfoRep.DetachedEntities
+ .Join(areaCodeRep.DetachedEntities, p => p.AreaCode, a => a.Code, (p, a) => new { p, AreaName = a.Name })
+ .Where(input.Type>0, x => x.p.Type == input.Type)
+ .Where(!string.IsNullOrEmpty(input.Name), x => x.p.Name.Contains(input.Name))
+ .Where(!string.IsNullOrEmpty(input.Note), x => x.p.Note.Contains(input.Note))
+ .Where(!string.IsNullOrEmpty(input.AreaCode), x => x.p.AreaCode == input.AreaCode)
+ .Where(!string.IsNullOrEmpty(input.pid) , x=> x.p.AreaCode.Contains(input.pid))
+ .Select(x => new { x.p.Id, x.p.Name, x.p.Note, x.p.Sort, x.p.AreaCode, x.AreaName, x.p.Type }.Adapt()).ToPagedListAsync(input.PageIndex, input.PageSize);
+ return PageDataResult.PageResult(projects);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("/houseProjectInfo/detail")]
+ public async Task GetProject([FromQuery] QueryProjectInput input)
+ {
+ var user = await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == input.Id);
+ var userDto = user.Adapt();
+
+ return userDto;
+ }
+
+ [HttpGet("/houseProjectInfo/nextSort")]
+ public async Task GetNextProjectSortByAreaCode([FromQuery] ListHouseProjectInfoInput input)
+ {
+ //var projects = await _houseProjectInfoRep.DetachedEntities
+ // .Where(p => p.AreaCode == input.AreaCode && p.Type == input.Type)
+ // .Select(p => p.Sort)
+ // .DefaultIfEmpty()
+ // .MaxAsync();
+ if (input.Type > 2 || input.Type < 1)
+ {
+ throw Oops.Oh("类型参数异常");
+ }
+ var p = await _houseProjectInfoRep.DetachedEntities
+ .Where(p => p.AreaCode == input.AreaCode && p.Type == input.Type)
+ .MaxAsync(p => (int?)p.Sort);
+
+ return p.GetValueOrDefault(0) + 1;
+ }
+
+ ///
+ /// 获取项目下拉列表
+ ///
+ ///
+ ///
+ [HttpGet("houseProjectInfo/list")]
+ public async Task GetProjectList([FromQuery] ListHouseProjectInfoInput input)
+ {
+ return await _houseProjectInfoRep.DetachedEntities
+ .Where(p => p.AreaCode == input.AreaCode && p.Type == input.Type)
+ .OrderBy(p => p.Sort)
+ .ToListAsync();
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs
new file mode 100644
index 0000000..e8b05c6
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs
@@ -0,0 +1,24 @@
+using Ewide.Application.Entity;
+using Ewide.Application.Service.HouseProjectInfo.Dto;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseProjectInfo
+{
+ public interface IHouseProjectInfoService
+ {
+ Task AddProject(AddProjectInput input);
+ Task DeleteProject(DeleteProjectInput input);
+ Task UpdateProject(UpdateProjectInput input);
+ Task GetById([FromRoute] string projectId);
+ Task GetProject([FromQuery] QueryProjectInput input);
+ Task QueryProjectPageList([FromQuery] PageProjectInput input);
+
+ Task GetNextProjectSortByAreaCode([FromQuery] ListHouseProjectInfoInput input);
+ Task GetProjectList([FromQuery] ListHouseProjectInfoInput input);
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/Dto/HouseQueryInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/Dto/HouseQueryInput.cs
new file mode 100644
index 0000000..096f601
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/Dto/HouseQueryInput.cs
@@ -0,0 +1,21 @@
+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 HouseQueryInput: PageInputBase
+ {
+
+ }
+
+ public class HouseQueryDetailInput
+ {
+ [Required(ErrorMessage = "Id不能为空")]
+ public string Id { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/Dto/HouseQueryOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/Dto/HouseQueryOutput.cs
new file mode 100644
index 0000000..a4464e1
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/Dto/HouseQueryOutput.cs
@@ -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 HouseQueryOutput
+ {
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/HouseQueryService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/HouseQueryService.cs
new file mode 100644
index 0000000..5800149
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/HouseQueryService.cs
@@ -0,0 +1,110 @@
+using Dapper;
+using Ewide.Core.Extension;
+using Furion.DatabaseAccessor;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseSafety.HouseQuery
+{
+ ///
+ /// 住宅查询
+ ///
+ [ApiDescriptionSettings(Name = "HouseQuery", Order = 210)]
+ public class HouseQueryService : IHouseQueryService, IDynamicApiController, ITransient
+ {
+ private readonly IRepository _houseCodeRep;
+ private readonly IRepository _houseInfoRep;
+ private readonly IRepository _houseTaskRep;
+ private readonly IDapperRepository _dapperRepository;
+
+ public HouseQueryService(IRepository HouseCodeRep, IRepository HouseInfoRep, IRepository HouseTaskRep, IDapperRepository dapperRepository)
+ {
+ _houseCodeRep = HouseCodeRep;
+ _houseInfoRep = HouseInfoRep;
+ _houseTaskRep = HouseTaskRep;
+ _dapperRepository = dapperRepository;
+ }
+
+ [HttpPost("/houseQuery/page")]
+ public async Task QueryPage([FromBody] HouseQueryInput input)
+ {
+ var sql = @"SELECT
+ HC.ID,
+ HC.HouseCode,
+ AA.Name AreaName,
+ RA.Name RoadName,
+ CA.Name CommName,
+ Proj.AreaCode,
+ Proj.Note,
+ Proj.Name,
+ CONCAT(Proj.Name,'(',Proj.Note,')') FullProjName,
+ HC.Address,
+ IFNULL(HI.BuildingName,'') BuildingName,
+ IFNULL(HI.TotalFloor,0) TotalFloor,
+ IFNULL(HI.TotalArea,0) TotalArea,
+ HI.LandAttribute,
+ IFNULL(HI.HouseGrade,0) HouseGrade,
+ HC.Type,
+ HC.No,
+ HI.State,
+ HI.CompletedDate,
+ HI.CreatedTime
+FROM bs_house_code HC
+LEFT JOIN bs_house_info HI ON HI.HouseCodeId = HC.Id
+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 1=1";
+
+ return await _dapperRepository.QueryPageDataDynamic(sql, input, filterFields: new string[] {
+ "HouseCode",
+ "Address",
+ "BuildingName",
+ "State",
+ "AreaCode",
+ "LandAttribute",
+ "HouseGrade",
+ "CompletedDate",
+ "CreatedTime",
+ "TotalArea",
+ "TotalFloor"
+ });
+ }
+
+ [HttpGet("/houseQuery/detail")]
+ public async Task Detail([FromQuery] HouseQueryDetailInput input)
+ {
+ 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,O.Name ZoneName,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_org O ON HC.ZoneId = O.Id
+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.Id=@Id", new { input.Id }
+ );
+
+ var houseCodeOutput = houseCodeOutputAsync.SingleOrDefault();
+
+
+ var houseInfoOutputForDetailPage = new HouseInfoOutputForDetailPage
+ {
+ HouseCode = houseCodeOutput
+ };
+
+ var houseInfoOutput = (await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.HouseCodeId == houseCodeOutput.Id)).Adapt();
+ houseInfoOutputForDetailPage.HouseInfo = houseInfoOutput;
+
+ return houseInfoOutputForDetailPage;
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/IHouseQueryService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/IHouseQueryService.cs
new file mode 100644
index 0000000..aa1e217
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseQuery/IHouseQueryService.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseSafety.HouseQuery
+{
+ public interface IHouseQueryService
+ {
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/Dto/HouseSelectorInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/Dto/HouseSelectorInput.cs
new file mode 100644
index 0000000..0001eff
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/Dto/HouseSelectorInput.cs
@@ -0,0 +1,24 @@
+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 HouseSelectInput
+ {
+ [Required(ErrorMessage = "用户Id不能为空")]
+ public string UserId { get; set; }
+
+ [Required(ErrorMessage = "房屋编码Id不能为空")]
+ public string[] Ids { get; set; }
+ }
+
+ public class QueryHouseSelectorInput : QueryHouseCodeInput
+ {
+ [Required(ErrorMessage = "用户Id不能为空")]
+ public string UserId { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/Dto/HouseSelectorOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/Dto/HouseSelectorOutput.cs
new file mode 100644
index 0000000..43fd2e9
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/Dto/HouseSelectorOutput.cs
@@ -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 HouseSelectorOutput
+ {
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs
new file mode 100644
index 0000000..df04bd2
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs
@@ -0,0 +1,225 @@
+using Dapper;
+using Ewide.Core;
+using Ewide.Core.Extension;
+using Furion.DatabaseAccessor;
+using Furion.DatabaseAccessor.Extensions;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Furion.FriendlyException;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ ///
+ /// 选房相关
+ ///
+ [ApiDescriptionSettings(Name = "HouseSelector", Order = 180)]
+ public class HouseSelectorService : IHouseSelectorService, IDynamicApiController, ITransient
+ {
+ private readonly IUserManager _userManager;
+ private readonly IDapperRepository _dapperRep;
+
+ private readonly IRepository _bsHouseMemberRelationRep;
+ private readonly IRepository _bsHouseCodeRep;
+ private readonly IRepository _bsHouseTaskRep;
+ private readonly IRepository _sysUserRep;
+ private readonly IHouseZoneService _houseZoneService;
+
+ private readonly IHouseLogService _houseLogService;
+
+ public HouseSelectorService(
+ IUserManager userManager,
+ IDapperRepository dapperRep,
+ IRepository bsHouseMemberRelationRep,
+ IRepository bsHouseCodeRep,
+ IRepository bsHouseTaskRep,
+ IRepository sysUserRep,
+ IHouseZoneService houseZoneService,
+ IHouseLogService houseLogService
+ )
+ {
+ _userManager = userManager;
+
+ _dapperRep = dapperRep;
+ _bsHouseMemberRelationRep = bsHouseMemberRelationRep;
+ _bsHouseCodeRep = bsHouseCodeRep;
+ _bsHouseTaskRep = bsHouseTaskRep;
+ _sysUserRep = sysUserRep;
+ _houseZoneService = houseZoneService;
+
+ _houseLogService = houseLogService;
+ }
+
+ ///
+ /// 获取人员允许绑定的房屋编码列表
+ ///
+ ///
+ ///
+ [HttpPost("/houseSelector/selectorPage")]
+ public async Task HouseSelectorList([FromBody] QueryHouseSelectorInput input)
+ {
+ var sql = @"SELECT
+ HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',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)
+LEFT JOIN bs_house_member_relation HM ON HC.Id = HM.HouseCodeId
+INNER JOIN (SELECT * FROM sys_emp WHERE Id = @UserId) E ON HC.ZoneId = E.OrgId
+WHERE HM.Id IS NULL";
+ return await _dapperRep.QueryPageDataDynamic(sql, input, param: new
+ {
+ input.UserId
+ }, filterFields: new[] {
+ nameof(BsHouseCode.Address) ,
+ nameof(BsHouseCode.CreatedTime)
+ });
+ }
+
+ ///
+ /// 获取人员已经绑定的房屋编码列表
+ ///
+ ///
+ ///
+ [HttpPost("/houseSelector/selectedPage")]
+ public async Task HouseSelectedList([FromBody] QueryHouseSelectorInput input)
+ {
+ var sql = @"SELECT
+ HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',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)
+INNER JOIN (SELECT * FROM bs_house_member_relation WHERE SysUserId = @UserId) HM ON HC.Id = HM.HouseCodeId";
+ return await _dapperRep.QueryPageDataDynamic(sql, input, param: new
+ {
+ input.UserId
+ }, filterFields: new[] {
+ nameof(BsHouseCode.Address) ,
+ nameof(BsHouseCode.CreatedTime)
+ });
+ }
+
+ ///
+ /// 从人员选择房屋
+ ///
+ ///
+ ///
+ [HttpPost("/houseSelector/select")]
+ [UnitOfWork]
+ public async Task Select([FromBody] HouseSelectInput input)
+ {
+ #region 验证房屋是否在当前用户可选范围内
+
+ var ids = input.Ids.Distinct().ToList();
+ if (ids.Count == 0) throw Oops.Oh("没有选中任何房屋");
+
+ // 验证当前用户是否安全员 **须补充
+
+ // 已经被选中的房屋,从ids中剔除
+ var houseSelected = await _bsHouseMemberRelationRep.DetachedEntities
+ .Where(p => ids.Contains(p.HouseCodeId))
+ .Select(p => p.HouseCodeId)
+ .ToListAsync();
+ if (houseSelected.Count > 0)
+ {
+ houseSelected.ForEach(p =>
+ {
+ var index = ids.IndexOf(p);
+ if (index > -1)
+ {
+ ids.RemoveAt(index);
+ }
+ });
+ }
+
+ if (ids.Count == 0) throw Oops.Oh("当前房屋在此之前已经全部被选中,请确认");
+
+ var selectedUser = await _sysUserRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.UserId));
+
+ // 从用户所在片区中过滤房屋
+ var zoneId = await _houseZoneService.GetZoneByUser(selectedUser.Id);
+ var house = await _bsHouseCodeRep.DetachedEntities.Where(p => ids.Contains(p.Id) && p.ZoneId == zoneId).Select(p => p.Id).ToListAsync();
+
+ if (house.Count == 0) throw Oops.Oh("选中的房屋错误");
+
+ #endregion
+
+ // 选定房屋
+ house.ForEach(async p =>
+ {
+ var originalTask = _bsHouseTaskRep.DetachedEntities.FirstOrDefault(t => t.HouseCodeId == p && t.TaskType == 0 && t.IsEnabled);
+ if (originalTask == null)
+ {
+ new BsHouseTask
+ {
+ Id = System.Guid.NewGuid().ToString(),
+ HouseCodeId = p,
+ UserID = selectedUser.Id,
+ EndTime = System.DateTime.Now.AddMonths(1),
+ Status = 0,
+ TaskType = 0
+ }.Insert();
+
+ await _houseLogService.Done(p);
+ await _houseLogService.Add(p, selectedUser, HouseLogType.CreateInfo);
+ }
+ else
+ {
+ var sort = await _houseLogService.AddThenDone(p, _userManager.User, HouseLogType.SelectMember);
+ if (originalTask.Status != 6)//建档未完成,生成新建档任务分配给新的人员;原建档任务数据保留,有效性设置为false,取消巡查关系
+ {
+ var newTask = originalTask.Adapt();
+ newTask.Id = System.Guid.NewGuid().ToString();
+ newTask.UserID = input.UserId;
+ newTask.EndTime = System.DateTime.Now.AddMonths(1);
+ newTask.Insert();
+
+ originalTask.IsEnabled = false;
+ originalTask.Update();
+
+ sort = await _houseLogService.Add(p, selectedUser, HouseLogType.CreateInfo, sort: sort);
+ }//已建档完成,不再分配建档任务,仅更换巡查关系
+ else
+ {
+ var originalRelation = _bsHouseMemberRelationRep.DetachedEntities.FirstOrDefault(r => r.HouseCodeId == p && r.SysUserId == originalTask.UserID);
+ originalRelation.Delete();
+ }
+ }
+
+ new BsHouseMemberRelation
+ {
+ SysUserId = selectedUser.Id,
+ HouseCodeId = p
+ }.Insert();
+ });
+ }
+
+ [HttpPost("/houseSelector/revoke")]
+ [UnitOfWork]
+ public async Task Revoke([FromBody] HouseSelectInput input)
+ {
+ var ids = input.Ids.Distinct().ToList();
+ if (ids.Count == 0) throw Oops.Oh("没有选中任何房屋");
+
+ var selected = await _bsHouseMemberRelationRep.Where(p => ids.Contains(p.HouseCodeId) && p.SysUserId == input.UserId).ToListAsync();
+
+ selected.ForEach(p =>
+ {
+ p.Delete();
+ });
+ }
+
+ public async Task SelectMember()
+ {
+
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/IHouseSelectorService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/IHouseSelectorService.cs
new file mode 100644
index 0000000..df71ac7
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseSelector/IHouseSelectorService.cs
@@ -0,0 +1,18 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ public interface IHouseSelectorService
+ {
+ Task HouseSelectorList([FromQuery] QueryHouseSelectorInput input);
+ Task HouseSelectedList([FromQuery] QueryHouseSelectorInput input);
+ Task Select([FromBody] HouseSelectInput input);
+ Task Revoke([FromBody] HouseSelectInput input);
+ Task SelectMember();
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs
new file mode 100644
index 0000000..53bdf4b
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs
@@ -0,0 +1,171 @@
+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
+ {
+ [Required(ErrorMessage = "巡查日期不能为空")]
+ public DateTime PatrolDate { get; set; }
+
+ [Required(ErrorMessage = "巡查人员/单位不能为空")]
+ public string PatrolUser { get; set; }
+
+ ///
+ /// 沉降倾斜
+ ///
+ public string SettlementTilt { get; set; }
+
+ ///
+ /// 沉降倾斜附件
+ ///
+ public string SettlementTiltFiles { get; set; }
+
+ ///
+ /// 其他情况
+ ///
+ public string OtherInfo { get; set; }
+
+ ///
+ /// 其他情况附件
+ ///
+ public string OtherInfoFiles { get; set; }
+
+ //[Required(ErrorMessage = "巡查初始等级不能为空")]
+ public int InitGrade { get; set; }
+ //[Required(ErrorMessage = "巡查损坏等级不能为空")]
+ public int DamageGrade { get; set; }
+ //[Required(ErrorMessage = "巡查综合等级不能为空")]
+ public int ComprehensiveGrade { get; set; }
+ #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
+ ///
+ /// 主要安全隐患综述
+ ///
+ public string MainSafety { get; set; }
+
+ ///
+ /// 处理意见
+ ///
+ public int? HandlingOpinion { get; set; }
+
+ ///
+ /// 处理意见备注
+ ///
+ public string HandlingOpinionRemark { get; set; }
+
+ ///
+ /// 整改情况
+ ///
+ public int? RectifyAndReform { get; set; }
+
+ ///
+ /// 整改情况备注
+ ///
+ public string RectifyAndReformRemark { get; set; }
+
+ ///
+ /// 巡查结果:1正常,-1异常
+ ///
+ //[Required(ErrorMessage = "巡查结果不能为空")]
+ public int PatrolResult { get; set; }
+
+ public string PatrolResultRemark { get; set; }
+
+ ///
+ /// 上报街道
+ ///
+ public int? ReportRoad { get; set; }
+
+ ///
+ /// 上报街道时间
+ ///
+ public DateTime? ReportRoadTime { get; set; }
+
+ ///
+ /// 上报区住建
+ ///
+ public int? ReportArea { get; set; }
+
+ ///
+ /// 上报区住建时间
+ ///
+ public DateTime? ReportAreaTime { get; set; }
+
+ ///
+ /// 上报备注
+ ///
+ public string ReportRemark { get; set; }
+ }
+
+ public class AddHouseTaskInput : HouseTaskInput
+ {
+
+ }
+
+ public class EditHouseTaskInput : HouseTaskInput
+ {
+ [Required(ErrorMessage = "任务Id不能为空")]
+ public string Id { get; set; }
+ }
+
+ public class SubmitHouseTaskInput
+ {
+ [Required(ErrorMessage = "任务Id不能为空")]
+ public string TaskId { get; set; }
+ }
+
+ public class QueryHouseTaskInput : PageInputBase
+ {
+
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
new file mode 100644
index 0000000..b5f1df0
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
@@ -0,0 +1,173 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ public class HouseTaskOutput
+ {
+ public DateTime? PatrolDate { get; set; }
+ public string PatrolUser { get; set; }
+
+ ///
+ /// 沉降倾斜
+ ///
+ public string SettlementTilt { get; set; }
+
+ ///
+ /// 沉降倾斜附件
+ ///
+ public string SettlementTiltFiles { get; set; }
+
+ ///
+ /// 其他情况
+ ///
+ public string OtherInfo { get; set; }
+
+ ///
+ /// 其他情况附件
+ ///
+ public string OtherInfoFiles { get; set; }
+
+ ///
+ /// 初始等级
+ ///
+ public int? InitGrade { get; set; }
+
+ ///
+ /// 损坏等级
+ ///
+ public int? DamageGrade { get; set; }
+
+ ///
+ /// 综合等级
+ ///
+ public int? ComprehensiveGrade { get; set; }
+
+ #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
+
+ ///
+ /// 主要安全隐患综述
+ ///
+ public string MainSafety { get; set; }
+
+ ///
+ /// 处理意见
+ ///
+ public int? HandlingOpinion { get; set; }
+
+ ///
+ /// 处理意见备注
+ ///
+ public string HandlingOpinionRemark { get; set; }
+
+ ///
+ /// 整改情况
+ ///
+ public int? RectifyAndReform { get; set; }
+
+ ///
+ /// 整改情况备注
+ ///
+ public string RectifyAndReformRemark { get; set; }
+
+ ///
+ /// 巡查结果:1正常,-1异常
+ ///
+ public int? PatrolResult { get; set; }
+
+ ///
+ /// 巡查异常描述
+ ///
+ public string PatrolResultRemark { get; set; }
+
+ ///
+ /// 上报街道
+ ///
+ public int? ReportRoad { get; set; }
+
+ ///
+ /// 上报街道时间
+ ///
+ public DateTime? ReportRoadTime { get; set; }
+
+ ///
+ /// 上报区住建
+ ///
+ public int? ReportArea { get; set; }
+
+ ///
+ /// 上报区住建时间
+ ///
+ public DateTime? ReportAreaTime { get; set; }
+
+ ///
+ /// 上报备注
+ ///
+ public string ReportRemark { get; set; }
+
+ public int Status { get; set; }
+
+ ///
+ /// 提交时间
+ ///
+ public DateTime? SubmitTime { get; set; }
+
+ ///
+ /// 最后提交时间
+ ///
+ public DateTime? LastSubmitTime { get; set; }
+
+ ///
+ /// 是否有效
+ ///
+ public bool IsEnabled { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs
new file mode 100644
index 0000000..6337437
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs
@@ -0,0 +1,102 @@
+using Dapper;
+using Ewide.Core;
+using Ewide.Core.Extension;
+using Furion.DatabaseAccessor;
+using Furion.DatabaseAccessor.Extensions;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Furion.FriendlyException;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ ///
+ /// 房屋任务(巡查任务/建档任务)
+ ///
+ [ApiDescriptionSettings(Name = "HouseTask", Order = 190)]
+ public class HouseTaskService : IHouseTaskService, IDynamicApiController, ITransient
+ {
+ private readonly IRepository _houseTaskRep;
+ private readonly IRepository _houseInfoRep;
+ private readonly IDapperRepository _dapperRepository;
+ private readonly IUserManager _userManager;
+
+ private readonly IHouseLogService _houseLogService;
+
+ public HouseTaskService(IRepository HouseTaskRep, IRepository HouseInfoRep, IDapperRepository dapperRepository, IUserManager userManager, IHouseLogService houseLogService)
+ {
+ _houseTaskRep = HouseTaskRep;
+ _houseInfoRep = HouseInfoRep;
+ _dapperRepository = dapperRepository;
+ _userManager = userManager;
+
+ _houseLogService = houseLogService;
+ }
+
+ [HttpPost("/houseTask/page")]
+ public async Task 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`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName,HC.HouseCode,HC.Address,T.EndTime,HC.Type,HC.Industry,HC.No,T.Status,IFNULL(HI.State,0) State 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)
+WHERE T.IsEnabled = 1 {0}";
+ var user = await _userManager.CheckUserAsync();
+ if (user == null) throw Oops.Oh("登录信息丢失");
+
+ var userRoles = await _userManager.GetUserRoleList();
+ var userOrg = await _userManager.GetUserOrgInfo();
+ var param = new DynamicParameters();
+ if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.HouseSecurityManager).ToUnderScoreCase()).Any())
+ {
+ sql = String.Format(sql, " AND T.UserID=@UserID ");
+ param.Add("UserID", user.Id);
+ }
+
+ if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase()).Any())
+ {
+ sql = String.Format(sql, " AND (T.Status=3 OR T.Status=6) AND HC.ZoneId = @ZoneId ");
+ param.Add("ZoneId", userOrg.Id);
+ }
+
+ return await _dapperRepository.QueryPageDataDynamic(sql, input, param, filterFields: new string[] { "Type", "Address", "HouseCode", "Status","State" });
+ }
+
+ [HttpPost("/houseTask/submit")]
+ [UnitOfWork]
+ [AllowAnonymous]
+ public async Task Submit([FromBody] SubmitHouseTaskInput input)
+ {
+ //获取任务实体
+ var houseTask = await _houseTaskRep.DetachedEntities.FirstOrDefaultAsync(t => t.Id == input.TaskId);
+ if (houseTask == null) throw Oops.Oh("任务不存在");
+ houseTask.Status = 2;
+ houseTask.LastSubmitTime = DateTime.Now;
+ if (!houseTask.SubmitTime.HasValue) houseTask.SubmitTime = houseTask.LastSubmitTime;
+ await houseTask.UpdateExcludeAsync(new string[] { nameof(BsHouseTask.TaskType) }, ignoreNullValues: true);
+
+ if(houseTask.TaskType == 0)
+ {
+ var houseInfo = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == houseTask.HouseCodeId);
+ if (houseInfo == null) throw Oops.Oh("提交审核失败:请先保存后再提交");
+
+ houseInfo.State = 5;
+ await houseInfo.UpdateExcludeAsync(new[] { nameof(BsHouseInfo.HouseGrade) }, true);
+ }
+
+ // 提交时流转日志
+ await _houseLogService.Done(houseTask.HouseCodeId);
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/IHouseTaskService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/IHouseTaskService.cs
new file mode 100644
index 0000000..75b2d3d
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTask/IHouseTaskService.cs
@@ -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 QueryPage(QueryHouseTaskInput input);
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTaskCheckRecord/Dto/HouseTaskCheckRecordInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTaskCheckRecord/Dto/HouseTaskCheckRecordInput.cs
new file mode 100644
index 0000000..497a3a7
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTaskCheckRecord/Dto/HouseTaskCheckRecordInput.cs
@@ -0,0 +1,46 @@
+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 HouseTaskCheckRecordInput
+ {
+ ///
+ /// 任务Id
+ ///
+ [Required(ErrorMessage = "任务参数有误")]
+ public string TaskId { get; set; }
+
+ ///
+ /// 通过3;退回-1
+ ///
+ [Required(ErrorMessage = "审核结果不能为空")]
+ public int PassOrBack { get; set; }
+
+ public DataStatus PassOrBackDataStatus
+ {
+ get
+ {
+ return PassOrBack switch
+ {
+ -1 => DataStatus.Back,
+ 1 => DataStatus.TempSaved,
+ 2 => DataStatus.Saved,
+ 3 => DataStatus.Submited,
+ 6 => DataStatus.Passed,
+ _ => DataStatus.Init,
+ };
+ }
+ }
+
+ ///
+ /// 审核内容
+ ///
+ [Required(ErrorMessage = "审核内容不能为空")]
+ public string Content { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTaskCheckRecord/Dto/HouseTaskCheckRecordOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTaskCheckRecord/Dto/HouseTaskCheckRecordOutput.cs
new file mode 100644
index 0000000..bdfa2ab
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseTaskCheckRecord/Dto/HouseTaskCheckRecordOutput.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service.HouseSafety.HouseTaskCheckRecord.Dto
+{
+ public class HouseTaskCheckRecordOutput
+ {
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/Dto/HouseZoneInput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/Dto/HouseZoneInput.cs
new file mode 100644
index 0000000..1d69b94
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/Dto/HouseZoneInput.cs
@@ -0,0 +1,41 @@
+using Ewide.Core.Service;
+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 HouseZoneInput
+ {
+ [Required(ErrorMessage = "区域编码不可为空")]
+ [MinLength(9, ErrorMessage = "区域编码长度必须为9位及以上")]
+ public string AreaCode { get; set; }
+ }
+
+ public class AddHouseZoneInput : OrgInput
+ {
+ ///
+ /// 所属街道
+ ///
+ [Required(ErrorMessage = "所属街道不能为空")]
+ public override string Pid { get; set; }
+ ///
+ /// 名称
+ ///
+ [Required(ErrorMessage = "片区名称不能为空")]
+ public override string Name { get; set; }
+
+ }
+
+ public class UpdateHouseZoneInput : AddHouseZoneInput
+ {
+ ///
+ /// 机构Id
+ ///
+ [Required(ErrorMessage = "片区Id不能为空")]
+ public string Id { get; set; }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/Dto/HouseZoneOutput.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/Dto/HouseZoneOutput.cs
new file mode 100644
index 0000000..d95ac21
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/Dto/HouseZoneOutput.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application
+{
+ class HouseZoneOutput
+ {
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs
new file mode 100644
index 0000000..791374b
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs
@@ -0,0 +1,175 @@
+using Ewide.Core;
+using Ewide.Core.Extension;
+using Ewide.Core.Service;
+using Furion.DatabaseAccessor;
+using Furion.DatabaseAccessor.Extensions;
+using Furion.DependencyInjection;
+using Furion.DynamicApiController;
+using Furion.FriendlyException;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ ///
+ /// 片区相关
+ ///
+ [ApiDescriptionSettings(Name = "HouseZone", Order = 180)]
+ public class HouseZoneService : IHouseZoneService, IDynamicApiController, ITransient
+ {
+ private readonly IUserManager _userManager;
+ private readonly IRepository _sysOrgRep;
+ private readonly IRepository _sysEmpRep;
+ private readonly ISysOrgService _sysOrgService;
+
+ public HouseZoneService(
+ IUserManager userManager,
+ IRepository sysOrgRep,
+ IRepository sysEmpRep,
+ ISysOrgService sysOrgService
+ )
+ {
+ _userManager = userManager;
+ _sysOrgRep = sysOrgRep;
+ _sysEmpRep = sysEmpRep;
+ _sysOrgService = sysOrgService;
+ }
+
+ ///
+ /// 获取片区列表
+ ///
+ ///
+ ///
+ [HttpGet("/houseZone/list")]
+ public async Task GetHouseZoneList([FromQuery] HouseZoneInput input)
+ {
+ var areaCode = input.AreaCode.Substring(0, 9);
+ var road = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.AreaCode == areaCode);
+ if (road == null) throw Oops.Oh("未在组织机构中配置街道");
+ return await _sysOrgRep.DetachedEntities
+ .Where(p => p.Pid == road.Id)
+ .Where(p => p.Type == (int)OrgType.片区)
+ .OrderBy(p => p.Sort)
+ .Select(p => new
+ {
+ p.Id,
+ p.Name
+ })
+ .ToListAsync();
+ }
+
+ [HttpGet("/houseZone/getById")]
+ public async Task GetById([Required] string zoneId)
+ {
+ return await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == zoneId);
+ }
+
+ ///
+ /// 分页查询片区
+ ///
+ ///
+ ///
+ [HttpPost("/houseZone/page")]
+ public async Task QueryZonePageList([FromBody] PageOrgInput input)
+ {
+ var dataScopeList = _sysOrgService.GetDataScopeList(await _userManager.GetUserAllDataScopeList());
+
+ var name = !string.IsNullOrEmpty(input.Name?.Trim());
+ var id = !string.IsNullOrEmpty(input.Id?.Trim());
+ var pId = !string.IsNullOrEmpty(input.Pid?.Trim());
+ var orgs = await _sysOrgRep.DetachedEntities
+ .Where((name, u => EF.Functions.Like(u.Name, $"%{input.Name.Trim()}%")), // 根据机构名称模糊查询
+ (id, u => u.Id == input.Id.Trim()), // 根据机构id查询
+ (pId, u => EF.Functions.Like(u.Pids, $"%[{input.Pid.Trim()}]%")
+ || u.Id == input.Pid.Trim())) // 根据父机构id查询
+ .Where(dataScopeList.Count > 0, u => dataScopeList.Contains(u.Id)) // 非管理员范围限制
+ .Where(u => u.Status != CommonStatus.DELETED)
+ .Where(u => u.Type == (int)OrgType.片区)
+ .OrderBy(u => u.Sort)
+ .ToPageData(input);
+ return PageDataResult.PageResult(orgs);
+ }
+
+ ///
+ /// 根据用户Id获取所在片区的Id
+ ///
+ ///
+ ///
+ [HttpGet("/houseZone/getByUser")]
+ public async Task GetZoneByUser([FromQuery][Required(ErrorMessage = "用户Id不能为空")] string userId)
+ {
+ var data = await _sysEmpRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == userId);
+ if(data == null) throw Oops.Oh("用户不在组织机构中");
+ var org = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == data.OrgId && p.Type == (int)OrgType.片区);
+ if(org == null) throw Oops.Oh("用户不在片区中");
+ return org.Id;
+ }
+
+ [HttpGet("/houseZone/autoIncrement")]
+ public async Task AutoIncrement([FromQuery] string roadId)
+ {
+ var road = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == roadId && p.Type == 3);
+ if (road == null) throw Oops.Oh("组织机构错误");
+ return await AutoIncrement(road);
+ }
+
+ [NonAction]
+ public async Task AutoIncrement(SysOrg road)
+ {
+ var maxZone = (await _sysOrgRep.DetachedEntities.Where(p => p.Pid == road.Id && p.Type == (int)OrgType.片区).MaxAsync(p => p.Code)) ?? "000";
+ return Convert.ToInt32(maxZone[^3..]) + 1;
+ }
+
+ [HttpPost("/houseZone/add")]
+ public async Task AddZone(AddHouseZoneInput input)
+ {
+ /*
+ * 区县市限定所属区域/上级机构是否为当前区
+ * 街道自动获取所属区域/上级机构
+ * 自动生成唯一编码, 街道Code+三位编号
+ *
+ * 机构类型默认为片区
+ */
+
+ var org = await _userManager.GetUserOrgInfo();
+
+ var areaManager = Enum.GetName(HouseManagerRole.AreaManager).ToUnderScoreCase();
+ var roadManager = Enum.GetName(HouseManagerRole.RoadManager).ToUnderScoreCase();
+ var roles = await _userManager.GetUserRoleList();
+ if (roles.Any(p => p.Code == areaManager))
+ {
+ var road = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == input.Pid);
+ if (!road.Pids.Contains(org.Id)) throw Oops.Oh("当前用户组织机构错误");
+
+ input.AreaCode = road.AreaCode;
+ input.Code = road.Code + (await AutoIncrement(road)).ToString().PadLeft(3, '0');
+ }
+ else if (roles.Any(p => p.Code == roadManager))
+ {
+ input.AreaCode = org.AreaCode;
+
+ input.Code = org.Code + (await AutoIncrement(org)).ToString().PadLeft(3, '0');
+ }
+
+ input.Type = (int)OrgType.片区;
+
+ AddOrgInput addOrgInput = input.Adapt();
+ await _sysOrgService.AddOrg(addOrgInput);
+ }
+
+ [HttpPost("/houseZone/edit")]
+ public async Task EditZone(UpdateHouseZoneInput input)
+ {
+ var zone = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(z => z.Id == input.Id);
+ if(zone == null) throw Oops.Oh("修改失败:数据有误,刷新列表后再尝试修改");
+ zone.Remark = input.Remark;
+ await zone.UpdateIncludeAsync(new[] { nameof(SysOrg.Remark) }, true);
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/IHouseZoneService.cs b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/IHouseZoneService.cs
new file mode 100644
index 0000000..9c0b138
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Service/HouseSafety/HouseZone/IHouseZoneService.cs
@@ -0,0 +1,15 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Application.Service
+{
+ public interface IHouseZoneService
+ {
+ Task GetHouseZoneList([FromQuery] HouseZoneInput input);
+ Task GetZoneByUser([FromQuery] string userId);
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/Startup.cs b/20220330_Vote/Ewide.Application/Startup.cs
new file mode 100644
index 0000000..ade1ce8
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/Startup.cs
@@ -0,0 +1,30 @@
+using Furion;
+using Microsoft.Extensions.DependencyInjection;
+using System.Linq;
+
+namespace Ewide.Application
+{
+ public class Startup : AppStartup
+ {
+ public void ConfigureServices(IServiceCollection services)
+ {
+ //services.AddSqlSugar(new ConnectionConfig
+ //{
+ // ConnectionString = App.Configuration["ConnectionStrings:DefaultConnection"],
+ // DbType = DbType.Sqlite,
+ // IsAutoCloseConnection = true,
+ // InitKeyType = InitKeyType.Attribute
+ //},
+ //db =>
+ //{
+ // // db.DbMaintenance.CreateDatabase();
+ // // db.CodeFirst.SetStringDefaultLength(200).InitTables(typeof(Test));
+
+ // db.Aop.OnLogExecuting = (sql, pars) =>
+ // {
+ // App.PrintToMiniProfiler("SqlSugar", "Info", sql + "\r\n" + string.Join(",", pars?.Select(it => it.ParameterName + ":" + it.Value)));
+ // };
+ //});
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Application/applicationsettings.json b/20220330_Vote/Ewide.Application/applicationsettings.json
new file mode 100644
index 0000000..29091fa
--- /dev/null
+++ b/20220330_Vote/Ewide.Application/applicationsettings.json
@@ -0,0 +1,3 @@
+{
+
+}
\ No newline at end of file
diff --git a/20220330_Vote/Ewide.Core/Attributes/OpAttribute.cs b/20220330_Vote/Ewide.Core/Attributes/OpAttribute.cs
new file mode 100644
index 0000000..4ccb1c3
--- /dev/null
+++ b/20220330_Vote/Ewide.Core/Attributes/OpAttribute.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Ewide.Core.Attributes
+{
+ public class OpAttribute : Attribute
+ {
+ private readonly LogOpType logOpType;
+ public OpAttribute(LogOpType logOpType)
+ {
+ this.logOpType = logOpType;
+ }
+ public int OpType { get => (int)logOpType; }
+ //测试修改
+ }
+}
diff --git a/20220330_Vote/Ewide.Core/Cache/CacheOptions.cs b/20220330_Vote/Ewide.Core/Cache/CacheOptions.cs
new file mode 100644
index 0000000..76d8f05
--- /dev/null
+++ b/20220330_Vote/Ewide.Core/Cache/CacheOptions.cs
@@ -0,0 +1,33 @@
+using Furion.ConfigurableOptions;
+
+namespace Ewide.Core
+{
+ ///
+ /// 缓存配置
+ ///
+ public class CacheOptions : IConfigurableOptions
+ {
+ ///
+ /// 缓存类型
+ ///
+ public CacheType CacheType { get; set; }
+
+ ///
+ /// Redis配置
+ ///
+ public string RedisConnectionString { get; set; }
+ }
+
+ public enum CacheType
+ {
+ ///
+ /// 内存缓存
+ ///
+ MemoryCache,
+
+ ///
+ /// Redis缓存
+ ///
+ RedisCache
+ }
+}
diff --git a/20220330_Vote/Ewide.Core/Cache/ICache.cs b/20220330_Vote/Ewide.Core/Cache/ICache.cs
new file mode 100644
index 0000000..2122c3e
--- /dev/null
+++ b/20220330_Vote/Ewide.Core/Cache/ICache.cs
@@ -0,0 +1,107 @@
+using System;
+using System.Threading.Tasks;
+
+namespace Ewide.Core
+{
+ ///
+ /// 缓存接口
+ ///
+ public interface ICache
+ {
+ ///
+ /// 用于在 key 存在时删除 key
+ ///
+ /// 键
+ long Del(params string[] key);
+
+ ///
+ /// 用于在 key 存在时删除 key
+ ///
+ /// 键
+ ///
+ Task DelAsync(params string[] key);
+
+ ///
+ /// 用于在 key 模板存在时删除
+ ///
+ /// key模板
+ ///
+ Task DelByPatternAsync(string pattern);
+
+ ///
+ /// 检查给定 key 是否存在
+ ///
+ /// 键
+ ///
+ bool Exists(string key);
+
+ ///
+ /// 检查给定 key 是否存在
+ ///
+ /// 键
+ ///
+ Task ExistsAsync(string key);
+
+ ///
+ /// 获取指定 key 的值
+ ///
+ /// 键
+ ///
+ string Get(string key);
+
+ ///
+ /// 获取指定 key 的值
+ ///
+ /// byte[] 或其他类型
+ /// 键
+ ///
+ T Get(string key);
+
+ ///
+ /// 获取指定 key 的值
+ ///
+ /// 键
+ ///
+ Task GetAsync(string key);
+
+ ///
+ /// 获取指定 key 的值
+ ///
+ /// byte[] 或其他类型
+ /// 键
+ ///
+ Task GetAsync(string key);
+
+ ///
+ /// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
+ ///
+ /// 键
+ /// 值
+ bool Set(string key, object value);
+
+ ///
+ /// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
+ ///
+ /// 键
+ /// 值
+ /// 有效期
+ bool Set(string key, object value, TimeSpan expire);
+
+ ///
+ /// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
+ ///
+ /// 键
+ /// 值
+ ///
+ Task SetAsync(string key, object value);
+
+ ///
+ /// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
+ ///
+ /// 键
+ /// 值
+ /// 有效期
+ ///
+ Task SetAsync(string key, object value, TimeSpan expire);
+ }
+}
diff --git a/20220330_Vote/Ewide.Core/Cache/MemoryCache.cs b/20220330_Vote/Ewide.Core/Cache/MemoryCache.cs
new file mode 100644
index 0000000..5e9c623
--- /dev/null
+++ b/20220330_Vote/Ewide.Core/Cache/MemoryCache.cs
@@ -0,0 +1,125 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using Furion.DependencyInjection;
+using Microsoft.Extensions.Caching.Memory;
+
+namespace Ewide.Core
+{
+ ///
+ /// 内存缓存
+ ///
+ public class MemoryCache : ICache, ISingleton
+ {
+ private readonly IMemoryCache _memoryCache;
+
+ public MemoryCache(IMemoryCache memoryCache)
+ {
+ _memoryCache = memoryCache;
+ }
+
+ public long Del(params string[] key)
+ {
+ foreach (var k in key)
+ {
+ _memoryCache.Remove(k);
+ }
+ return key.Length;
+ }
+
+ public Task DelAsync(params string[] key)
+ {
+ foreach (var k in key)
+ {
+ _memoryCache.Remove(k);
+ }
+
+ return Task.FromResult((long)key.Length);
+ }
+
+ public async Task DelByPatternAsync(string pattern)
+ {
+ if (string.IsNullOrEmpty(pattern))
+ return default;
+
+ //pattern = Regex.Replace(pattern, @"\{*.\}", "(.*)");
+ var keys = GetAllKeys().Where(k => k.StartsWith(pattern));
+ if (keys != null && keys.Any())
+ return await DelAsync(keys.ToArray());
+
+ return default;
+ }
+
+ public bool Exists(string key)
+ {
+ return _memoryCache.TryGetValue(key, out _);
+ }
+
+ public Task ExistsAsync(string key)
+ {
+ return Task.FromResult(_memoryCache.TryGetValue(key, out _));
+ }
+
+ public string Get(string key)
+ {
+ return _memoryCache.Get(key)?.ToString();
+ }
+
+ public T Get(string key)
+ {
+ return _memoryCache.Get(key);
+ }
+
+ public Task GetAsync(string key)
+ {
+ return Task.FromResult(Get(key));
+ }
+
+ public Task GetAsync(string key)
+ {
+ return Task.FromResult(Get(key));
+ }
+
+ public bool Set(string key, object value)
+ {
+ _memoryCache.Set(key, value);
+ return true;
+ }
+
+ public bool Set(string key, object value, TimeSpan expire)
+ {
+ _memoryCache.Set(key, value, expire);
+ return true;
+ }
+
+ public Task SetAsync(string key, object value)
+ {
+ Set(key, value);
+ return Task.FromResult(true);
+ }
+
+ public Task SetAsync(string key, object value, TimeSpan expire)
+ {
+ Set(key, value, expire);
+ return Task.FromResult(true);
+ }
+
+ private List GetAllKeys()
+ {
+ const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
+ var entries = _memoryCache.GetType().GetField("_entries", flags).GetValue(_memoryCache);
+ var cacheItems = entries.GetType().GetProperty("Keys").GetValue(entries) as ICollection