init commit
This commit is contained in:
52
20220330_Vote/Ewide.Application/Entity/BsHouseCode.cs
Normal file
52
20220330_Vote/Ewide.Application/Entity/BsHouseCode.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
36
20220330_Vote/Ewide.Application/Entity/BsHouseCompany.cs
Normal file
36
20220330_Vote/Ewide.Application/Entity/BsHouseCompany.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 单位类型,多选
|
||||
/// </summary>
|
||||
[Comment("单位类型,多选")]
|
||||
[MaxLength(20)]
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位名称
|
||||
/// </summary>
|
||||
[Comment("单位名称")]
|
||||
[MaxLength(200)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 信息
|
||||
/// </summary>
|
||||
[Comment("信息")]
|
||||
public string Info { get; set; }
|
||||
}
|
||||
}
|
||||
378
20220330_Vote/Ewide.Application/Entity/BsHouseInfo.cs
Normal file
378
20220330_Vote/Ewide.Application/Entity/BsHouseInfo.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// HouseCode主键ID
|
||||
/// </summary>
|
||||
[Comment("bs_house_code主键Id")]
|
||||
[MaxLength(36)]
|
||||
[Required]
|
||||
public string HouseCodeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 幢名称
|
||||
/// </summary>
|
||||
[Comment("幢名称")]
|
||||
[MaxLength(255)]
|
||||
public string BuildingName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 土地性质
|
||||
/// </summary>
|
||||
[Comment("土地性质")]
|
||||
public int? LandAttribute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结构类型
|
||||
/// </summary>
|
||||
[Comment("结构类型")]
|
||||
public int? StructureType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 基础情况
|
||||
/// </summary>
|
||||
[Comment("基础情况")]
|
||||
public int? BaseInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 抗震等级
|
||||
/// </summary>
|
||||
[Comment("抗震等级")]
|
||||
public int? SeismicGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 竣工日期
|
||||
/// </summary>
|
||||
[Comment("竣工日期")]
|
||||
public DateTime? CompletedDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设计使用年限
|
||||
/// </summary>
|
||||
[Comment("设计使用年限")]
|
||||
public int? UsefulYear { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总层数
|
||||
/// </summary>
|
||||
[Comment("总层数")]
|
||||
public int? TotalFloor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上层数
|
||||
/// </summary>
|
||||
[Comment("地上层数")]
|
||||
public int? LandFloorCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上商业层数开始
|
||||
/// </summary>
|
||||
[Comment("地上商业层数开始")]
|
||||
public int? LandBsFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上商业层数结束
|
||||
/// </summary>
|
||||
[Comment("地上商业层数结束")]
|
||||
public int? LandBsFloorEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上车棚层开始
|
||||
/// </summary>
|
||||
[Comment("地上车棚层开始")]
|
||||
public int? LandBikeFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上住宅层开始
|
||||
/// </summary>
|
||||
[Comment("地上住宅层开始")]
|
||||
public int? LandResidenceFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上住宅层结束
|
||||
/// </summary>
|
||||
[Comment("地上住宅层结束")]
|
||||
public int? LandResidenceFloorEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地下层数
|
||||
/// </summary>
|
||||
[Comment("地下层数")]
|
||||
public int? UnderFloorCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总建筑面积
|
||||
/// </summary>
|
||||
[Comment("总建筑面积")]
|
||||
public float? TotalArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 有无建筑幕墙
|
||||
/// </summary>
|
||||
[Comment("有无建筑幕墙")]
|
||||
public int? CurtainWall { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 有无面砖
|
||||
/// </summary>
|
||||
[Comment("有无面砖")]
|
||||
public int? FaceBrick { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 有无涂料
|
||||
/// </summary>
|
||||
[Comment("有无涂料")]
|
||||
public int? Coating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 有无粉刷
|
||||
/// </summary>
|
||||
[Comment("有无粉刷")]
|
||||
public int? Painting { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电梯
|
||||
/// </summary>
|
||||
[Comment("电梯")]
|
||||
[MaxLength(20)]
|
||||
public string Elevator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总户数(户)
|
||||
/// </summary>
|
||||
[Comment("总户数(户)")]
|
||||
public int? HouseHolds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房屋单元数
|
||||
/// </summary>
|
||||
[Comment("房屋单元数")]
|
||||
public int? Units { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 各单元每层户数(户)
|
||||
/// </summary>
|
||||
[Comment("各单元每层户数(户)")]
|
||||
public int? UnitFloorHolds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 建设单位ID
|
||||
/// </summary>
|
||||
[Comment("建设单位ID")]
|
||||
[MaxLength(36)]
|
||||
public string BuildingUnitId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设计单位ID
|
||||
/// </summary>
|
||||
[Comment("设计单位ID")]
|
||||
[MaxLength(36)]
|
||||
public string DesingerUnitId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 施工单位ID
|
||||
/// </summary>
|
||||
[Comment("施工单位ID")]
|
||||
[MaxLength(36)]
|
||||
public string ConstructionUnitId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 监理单位ID
|
||||
/// </summary>
|
||||
[Comment("监理单位ID")]
|
||||
[MaxLength(36)]
|
||||
public string MonitorUnitId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产权性质
|
||||
/// </summary>
|
||||
[Comment("产权性质")]
|
||||
[MaxLength(100)]
|
||||
public string PropertyRights { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总共套数
|
||||
/// </summary>
|
||||
[Comment("总共套数")]
|
||||
public int? HouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 直管公房套数
|
||||
/// </summary>
|
||||
[Comment("直管公房套数")]
|
||||
public int? StraightHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自管公房套数
|
||||
/// </summary>
|
||||
[Comment("自管公房套数")]
|
||||
public int? SelfHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 私房套数
|
||||
/// </summary>
|
||||
[Comment("私房套数")]
|
||||
public int? PrivateHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品房套数
|
||||
/// </summary>
|
||||
[Comment("商品房套数")]
|
||||
public int? BusinessCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房改房套数
|
||||
/// </summary>
|
||||
[Comment("房改房套数")]
|
||||
public int? ChangeHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拆迁安置房套数
|
||||
/// </summary>
|
||||
[Comment("拆迁安置房套数")]
|
||||
public int? ResettlementHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其它套数
|
||||
/// </summary>
|
||||
[Comment("其它套数")]
|
||||
public int? OtherCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产权单位ID
|
||||
/// </summary>
|
||||
[Comment("产权单位ID")]
|
||||
[MaxLength(36)]
|
||||
public string PropertyUnitId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物业单位ID
|
||||
/// </summary>
|
||||
[Comment("物业单位ID")]
|
||||
[MaxLength(36)]
|
||||
public string WuYeUnitId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图纸资料存档处
|
||||
/// </summary>
|
||||
[Comment("图纸资料存档处")]
|
||||
[MaxLength(50)]
|
||||
public string DrawingMaterial { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他图纸存档
|
||||
/// </summary>
|
||||
[Comment("其他图纸存档")]
|
||||
[MaxLength(100)]
|
||||
public string DrawingMaterialText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 立项文件
|
||||
/// </summary>
|
||||
[Comment("立项文件")]
|
||||
[MaxLength(2000)]
|
||||
public string AnEntryDocument { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规划许可
|
||||
/// </summary>
|
||||
[Comment("规划许可")]
|
||||
[MaxLength(2000)]
|
||||
public string PlanningPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 竣工验收备案
|
||||
/// </summary>
|
||||
[Comment("竣工验收备案")]
|
||||
[MaxLength(2000)]
|
||||
public string CompletionRecord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 监理资料
|
||||
/// </summary>
|
||||
[Comment("监理资料")]
|
||||
[MaxLength(2000)]
|
||||
public string MonitorDocument { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 鉴定报告
|
||||
/// </summary>
|
||||
[Comment("鉴定报告")]
|
||||
[MaxLength(2000)]
|
||||
public string IdentificationReport { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其它资料
|
||||
/// </summary>
|
||||
[Comment("其它资料")]
|
||||
[MaxLength(2000)]
|
||||
public string OtherDocument { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 外立面照片
|
||||
/// </summary>
|
||||
[Comment("外立面照片")]
|
||||
[MaxLength(2000)]
|
||||
public string FacadePhoto { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房屋等级 1,2,3,4,C,d
|
||||
/// </summary>
|
||||
[Comment("房屋等级 1,2,3,4,C,d")]
|
||||
public int? HouseGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房屋使用状态
|
||||
/// </summary>
|
||||
[Comment("房屋使用状态")]
|
||||
public int? HouseUsedStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// -1 退回(审核被退回的数据) 1、待建档(需要建档的数据未暂存未保存的)2、暂存(点击了暂存的数据)3、待提交(点击了保存的数据) 5、审核中6、审核通过
|
||||
/// </summary>
|
||||
[Comment("-1 退回(审核被退回的数据) 1、待建档(需要建档的数据未暂存未保存的)2、暂存(点击了暂存的数据)3、待提交(点击了保存的数据) 5、审核中6、审核通过")]
|
||||
[Required]
|
||||
public int State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 调查登记机构
|
||||
/// </summary>
|
||||
[Comment("调查登记机构")]
|
||||
[MaxLength(100)]
|
||||
public string InvestigateAgency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纸质资料调查人
|
||||
/// </summary>
|
||||
[Comment("纸质资料调查人")]
|
||||
[MaxLength(50)]
|
||||
public string InvestigateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纸质资料审核人
|
||||
/// </summary>
|
||||
[Comment("纸质资料审核人")]
|
||||
[MaxLength(50)]
|
||||
public string OfflineAuditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主管部门
|
||||
/// </summary>
|
||||
[Comment("主管部门")]
|
||||
[MaxLength(50)]
|
||||
public string CompetentDepartment { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
46
20220330_Vote/Ewide.Application/Entity/BsHouseLog.cs
Normal file
46
20220330_Vote/Ewide.Application/Entity/BsHouseLog.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
38
20220330_Vote/Ewide.Application/Entity/BsHouseProjectInfo.cs
Normal file
38
20220330_Vote/Ewide.Application/Entity/BsHouseProjectInfo.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
266
20220330_Vote/Ewide.Application/Entity/BsHouseTask.cs
Normal file
266
20220330_Vote/Ewide.Application/Entity/BsHouseTask.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// bs_house_code主键Id
|
||||
/// </summary>
|
||||
[Comment("bs_house_code主键Id")]
|
||||
[MaxLength(36)]
|
||||
[Required]
|
||||
public string HouseCodeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巡查日期
|
||||
/// </summary>
|
||||
[Comment("巡查日期")]
|
||||
public DateTime? PatrolDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巡查人姓名
|
||||
/// </summary>
|
||||
[Comment("巡查人姓名")]
|
||||
[MaxLength(50)]
|
||||
public string PatrolUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 沉降倾斜
|
||||
/// </summary>
|
||||
[Comment("沉降倾斜")]
|
||||
[MaxLength(1000)]
|
||||
public string SettlementTilt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 沉降倾斜附件
|
||||
/// </summary>
|
||||
[Comment("沉降倾斜附件")]
|
||||
[MaxLength(2000)]
|
||||
public string SettlementTiltFiles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他情况
|
||||
/// </summary>
|
||||
[Comment("其他情况")]
|
||||
[MaxLength(1000)]
|
||||
public string OtherInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他情况附件
|
||||
/// </summary>
|
||||
[Comment("其他情况附件")]
|
||||
[MaxLength(2000)]
|
||||
public string OtherInfoFiles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始等级
|
||||
/// </summary>
|
||||
[Comment("初始等级")]
|
||||
public int? InitGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 损坏等级
|
||||
/// </summary>
|
||||
[Comment("损坏等级")]
|
||||
public int? DamageGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 综合等级
|
||||
/// </summary>
|
||||
[Comment("综合等级")]
|
||||
public int? ComprehensiveGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房屋场地
|
||||
/// </summary>
|
||||
[Comment("房屋场地")]
|
||||
[MaxLength(100)]
|
||||
public string HouseSite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 相邻施工
|
||||
/// </summary>
|
||||
[Comment("相邻施工")]
|
||||
[MaxLength(100)]
|
||||
public string AdjacentConstruction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 化学侵蚀
|
||||
/// </summary>
|
||||
[Comment("化学侵蚀")]
|
||||
[MaxLength(100)]
|
||||
public string ChemicalErosion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结构拆改
|
||||
/// </summary>
|
||||
[Comment("结构拆改")]
|
||||
public int? StructuralDismantling { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 加层改造
|
||||
/// </summary>
|
||||
[Comment("加层改造")]
|
||||
public int? AddingLayer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修缮加固
|
||||
/// </summary>
|
||||
[Comment("修缮加固")]
|
||||
[MaxLength(100)]
|
||||
public string RepairAndReinforce { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 历史灾害
|
||||
/// </summary>
|
||||
[Comment("历史灾害")]
|
||||
[MaxLength(100)]
|
||||
public string HistoricalCalamity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 使用功能变更
|
||||
/// </summary>
|
||||
[Comment("使用功能变更")]
|
||||
[MaxLength(100)]
|
||||
public string FunctionalChange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他调查内容
|
||||
/// </summary>
|
||||
[Comment("其他调查内容")]
|
||||
[MaxLength(1000)]
|
||||
public string OtherContents { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主要安全隐患综述
|
||||
/// </summary>
|
||||
[Comment("主要安全隐患综述")]
|
||||
[MaxLength(1000)]
|
||||
public string MainSafety { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理意见
|
||||
/// </summary>
|
||||
[Comment("处理意见")]
|
||||
public int? HandlingOpinion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理意见备注
|
||||
/// </summary>
|
||||
[Comment("处理意见备注")]
|
||||
[MaxLength(1000)]
|
||||
public string HandlingOpinionRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 整改情况
|
||||
/// </summary>
|
||||
[Comment("整改情况")]
|
||||
public int? RectifyAndReform { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 整改情况备注
|
||||
/// </summary>
|
||||
[Comment("整改情况备注")]
|
||||
[MaxLength(1000)]
|
||||
public string RectifyAndReformRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巡查结果:1正常,-1异常
|
||||
/// </summary>
|
||||
[Comment("巡查结果:1正常,-1异常")]
|
||||
public int? PatrolResult { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巡查异常描述
|
||||
/// </summary>
|
||||
[Comment("巡查异常描述")]
|
||||
[MaxLength(1000)]
|
||||
public string PatrolResultRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务人员ID
|
||||
/// </summary>
|
||||
[Comment("任务人员ID")]
|
||||
[MaxLength(36)]
|
||||
public string UserID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务截止时间
|
||||
/// </summary>
|
||||
[Comment("任务截止时间")]
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否过期
|
||||
/// </summary>
|
||||
[Comment("是否过期")]
|
||||
public bool? IsDelay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// -1:退回0:待处理1:保存待提交2:待审核3:审核通过
|
||||
/// </summary>
|
||||
[Comment("-1:退回0:待处理1:保存待提交2:待审核6:审核通过")]
|
||||
public int Status { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 0:建档任务1:系统派发的巡查任务2:主动巡查任务
|
||||
/// </summary>
|
||||
[Comment("0:建档任务1:系统派发的巡查任务2:主动巡查任务")]
|
||||
public int? TaskType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报街道
|
||||
/// </summary>
|
||||
[Comment("上报街道")]
|
||||
public int? ReportRoad { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报街道时间
|
||||
/// </summary>
|
||||
[Comment("上报街道时间")]
|
||||
public DateTime? ReportRoadTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报区住建
|
||||
/// </summary>
|
||||
[Comment("上报区住建")]
|
||||
public int? ReportArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报区住建时间
|
||||
/// </summary>
|
||||
[Comment("上报区住建时间")]
|
||||
public DateTime? ReportAreaTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报备注
|
||||
/// </summary>
|
||||
[Comment("上报备注")]
|
||||
[MaxLength(1000)]
|
||||
public string ReportRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提交时间
|
||||
/// </summary>
|
||||
[Comment("提交时间")]
|
||||
public DateTime? SubmitTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后提交时间
|
||||
/// </summary>
|
||||
[Comment("最后提交时间")]
|
||||
public DateTime? LastSubmitTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有效
|
||||
/// </summary>
|
||||
[Comment("是否有效")]
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务Id
|
||||
/// </summary>
|
||||
[Comment("任务Id")]
|
||||
[MaxLength(36)]
|
||||
public string TaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 通过1;退回-1
|
||||
/// </summary>
|
||||
[Comment("通过3;退回-1")]
|
||||
public int PassOrBack { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审核内容
|
||||
/// </summary>
|
||||
[Comment("审核内容")]
|
||||
[MaxLength(500)]
|
||||
public string Content { get; set; }
|
||||
}
|
||||
}
|
||||
60
20220330_Vote/Ewide.Application/Entity/BsHouseTaskOptions.cs
Normal file
60
20220330_Vote/Ewide.Application/Entity/BsHouseTaskOptions.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// bs_house_code主键Id
|
||||
/// </summary>
|
||||
[Comment("bs_house_code主键Id")]
|
||||
[MaxLength(36)]
|
||||
[Required]
|
||||
public string TaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典类型
|
||||
/// </summary>
|
||||
[Comment("字典类型")]
|
||||
[MaxLength(50)]
|
||||
public string DictType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典code
|
||||
/// </summary>
|
||||
[Comment("字典code")]
|
||||
[MaxLength(50)]
|
||||
public string DictCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典值
|
||||
/// </summary>
|
||||
[Comment("字典值")]
|
||||
[MaxLength(100)]
|
||||
public string DictValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
[MaxLength(500)]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
[Comment("附件")]
|
||||
[MaxLength(2000)]
|
||||
public string File { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
[Comment("是否选中")]
|
||||
public bool? Checked { get; set; }
|
||||
}
|
||||
}
|
||||
1
20220330_Vote/Ewide.Application/Entity/README.md
Normal file
1
20220330_Vote/Ewide.Application/Entity/README.md
Normal file
@@ -0,0 +1 @@
|
||||
/** 您的业务实体文件写在此文件夹下面 **/
|
||||
48
20220330_Vote/Ewide.Application/Enum/DataStatus.cs
Normal file
48
20220330_Vote/Ewide.Application/Enum/DataStatus.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 审核退回
|
||||
/// </summary>
|
||||
[Description("审核退回")]
|
||||
Back = -1,
|
||||
|
||||
/// <summary>
|
||||
/// 初始未处理
|
||||
/// </summary>
|
||||
[Description("初始未处理")]
|
||||
Init = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 暂存
|
||||
/// </summary>
|
||||
[Description("暂存")]
|
||||
TempSaved = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 已保存,待提交
|
||||
/// </summary>
|
||||
[Description("已保存,待提交")]
|
||||
Saved = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 已提交,待审核
|
||||
/// </summary>
|
||||
[Description("已提交,待审核")]
|
||||
Submited = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 审核通过
|
||||
/// </summary>
|
||||
[Description("审核通过")]
|
||||
Passed = 6
|
||||
}
|
||||
}
|
||||
43
20220330_Vote/Ewide.Application/Enum/HouseLog.cs
Normal file
43
20220330_Vote/Ewide.Application/Enum/HouseLog.cs
Normal file
@@ -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,
|
||||
}
|
||||
}
|
||||
36
20220330_Vote/Ewide.Application/Enum/HouseManagerRole.cs
Normal file
36
20220330_Vote/Ewide.Application/Enum/HouseManagerRole.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 市住建部门
|
||||
/// </summary>
|
||||
CityManager,
|
||||
|
||||
/// <summary>
|
||||
/// 区住建部门
|
||||
/// </summary>
|
||||
AreaManager,
|
||||
|
||||
/// <summary>
|
||||
/// 街道管理员
|
||||
/// </summary>
|
||||
RoadManager,
|
||||
|
||||
/// <summary>
|
||||
/// 片区监管员
|
||||
/// </summary>
|
||||
ZoneManager,
|
||||
|
||||
/// <summary>
|
||||
/// 房屋安全管理员
|
||||
/// </summary>
|
||||
HouseSecurityManager
|
||||
}
|
||||
}
|
||||
27
20220330_Vote/Ewide.Application/Ewide.Application.csproj
Normal file
27
20220330_Vote/Ewide.Application/Ewide.Application.csproj
Normal file
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<NoWarn>1701;1702;1591</NoWarn>
|
||||
<DocumentationFile>Ewide.Application.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="applicationsettings.json" />
|
||||
<None Remove="Ewide.Application.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="applicationsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ewide.Core\Ewide.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
1490
20220330_Vote/Ewide.Application/Ewide.Application.xml
Normal file
1490
20220330_Vote/Ewide.Application/Ewide.Application.xml
Normal file
File diff suppressed because it is too large
Load Diff
3
20220330_Vote/Ewide.Application/README.md
Normal file
3
20220330_Vote/Ewide.Application/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
1、原则上服务应该放在Application层次,考虑将咱自己的业务层直接写在Application里面好些,后续升级后,咱大家直接升级就行了,减少冲突!
|
||||
2、系统默认ORM为EF Core,如果觉得不趁手,可以自行更换
|
||||
3、在此应用层默认集成了SqlSugar,其他ORM类同,可以多个ORM并行开发,熟悉哪个用哪个
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 房屋编码相关
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseCode", Order = 180)]
|
||||
public class HouseCodeService : IHouseCodeService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IRepository<BsHouseCode> _houseCodeRep;
|
||||
private readonly IDapperRepository _dapperRepository;
|
||||
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IHouseLogService _houseLogService;
|
||||
|
||||
public HouseCodeService(IRepository<BsHouseCode> 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<BsHouseProjectInfo>();
|
||||
var houseProject = await houseProjectInfoRep.FirstOrDefaultAsync(p => p.Id == input.ProjectId);
|
||||
if (houseProject == null) throw Oops.Oh("项目参数有误,添加失败");
|
||||
|
||||
var areaCodeRep = Db.GetRepository<SysAreaCode>();
|
||||
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<BsHouseCode>();
|
||||
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<BsHouseCode>();
|
||||
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<dynamic> 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<dynamic> GetHouserCode([FromQuery] GetHouseCodeInput input)
|
||||
{
|
||||
var houseCode = await _houseCodeRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == input.Id);
|
||||
var areaCode = (await Db.GetRepository<BsHouseProjectInfo>().DetachedEntities.FirstOrDefaultAsync(p => p.Id == houseCode.ProjectId)).AreaCode;
|
||||
var result = houseCode.Adapt<GetHouseCodeOutput>();
|
||||
result.AreaCode = areaCode;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取同一区域下的下一个编号
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseCode/getNextNoByCode")]
|
||||
public async Task<dynamic> GetNextNoByFullNumber([Required] string projectId)
|
||||
{
|
||||
var areaCodeRep = Db.GetRepository<SysAreaCode>();
|
||||
var houseProjectInfoRep = Db.GetRepository<BsHouseProjectInfo>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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<HouseCompanyInfoInput> 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; }
|
||||
}
|
||||
}
|
||||
@@ -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<HouseCompanyInfoOutput> Info { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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<BsHouseCompany> _bsHouseCompanyRep;
|
||||
|
||||
public HouseCompanyService(IRepository<BsHouseCompany> bsHouseCompanyRep)
|
||||
{
|
||||
_bsHouseCompanyRep = bsHouseCompanyRep;
|
||||
}
|
||||
|
||||
[HttpPost("/houseCompany/page")]
|
||||
public async Task<dynamic> Page([FromBody] HouseCompanyPageInput input)
|
||||
{
|
||||
var config = new TypeAdapterConfig().ForType<BsHouseCompany, HouseCompanyDetailOutput>()
|
||||
.Map(target => target.Info, src => JsonConvert.DeserializeObject<List<HouseCompanyInfoOutput>>(src.Info))
|
||||
.Config;
|
||||
return await _bsHouseCompanyRep.DetachedEntities.ToPageData<BsHouseCompany, HouseCompanyDetailOutput>(input, config);
|
||||
}
|
||||
|
||||
[HttpPost("/houseCompany/add")]
|
||||
public async Task Add([FromBody] HouseCompanyAddInput input)
|
||||
{
|
||||
var info = JsonConvert.SerializeObject(input.Info);
|
||||
var config = new TypeAdapterConfig().ForType<HouseCompanyAddInput, BsHouseCompany>()
|
||||
.Map(target => target.Info, src => JsonConvert.SerializeObject(src.Info))
|
||||
.Config;
|
||||
var company = input.Adapt<BsHouseCompany>(config);
|
||||
await company.InsertAsync();
|
||||
}
|
||||
|
||||
[HttpPost("/houseCompany/edit")]
|
||||
public async Task Edit([FromBody] HouseCompanyEditInput input)
|
||||
{
|
||||
var config = new TypeAdapterConfig().ForType<HouseCompanyEditInput, BsHouseCompany>()
|
||||
.Map(target => target.Info, src => JsonConvert.SerializeObject(src.Info))
|
||||
.Config;
|
||||
var company = input.Adapt<BsHouseCompany>(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<HouseCompanyDetailOutput> Detail([FromQuery] HouseCompanyInput input)
|
||||
{
|
||||
var company = await _bsHouseCompanyRep.FirstOrDefaultAsync(p => p.Id.Equals(input.Id));
|
||||
var config = new TypeAdapterConfig().ForType<BsHouseCompany, HouseCompanyDetailOutput>()
|
||||
.Map(target => target.Info, src => JsonConvert.DeserializeObject<List<HouseCompanyInfoOutput>>(src.Info))
|
||||
.Config;
|
||||
var output = company.Adapt<HouseCompanyDetailOutput>(config);
|
||||
return output;
|
||||
}
|
||||
|
||||
[HttpGet("/houseCompany/list")]
|
||||
public async Task<dynamic> List([FromQuery] HouseCompanyListInput input)
|
||||
{
|
||||
var types = input.Type.Split(',');
|
||||
var result = new List<HouseCompanyDetailOutput>();
|
||||
var config = new TypeAdapterConfig().ForType<BsHouseCompany, HouseCompanyDetailOutput>()
|
||||
.Map(target => target.Info, src => JsonConvert.DeserializeObject<List<HouseCompanyInfoOutput>>(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<HouseCompanyDetailOutput>(config);
|
||||
return output;
|
||||
});
|
||||
result.AddRange(list);
|
||||
}
|
||||
|
||||
return result.Distinct();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<dynamic> Page([FromBody] HouseCompanyPageInput input);
|
||||
Task Add([FromBody] HouseCompanyAddInput input);
|
||||
Task Edit([FromBody] HouseCompanyEditInput input);
|
||||
Task Delete([FromBody] HouseCompanyInput input);
|
||||
Task<HouseCompanyDetailOutput> Detail([FromQuery] HouseCompanyInput input);
|
||||
Task<dynamic> List([FromQuery] HouseCompanyListInput input);
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
/// <summary>
|
||||
/// 总建筑面积
|
||||
/// </summary>
|
||||
public float? TotalArea { get; set; }
|
||||
/// <summary>
|
||||
/// 总户数(户)
|
||||
/// </summary>
|
||||
public int? HouseHolds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房屋单元数
|
||||
/// </summary>
|
||||
public int? Units { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 各单元每层户数(户)
|
||||
/// </summary>
|
||||
public int? UnitFloorHolds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总层数
|
||||
/// </summary>
|
||||
public int? TotalFloor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上层数
|
||||
/// </summary>
|
||||
public int? LandFloorCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上商业层数开始
|
||||
/// </summary>
|
||||
public int? LandBsFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上商业层数结束
|
||||
/// </summary>
|
||||
public int? LandBsFloorEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上车棚层开始
|
||||
/// </summary>
|
||||
public int? LandBikeFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上住宅层开始
|
||||
/// </summary>
|
||||
public int? LandResidenceFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上住宅层结束
|
||||
/// </summary>
|
||||
public int? LandResidenceFloorEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地下层数
|
||||
/// </summary>
|
||||
public int? UnderFloorCount { get; set; }
|
||||
#endregion
|
||||
#region 权属情况ownership
|
||||
/// <summary>
|
||||
/// 产权性质
|
||||
/// </summary>
|
||||
public string PropertyRights { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总共套数
|
||||
/// </summary>
|
||||
public int? HouseCount { get; set; }
|
||||
/// <summary>
|
||||
/// 直管公房套数
|
||||
/// </summary>
|
||||
public int? StraightHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自管公房套数
|
||||
/// </summary>
|
||||
public int? SelfHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 私房套数
|
||||
/// </summary>
|
||||
public int? PrivateHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品房套数
|
||||
/// </summary>
|
||||
public int? BusinessCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房改房套数
|
||||
/// </summary>
|
||||
public int? ChangeHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拆迁安置房套数
|
||||
/// </summary>
|
||||
public int? ResettlementHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其它套数
|
||||
/// </summary>
|
||||
public int? OtherCount { get; set; }
|
||||
|
||||
#endregion
|
||||
#region 管理情况manager
|
||||
#endregion
|
||||
|
||||
#region 鉴定治理identification
|
||||
|
||||
/// <summary>
|
||||
/// 房屋等级 1,2,3,4,C,d
|
||||
/// </summary>
|
||||
public int? HouseGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房屋使用状态
|
||||
/// </summary>
|
||||
public int? HouseUsedStatus { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 图纸资料存档处drawing
|
||||
|
||||
/// <summary>
|
||||
/// 图纸资料存档处
|
||||
/// </summary>
|
||||
public string DrawingMaterial { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他图纸存档
|
||||
/// </summary>
|
||||
public string DrawingMaterialText { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 相关附件资料attachments
|
||||
/// <summary>
|
||||
/// 立项文件
|
||||
/// </summary>
|
||||
public string AnEntryDocument { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规划许可
|
||||
/// </summary>
|
||||
public string PlanningPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 竣工验收备案
|
||||
/// </summary>
|
||||
public string CompletionRecord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 监理资料
|
||||
/// </summary>
|
||||
public string MonitorDocument { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 鉴定报告
|
||||
/// </summary>
|
||||
public string IdentificationReport { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其它资料
|
||||
/// </summary>
|
||||
public string OtherDocument { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 建筑概貌aspect
|
||||
/// <summary>
|
||||
/// 外立面照片
|
||||
/// </summary>
|
||||
public string FacadePhoto { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 调查单位unit
|
||||
/// <summary>
|
||||
/// 调查登记机构
|
||||
/// </summary>
|
||||
public string InvestigateAgency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纸质资料调查人
|
||||
/// </summary>
|
||||
public string InvestigateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纸质资料审核人
|
||||
/// </summary>
|
||||
public string OfflineAuditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主管部门
|
||||
/// </summary>
|
||||
public string CompetentDepartment { get; set; }
|
||||
#endregion
|
||||
|
||||
public 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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
/// <summary>
|
||||
/// 总建筑面积
|
||||
/// </summary>
|
||||
public float? TotalArea { get; set; }
|
||||
/// <summary>
|
||||
/// 总户数(户)
|
||||
/// </summary>
|
||||
public int? HouseHolds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房屋单元数
|
||||
/// </summary>
|
||||
public int? Units { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 各单元每层户数(户)
|
||||
/// </summary>
|
||||
public int? UnitFloorHolds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总层数
|
||||
/// </summary>
|
||||
public int? TotalFloor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上层数
|
||||
/// </summary>
|
||||
public int? LandFloorCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上商业层数开始
|
||||
/// </summary>
|
||||
public int? LandBsFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上商业层数结束
|
||||
/// </summary>
|
||||
public int? LandBsFloorEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上车棚层开始
|
||||
/// </summary>
|
||||
public int? LandBikeFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上住宅层开始
|
||||
/// </summary>
|
||||
public int? LandResidenceFloorStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地上住宅层结束
|
||||
/// </summary>
|
||||
public int? LandResidenceFloorEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地下层数
|
||||
/// </summary>
|
||||
public int? UnderFloorCount { get; set; }
|
||||
#endregion
|
||||
#region 权属情况ownership
|
||||
/// <summary>
|
||||
/// 产权性质
|
||||
/// </summary>
|
||||
public string PropertyRights { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 总共套数
|
||||
/// </summary>
|
||||
public int? HouseCount { get; set; }
|
||||
/// <summary>
|
||||
/// 直管公房套数
|
||||
/// </summary>
|
||||
public int? StraightHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自管公房套数
|
||||
/// </summary>
|
||||
public int? SelfHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 私房套数
|
||||
/// </summary>
|
||||
public int? PrivateHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 商品房套数
|
||||
/// </summary>
|
||||
public int? BusinessCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房改房套数
|
||||
/// </summary>
|
||||
public int? ChangeHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拆迁安置房套数
|
||||
/// </summary>
|
||||
public int? ResettlementHouseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其它套数
|
||||
/// </summary>
|
||||
public int? OtherCount { get; set; }
|
||||
|
||||
#endregion
|
||||
#region 管理情况manager
|
||||
#endregion
|
||||
|
||||
#region 鉴定治理identification
|
||||
|
||||
/// <summary>
|
||||
/// 房屋等级 1,2,3,4,C,d
|
||||
/// </summary>
|
||||
public int? HouseGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房屋使用状态
|
||||
/// </summary>
|
||||
public int? HouseUsedStatus { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 图纸资料存档处drawing
|
||||
|
||||
/// <summary>
|
||||
/// 图纸资料存档处
|
||||
/// </summary>
|
||||
public string DrawingMaterial { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他图纸存档
|
||||
/// </summary>
|
||||
public string DrawingMaterialText { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 相关附件资料attachments
|
||||
/// <summary>
|
||||
/// 立项文件
|
||||
/// </summary>
|
||||
public string AnEntryDocument { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规划许可
|
||||
/// </summary>
|
||||
public string PlanningPermission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 竣工验收备案
|
||||
/// </summary>
|
||||
public string CompletionRecord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 监理资料
|
||||
/// </summary>
|
||||
public string MonitorDocument { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 鉴定报告
|
||||
/// </summary>
|
||||
public string IdentificationReport { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其它资料
|
||||
/// </summary>
|
||||
public string OtherDocument { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 建筑概貌aspect
|
||||
/// <summary>
|
||||
/// 外立面照片
|
||||
/// </summary>
|
||||
public string FacadePhoto { get; set; }
|
||||
#endregion
|
||||
public int State { get; set; }
|
||||
#region 调查单位unit
|
||||
/// <summary>
|
||||
/// 调查登记机构
|
||||
/// </summary>
|
||||
public string InvestigateAgency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纸质资料调查人
|
||||
/// </summary>
|
||||
public string InvestigateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纸质资料审核人
|
||||
/// </summary>
|
||||
public string OfflineAuditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主管部门
|
||||
/// </summary>
|
||||
public string CompetentDepartment { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class HouseInfoOutputForDetailPage
|
||||
{
|
||||
#region header
|
||||
public HouseCodeOutput HouseCode { get; set; }
|
||||
#endregion
|
||||
|
||||
public HouseInfoOutput HouseInfo { get; set; }
|
||||
public HouseTaskOutput PatrolInfo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 房屋详细信息
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseInfo", Order = 200)]
|
||||
public class HouseInfoService : IHouseInfoService, IDynamicApiController, ITransient
|
||||
{
|
||||
|
||||
private readonly IRepository<BsHouseCode> _houseCodeRep;
|
||||
private readonly IRepository<BsHouseInfo> _houseInfoRep;
|
||||
private readonly IRepository<BsHouseTask> _houseTaskRep;
|
||||
private readonly IRepository<SysUser> _sysUserRep;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDapperRepository _dapperRepository;
|
||||
|
||||
private readonly IHouseLogService _houseLogService;
|
||||
|
||||
|
||||
public HouseInfoService(
|
||||
IRepository<BsHouseCode> HouseCodeRep,
|
||||
IRepository<BsHouseInfo> HouseInfoRep,
|
||||
IRepository<BsHouseTask> HouseTaskRep,
|
||||
IRepository<SysUser> 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<HouseInfoOutputForDetailPage> 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<HouseCodeOutput>(
|
||||
@"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<HouseTaskOutput>();
|
||||
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<HouseInfoOutput>();
|
||||
houseInfoOutputForDetailPage.HouseInfo = houseInfoOutput;
|
||||
|
||||
return houseInfoOutputForDetailPage;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task InputDataProcess(HouseInfoInputSave input,DataStatus dataStatus = DataStatus.Init)
|
||||
{
|
||||
//房屋编码地址/坐标单独更新
|
||||
var houseCode = input.houseCode.Adapt<BsHouseCode>();
|
||||
await houseCode.UpdateIncludeAsync(new[] { nameof(BsHouseCode.Address), nameof(BsHouseCode.Lng), nameof(BsHouseCode.Lat) }, true);
|
||||
|
||||
//获取房屋详情实体,判断是新增还是更新
|
||||
var houseEntity = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == input.houseCode.Id);
|
||||
|
||||
//建档审核通过的房屋数据修改时,对应的建档任务Task不处理
|
||||
var houseTask = await _houseTaskRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == input.PatrolInfo.Id);
|
||||
if (houseEntity == null || houseEntity.State != 6)
|
||||
{
|
||||
var _houseTask = input.PatrolInfo.Adapt<BsHouseTask>();
|
||||
_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<BsHouseInfo>();
|
||||
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<SysEmp>();
|
||||
var _sysUserRoleRep = Db.GetRepository<SysUserRole>();
|
||||
var _sysRoleRep = Db.GetRepository<SysRole>();
|
||||
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<BsHouseTaskCheckRecord>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<HouseInfoOutputForDetailPage> GetByTaskId(string taskId);
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 房屋流转日志
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseLog", Order = 210)]
|
||||
public class HouseLogService : IHouseLogService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IDapperRepository _dapperRep;
|
||||
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
private readonly IRepository<BsHouseLog> _bsHouseLogRep;
|
||||
|
||||
public HouseLogService(IDapperRepository dapperRep, IUserManager userManager, IRepository<BsHouseLog> bsHouseLogRep)
|
||||
{
|
||||
_dapperRep = dapperRep;
|
||||
_userManager = userManager;
|
||||
_bsHouseLogRep = bsHouseLogRep;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task<int> Add(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null)
|
||||
{
|
||||
return await Add(houseCodeId, new List<SysUser> { targetUser }, type, remark, sort);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task<int> Add(string houseCodeId, List<SysUser> 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<int> AddThenRead(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null)
|
||||
{
|
||||
return await AddThenRead(houseCodeId, new List<SysUser> { targetUser }, type, remark, sort);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task<int> AddThenRead(string houseCodeId, List<SysUser> 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<int> AddThenDone(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null)
|
||||
{
|
||||
return await AddThenDone(houseCodeId, new List<SysUser> { targetUser }, type, remark, sort);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task<int> AddThenDone(string houseCodeId, List<SysUser> 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<dynamic> 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<HouseLogOutput>(sql, new { houseCodeId = input.Id });
|
||||
}
|
||||
|
||||
[HttpGet("/houseLog/listByInfoId")]
|
||||
public async Task<dynamic> ListByInfoId([FromQuery] HouseLogInput input)
|
||||
{
|
||||
var info = await Db.GetRepository<BsHouseInfo>().DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.Id));
|
||||
return await List(new HouseLogInput
|
||||
{
|
||||
Id = info.HouseCodeId
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet("/houseLog/listByTaskId")]
|
||||
public async Task<dynamic> ListByTaskId([FromQuery] HouseLogInput input)
|
||||
{
|
||||
var task = await Db.GetRepository<BsHouseTask>().DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.Id));
|
||||
return await List(new HouseLogInput
|
||||
{
|
||||
Id = task.HouseCodeId
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<int> Add(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null);
|
||||
Task<int> Add(string houseCodeId, List<SysUser> targetUsers, HouseLogType type, string remark = null, int? sort = null);
|
||||
Task Read(string houseCodeId);
|
||||
Task Done(string houseCodeId);
|
||||
Task<int> AddThenRead(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null);
|
||||
Task<int> AddThenRead(string houseCodeId, List<SysUser> targetUsers, HouseLogType type, string remark = null, int? sort = null);
|
||||
Task<int> AddThenDone(string houseCodeId, SysUser targetUser, HouseLogType type, string remark = null, int? sort = null);
|
||||
Task<int> AddThenDone(string houseCodeId, List<SysUser> targetUsers, HouseLogType type, string remark = null, int? sort = null);
|
||||
Task<dynamic> List(HouseLogInput input);
|
||||
Task<dynamic> ListByInfoId(HouseLogInput input);
|
||||
Task<dynamic> ListByTaskId(HouseLogInput input);
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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<SysUser> _sysUserRep; // 用户表仓储
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ISysUserService _sysUserService;
|
||||
private readonly ISysEmpService _sysEmpService;
|
||||
|
||||
public HouseMemberService(
|
||||
IDapperRepository dapperRepository,
|
||||
IRepository<SysUser> sysUserRep,
|
||||
IUserManager userManager,
|
||||
ISysUserService sysUserService,
|
||||
ISysEmpService sysEmpService
|
||||
)
|
||||
{
|
||||
_dapperRepository = dapperRepository;
|
||||
_sysUserRep = sysUserRep;
|
||||
_userManager = userManager;
|
||||
_sysUserService = sysUserService;
|
||||
_sysEmpService = sysEmpService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseMember/page")]
|
||||
public async Task<dynamic> 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<UserOutput>(sql, input, param);
|
||||
|
||||
//foreach (var user in users.Items)
|
||||
//{
|
||||
// user.SysEmpInfo = await _sysEmpService.GetEmpInfo(user.Id);
|
||||
//}
|
||||
return PageDataResult<UserOutput>.PageResult(users);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseMember/add")]
|
||||
[UnitOfWork]
|
||||
public async Task AddUser(AddHouseMemberInput input)
|
||||
{
|
||||
var id = await _sysUserService.AddUser(input);
|
||||
var grantRoleInput = input.Adapt<UpdateUserInput>();
|
||||
grantRoleInput.Id = id;
|
||||
|
||||
// 添加角色
|
||||
grantRoleInput.GrantRoleIdList.Add(input.RoleId);
|
||||
await _sysUserService.GrantUserRole(grantRoleInput);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色
|
||||
/// </summary>
|
||||
/// <param name="orgId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseMember/defaultRole")]
|
||||
public async Task<dynamic> DefaultRole([FromQuery] string orgId)
|
||||
{
|
||||
return (await GetDefaultRole(orgId)).Adapt<RoleOutput>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户拥有角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseMember/ownRole")]
|
||||
public async Task<dynamic> GetUserOwnRole([FromQuery] QueryUserInput input)
|
||||
{
|
||||
return await _sysUserService.GetUserOwnRole(input);
|
||||
}
|
||||
|
||||
[HttpGet("/houseMember/defaultRoleRange")]
|
||||
public async Task<dynamic> DefaultRoleRange()
|
||||
{
|
||||
return (await GetRoleRange()).Select(p => p.Adapt<RoleOutput>()).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseMember/delete")]
|
||||
[UnitOfWork]
|
||||
public async Task DeleteUser(DeleteUserInput input)
|
||||
{
|
||||
/*
|
||||
* 未处理逻辑
|
||||
* 片区监管员在本片区已有安全员的情况下无法删除
|
||||
*/
|
||||
|
||||
await _sysUserService.DeleteUser(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseMember/edit")]
|
||||
[UnitOfWork]
|
||||
public async Task UpdateUser(UpdateUserInput input)
|
||||
{
|
||||
/*
|
||||
* 未处理逻辑
|
||||
* 如果移动组织架构,会产生以下几种逻辑
|
||||
* 片区1监管员(无安全员或有其他监管员)=>片区2,直接成功
|
||||
* 片区1监管员(有安全员并且无其他监管员)=>片区2,无法移动
|
||||
* 片区1安全员=>片区2(有监管员),直接成功
|
||||
* 片区1安全员=>片区2(无监管员),无法移动,需要创建监管员
|
||||
*/
|
||||
|
||||
await _sysUserService.UpdateUser(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查看用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseMember/detail")]
|
||||
public async Task<dynamic> 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<UserOutput>(sql, new { input.Id })).SingleOrDefault();
|
||||
if (user != null)
|
||||
{
|
||||
user.SysEmpInfo = await _sysEmpService.GetEmpInfo(user.Id);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户状态
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseMember/changeStatus")]
|
||||
public async Task ChangeUserStatus(UpdateUserInput input)
|
||||
{
|
||||
await _sysUserService.ChangeUserStatus(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 授权用户数据范围
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseMember/grantData")]
|
||||
public async Task GrantUserData(UpdateUserInput input)
|
||||
{
|
||||
await _sysUserService.GrantUserData(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户拥有数据
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseMember/ownData")]
|
||||
public async Task<dynamic> GetUserOwnData([FromQuery] QueryUserInput input)
|
||||
{
|
||||
return await _sysUserService.GetUserOwnData(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前机构中所创建的默认角色
|
||||
/// 片区中的第一个帐号必定为片区监管员
|
||||
/// </summary>
|
||||
/// <param name="orgId"></param>
|
||||
/// <returns></returns>
|
||||
[NonAction]
|
||||
private async Task<SysRole> GetDefaultRole(string orgId)
|
||||
{
|
||||
var roles = await GetRoleRange();
|
||||
if (roles.Count < 2) throw Oops.Oh("未配置正确的角色");
|
||||
|
||||
var _sysOrgRep = Db.GetRepository<SysOrg>();
|
||||
var org = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == orgId);
|
||||
// 如果当前组织为街道, 则直接返回安全员
|
||||
if (org == null || org.Type <= (int)OrgType.乡镇街道办事处)
|
||||
{
|
||||
return roles.LastOrDefault();
|
||||
}
|
||||
|
||||
var _sysEmpRep = Db.GetRepository<SysEmp>();
|
||||
var _sysUserRoleRep = Db.GetRepository<SysUserRole>();
|
||||
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<SysRole>();
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取可创建的角色列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[NonAction]
|
||||
private async Task<List<SysRole>> GetRoleRange()
|
||||
{
|
||||
var codes = (new[] {
|
||||
Enum.GetName(HouseManagerRole.ZoneManager),
|
||||
Enum.GetName(HouseManagerRole.HouseSecurityManager),
|
||||
}).Select(p => p.ToUnderScoreCase());
|
||||
|
||||
var _sysRoleRep = Db.GetRepository<SysRole>();
|
||||
var roles = await _sysRoleRep.DetachedEntities.Where(p => codes.Contains(p.Code)).ToListAsync();
|
||||
|
||||
return roles;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<dynamic> QueryMemberPageList([FromBody] UserInput input);
|
||||
Task AddUser(AddHouseMemberInput input);
|
||||
Task<dynamic> DefaultRole([FromQuery] string orgId);
|
||||
Task DeleteUser(DeleteUserInput input);
|
||||
Task UpdateUser(UpdateUserInput input);
|
||||
Task<dynamic> GetUser([FromQuery] QueryUserInput input);
|
||||
Task ChangeUserStatus(UpdateUserInput input);
|
||||
Task<dynamic> GetUserOwnRole([FromQuery] QueryUserInput input);
|
||||
Task GrantUserData(UpdateUserInput input);
|
||||
Task<dynamic> GetUserOwnData([FromQuery] QueryUserInput input);
|
||||
Task<dynamic> DefaultRoleRange();
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目管理相关服务
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseProjectInfo", Order = 170)]
|
||||
public class HouseProjectInfoService : IHouseProjectInfoService, ITransient, IDynamicApiController
|
||||
{
|
||||
private readonly IRepository<BsHouseProjectInfo> _houseProjectInfoRep;
|
||||
|
||||
public HouseProjectInfoService(IRepository<BsHouseProjectInfo> houseProjectInfoRep)
|
||||
{
|
||||
_houseProjectInfoRep = houseProjectInfoRep;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加项目
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseProjectInfo/add")]
|
||||
public async Task AddProject(AddProjectInput input)
|
||||
{
|
||||
await _houseProjectInfoRep.InsertNowAsync(input.Adapt<BsHouseProjectInfo>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除项目
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseProjectInfo/delete")]
|
||||
public async Task DeleteProject(DeleteProjectInput input)
|
||||
{
|
||||
var project = _houseProjectInfoRep.FirstOrDefault(p => p.Id == input.Id);
|
||||
await project.DeleteNowAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑项目
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseProjectInfo/edit")]
|
||||
public async Task UpdateProject(UpdateProjectInput input)
|
||||
{
|
||||
var project = input.Adapt<BsHouseProjectInfo>();
|
||||
await project.UpdateExcludeAsync(new[] { nameof(BsHouseProjectInfo.AreaCode) }, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过ID获取项目
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseProjectInfo/getById")]
|
||||
public async Task<BsHouseProjectInfo> GetById([Required] string projectId)
|
||||
{
|
||||
return await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == projectId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseProjectInfo/page")]
|
||||
public async Task<dynamic> QueryProjectPageList([FromBody] PageProjectInput input)
|
||||
{
|
||||
var areaCodeRep = Db.GetRepository<SysAreaCode>();
|
||||
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<HouseProjectOutput>()).ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
return PageDataResult<HouseProjectOutput>.PageResult(projects);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseProjectInfo/detail")]
|
||||
public async Task<dynamic> GetProject([FromQuery] QueryProjectInput input)
|
||||
{
|
||||
var user = await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == input.Id);
|
||||
var userDto = user.Adapt<UserOutput>();
|
||||
|
||||
return userDto;
|
||||
}
|
||||
|
||||
[HttpGet("/houseProjectInfo/nextSort")]
|
||||
public async Task<int> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目下拉列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("houseProjectInfo/list")]
|
||||
public async Task<dynamic> GetProjectList([FromQuery] ListHouseProjectInfoInput input)
|
||||
{
|
||||
return await _houseProjectInfoRep.DetachedEntities
|
||||
.Where(p => p.AreaCode == input.AreaCode && p.Type == input.Type)
|
||||
.OrderBy(p => p.Sort)
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<BsHouseProjectInfo> GetById([FromRoute] string projectId);
|
||||
Task<dynamic> GetProject([FromQuery] QueryProjectInput input);
|
||||
Task<dynamic> QueryProjectPageList([FromQuery] PageProjectInput input);
|
||||
|
||||
Task<int> GetNextProjectSortByAreaCode([FromQuery] ListHouseProjectInfoInput input);
|
||||
Task<dynamic> GetProjectList([FromQuery] ListHouseProjectInfoInput input);
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 住宅查询
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseQuery", Order = 210)]
|
||||
public class HouseQueryService : IHouseQueryService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IRepository<BsHouseCode> _houseCodeRep;
|
||||
private readonly IRepository<BsHouseInfo> _houseInfoRep;
|
||||
private readonly IRepository<BsHouseTask> _houseTaskRep;
|
||||
private readonly IDapperRepository _dapperRepository;
|
||||
|
||||
public HouseQueryService(IRepository<BsHouseCode> HouseCodeRep, IRepository<BsHouseInfo> HouseInfoRep, IRepository<BsHouseTask> HouseTaskRep, IDapperRepository dapperRepository)
|
||||
{
|
||||
_houseCodeRep = HouseCodeRep;
|
||||
_houseInfoRep = HouseInfoRep;
|
||||
_houseTaskRep = HouseTaskRep;
|
||||
_dapperRepository = dapperRepository;
|
||||
}
|
||||
|
||||
[HttpPost("/houseQuery/page")]
|
||||
public async Task<dynamic> 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<dynamic> Detail([FromQuery] HouseQueryDetailInput input)
|
||||
{
|
||||
var houseCodeOutputAsync = await _dapperRepository.QueryAsync<HouseCodeOutput>(
|
||||
@"SELECT HC.Id,HC.Address,HC.ProjectId,HC.ZoneId,HC.Type,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,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<HouseInfoOutput>();
|
||||
houseInfoOutputForDetailPage.HouseInfo = houseInfoOutput;
|
||||
|
||||
return houseInfoOutputForDetailPage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 选房相关
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseSelector", Order = 180)]
|
||||
public class HouseSelectorService : IHouseSelectorService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDapperRepository _dapperRep;
|
||||
|
||||
private readonly IRepository<BsHouseMemberRelation> _bsHouseMemberRelationRep;
|
||||
private readonly IRepository<BsHouseCode> _bsHouseCodeRep;
|
||||
private readonly IRepository<BsHouseTask> _bsHouseTaskRep;
|
||||
private readonly IRepository<SysUser> _sysUserRep;
|
||||
private readonly IHouseZoneService _houseZoneService;
|
||||
|
||||
private readonly IHouseLogService _houseLogService;
|
||||
|
||||
public HouseSelectorService(
|
||||
IUserManager userManager,
|
||||
IDapperRepository dapperRep,
|
||||
IRepository<BsHouseMemberRelation> bsHouseMemberRelationRep,
|
||||
IRepository<BsHouseCode> bsHouseCodeRep,
|
||||
IRepository<BsHouseTask> bsHouseTaskRep,
|
||||
IRepository<SysUser> sysUserRep,
|
||||
IHouseZoneService houseZoneService,
|
||||
IHouseLogService houseLogService
|
||||
)
|
||||
{
|
||||
_userManager = userManager;
|
||||
|
||||
_dapperRep = dapperRep;
|
||||
_bsHouseMemberRelationRep = bsHouseMemberRelationRep;
|
||||
_bsHouseCodeRep = bsHouseCodeRep;
|
||||
_bsHouseTaskRep = bsHouseTaskRep;
|
||||
_sysUserRep = sysUserRep;
|
||||
_houseZoneService = houseZoneService;
|
||||
|
||||
_houseLogService = houseLogService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取人员允许绑定的房屋编码列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseSelector/selectorPage")]
|
||||
public async Task<dynamic> 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)
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取人员已经绑定的房屋编码列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseSelector/selectedPage")]
|
||||
public async Task<dynamic> 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)
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从人员选择房屋
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[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<BsHouseTask>();
|
||||
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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<dynamic> HouseSelectorList([FromQuery] QueryHouseSelectorInput input);
|
||||
Task<dynamic> HouseSelectedList([FromQuery] QueryHouseSelectorInput input);
|
||||
Task Select([FromBody] HouseSelectInput input);
|
||||
Task Revoke([FromBody] HouseSelectInput input);
|
||||
Task SelectMember();
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// 沉降倾斜
|
||||
/// </summary>
|
||||
public string SettlementTilt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 沉降倾斜附件
|
||||
/// </summary>
|
||||
public string SettlementTiltFiles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他情况
|
||||
/// </summary>
|
||||
public string OtherInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他情况附件
|
||||
/// </summary>
|
||||
public string OtherInfoFiles { get; set; }
|
||||
|
||||
//[Required(ErrorMessage = "巡查初始等级不能为空")]
|
||||
public int InitGrade { get; set; }
|
||||
//[Required(ErrorMessage = "巡查损坏等级不能为空")]
|
||||
public int DamageGrade { get; set; }
|
||||
//[Required(ErrorMessage = "巡查综合等级不能为空")]
|
||||
public int ComprehensiveGrade { get; set; }
|
||||
#region 调查情况investigation
|
||||
/// <summary>
|
||||
/// 房屋场地
|
||||
/// </summary>
|
||||
public string HouseSite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 相邻施工
|
||||
/// </summary>
|
||||
public string AdjacentConstruction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 化学侵蚀
|
||||
/// </summary>
|
||||
public string ChemicalErosion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结构拆改
|
||||
/// </summary>
|
||||
public int? StructuralDismantling { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 加层改造
|
||||
/// </summary>
|
||||
public int? AddingLayer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修缮加固
|
||||
/// </summary>
|
||||
public string RepairAndReinforce { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 历史灾害
|
||||
/// </summary>
|
||||
public string HistoricalCalamity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 使用功能变更
|
||||
/// </summary>
|
||||
public string FunctionalChange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他调查内容
|
||||
/// </summary>
|
||||
public string OtherContents { get; set; }
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 主要安全隐患综述
|
||||
/// </summary>
|
||||
public string MainSafety { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理意见
|
||||
/// </summary>
|
||||
public int? HandlingOpinion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理意见备注
|
||||
/// </summary>
|
||||
public string HandlingOpinionRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 整改情况
|
||||
/// </summary>
|
||||
public int? RectifyAndReform { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 整改情况备注
|
||||
/// </summary>
|
||||
public string RectifyAndReformRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巡查结果:1正常,-1异常
|
||||
/// </summary>
|
||||
//[Required(ErrorMessage = "巡查结果不能为空")]
|
||||
public int PatrolResult { get; set; }
|
||||
|
||||
public string PatrolResultRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报街道
|
||||
/// </summary>
|
||||
public int? ReportRoad { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报街道时间
|
||||
/// </summary>
|
||||
public DateTime? ReportRoadTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报区住建
|
||||
/// </summary>
|
||||
public int? ReportArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报区住建时间
|
||||
/// </summary>
|
||||
public DateTime? ReportAreaTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报备注
|
||||
/// </summary>
|
||||
public string ReportRemark { get; set; }
|
||||
}
|
||||
|
||||
public class AddHouseTaskInput : HouseTaskInput
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class EditHouseTaskInput : HouseTaskInput
|
||||
{
|
||||
[Required(ErrorMessage = "任务Id不能为空")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
public class SubmitHouseTaskInput
|
||||
{
|
||||
[Required(ErrorMessage = "任务Id不能为空")]
|
||||
public string TaskId { get; set; }
|
||||
}
|
||||
|
||||
public class QueryHouseTaskInput : PageInputBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// 沉降倾斜
|
||||
/// </summary>
|
||||
public string SettlementTilt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 沉降倾斜附件
|
||||
/// </summary>
|
||||
public string SettlementTiltFiles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他情况
|
||||
/// </summary>
|
||||
public string OtherInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他情况附件
|
||||
/// </summary>
|
||||
public string OtherInfoFiles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始等级
|
||||
/// </summary>
|
||||
public int? InitGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 损坏等级
|
||||
/// </summary>
|
||||
public int? DamageGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 综合等级
|
||||
/// </summary>
|
||||
public int? ComprehensiveGrade { get; set; }
|
||||
|
||||
#region 调查情况investigation
|
||||
/// <summary>
|
||||
/// 房屋场地
|
||||
/// </summary>
|
||||
public string HouseSite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 相邻施工
|
||||
/// </summary>
|
||||
public string AdjacentConstruction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 化学侵蚀
|
||||
/// </summary>
|
||||
public string ChemicalErosion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结构拆改
|
||||
/// </summary>
|
||||
public int? StructuralDismantling { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 加层改造
|
||||
/// </summary>
|
||||
public int? AddingLayer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修缮加固
|
||||
/// </summary>
|
||||
public string RepairAndReinforce { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 历史灾害
|
||||
/// </summary>
|
||||
public string HistoricalCalamity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 使用功能变更
|
||||
/// </summary>
|
||||
public string FunctionalChange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他调查内容
|
||||
/// </summary>
|
||||
public string OtherContents { get; set; }
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 主要安全隐患综述
|
||||
/// </summary>
|
||||
public string MainSafety { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理意见
|
||||
/// </summary>
|
||||
public int? HandlingOpinion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理意见备注
|
||||
/// </summary>
|
||||
public string HandlingOpinionRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 整改情况
|
||||
/// </summary>
|
||||
public int? RectifyAndReform { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 整改情况备注
|
||||
/// </summary>
|
||||
public string RectifyAndReformRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巡查结果:1正常,-1异常
|
||||
/// </summary>
|
||||
public int? PatrolResult { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巡查异常描述
|
||||
/// </summary>
|
||||
public string PatrolResultRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报街道
|
||||
/// </summary>
|
||||
public int? ReportRoad { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报街道时间
|
||||
/// </summary>
|
||||
public DateTime? ReportRoadTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报区住建
|
||||
/// </summary>
|
||||
public int? ReportArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报区住建时间
|
||||
/// </summary>
|
||||
public DateTime? ReportAreaTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报备注
|
||||
/// </summary>
|
||||
public string ReportRemark { get; set; }
|
||||
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提交时间
|
||||
/// </summary>
|
||||
public DateTime? SubmitTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后提交时间
|
||||
/// </summary>
|
||||
public DateTime? LastSubmitTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有效
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 房屋任务(巡查任务/建档任务)
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseTask", Order = 190)]
|
||||
public class HouseTaskService : IHouseTaskService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IRepository<BsHouseTask> _houseTaskRep;
|
||||
private readonly IRepository<BsHouseInfo> _houseInfoRep;
|
||||
private readonly IDapperRepository _dapperRepository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
private readonly IHouseLogService _houseLogService;
|
||||
|
||||
public HouseTaskService(IRepository<BsHouseTask> HouseTaskRep, IRepository<BsHouseInfo> HouseInfoRep, IDapperRepository dapperRepository, IUserManager userManager, IHouseLogService houseLogService)
|
||||
{
|
||||
_houseTaskRep = HouseTaskRep;
|
||||
_houseInfoRep = HouseInfoRep;
|
||||
_dapperRepository = dapperRepository;
|
||||
_userManager = userManager;
|
||||
|
||||
_houseLogService = houseLogService;
|
||||
}
|
||||
|
||||
[HttpPost("/houseTask/page")]
|
||||
public async Task<dynamic> QueryPage([FromBody] QueryHouseTaskInput input)
|
||||
{
|
||||
var sql = @"SELECT T.Id,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,Proj.Name,CONCAT(Proj.`Name`, 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application.Service
|
||||
{
|
||||
public interface IHouseTaskService
|
||||
{
|
||||
Task<dynamic> QueryPage(QueryHouseTaskInput input);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务Id
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "任务参数有误")]
|
||||
public string TaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 通过3;退回-1
|
||||
/// </summary>
|
||||
[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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核内容
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "审核内容不能为空")]
|
||||
public string Content { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 所属街道
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "所属街道不能为空")]
|
||||
public override string Pid { get; set; }
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "片区名称不能为空")]
|
||||
public override string Name { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class UpdateHouseZoneInput : AddHouseZoneInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 机构Id
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "片区Id不能为空")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 片区相关
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseZone", Order = 180)]
|
||||
public class HouseZoneService : IHouseZoneService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IRepository<SysOrg> _sysOrgRep;
|
||||
private readonly IRepository<SysEmp> _sysEmpRep;
|
||||
private readonly ISysOrgService _sysOrgService;
|
||||
|
||||
public HouseZoneService(
|
||||
IUserManager userManager,
|
||||
IRepository<SysOrg> sysOrgRep,
|
||||
IRepository<SysEmp> sysEmpRep,
|
||||
ISysOrgService sysOrgService
|
||||
)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_sysOrgRep = sysOrgRep;
|
||||
_sysEmpRep = sysEmpRep;
|
||||
_sysOrgService = sysOrgService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取片区列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseZone/list")]
|
||||
public async Task<dynamic> 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<dynamic> GetById([Required] string zoneId)
|
||||
{
|
||||
return await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == zoneId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询片区
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseZone/page")]
|
||||
public async Task<dynamic> 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<SysOrg, OrgOutput>(input);
|
||||
return PageDataResult<OrgOutput>.PageResult(orgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据用户Id获取所在片区的Id
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseZone/getByUser")]
|
||||
public async Task<string> 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<dynamic> 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<dynamic> 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<AddOrgInput>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<dynamic> GetHouseZoneList([FromQuery] HouseZoneInput input);
|
||||
Task<string> GetZoneByUser([FromQuery] string userId);
|
||||
}
|
||||
}
|
||||
30
20220330_Vote/Ewide.Application/Startup.cs
Normal file
30
20220330_Vote/Ewide.Application/Startup.cs
Normal file
@@ -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)));
|
||||
// };
|
||||
//});
|
||||
}
|
||||
}
|
||||
}
|
||||
3
20220330_Vote/Ewide.Application/applicationsettings.json
Normal file
3
20220330_Vote/Ewide.Application/applicationsettings.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user